partially done work on total source tree rework, separation of engine context and game context, generalization of renderer for different backends as well as web platform target
This commit is contained in:
50
src/twn_engine_context_c.h
Normal file
50
src/twn_engine_context_c.h
Normal file
@ -0,0 +1,50 @@
|
||||
#ifndef TWN_ENGINE_CONTEXT_H
|
||||
#define TWN_ENGINE_CONTEXT_H
|
||||
|
||||
#include "twn_context.h"
|
||||
#include "textures/internal_api.h"
|
||||
#include "twn_input.h"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
typedef struct engine_context {
|
||||
t_ctx game_context;
|
||||
|
||||
/* the program's actual argc and argv */
|
||||
int argc;
|
||||
char **argv;
|
||||
|
||||
struct primitive_2d *render_queue_2d;
|
||||
struct mesh_batch_item *uncolored_mesh_batches;
|
||||
struct text_cache text_cache;
|
||||
struct texture_cache texture_cache;
|
||||
|
||||
struct audio_channel_item *audio_channels;
|
||||
SDL_AudioDeviceID audio_device;
|
||||
int audio_stream_frequency;
|
||||
SDL_AudioFormat audio_stream_format;
|
||||
uint8_t audio_stream_channel_count;
|
||||
|
||||
/* main loop machinery */
|
||||
int64_t clocks_per_second;
|
||||
int64_t prev_frame_time;
|
||||
int64_t desired_frametime; /* how long one tick should be */
|
||||
int64_t frame_accumulator;
|
||||
int64_t delta_averager_residual;
|
||||
int64_t time_averager[4];
|
||||
|
||||
SDL_GLContext *gl_context;
|
||||
SDL_Window *window;
|
||||
uint32_t window_id;
|
||||
|
||||
bool resync_flag;
|
||||
bool was_successful;
|
||||
} t_engine_ctx;
|
||||
|
||||
extern t_engine_ctx ctx = ;
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user