Created
May 18, 2017 12:17
-
-
Save Steven-Wilson/168123e16fefc1a0aea7da254f518321 to your computer and use it in GitHub Desktop.
making a topmost window in sdl2 on windows with python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sdl2 | |
import ctypes | |
def main(): | |
window = sdl2.SDL_CreateWindow('test'.encode('utf-8'), | |
sdl2.SDL_WINDOWPOS_UNDEFINED, | |
sdl2.SDL_WINDOWPOS_UNDEFINED, | |
800, 600, | |
sdl2.SDL_WINDOW_SHOWN) | |
window_info = sdl2.SDL_SysWMinfo() | |
sdl2.SDL_VERSION(ctypes.pointer(window_info.version)) | |
window_info.version.major = 2 | |
window_info.version.minor = 0 | |
sdl2.SDL_GetWindowWMInfo(window, ctypes.pointer(window_info)) | |
user32 = ctypes.WinDLL('User32.dll') | |
SetWindowPos = user32.SetWindowPos | |
SetWindowPos(window_info.info.win.window, | |
-1, 50, 50, 800, 600, | |
# No Move/Resize | |
0x0002 | 0x0001) | |
while True: | |
event = sdl2.SDL_Event() | |
while sdl2.SDL_PollEvent(ctypes.byref(event)) != 0: | |
if event.type == sdl2.SDL_QUIT: | |
return | |
sdl2.SDL_Delay(60) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment