Compare commits
3 Commits
4e8c48c667
...
d214571ef9
| Author | SHA1 | Date |
|---|---|---|
|
|
d214571ef9 | |
|
|
dfd1811009 | |
|
|
54604db0c7 |
|
|
@ -8,10 +8,10 @@
|
|||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/build/2D_Engine",
|
||||
"program": "${workspaceFolder}/build/2D_Engine",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceRoot}",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#define PLAYER_DEFAULT_SPEED 80.0f // px / s
|
||||
#define PLAYER_DEFAULT_IDLE_ANIMATION_SPEED 250.0f // ms / frame
|
||||
#define PLAYER_DEFAULT_RUN_ANIMATION_SPEED 160.0f // ms / frame
|
||||
#define PLAYER_DEFAULT_WALK_ANIMATION_SPEED 160.0f // ms / frame
|
||||
|
||||
typedef enum player_state_t {
|
||||
PLAYER_IDLE = 0x00, // 00000000
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ static inline void player_system_set_animation(player_system_data_t *system_data
|
|||
|
||||
if((system_data->state & PLAYER_RUNNING) && !(system_data->last_state & PLAYER_RUNNING))
|
||||
{
|
||||
animation_system_data->frame_delay_ms = PLAYER_DEFAULT_RUN_ANIMATION_SPEED;
|
||||
animation_system_change_animation(animation_system_data, "player_run_sheet", 6);
|
||||
animation_system_data->frame_delay_ms = PLAYER_DEFAULT_WALK_ANIMATION_SPEED;
|
||||
animation_system_change_animation(animation_system_data, "player_walk_sheet", 4);
|
||||
}
|
||||
else if(!(system_data->state & PLAYER_RUNNING) && (system_data->last_state & PLAYER_RUNNING))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void game_handle_event(void)
|
|||
|
||||
static inline void update_time(void)
|
||||
{
|
||||
clock_t last_clock_state = clock();
|
||||
static clock_t last_clock_state = 0;
|
||||
clock_t start_clock = clock();
|
||||
game.delta_time_ms = (float)(start_clock - last_clock_state) * 1000.0f / CLOCKS_PER_SEC;
|
||||
last_clock_state = start_clock;
|
||||
|
|
|
|||
Loading…
Reference in New Issue