Window Postition question

Hi all,

I have a simple question.
How do I programatically set the position of my SDL window?

I’m writing an editor for my game that uses the game engine to display the
levels. I’ve got other forms that surround the form for tools and so on

But the SDL window seems to appear at random co-ordinates each time I run it.
Is there anyway I can fix its position?

Thanks in advance

Later

Jason

But the SDL window seems to appear at random co-ordinates each time I run it.
Is there anyway I can fix its position?

i am not sure but i think that this depend on window manager so you can do
it as platform specific code i.e for windows or for KDE.
Am i right?

Well, I’m actually looking for a cross platform and window manager independent
method of programatically controlling the window position.

If I’ve got to code separate Win32 API calls for windows and Xwindows calls
for Linux then so be it, but I certainly don’t want to have to code for every
window manager as well. KDE is one thing, but Gnome can use loads of
different window managers if I remember correctly.

Has anyone else done this?

has anyone got any code?
I work in Pascal, but I’m fluent enough in C to convert it.

Cheers

Jason> > But the SDL window seems to appear at random co-ordinates each time I run

it. Is there anyway I can fix its position?

i am not sure but i think that this depend on window manager so you can do
it as platform specific code i.e for windows or for KDE.
Am i right?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Well, I’m actually looking for a cross platform and window manager
independent method of programatically controlling the window position.

If I’ve got to code separate Win32 API calls for windows and Xwindows
calls for Linux then so be it, but I certainly don’t want to have to
code for every window manager as well. KDE is one thing, but Gnome can
use loads of different window managers if I remember correctly.

Has anyone else done this?

has anyone got any code?
I work in Pascal, but I’m fluent enough in C to convert it.

From the Stella source code (originally from some example on the SDL
page):

SDL_SysWMinfo info;

SDL_VERSION(&info.version);
if(SDL_GetWMInfo(&info) > 0)
if(info.subsystem == SDL_SYSWM_X11)
x11Available = true;

int x, y, w, h;
info.info.x11.lock_func();
theX11Display = info.info.x11.display;
theX11Window = info.info.x11.wmwindow;
theX11Screen = DefaultScreen(theX11Display);

w = DisplayWidth(theX11Display, theX11Screen);
h = DisplayHeight(theX11Display, theX11Screen);
x = (w - screen->w)/2;
y = (h - screen->h)/2;

XMoveWindow(theX11Display, theX11Window, x, y);
info.info.x11.unlock_func();

This code actually centers the window onscreen. You can use it to place
the window whereever you want.

Of course, this only works under X11 in Linux. Don’t know about other
windowing systems.

SteveOn August 12, 2002 09:12 pm, Jason Farmer wrote: