J :
* Make the FULLSCREEN function bindable on platforms that support it. * Linux has F as default binding. * Windows support is not implemented, but is there ; applications will just not suggest it under windows for the moment.
This commit is contained in:
@@ -46,6 +46,7 @@ void JGECreateDefaultBindings();
|
||||
int JGEGetTime();
|
||||
u8 JGEGetAnalogX();
|
||||
u8 JGEGetAnalogY();
|
||||
bool JGEToggleFullscreen();
|
||||
|
||||
#if !defined(WIN32) && !defined(LINUX)
|
||||
|
||||
|
||||
@@ -227,6 +227,7 @@ typedef enum Buttons
|
||||
JGE_BTN_SEC, // Cross or Circle (secondary)
|
||||
JGE_BTN_PREV, // Left trigger
|
||||
JGE_BTN_NEXT, // Right trigger
|
||||
JGE_BTN_FULLSCREEN, // Switch to fullscreen (obviously, PC only)
|
||||
|
||||
JGE_BTN_MAX = JGE_BTN_NEXT + 1
|
||||
} JButton;
|
||||
|
||||
@@ -78,11 +78,18 @@ void JGE::PressKey(const LocalKeySym sym)
|
||||
const pair<keycodes_it, keycodes_it> rng = keyBinds.equal_range(sym);
|
||||
if (rng.first == rng.second)
|
||||
keyBuffer.push(triplet(sym, JGE_BTN_NONE, false));
|
||||
else for (keycodes_it it = rng.first; it != rng.second; ++it)
|
||||
else for (keycodes_it it = rng.first; it != rng.second; ++it) {
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if (JGE_BTN_FULLSCREEN == it->second) JGEToggleFullscreen();
|
||||
#endif
|
||||
keyBuffer.push(triplet(*it, held(it->second)));
|
||||
}
|
||||
}
|
||||
void JGE::PressKey(const JButton sym)
|
||||
{
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if (sym == JGE_BTN_FULLSCREEN) JGEToggleFullscreen();
|
||||
#endif
|
||||
keyBuffer.push(triplet(LOCAL_KEY_NONE, sym, held(sym)));
|
||||
}
|
||||
void JGE::HoldKey(const LocalKeySym sym)
|
||||
@@ -92,6 +99,9 @@ void JGE::HoldKey(const LocalKeySym sym)
|
||||
keyBuffer.push(triplet(sym, JGE_BTN_NONE, false));
|
||||
else for (keycodes_it it = rng.first; it != rng.second; ++it)
|
||||
{
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if (JGE_BTN_FULLSCREEN == it->second) JGEToggleFullscreen();
|
||||
#endif
|
||||
if (!held(it->second))
|
||||
{
|
||||
keyBuffer.push(triplet(*it, false));
|
||||
@@ -107,6 +117,9 @@ void JGE::HoldKey_NoRepeat(const LocalKeySym sym)
|
||||
keyBuffer.push(triplet(sym, JGE_BTN_NONE, false));
|
||||
else for (keycodes_it it = rng.first; it != rng.second; ++it)
|
||||
{
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if (JGE_BTN_FULLSCREEN == it->second) JGEToggleFullscreen();
|
||||
#endif
|
||||
keyBuffer.push(triplet(*it, true));
|
||||
if (!held(it->second))
|
||||
holds[it->second] = std::numeric_limits<float>::quiet_NaN();
|
||||
@@ -114,6 +127,9 @@ void JGE::HoldKey_NoRepeat(const LocalKeySym sym)
|
||||
}
|
||||
void JGE::HoldKey(const JButton sym)
|
||||
{
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if (JGE_BTN_FULLSCREEN == sym) JGEToggleFullscreen();
|
||||
#endif
|
||||
if (!held(sym))
|
||||
{
|
||||
keyBuffer.push(triplet(LOCAL_KEY_NONE, sym, false));
|
||||
@@ -123,6 +139,9 @@ void JGE::HoldKey(const JButton sym)
|
||||
}
|
||||
void JGE::HoldKey_NoRepeat(const JButton sym)
|
||||
{
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
if (JGE_BTN_FULLSCREEN == sym) JGEToggleFullscreen();
|
||||
#endif
|
||||
keyBuffer.push(triplet(LOCAL_KEY_NONE, sym, true));
|
||||
if (!held(sym))
|
||||
holds[sym] = std::numeric_limits<float>::quiet_NaN();
|
||||
|
||||
@@ -77,9 +77,7 @@ static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[]
|
||||
{ XK_Caps_Lock, JGE_BTN_SEC },
|
||||
{ XK_Shift_L, JGE_BTN_PREV },
|
||||
{ XK_Shift_R, JGE_BTN_NEXT },
|
||||
{ XK_F1, JGE_BTN_QUIT },
|
||||
{ XK_F2, JGE_BTN_POWER },
|
||||
{ XK_F3, JGE_BTN_SOUND }
|
||||
{ XK_F, JGE_BTN_FULLSCREEN },
|
||||
};
|
||||
|
||||
GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize The GL Window
|
||||
@@ -300,7 +298,7 @@ void reshapeFunc(int width, int height)
|
||||
ReSizeGLScene(width, height);
|
||||
}
|
||||
|
||||
void fullscreen()
|
||||
bool JGEToggleFullscreen()
|
||||
{
|
||||
Atom wmState = XInternAtom(gXDisplay, "_NET_WM_STATE", False);
|
||||
Atom fullScreen = XInternAtom(gXDisplay, "_NET_WM_STATE_FULLSCREEN", False);
|
||||
@@ -337,6 +335,7 @@ void fullscreen()
|
||||
XGetWindowAttributes(gXDisplay, DefaultRootWindow(gXDisplay), &xwa);
|
||||
XMoveResizeWindow(gXDisplay, gXWindow, 0, 0, xwa.width, xwa.height);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@@ -392,7 +391,6 @@ int main(int argc, char* argv[])
|
||||
case KeyPress:
|
||||
{
|
||||
const KeySym sym = XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1);
|
||||
if (sym == XK_F) fullscreen();
|
||||
g_engine->HoldKey_NoRepeat(sym);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -179,9 +179,6 @@ static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[]
|
||||
{ VK_SPACE, JGE_BTN_OK },
|
||||
{ 'K', JGE_BTN_SEC },
|
||||
{ 'J', JGE_BTN_PRI },
|
||||
{ VK_F1, JGE_BTN_QUIT },
|
||||
{ VK_F2, JGE_BTN_POWER },
|
||||
{ VK_F3, JGE_BTN_SOUND }
|
||||
};
|
||||
|
||||
void JGECreateDefaultBindings()
|
||||
@@ -634,6 +631,11 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
|
||||
return DefWindowProc(hWnd,uMsg,wParam,lParam);
|
||||
}
|
||||
|
||||
bool JGEToggleFullscreen()
|
||||
{
|
||||
return false; // Not implemented under windows
|
||||
}
|
||||
|
||||
int WINAPI WinMain( HINSTANCE hInstance, // Instance
|
||||
HINSTANCE hPrevInstance, // Previous Instance
|
||||
LPSTR lpCmdLine, // Command Line Parameters
|
||||
|
||||
Reference in New Issue
Block a user