Files
dusk/archive/dusk/time.h
2025-08-23 10:13:49 -05:00

53 lines
881 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 TIME_STEP (1.0f / 60.0f) // Default to 60FPS
#ifndef TIME_DYNAMIC
#define TIME_DYNAMIC 1
#endif
#if TIME_DYNAMIC == 0
#ifndef TIME_PLATFORM_STEP
#define TIME_PLATFORM_STEP TIME_STEP
#endif
#endif
/**
* Initializes the time system.
*/
void timeInit(void);
/**
* Updates the time system
*/
void timeUpdate(void);
#if 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