Initiate game mode support
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37820 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -20,7 +20,7 @@ MergeObject <opengl>glut.o :
|
|||||||
glutCursor.cpp
|
glutCursor.cpp
|
||||||
glutMenu.cpp
|
glutMenu.cpp
|
||||||
glutDstr.cpp
|
glutDstr.cpp
|
||||||
# glutGameMode.cpp
|
glutGameMode.cpp
|
||||||
beos_x11.cpp
|
beos_x11.cpp
|
||||||
|
|
||||||
# C sources
|
# C sources
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010, Haiku Inc.
|
||||||
|
* Authors:
|
||||||
|
* Philippe Houdoin <phoudoin %at% haiku-os %dot% org>
|
||||||
|
*
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <GL/glut.h>
|
||||||
|
#include "glutint.h"
|
||||||
|
#include "glutState.h"
|
||||||
|
#include "glutBlocker.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
void APIENTRY
|
||||||
|
glutGameModeString(const char *string)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int APIENTRY
|
||||||
|
glutEnterGameMode(void)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void APIENTRY
|
||||||
|
glutLeaveGameMode(void)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int APIENTRY
|
||||||
|
glutGameModeGet(GLenum pname)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
switch( pname ) {
|
||||||
|
case GLUT_GAME_MODE_ACTIVE:
|
||||||
|
ret = gState.gameMode != NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GLUT_GAME_MODE_POSSIBLE:
|
||||||
|
// TODO
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GLUT_GAME_MODE_WIDTH:
|
||||||
|
if (gState.gameMode)
|
||||||
|
ret = gState.gameMode->width;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GLUT_GAME_MODE_HEIGHT:
|
||||||
|
if (gState.gameMode)
|
||||||
|
ret = gState.gameMode->height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GLUT_GAME_MODE_PIXEL_DEPTH:
|
||||||
|
if (gState.gameMode)
|
||||||
|
ret = gState.gameMode->pixelDepth;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GLUT_GAME_MODE_REFRESH_RATE:
|
||||||
|
if (gState.gameMode)
|
||||||
|
ret = gState.gameMode->refreshRate;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GLUT_GAME_MODE_DISPLAY_CHANGED:
|
||||||
|
// TODO
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
__glutWarning( "Unknown gamemode get: %d", pname );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void APIENTRY
|
||||||
|
glutForceJoystickFunc(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Forces a joystick poll and callback.
|
||||||
|
|
||||||
|
Forces the OpenGLUT joystick code to poll your
|
||||||
|
joystick(s) and to call your joystick callbacks
|
||||||
|
with the result. The operation completes, including
|
||||||
|
callbacks, before glutForceJoystickFunc() returns.
|
||||||
|
|
||||||
|
See also glutJoystickFunc()
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010, Haiku Inc.
|
||||||
|
* Authors:
|
||||||
|
* Philippe Houdoin <phoudoin %at% haiku-os %dot% org>
|
||||||
|
*
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*! All information needed for game mode and
|
||||||
|
subwindows (handled as similarly as possible).
|
||||||
|
*/
|
||||||
|
class GlutGameMode {
|
||||||
|
public:
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int pixelDepth;
|
||||||
|
int refreshRate;
|
||||||
|
};
|
||||||
@@ -17,8 +17,10 @@
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
#include <GL/glut.h>
|
#include <GL/glut.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
|
||||||
#include "glutWindow.h"
|
#include "glutWindow.h"
|
||||||
#include "glutMenu.h"
|
#include "glutMenu.h"
|
||||||
|
#include "glutGameMode.h"
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
* CLASS: GlutState
|
* CLASS: GlutState
|
||||||
@@ -45,7 +47,7 @@ struct GlutState {
|
|||||||
int modifierKeys; // only valid during keyboard callback
|
int modifierKeys; // only valid during keyboard callback
|
||||||
int keyRepeatMode; // global repeat
|
int keyRepeatMode; // global repeat
|
||||||
|
|
||||||
bool gameMode; // game mode is active
|
GlutGameMode* gameMode;
|
||||||
|
|
||||||
bool debug; // call glGetError
|
bool debug; // call glGetError
|
||||||
bool quitAll; // quit
|
bool quitAll; // quit
|
||||||
@@ -57,14 +59,15 @@ struct GlutState {
|
|||||||
initWidth = initHeight = 300;
|
initWidth = initHeight = 300;
|
||||||
displayMode = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH;
|
displayMode = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH;
|
||||||
displayString = 0;
|
displayString = 0;
|
||||||
currentWindow = 0;
|
currentWindow = NULL;
|
||||||
currentMenu = 0;
|
currentMenu = NULL;
|
||||||
windowList = 0;
|
windowList = NULL;
|
||||||
windowListSize = 0;
|
windowListSize = 0;
|
||||||
idle = 0;
|
idle = 0;
|
||||||
menuStatus = 0;
|
menuStatus = 0;
|
||||||
modifierKeys = ~0;
|
modifierKeys = ~0;
|
||||||
keyRepeatMode = GLUT_KEY_REPEAT_DEFAULT;
|
keyRepeatMode = GLUT_KEY_REPEAT_DEFAULT;
|
||||||
|
gameMode = NULL;
|
||||||
debug = quitAll = false;
|
debug = quitAll = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -103,16 +103,16 @@ GlutWindow::GlutWindow(GlutWindow *nparent, const char *name,
|
|||||||
// clear callbacks
|
// clear callbacks
|
||||||
display = __glutDefaultDisplay;
|
display = __glutDefaultDisplay;
|
||||||
reshape = __glutDefaultReshape;
|
reshape = __glutDefaultReshape;
|
||||||
mouse = 0;
|
mouse = NULL;
|
||||||
motion = 0;
|
motion = NULL;
|
||||||
passive = 0;
|
passive = NULL;
|
||||||
entry = 0;
|
entry = NULL;
|
||||||
keyboard = 0;
|
keyboard = NULL;
|
||||||
keyboardUp = 0;
|
keyboardUp = NULL;
|
||||||
visibility = 0;
|
visibility = NULL;
|
||||||
special = 0;
|
special = NULL;
|
||||||
specialUp = 0;
|
specialUp = NULL;
|
||||||
windowStatus = 0;
|
windowStatus = NULL;
|
||||||
|
|
||||||
// clear event counters
|
// clear event counters
|
||||||
anyevents = 1;
|
anyevents = 1;
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ static struct name_address_pair glut_functions[] = {
|
|||||||
{ "glutWindowStatusFunc", (const GLUTproc) glutWindowStatusFunc },
|
{ "glutWindowStatusFunc", (const GLUTproc) glutWindowStatusFunc },
|
||||||
{ "glutKeyboardUpFunc", (const GLUTproc) glutKeyboardUpFunc },
|
{ "glutKeyboardUpFunc", (const GLUTproc) glutKeyboardUpFunc },
|
||||||
{ "glutSpecialUpFunc", (const GLUTproc) glutSpecialUpFunc },
|
{ "glutSpecialUpFunc", (const GLUTproc) glutSpecialUpFunc },
|
||||||
// { "glutJoystickFunc", (const GLUTproc) glutJoystickFunc },
|
{ "glutJoystickFunc", (const GLUTproc) glutJoystickFunc },
|
||||||
{ "glutSetColor", (const GLUTproc) glutSetColor },
|
{ "glutSetColor", (const GLUTproc) glutSetColor },
|
||||||
{ "glutGetColor", (const GLUTproc) glutGetColor },
|
{ "glutGetColor", (const GLUTproc) glutGetColor },
|
||||||
{ "glutCopyColormap", (const GLUTproc) glutCopyColormap },
|
{ "glutCopyColormap", (const GLUTproc) glutCopyColormap },
|
||||||
@@ -167,11 +167,11 @@ static struct name_address_pair glut_functions[] = {
|
|||||||
{ "glutReportErrors", (const GLUTproc) glutReportErrors },
|
{ "glutReportErrors", (const GLUTproc) glutReportErrors },
|
||||||
{ "glutIgnoreKeyRepeat", (const GLUTproc) glutIgnoreKeyRepeat },
|
{ "glutIgnoreKeyRepeat", (const GLUTproc) glutIgnoreKeyRepeat },
|
||||||
{ "glutSetKeyRepeat", (const GLUTproc) glutSetKeyRepeat },
|
{ "glutSetKeyRepeat", (const GLUTproc) glutSetKeyRepeat },
|
||||||
// { "glutForceJoystickFunc", (const GLUTproc) glutForceJoystickFunc },
|
{ "glutForceJoystickFunc", (const GLUTproc) glutForceJoystickFunc },
|
||||||
// { "glutGameModeString", (const GLUTproc) glutGameModeString },
|
{ "glutGameModeString", (const GLUTproc) glutGameModeString },
|
||||||
// { "glutEnterGameMode", (const GLUTproc) glutEnterGameMode },
|
{ "glutEnterGameMode", (const GLUTproc) glutEnterGameMode },
|
||||||
// { "glutLeaveGameMode", (const GLUTproc) glutLeaveGameMode },
|
{ "glutLeaveGameMode", (const GLUTproc) glutLeaveGameMode },
|
||||||
// { "glutGameModeGet", (const GLUTproc) glutGameModeGet },
|
{ "glutGameModeGet", (const GLUTproc) glutGameModeGet },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user