From a40638b63deeb27301d56db7426fba56850927ca Mon Sep 17 00:00:00 2001 From: cflip Date: Tue, 17 Jan 2023 20:52:18 -0700 Subject: Allow window to be resizable --- window.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'window.c') diff --git a/window.c b/window.c index ea3f9f4..74e2e10 100644 --- a/window.c +++ b/window.c @@ -23,7 +23,7 @@ void window_init(const char *title, int rows, int cols) int window_width = cols * font.width; int window_height = rows * font.height; - window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_width, window_height, 0); + window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_width, window_height, SDL_WINDOW_RESIZABLE); if (window == NULL) fatal_error("Failed to create window: %s\n", SDL_GetError()); @@ -59,6 +59,10 @@ int window_handle_event(struct editor_state *editor) } editor_insert_char(editor, *e.text.text); break; + case SDL_WINDOWEVENT: + if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) + editor_update_screen_size(editor); + break; } return 1; } -- cgit v1.2.3