[英]Move SDL window in SDL 1.2
I am using SDL 1.2 with FFmpeg on MAC. 我在MAC上使用带有FFmpeg的SDL 1.2。 I am trying to build a video player using both FFmpeg and SDL.
我正在尝试使用FFmpeg和SDL构建视频播放器。 I am viewing my video on SDL_Surface.
我正在SDL_Surface上观看我的视频。 My player is working fine.
我的播放器工作正常。 Now my problem is, i want to move SDL window without dragging it from title bar.
现在我的问题是,我想移动SDL窗口而不将其从标题栏拖动。 Is there any function/method in SDL 1.2 framework for moving SDL_Surface.
SDL 1.2框架中是否有任何用于移动SDL_Surface的功能/方法。
SDL 1.2 does not have an API for moving windows. SDL 1.2没有用于移动窗口的API。 SDL 2.0 has better support for multiple windows and window management in general.
通常,SDL 2.0更好地支持多个窗口和窗口管理。
See http://wiki.libsdl.org/SDL_SetWindowPosition 参见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. 为此,对于SDL 1.2,您需要使用窗口句柄使用特定于平台的调用。 You can get that with
SDL_GetWMInfo()
. 您可以使用
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_SetVideoMode()
之前尝试以下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. 哪个为您设置了窗口的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.