From deb91e9d10f4abbc71dea3af72c84935024bc357 Mon Sep 17 00:00:00 2001 From: Stealcase Date: Sun, 31 Aug 2025 23:48:19 +0200 Subject: [PATCH 1/4] Create black screen --- examples/sdl/hello_world.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/sdl/hello_world.c b/examples/sdl/hello_world.c index 94271df..06941f5 100644 --- a/examples/sdl/hello_world.c +++ b/examples/sdl/hello_world.c @@ -313,7 +313,10 @@ int main(int argc, char *argv[]) { window_state_init(&state); SDL_Window *window = SDL_CreateWindow(WINDOW_TITLE, SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_HIDDEN); + SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN); + SDL_Surface *screenSurface = SDL_GetWindowSurface(window); + SDL_FillRect(screenSurface, NULL, SDL_MapRGB(&(*screenSurface->format), 0x00, 0x00, 0x00)); + SDL_UpdateWindowSurface(window); Uint32 window_id = SDL_GetWindowID(window); struct action_handler_state action_handler = {user_event, window_id}; struct accesskit_sdl_adapter adapter; From d60a47590fe585e0b792211420febecd69da7223 Mon Sep 17 00:00:00 2001 From: Stealcase Date: Thu, 4 Sep 2025 22:23:00 +0200 Subject: [PATCH 2/4] Snake case, re-drawing rect every frame --- examples/sdl/hello_world.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/sdl/hello_world.c b/examples/sdl/hello_world.c index 06941f5..e3b56d1 100644 --- a/examples/sdl/hello_world.c +++ b/examples/sdl/hello_world.c @@ -314,9 +314,7 @@ int main(int argc, char *argv[]) { SDL_Window *window = SDL_CreateWindow(WINDOW_TITLE, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN); - SDL_Surface *screenSurface = SDL_GetWindowSurface(window); - SDL_FillRect(screenSurface, NULL, SDL_MapRGB(&(*screenSurface->format), 0x00, 0x00, 0x00)); - SDL_UpdateWindowSurface(window); + SDL_Surface *screen_surface = SDL_GetWindowSurface(window); Uint32 window_id = SDL_GetWindowID(window); struct action_handler_state action_handler = {user_event, window_id}; struct accesskit_sdl_adapter adapter; @@ -376,6 +374,8 @@ int main(int argc, char *argv[]) { window_state_unlock(&state); } } + SDL_FillRect(screen_surface, NULL, SDL_MapRGB(&(*screen_surface->format), 0x00, 0x00, 0x00)); + SDL_UpdateWindowSurface(window); } accesskit_sdl_adapter_destroy(&adapter); From 373078052d1afa590af23a305a2f30ee4bfb81ce Mon Sep 17 00:00:00 2001 From: Stealcase Date: Thu, 4 Sep 2025 22:23:13 +0200 Subject: [PATCH 3/4] Revert SDL hidden change --- examples/sdl/hello_world.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sdl/hello_world.c b/examples/sdl/hello_world.c index e3b56d1..dc7e8e4 100644 --- a/examples/sdl/hello_world.c +++ b/examples/sdl/hello_world.c @@ -313,7 +313,7 @@ int main(int argc, char *argv[]) { window_state_init(&state); SDL_Window *window = SDL_CreateWindow(WINDOW_TITLE, SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN); + SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_HIDDEN); SDL_Surface *screen_surface = SDL_GetWindowSurface(window); Uint32 window_id = SDL_GetWindowID(window); struct action_handler_state action_handler = {user_event, window_id}; From 4ead99d0a4e9e6e0f30aa94855a32287570ac188 Mon Sep 17 00:00:00 2001 From: Stealcase Date: Fri, 5 Sep 2025 14:43:23 +0200 Subject: [PATCH 4/4] format example file --- examples/sdl/hello_world.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/sdl/hello_world.c b/examples/sdl/hello_world.c index dc7e8e4..9deb453 100644 --- a/examples/sdl/hello_world.c +++ b/examples/sdl/hello_world.c @@ -374,7 +374,8 @@ int main(int argc, char *argv[]) { window_state_unlock(&state); } } - SDL_FillRect(screen_surface, NULL, SDL_MapRGB(&(*screen_surface->format), 0x00, 0x00, 0x00)); + SDL_FillRect(screen_surface, NULL, + SDL_MapRGB(&(*screen_surface->format), 0x00, 0x00, 0x00)); SDL_UpdateWindowSurface(window); }