Fix the double key bindings problem.
The problem was, the game would initialize first, reading the keybindings from the configuration, and THEN set up the default key bindings. I think this affects only PSP, X, SDL and Qt. A quick scan of the windows version code looks to me that the order is correct and the problem should not exist, but I may be mistaken. The iPhone version looks to me like it has no keybindings at all, though the call is there ; I put the call in the right order so that the problem does not happen in the future if we implement some key bindings for it. If someone can check for windows...
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <QtOpenGL>
|
||||
#include <QTime>
|
||||
#include <QtOpenGL/QtOpenGL>
|
||||
#include <QtCore/QTime>
|
||||
|
||||
#ifdef Q_WS_MAEMO_5
|
||||
// For volume buttons support
|
||||
@@ -599,14 +599,14 @@ int main(int argc, char* argv[])
|
||||
g_glwidget->show();
|
||||
#endif
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
if (!InitGame())
|
||||
{
|
||||
qCritical("Could not init the game\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
a.exec();
|
||||
|
||||
if (g_launcher)
|
||||
|
||||
@@ -667,6 +667,7 @@ bool SdlApp::OnInit()
|
||||
|
||||
glEnable(GL_SCISSOR_TEST); // Enable Clipping
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
if (!InitGame())
|
||||
{
|
||||
@@ -676,8 +677,6 @@ bool SdlApp::OnInit()
|
||||
|
||||
OnResize(window_w, window_h);
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ JGameLauncher* g_launcher = NULL;
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
Display* gXDisplay = NULL;
|
||||
Window gXWindow = NULL;
|
||||
GLXWindow glxWin = NULL;
|
||||
Window gXWindow = (Window)0;
|
||||
GLXWindow glxWin = (GLXWindow)0;
|
||||
|
||||
static std::multiset<JButton> gControllerState;
|
||||
static std::multiset<JButton> gPrevControllerState;
|
||||
@@ -140,6 +140,7 @@ bool InitGame(void)
|
||||
{
|
||||
g_engine = JGE::GetInstance();
|
||||
g_app = g_launcher->GetGameApp();
|
||||
JGECreateDefaultBindings();
|
||||
g_app->Create();
|
||||
g_engine->SetApp(g_app);
|
||||
|
||||
@@ -172,7 +173,7 @@ void KillGLWindow(void) // Properly Kill The Window
|
||||
{
|
||||
if (gXWindow && gXDisplay)
|
||||
XDestroyWindow(gXDisplay, gXWindow);
|
||||
gXWindow = NULL;
|
||||
gXWindow = (Window)0;
|
||||
}
|
||||
|
||||
|
||||
@@ -369,8 +370,6 @@ int main(int argc, char* argv[])
|
||||
XSelectInput(gXDisplay, gXWindow, KeyPressMask | KeyReleaseMask | StructureNotifyMask);
|
||||
XkbSetDetectableAutoRepeat(gXDisplay, True, NULL);
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
static uint64_t tickCount;
|
||||
while (!g_engine->IsDone())
|
||||
{
|
||||
|
||||
@@ -265,12 +265,13 @@ void DestroyGame(void)
|
||||
JRenderer::Set3DFlag(true);
|
||||
}
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
if (!InitGame())
|
||||
{
|
||||
//return 1;
|
||||
}
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
started = TRUE;
|
||||
}
|
||||
|
||||
@@ -323,7 +323,6 @@ void Run()
|
||||
|
||||
sceRtcGetCurrentTick(&lastTime);
|
||||
oldButtons = veryOldButtons = 0;
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
while (!g_engine->mDone)
|
||||
{
|
||||
@@ -383,6 +382,7 @@ int main(int argc, char *argv[])
|
||||
JLOG("JGE::GetInstance()");
|
||||
g_engine = JGE::GetInstance();
|
||||
g_engine->SetARGV(argc, argv);
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
JLOG("Create Game");
|
||||
game = launcher->GetGameApp();
|
||||
|
||||
Reference in New Issue
Block a user