Skip to content

Commit 0b1e51f

Browse files
authored
Cleaner implementation of support dynamic resizing aspect ratio (#228)
* Add dynamic resolution * Clean up implementation * Use existing ints instead of new ones * Remove WM_SIZE argument (unecessary now that we directly use g_iScreenWidth and g_iScreenHeight)
1 parent acf4a38 commit 0b1e51f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Minecraft.Client/glWrapper.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ void glLoadIdentity()
4848
RenderManager.MatrixSetIdentity();
4949
}
5050

51-
extern UINT g_ScreenWidth;
52-
extern UINT g_ScreenHeight;
51+
extern int g_iScreenWidth;
52+
extern int g_iScreenHeight;
5353

5454
void gluPerspective(float fovy, float aspect, float zNear, float zFar)
5555
{
56-
RenderManager.MatrixPerspective(fovy,aspect,zNear,zFar);
56+
float dynamicAspect = (float)g_iScreenWidth / (float)g_iScreenHeight;
57+
RenderManager.MatrixPerspective(fovy, dynamicAspect, zNear, zFar);
5758
}
5859

5960
void glOrtho(float left,float right,float bottom,float top,float zNear,float zFar)

0 commit comments

Comments
 (0)