简体   繁体   中英

Move SDL window in SDL 1.2

I am using SDL 1.2 with FFmpeg on MAC. I am trying to build a video player using both FFmpeg and SDL. I am viewing my video on SDL_Surface. My player is working fine. Now my problem is, i want to move SDL window without dragging it from title bar. Is there any function/method in SDL 1.2 framework for moving SDL_Surface.

SDL 1.2 does not have an API for moving windows. SDL 2.0 has better support for multiple windows and window management in general.
See http://wiki.libsdl.org/SDL_SetWindowPosition

To do this with SDL 1.2, you'll need to use platform-specific calls using the window handle. You can get that with SDL_GetWMInfo() .

If you just need to set the initial position of the window so it is centered, then try this before SDL_SetVideoMode() :

SDL_putenv("SDL_VIDEO_WINDOW_POS=center");

The function you are looking for is:

void SDL_SetWindowPosition(SDL_Window* window,
                           int         x,
                           int         y)

Which set the position of the window for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM