- tab cleanup
- replace unix path management code by Qt one
This commit is contained in:
+9
-11
@@ -20,7 +20,6 @@ public:
|
||||
JGEQtRenderer(QWidget *parent);
|
||||
|
||||
protected:
|
||||
|
||||
void initializeGL();
|
||||
|
||||
void resizeGL(int w, int h);
|
||||
@@ -115,7 +114,7 @@ void DestroyGame(void)
|
||||
|
||||
|
||||
JGEQtRenderer::JGEQtRenderer(QWidget *parent)
|
||||
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
|
||||
: QGLWidget(parent)
|
||||
{
|
||||
startTimer( 5 );
|
||||
setWindowTitle(g_launcher->GetName());
|
||||
@@ -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