diff --git a/example/main.c b/example/main.c index 2eb9b7f1..31c5bfe7 100644 --- a/example/main.c +++ b/example/main.c @@ -467,7 +467,7 @@ int main(int argc, char *argv[]) binocle_log_info("%s", s1.data); binocle_log_info("%s", s2.data); - window = binocle_window_new(game_state->main_arena, DESIGN_WIDTH, DESIGN_HEIGHT, "Binocle Test Game"); + window = binocle_window_new(DESIGN_WIDTH, DESIGN_HEIGHT, "Binocle Test Game"); binocle_window_set_background_color(window, binocle_color_azure()); binocle_window_set_minimum_size(window, DESIGN_WIDTH, DESIGN_HEIGHT); adapter = binocle_viewport_adapter_new(window, BINOCLE_VIEWPORT_ADAPTER_KIND_SCALING, BINOCLE_VIEWPORT_ADAPTER_SCALING_TYPE_PIXEL_PERFECT, window->original_width, window->original_height, window->original_width, window->original_height); diff --git a/src/binocle/core/binocle_lua.c b/src/binocle/core/binocle_lua.c index 28058d37..b8c02be3 100644 --- a/src/binocle/core/binocle_lua.c +++ b/src/binocle/core/binocle_lua.c @@ -32,8 +32,6 @@ #include #include -binocle_lua g_binocle_lua; - binocle_lua binocle_lua_new() { binocle_lua res = {0}; return res; diff --git a/src/binocle/core/binocle_window.c b/src/binocle/core/binocle_window.c index f041caeb..7b1c337a 100644 --- a/src/binocle/core/binocle_window.c +++ b/src/binocle/core/binocle_window.c @@ -12,8 +12,8 @@ #include #include -binocle_window *binocle_window_new(binocle_memory_arena *arena, uint32_t width, uint32_t height, char *title) { - binocle_window *res = binocle_memory_push_struct(arena, binocle_window, binocle_memory_default_arena_params()); +binocle_window *binocle_window_new(uint32_t width, uint32_t height, char *title) { + binocle_window *res = SDL_malloc(sizeof(binocle_window)); SDL_memset(res, 0, sizeof(*res)); res->width = width; @@ -65,7 +65,7 @@ void binocle_window_destroy(binocle_window *win) { } #endif - win = NULL; + SDL_free(win); } void binocle_window_refresh(binocle_window *win) { diff --git a/src/binocle/core/binocle_window.h b/src/binocle/core/binocle_window.h index 270f5ca7..5efb1d49 100644 --- a/src/binocle/core/binocle_window.h +++ b/src/binocle/core/binocle_window.h @@ -55,7 +55,7 @@ typedef struct binocle_window { * @param title the title of the window * @return a window instance */ -binocle_window *binocle_window_new(struct binocle_memory_arena *arena, uint32_t width, uint32_t height, char *title); +binocle_window *binocle_window_new(uint32_t width, uint32_t height, char *title); /** * \brief Destroys an initialized window diff --git a/src/binocle/core/binocle_window_wrap.c b/src/binocle/core/binocle_window_wrap.c index 9d704e77..21833c6b 100644 --- a/src/binocle/core/binocle_window_wrap.c +++ b/src/binocle/core/binocle_window_wrap.c @@ -7,8 +7,6 @@ #include "binocle_window.h" #include "binocle_color_wrap.h" -extern binocle_lua g_binocle_lua; - int l_binocle_window_set_background_color(lua_State *L) { l_binocle_window_t *window = luaL_checkudata(L, 1, "binocle_window"); l_binocle_color_t *color = luaL_checkudata(L, 2, "binocle_color"); @@ -32,7 +30,7 @@ int l_binocle_window_new(lua_State *L) { lua_getfield(L, LUA_REGISTRYINDEX, "binocle_window"); lua_setmetatable(L, -2); SDL_memset(window, 0, sizeof(*window)); - binocle_window *win = binocle_window_new(g_binocle_lua.arena, width, height, title); + binocle_window *win = binocle_window_new(width, height, title); window->window = win; return 1; }