How to give the sure position of the SDL screen

hi,all!

Now I want to give the sure position of the SDL screen, but I don’t know how to do ?

There’s just a SDL_SetVideoMode, with parameter w&h, but I can’t find x&y, the position param.

could someone help me out here?

thanks for your time,

Linden

The following code works for X Window System, but not for MS Windows.
Hope it helps.

#ifndef WIN32
bool isX11 = FALSE;
int x, y, w, h;
int x11screen;
SDL_SysWMinfo info;
#endif
if (SDL_Init(SDL_INIT_VIDEO ) != 0)
{
printf("\nUnable to initialize SDL: %s\n", SDL_GetError());
return 1;
}

init_video(SCREEN_PIXEL_WIDTH, SCREEN_PIXEL_HEIGHT, SCREEN_PIXEL_DEPTH);

#ifndef WIN32 // put the window where we want it
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info) > 0)
{
if (info.subsystem == SDL_SYSWM_X11)
isX11 = TRUE;
}
if (isX11)
{
info.info.x11.lock_func();
x11screen = DefaultScreen(info.info.x11.display);
w = DisplayWidth(info.info.x11.display, x11screen);
h = DisplayHeight(info.info.x11.display, x11screen);
x = (w - screen->w) / 2;
if (x + screen->w > w) // if centering x won’t fit,
x = WINDOW_X_POSITION; // use arbitrary horizontal position
y = (h - screen->h) / 2;
if (y + screen->h > h) // if centering y won’t fit,
y = WINDOW_Y_POSITION; // use arbitrary vertical position
if (x >= 0 && y >= 0)
XMoveWindow(info.info.x11.display, info.info.x11.wmwindow, x, y);
info.info.x11.unlock_func();
}
#endifOn Thursday 10 July 2003 06:06 pm, you wrote:

Now I want to give the sure position of the SDL screen, but I don’t know
how to do ?