fg_cursor is a much better place for code reading the mouse position
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1377 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
faf732bda6
commit
89df7d96ed
@ -76,6 +76,7 @@ static float menu_pen_hback [4] = FREEGLUT_MENU_PEN_HBACK_COLORS;
|
|||||||
|
|
||||||
|
|
||||||
extern GLvoid fgPlatformGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y );
|
extern GLvoid fgPlatformGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y );
|
||||||
|
extern void fghPlatformGetCursorPos(SFG_XYUse *mouse_pos);
|
||||||
|
|
||||||
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
|
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
|
||||||
|
|
||||||
@ -721,7 +722,7 @@ void fgDeactivateMenu( SFG_Window *window )
|
|||||||
{
|
{
|
||||||
/* Get cursor position on screen and convert to relative to parent_window's client area */
|
/* Get cursor position on screen and convert to relative to parent_window's client area */
|
||||||
SFG_XYUse mouse_pos;
|
SFG_XYUse mouse_pos;
|
||||||
fghPlatformGetMousePos(&mouse_pos);
|
fghPlatformGetCursorPos(&mouse_pos);
|
||||||
|
|
||||||
mouse_pos.X -= glutGet( GLUT_WINDOW_X );
|
mouse_pos.X -= glutGet( GLUT_WINDOW_X );
|
||||||
mouse_pos.Y -= glutGet( GLUT_WINDOW_Y );
|
mouse_pos.Y -= glutGet( GLUT_WINDOW_Y );
|
||||||
|
@ -113,3 +113,12 @@ void fgPlatformWarpPointer ( int x, int y )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fghPlatformGetCursorPos(SFG_XYUse *mouse_pos)
|
||||||
|
{
|
||||||
|
POINT pos;
|
||||||
|
GetCursorPos(&pos);
|
||||||
|
|
||||||
|
mouse_pos->X = pos.x;
|
||||||
|
mouse_pos->Y = pos.y;
|
||||||
|
mouse_pos->Use = GL_TRUE;
|
||||||
|
}
|
@ -371,16 +371,6 @@ void fgPlatformSetWindow ( SFG_Window *window )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fghPlatformGetMousePos(SFG_XYUse *mouse_pos)
|
|
||||||
{
|
|
||||||
POINT pos;
|
|
||||||
GetCursorPos(&pos);
|
|
||||||
|
|
||||||
mouse_pos->X = pos.x;
|
|
||||||
mouse_pos->Y = pos.y;
|
|
||||||
mouse_pos->Use = GL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns the width of the window borders based on the window's style.
|
/* Returns the width of the window borders based on the window's style.
|
||||||
*/
|
*/
|
||||||
void fghGetBorderWidth(const DWORD windowStyle, int* xBorderWidth, int* yBorderWidth)
|
void fghGetBorderWidth(const DWORD windowStyle, int* xBorderWidth, int* yBorderWidth)
|
||||||
|
Reference in New Issue
Block a user