Skip to content

Commit

Permalink
Reverted the changes to binocle_window. We will not use a memory arena
Browse files Browse the repository at this point in the history
for that.
  • Loading branch information
tanis2000 committed Apr 3, 2024
1 parent fe08570 commit 3daf061
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion example/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/binocle/core/binocle_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include <sokol_time.h>
#include <stdlib.h>

binocle_lua g_binocle_lua;

binocle_lua binocle_lua_new() {
binocle_lua res = {0};
return res;
Expand Down
6 changes: 3 additions & 3 deletions src/binocle/core/binocle_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <inttypes.h>
#include <stdlib.h>

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;
Expand Down Expand Up @@ -65,7 +65,7 @@ void binocle_window_destroy(binocle_window *win) {
}
#endif

win = NULL;
SDL_free(win);
}

void binocle_window_refresh(binocle_window *win) {
Expand Down
2 changes: 1 addition & 1 deletion src/binocle/core/binocle_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/binocle/core/binocle_window_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
}
Expand Down

0 comments on commit 3daf061

Please sign in to comment.