fixed mouse position and keyboard mapping.
added c-wrapper cpp file for GAPI. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@485 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
30aa3f91c3
commit
154a985699
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -68,6 +68,7 @@ freeglut/freeglut/src/freeglut_font_data.c svn_keywords=Author+Date+Id+Revision
|
||||
freeglut/freeglut/src/freeglut_gamemode.c svn_keywords=Author+Date+Id+Revision
|
||||
freeglut/freeglut/src/freeglut_geometry.c svn_keywords=Author+Date+Id+Revision
|
||||
freeglut/freeglut/src/freeglut_glutfont_definitions.c svn_keywords=Author+Date+Id+Revision
|
||||
freeglut/freeglut/src/freeglut_gx.cpp svn_keywords=Author+Date+Id+Revision
|
||||
freeglut/freeglut/src/freeglut_init.c svn_keywords=Author+Date+Id+Revision
|
||||
freeglut/freeglut/src/freeglut_internal.h svn_keywords=Author+Date+Id+Revision
|
||||
freeglut/freeglut/src/freeglut_joystick.c svn_keywords=Author+Date+Id+Revision
|
||||
|
@ -208,6 +208,13 @@ DEP_CPP_FREEGLUT_GL=\
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\freeglut_gx.cpp
|
||||
DEP_CPP_FREEGLUT_GX=\
|
||||
{$(INCLUDE)}"gx.h"\
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\freeglut_init.c
|
||||
DEP_CPP_FREEGLUT_I=\
|
||||
".\src\freeglut_internal.h"\
|
||||
@ -351,11 +358,15 @@ NODEP_CPP_FREEGLUT_V=\
|
||||
SOURCE=.\src\freeglut_window.c
|
||||
DEP_CPP_FREEGLUT_W=\
|
||||
".\src\freeglut_internal.h"\
|
||||
{$(INCLUDE)}"aygshell.h"\
|
||||
{$(INCLUDE)}"GL\freeglut.h"\
|
||||
{$(INCLUDE)}"GL\freeglut_ext.h"\
|
||||
{$(INCLUDE)}"GL\freeglut_std.h"\
|
||||
{$(INCLUDE)}"sipapi.h"\
|
||||
{$(INCLUDE)}"winuserm.h"\
|
||||
|
||||
NODEP_CPP_FREEGLUT_W=\
|
||||
"..\..\..\..\..\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Include\ARMV4\vibrate.h"\
|
||||
".\src\config.h"\
|
||||
|
||||
# End Source File
|
||||
|
52
freeglut/freeglut/src/freeglut_gx.cpp
Normal file
52
freeglut/freeglut/src/freeglut_gx.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* freeglut_gx.cpp
|
||||
*
|
||||
* WindowsCE specific file
|
||||
*
|
||||
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
|
||||
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
|
||||
* Creation date: Fri Dec 3 1999
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <gx.h>
|
||||
|
||||
#pragma comment( lib, "gx.lib" )
|
||||
|
||||
// Microsoft decided that gapi should only work in C++ (thanks...)
|
||||
// so we need a c-wrapper for it...
|
||||
//
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
void wince_GetDefaultKeys(void* nData, int iOptions)
|
||||
{
|
||||
*(GXKeyList*)nData = GXGetDefaultKeys(iOptions);
|
||||
};
|
||||
|
||||
|
||||
void wince_OpenInput()
|
||||
{
|
||||
GXOpenInput();
|
||||
}
|
||||
|
||||
}
|
@ -25,6 +25,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@ -40,6 +41,29 @@
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#elif TARGET_HOST_WIN32
|
||||
#elif TARGET_HOST_WINCE
|
||||
// including gx.h does only work in c++ (thanks MS...),
|
||||
// so we define this on our own...
|
||||
struct GXKeyList {
|
||||
short vkUp; // key for up
|
||||
POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates.
|
||||
short vkDown;
|
||||
POINT ptDown;
|
||||
short vkLeft;
|
||||
POINT ptLeft;
|
||||
short vkRight;
|
||||
POINT ptRight;
|
||||
short vkA;
|
||||
POINT ptA;
|
||||
short vkB;
|
||||
POINT ptB;
|
||||
short vkC;
|
||||
POINT ptC;
|
||||
short vkStart;
|
||||
POINT ptStart;
|
||||
};
|
||||
extern void wince_GetDefaultKeys(void* nData, int iOptions);
|
||||
extern void wince_OpenInput();
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
@ -1259,6 +1283,11 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||
window->State.Height = fgState.Size.Y;
|
||||
|
||||
ReleaseDC( window->Window.Handle, window->Window.Device );
|
||||
|
||||
#if TARGET_HOST_WINCE
|
||||
// Take over button handling
|
||||
wince_OpenInput();
|
||||
#endif //TARGET_HOST_WINCE
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
@ -1370,8 +1399,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
#if TARGET_HOST_WINCE
|
||||
window->State.MouseX = 320-HIWORD( lParam );
|
||||
window->State.MouseY = LOWORD( lParam );
|
||||
#else
|
||||
window->State.MouseX = LOWORD( lParam );
|
||||
window->State.MouseY = HIWORD( lParam );
|
||||
#endif //TARGET_HOST_WINCE
|
||||
|
||||
if ( window->ActiveMenu )
|
||||
{
|
||||
@ -1405,8 +1439,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||
GLboolean pressed = GL_TRUE;
|
||||
int button;
|
||||
|
||||
#if TARGET_HOST_WINCE
|
||||
window->State.MouseX = 320-HIWORD( lParam );
|
||||
window->State.MouseY = LOWORD( lParam );
|
||||
#else
|
||||
window->State.MouseX = LOWORD( lParam );
|
||||
window->State.MouseY = HIWORD( lParam );
|
||||
#endif //TARGET_HOST_WINCE
|
||||
|
||||
switch( uMsg )
|
||||
{
|
||||
@ -1609,6 +1648,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
{
|
||||
#if TARGET_HOST_WINCE
|
||||
struct GXKeyList gxKeyList;
|
||||
#endif //TARGET_HOST_WINCE
|
||||
int keypress = -1;
|
||||
POINT mouse_pos ;
|
||||
|
||||
@ -1665,6 +1707,30 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||
);
|
||||
}
|
||||
|
||||
#if TARGET_HOST_WINCE
|
||||
if(!(lParam & 0x40000000)) // Prevent auto-repeat
|
||||
{
|
||||
wince_GetDefaultKeys(&gxKeyList, 0x03);
|
||||
|
||||
if(wParam==(unsigned)gxKeyList.vkRight)
|
||||
keypress = GLUT_KEY_RIGHT;
|
||||
else if(wParam==(unsigned)gxKeyList.vkLeft)
|
||||
keypress = GLUT_KEY_LEFT;
|
||||
else if(wParam==(unsigned)gxKeyList.vkUp)
|
||||
keypress = GLUT_KEY_UP;
|
||||
else if(wParam==(unsigned)gxKeyList.vkDown)
|
||||
keypress = GLUT_KEY_DOWN;
|
||||
else if(wParam==(unsigned)gxKeyList.vkA)
|
||||
keypress = GLUT_KEY_F1;
|
||||
else if(wParam==(unsigned)gxKeyList.vkB)
|
||||
keypress = GLUT_KEY_F2;
|
||||
else if(wParam==(unsigned)gxKeyList.vkC)
|
||||
keypress = GLUT_KEY_F3;
|
||||
else if(wParam==(unsigned)gxKeyList.vkStart)
|
||||
keypress = GLUT_KEY_F4;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( keypress != -1 )
|
||||
INVOKE_WCB( *window, Special,
|
||||
( keypress,
|
||||
|
Reference in New Issue
Block a user