A Window Coordinate question

An embedded and charset-unspecified text was scrubbed…
Name: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20041223/629a706d/attachment.asc

bloomp at rpi.edu wrote:

Okay, I’m working a bit on a 3d camera function using openGL through SDL
and I’ve run into a bit of a hitch.

I’m certain there’s some way to get data on the current window position,
but I’m having trouble figuring out what it is. Basically, I want to be
able to know when the mouse is in the edges of the application window
(While ignoring it when it is outside the window). It’s pretty easy to do
when the window starts and is centered but I’m allowing both resize and
moving the window around and I don’t want to grab input (because that
blocks the user from moving up to the title bar, clicking x, and closing
the program that way). I keep a record of the window’s current height and
width, so I have that easily accessible at all times. If I can get either
a window corner coordinate (any of them as long as it can be gotten
consistently) or the current center of the window, I could easily calculate
whether the mouse was inside the window and in the edges or not.
Alternatively, if there’s a way to detect how the center has moved when a
resize or window move command occurs, I could use that. Any way to get any
of those pieces of information?

Thanks in advance, this list has made using SDL awesome.

Philip Bloom

I don’t think you can get the current window position in SDL.
All coordinates are already relative to the window, however, and the mouse is ignored when outside the window.
Basically, if you substitute window for screen in the documentation, you should get a good idea of how things work.

Chris E.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20041223/c5d74be1/attachment.pgp

— bloomp at rpi.edu escreveu:

Hi there.
I am not a windows expert (I programmed in C using
Windows API for 3 years, but it was basic things). The
things you want you can get by the CALLBACK function
(LRESULT CALLBACK func (WND, MSG, LRESULT, WRESULT)
(please correct me if I wrote something wrong).
You can diable the close function of your window on
WM_CLOSE set to nothing
(switch LOWORD(lParam)) { case WM_CLOSE: break;}

if the mouse pointer is over the left edge of the
window, xPos of mouse = 0, else (right edge), xPos =
WindowWidth -1). The same is true for yPos.

You can send me a private email if you want more info
about this way of mouse handling or CALLBACK functions
or if I was not THAT clear about something (window
manipulation is not the main topic of the list)> Okay, I’m working a bit on a 3d camera function

using openGL through SDL
and I’ve run into a bit of a hitch.

I’m certain there’s some way to get data on the
current window position,
but I’m having trouble figuring out what it is.
Basically, I want to be
able to know when the mouse is in the edges of the
application window
(While ignoring it when it is outside the window).
It’s pretty easy to do
when the window starts and is centered but I’m
allowing both resize and
moving the window around and I don’t want to grab
input (because that
blocks the user from moving up to the title bar,
clicking x, and closing
the program that way). I keep a record of the
window’s current height and
width, so I have that easily accessible at all
times. If I can get either
a window corner coordinate (any of them as long as
it can be gotten
consistently) or the current center of the window, I
could easily calculate
whether the mouse was inside the window and in the
edges or not.
Alternatively, if there’s a way to detect how the
center has moved when a
resize or window move command occurs, I could use
that. Any way to get any
of those pieces of information?

Thanks in advance, this list has made using SDL
awesome.

Philip Bloom


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


Yahoo! Acesso Gr?tis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet r?pida e gr?tis

An embedded and charset-unspecified text was scrubbed…
Name: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20041226/15ba46ad/attachment.txt

An embedded and charset-unspecified text was scrubbed…
Name: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20041226/ddb7e070/attachment.asc