Since SDL_CreateWindow() doesn’t allow us to specify what screen to open on, how do we do it?
We already got a list of resolutions that each screen supports (all 3 of them), and their format types, but actually opening up a window on monitor 1, 2 & 3 doesn’t look possible from all the functions I looked at.
Using custom openGL here, so no need for SDL to make a renderer for us (SDL_CreateWindowAndRenderer).
When you get the display bounds, it returns them in global screen space,
and you can use coordinates that match the display you want the window on.
Alternatively, you can use the macros provided if you don’t care or want
them centered and don’t want to do the math:
SDL_WINDOWPOS_UNDEFINED_DISPLAY(N)
SDL_WINDOWPOS_CENTERED_DISPLAY(N)On Sat, Aug 17, 2013 at 4:07 PM, Sparks wrote:
**
Since SDL_CreateWindow() doesn’t allow us to specify what screen to open
on, how do we do it?
We already got a list of resolutions that each screen supports (all 3 of
them), and their format types, but actually opening up a window on monitor
1, 2 & 3 doesn’t look possible from all the functions I looked at.
Using custom openGL here, so no need for SDL to make a renderer for us
(SDL_CreateWindowAndRenderer).
When you get the display bounds, it returns them in global screen space, and you can use coordinates that match the display you want the window on.
Alternatively, you can use the macros provided if you don’t care or want them centered and don’t want to do the math:
SDL_WINDOWPOS_UNDEFINED_DISPLAY(N)
Perhaps it would be better to use doxygen generated stuff nightly, instead of the wiki, (or perhaps point to the wiki entry in doxygen) lots of stuff is slipping through the cracks, until someone comes along asking on how to do this…
Like, perhaps the bottom part starting with @helper macros
Code:
/**
\brief Create a window with the specified position, dimensions, and flags.*
\param title The title of the window, in UTF-8 encoding.
\param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
::SDL_WINDOWPOS_UNDEFINED.
\param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
::SDL_WINDOWPOS_UNDEFINED.
\param w The width of the window.
\param h The height of the window.
\param flags The flags for the window, a mask of any of the following:
Message-ID: <1376797685.m2f.38717 at forums.libsdl.org>
Content-Type: text/plain; charset=“iso-8859-1”
Sam Lantinga wrote:
When you get the display bounds, it returns them in global screen space,
and you can use coordinates that match the display you want the window
on.
Alternatively, you can use the macros provided if you don’t care or want
them centered and don’t want to do the math:
SDL_WINDOWPOS_UNDEFINED_DISPLAY(N)
Perhaps it would be better to use doxygen generated stuff nightly, instead
of the wiki, (or perhaps point to the wiki entry in doxygen) lots of stuff
is slipping through the cracks, until someone comes along asking on how to
do this…
That does sound like an interesting idea. Perhaps have cron invoke a
script for something like “make web-doc”, then "make web-doc-install"
if that succeeds. Meanwhile, have links to relevant wiki pages inside
the doxygen stuff, and links to the doxygen pages inside the wiki
pages (in which case you would probably want to modify the new page
template to list things that need to be added).
This would certainly pose a potential solution to the endless
documentation question.> Date: Sun, 18 Aug 2013 03:48:05 +0000
From: “Sparks”
To: sdl at lists.libsdl.org
Subject: Re: [SDL] SDL_CreateWindow on multiple screens ?
When you get the display bounds, it returns them in global screen space, and you can use coordinates that match the display you want the window on.
Alternatively, you can use the macros provided if you don’t care or want them centered and don’t want to do the math:
SDL_WINDOWPOS_UNDEFINED_DISPLAY(N)
SDL_WINDOWPOS_CENTERED_DISPLAY(N)
I’ve tried both methods and the results seem implementation dependent. I’ve run the following code on Debian with XFCE and on Windows (compiled with mingw). On Debian it shows the windows correctly if my mouse pointer is on the first display when I run the program, but if the mouse pointer is on the second display, it shows both windows on the second display (resulting in only the second display being visible. On Windows it shows both windows on the second display regardless of the mouse position. The coordinates that are output are the same in all cases. Am I doing something wrong here?