@@ -62,6 +62,7 @@ pub const InitOptions = struct {
6262 /// use when running tests
6363 hidden : bool = false ,
6464 fullscreen : bool = false ,
65+ transparent : bool = false ,
6566};
6667
6768pub fn initWindow (options : InitOptions ) ! SDLBackend {
@@ -99,12 +100,13 @@ pub fn initWindow(options: InitOptions) !SDLBackend {
99100
100101 const hidden_flag = if (hidden ) c .SDL_WINDOW_HIDDEN else 0 ;
101102 const fullscreen_flag = if (options .fullscreen ) c .SDL_WINDOW_FULLSCREEN else 0 ;
103+ const transparent_flag = if (options .transparent and sdl3 ) c .SDL_WINDOW_TRANSPARENT else 0 ;
102104 const window : * c.SDL_Window = if (sdl3 )
103105 c .SDL_CreateWindow (
104106 options .title ,
105107 @as (c_int , @intFromFloat (options .size .w )),
106108 @as (c_int , @intFromFloat (options .size .h )),
107- @intCast (c .SDL_WINDOW_HIGH_PIXEL_DENSITY | c .SDL_WINDOW_RESIZABLE | c . SDL_WINDOW_TRANSPARENT | hidden_flag | fullscreen_flag ),
109+ @intCast (c .SDL_WINDOW_HIGH_PIXEL_DENSITY | c .SDL_WINDOW_RESIZABLE | transparent_flag | hidden_flag | fullscreen_flag ),
108110 ) orelse return logErr ("SDL_CreateWindow in initWindow" )
109111 else
110112 c .SDL_CreateWindow (
@@ -1563,6 +1565,7 @@ pub fn main() !u8 {
15631565 .title = init_opts .title ,
15641566 .icon = init_opts .icon ,
15651567 .hidden = init_opts .hidden ,
1568+ .transparent = init_opts .transparent ,
15661569 });
15671570 defer back .deinit ();
15681571
@@ -1665,6 +1668,7 @@ fn appInit(appstate: ?*?*anyopaque, argc: c_int, argv: ?[*:null]?[*:0]u8) callco
16651668 .title = init_opts .title ,
16661669 .icon = init_opts .icon ,
16671670 .hidden = init_opts .hidden ,
1671+ .transparent = init_opts .transparent ,
16681672 }) catch | err | {
16691673 log .err ("initWindow failed: {any}" , .{err });
16701674 return c .SDL_APP_FAILURE ;
0 commit comments