2024-09-16 06:07:01 +00:00
|
|
|
#ifndef TWN_CONTEXT_H
|
|
|
|
#define TWN_CONTEXT_H
|
|
|
|
|
|
|
|
#include "twn_input.h"
|
|
|
|
#include "twn_engine_api.h"
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct context {
|
|
|
|
struct input_state input;
|
|
|
|
|
|
|
|
int64_t delta_time; /* preserves real time frame delta with no manipilation */
|
|
|
|
uint64_t tick_count;
|
|
|
|
|
|
|
|
/* set just once on startup */
|
|
|
|
uint64_t random_seed;
|
|
|
|
|
|
|
|
/* this should be a multiple of TICKS_PER_SECOND */
|
|
|
|
/* use it to simulate low framerate (e.g. at 60 tps, set to 2 for 30 fps) */
|
|
|
|
/* it can be changed at runtime; any resulting logic anomalies are bugs */
|
|
|
|
unsigned int update_multiplicity;
|
|
|
|
int window_w;
|
|
|
|
int window_h;
|
|
|
|
|
|
|
|
/* you may read from and write to these from game code */
|
|
|
|
void *udata;
|
|
|
|
|
|
|
|
bool debug;
|
|
|
|
bool is_running;
|
|
|
|
bool window_size_has_changed;
|
|
|
|
bool initialization_needed;
|
|
|
|
} t_ctx;
|
|
|
|
|
2024-09-16 13:17:00 +00:00
|
|
|
#ifndef TWN_ENGINE_CONTEXT_C_H
|
2024-09-16 06:07:01 +00:00
|
|
|
TWN_API extern t_ctx ctx;
|
2024-09-16 13:17:00 +00:00
|
|
|
#endif
|
2024-09-16 06:07:01 +00:00
|
|
|
|
|
|
|
#endif
|