- tab cleanup
- replace unix path management code by Qt one
This commit is contained in:
+12
-14
@@ -20,7 +20,6 @@ public:
|
||||
JGEQtRenderer(QWidget *parent);
|
||||
|
||||
protected:
|
||||
|
||||
void initializeGL();
|
||||
|
||||
void resizeGL(int w, int h);
|
||||
@@ -41,7 +40,7 @@ JGameLauncher* g_launcher = NULL;
|
||||
JGEQtRenderer *g_glwidget = NULL;
|
||||
|
||||
static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] =
|
||||
{
|
||||
{
|
||||
{ Qt::Key_Enter, JGE_BTN_MENU },
|
||||
{ Qt::Key_Backspace, JGE_BTN_CTRL },
|
||||
{ Qt::Key_Up, JGE_BTN_UP },
|
||||
@@ -56,7 +55,7 @@ static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[]
|
||||
{ Qt::Key_A, JGE_BTN_NEXT },
|
||||
// fullscreen management seems somehow broken in JGE, it works fine with Qt directly
|
||||
// { Qt::Key_F, JGE_BTN_FULLSCREEN },
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
void JGECreateDefaultBindings()
|
||||
@@ -115,7 +114,7 @@ void DestroyGame(void)
|
||||
|
||||
|
||||
JGEQtRenderer::JGEQtRenderer(QWidget *parent)
|
||||
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
|
||||
: QGLWidget(parent)
|
||||
{
|
||||
startTimer( 5 );
|
||||
setWindowTitle(g_launcher->GetName());
|
||||
@@ -149,7 +148,7 @@ void JGEQtRenderer::initializeGL()
|
||||
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // Set Line Antialiasing
|
||||
glEnable(GL_LINE_SMOOTH); // Enable it!
|
||||
#endif
|
||||
#endif
|
||||
|
||||
glEnable(GL_CULL_FACE); // do not calculate inside of poly's
|
||||
glFrontFace(GL_CCW); // counter clock-wise polygons are out
|
||||
@@ -171,9 +170,13 @@ GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize The GL Window
|
||||
actualHeight = height;
|
||||
|
||||
if ((GLfloat)width / (GLfloat)height < ACTUAL_RATIO)
|
||||
{
|
||||
glViewport(0, -((width/ACTUAL_RATIO)-height)/2, width, width / ACTUAL_RATIO); // Reset The Current Viewport
|
||||
}
|
||||
else
|
||||
{
|
||||
glViewport(-(height*ACTUAL_RATIO-width)/2, 0, height * ACTUAL_RATIO, height);
|
||||
}
|
||||
glScissor(0, 0, width, height);
|
||||
}
|
||||
|
||||
@@ -229,30 +232,25 @@ void JGEQtRenderer::keyReleaseEvent(QKeyEvent *event)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char* path = argv[0];
|
||||
while (*path) ++path;
|
||||
while ((*path != '/') && (path > argv[0])) --path;
|
||||
if ('/' == *path) *path = 0;
|
||||
if (strlen(argv[0]) != 0) QDir::current().cd(argv[0]);
|
||||
|
||||
QApplication a( argc, argv );
|
||||
QDir::setCurrent(QCoreApplication::applicationDirPath () );
|
||||
|
||||
g_launcher = new JGameLauncher();
|
||||
|
||||
u32 flags = g_launcher->GetInitFlags();
|
||||
|
||||
if ((flags&JINIT_FLAG_ENABLE3D)!=0)
|
||||
{
|
||||
JRenderer::Set3DFlag(true);
|
||||
}
|
||||
|
||||
g_glwidget = new JGEQtRenderer(NULL);
|
||||
|
||||
g_glwidget->resize(ACTUAL_SCREEN_WIDTH, ACTUAL_SCREEN_HEIGHT);
|
||||
|
||||
g_glwidget->show();
|
||||
|
||||
if (!InitGame())
|
||||
{
|
||||
printf("Could not init the game\n");
|
||||
qDebug("Could not init the game\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user