allow for custom SDL window parameters, fixes #5
This commit is contained in:
+11
-7
@@ -6,16 +6,13 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define WINDOW_WIDTH 1280
|
||||
#define WINDOW_HEIGHT 720
|
||||
#define DEFAULT_WINDOW_NAME "Dangerzone"
|
||||
#define WINDOW_NAME_LENGTH 128
|
||||
#define WINDOW_NAME_MAX_LENGTH 128
|
||||
#define TARGET_FRAME 1.0 / 60.0
|
||||
#define FONT_ROWS 7
|
||||
#define FONT_COLS 5
|
||||
|
||||
typedef struct {
|
||||
char window_name[WINDOW_NAME_LENGTH];
|
||||
char window_name[WINDOW_NAME_MAX_LENGTH];
|
||||
uint16_t width, height;
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
@@ -38,19 +35,23 @@ typedef struct {
|
||||
} engine_internal_state_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t framebuffer[WINDOW_WIDTH * WINDOW_HEIGHT];
|
||||
SDL_Event event;
|
||||
bool is_running;
|
||||
bool framebuffer_dirty;
|
||||
SDL_Rect dirty_rect;
|
||||
uint16_t width, height;
|
||||
uint32_t *framebuffer;
|
||||
} game_state_t;
|
||||
|
||||
extern engine_internal_state_t *internal_state;
|
||||
extern game_state_t *game_state;
|
||||
|
||||
engine_sdl_state_t*
|
||||
engine_sdl_init();
|
||||
engine_sdl_init(
|
||||
uint32_t window_width,
|
||||
uint32_t window_height,
|
||||
const char window_name[]
|
||||
);
|
||||
|
||||
void
|
||||
engine_sdl_destroy(
|
||||
@@ -59,6 +60,9 @@ engine_sdl_destroy(
|
||||
|
||||
bool
|
||||
engine_init(
|
||||
uint32_t window_width,
|
||||
uint32_t window_height,
|
||||
const char window_name[],
|
||||
void (*engine_poll_events)(void),
|
||||
void (*engine_update_framebuffer)(void)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user