50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
#ifndef TWN_CONTEXT_H
|
|
#define TWN_CONTEXT_H
|
|
|
|
#include "twn_input.h"
|
|
#include "twn_engine_api.h"
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
|
|
/* context that is valid for current frame */
|
|
/* changes to it should not have an effect, unless specified */
|
|
/* TODO: ensure the statement above */
|
|
typedef struct Context {
|
|
/* you may read from and write to these from game code */
|
|
void *udata;
|
|
|
|
/* TODO: is it what we actually want? */
|
|
int64_t delta_time; /* preserves real time frame delta with no manipilation */
|
|
uint64_t tick_count;
|
|
|
|
Vec2i mouse_window_position;
|
|
Vec2i mouse_relative_position;
|
|
|
|
/* set just once on startup */
|
|
uint64_t random_seed;
|
|
|
|
/* this should be a multiple of the current 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;
|
|
|
|
/* TODO: use Vec2i? */
|
|
int window_w;
|
|
int window_h;
|
|
int base_draw_w;
|
|
int base_draw_h;
|
|
|
|
bool debug;
|
|
bool is_running;
|
|
bool window_size_has_changed;
|
|
bool initialization_needed;
|
|
} Context;
|
|
|
|
#ifndef TWN_ENGINE_CONTEXT_C_H
|
|
TWN_API extern Context ctx;
|
|
#endif
|
|
|
|
#endif
|