Same actualWidth/Height changes for QTmain.
This commit is contained in:
+4
-5
@@ -269,13 +269,10 @@ void JGEQtRenderer::initializeGL()
|
|||||||
glEnable(GL_SCISSOR_TEST); // Enable Clipping
|
glEnable(GL_SCISSOR_TEST); // Enable Clipping
|
||||||
}
|
}
|
||||||
|
|
||||||
int actualWidth;
|
|
||||||
int actualHeight;
|
|
||||||
|
|
||||||
GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize The GL Window
|
GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize The GL Window
|
||||||
{
|
{
|
||||||
actualWidth = width;
|
JRenderer::GetInstance()->SetActualWidth(width);
|
||||||
actualHeight = height;
|
JRenderer::GetInstance()->SetActualHeight(height);
|
||||||
|
|
||||||
if ((GLfloat)width / (GLfloat)height < ACTUAL_RATIO)
|
if ((GLfloat)width / (GLfloat)height < ACTUAL_RATIO)
|
||||||
{
|
{
|
||||||
@@ -323,6 +320,8 @@ void JGEQtRenderer::mousePressEvent(QMouseEvent *event)
|
|||||||
lastPos = event->pos();
|
lastPos = event->pos();
|
||||||
// this is intended to convert window coordinate into game coordinate.
|
// this is intended to convert window coordinate into game coordinate.
|
||||||
// this is correct only if the game and window have the same aspect ratio, otherwise, it's just wrong
|
// this is correct only if the game and window have the same aspect ratio, otherwise, it's just wrong
|
||||||
|
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
|
||||||
|
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
|
||||||
g_engine->LeftClicked((lastPos.x()*SCREEN_WIDTH)/actualWidth, (lastPos.y()*SCREEN_HEIGHT)/actualHeight);
|
g_engine->LeftClicked((lastPos.x()*SCREEN_WIDTH)/actualWidth, (lastPos.y()*SCREEN_HEIGHT)/actualHeight);
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user