63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "../libs.h"
|
|
#include "../display/texture.h"
|
|
#include "../display/tileset.h"
|
|
#include "../display/primitive/primitive.h"
|
|
#include "../display/shader.h"
|
|
#include "../display/primitive/quad.h"
|
|
#include "../display/animation/animation.h"
|
|
#include "../engine/engine.h"
|
|
#include "../display/animation/easing.h"
|
|
|
|
#define VN_CHARACTER_BLINK_TIME_RANGE_MAX 6
|
|
#define VN_CHARACTER_BLINK_SPEED 3.0f
|
|
#define VN_CHARACTER_LAYERS_MAX 6
|
|
|
|
typedef struct {
|
|
int16_t lx, ly, x, y, width, height;
|
|
uint8_t frames;
|
|
} vncharacterlayer_t;
|
|
|
|
typedef struct {
|
|
/** Position, Rotation and Scale of the character */
|
|
float x, y, z;
|
|
float yaw, pitch, roll;
|
|
float scaleX, scaleY;
|
|
|
|
/** Quadded primitive */
|
|
primitive_t primitive;
|
|
/** Texture sheet for the character */
|
|
texture_t *texture;
|
|
|
|
/** Layer Information */
|
|
vncharacterlayer_t layers[VN_CHARACTER_LAYERS_MAX];
|
|
uint8_t layerCount;
|
|
uint8_t layerEyes;
|
|
uint8_t layerMouth;
|
|
uint8_t layerEyebrows;
|
|
|
|
bool breathing;
|
|
float blinkStart;
|
|
} vncharacter_t;
|
|
|
|
void vnCharacterInit(vncharacter_t *character, texture_t *texture);
|
|
|
|
uint8_t vnCharacterLayerAdd(vncharacter_t *character,
|
|
uint8_t frames,
|
|
int16_t lx, int16_t ly,
|
|
int16_t x, int16_t y,
|
|
int16_t width, int16_t height
|
|
);
|
|
void vnCharacterLayerSetFrame(vncharacter_t *character, uint8_t l, uint8_t f);
|
|
|
|
void vnCharacterUpdate(vncharacter_t *character, engine_t *engine);
|
|
void vnCharacterRender(vncharacter_t *character, shader_t *shader);
|
|
|
|
void vnCharacterDispose(vncharacter_t *character); |