Hello everyone,
I’d like to find out if it’s possible to achieve the following with SDL2, or if I need to embed SDL2 into another Windows framework:
- Position the game window to occupy one-third of the desktop screen horizontally or one-third vertically.
- Have the ability to minimize the window to the system tray.
- Add an option to keep the window always on top.
Can all of this be done with SDL2 alone, or would I need to integrate SDL2 with native Windows APIs to achieve these features?
Thank you for your help!
- You can set any window position and any window size, on any display, and the window can have a system decoration or no border at all. So yes.
- SDL API does not have anything to handle system tray, so you will need to touch the Win32 API to implement this. Here is the example.
- SDL_SetWindowAlwaysOnTop — yes, you can.
Unless you have a very good reason to use SDL2, then forget about it and use SDL3.
Thank you for your reply , no good reason for SDL2 , i didn’t know even that SDL3 is a thing .
Where can i learn about SDL3 vs SDL2 ?
SDL2 is still the current stable release, SDL3 is only available as a preview.
SDL3/FrontPage - SDL Wiki — here is the documentation for SDL3
Of course but, sooner or later it will be stable, so using SDL3 right away will allow to learn its API and will prevent from having to migrate code later. There are a lot of changes between SDL2 and SDL3 (SDL3/README/migration - SDL Wiki), so it’s better not to waste time and use something that will soon be the standard.
Nobody will “have to” migrate to SDL3, and not everybody will be able to (I can’t migrate my app, because SDL3 doesn’t support the features it needs). Some people are still happily using SDL1 and haven’t needed to migrate to SDL2!
1 Like