53 lines
921 B
C
53 lines
921 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "dusk.h"
|
|
|
|
typedef struct {
|
|
float_t delta;
|
|
float_t lastTick;
|
|
float_t time;
|
|
float_t realDelta;
|
|
float_t realTime;
|
|
} dusktime_t;
|
|
|
|
extern dusktime_t TIME;
|
|
|
|
#define DUSK_TIME_STEP (1.0f / 60.0f) // Default to 60FPS
|
|
|
|
#ifndef DUSK_TIME_DYNAMIC
|
|
#define DUSK_TIME_DYNAMIC 1
|
|
#endif
|
|
|
|
#if DUSK_TIME_DYNAMIC == 0
|
|
#ifndef DUSK_TIME_PLATFORM_STEP
|
|
#define DUSK_TIME_PLATFORM_STEP DUSK_TIME_STEP
|
|
#endif
|
|
#endif
|
|
|
|
/**
|
|
* Initializes the time system.
|
|
*/
|
|
void timeInit(void);
|
|
|
|
/**
|
|
* Updates the time system
|
|
*/
|
|
void timeUpdate(void);
|
|
|
|
#if DUSK_TIME_DYNAMIC == 1
|
|
/**
|
|
* Gets the time delta since the last frame, in seconds. Tied to the
|
|
* platform.
|
|
*
|
|
* This will only get called once per gameUpdate.
|
|
*/
|
|
float_t timeDeltaGet(void);
|
|
#endif
|
|
|