type usage consistency

This commit is contained in:
2024-03-12 22:19:55 +11:00
parent 2ac4bf8461
commit e1ff61d0df

View File

@@ -39,14 +39,14 @@ typedef struct tagCAMERA
{ {
float heading; float heading;
float xpos, zpos; float xpos, zpos;
GLfloat yrot; // Y Rotation float yrot; // Y Rotation
GLfloat walkbias, walkbiasangle; float walkbias, walkbiasangle;
GLfloat lookupdown; float lookupdown;
GLfloat z; // Depth Into The Screen float z; // Depth Into The Screen
} CAMERA; } CAMERA;
CAMERA camera; CAMERA camera;
GLuint filter; // Which Filter To Use unsigned filter; // Which Filter To Use
GLuint texture[3] = { 0, 0, 0 }; // Storage For 3 Textures GLuint texture[3] = { 0, 0, 0 }; // Storage For 3 Textures
typedef struct tagVERTEX typedef struct tagVERTEX
@@ -138,7 +138,7 @@ bool FlipSurface(SDL_Surface *surface)
return true; return true;
} }
int LoadGLTextures(void) // Load bitmap as textures bool LoadGLTextures(void) // Load bitmap as textures
{ {
SDL_Surface *TextureImage = NULL; // Create Storage Space For The Texture SDL_Surface *TextureImage = NULL; // Create Storage Space For The Texture
@@ -177,7 +177,7 @@ static void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdou
double invcliprng = 1.0 / (zFar - zNear); double invcliprng = 1.0 / (zFar - zNear);
double z = -(zFar + zNear) * invcliprng; double z = -(zFar + zNear) * invcliprng;
double z2 = -(2.0 * zFar * zNear) * invcliprng; double z2 = -(2.0 * zFar * zNear) * invcliprng;
double mtx[16] = GLdouble mtx[16] =
{ {
w, 0.0, 0.0, 0.0, w, 0.0, 0.0, 0.0,
0.0, h, 0.0, 0.0, 0.0, h, 0.0, 0.0,
@@ -187,7 +187,7 @@ static void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdou
glLoadMatrixd(mtx); glLoadMatrixd(mtx);
} }
void ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window void ReSizeGLScene(int width, int height) // Resize And Initialize The GL Window
{ {
if (height == 0) // Prevent A Divide By Zero By if (height == 0) // Prevent A Divide By Zero By
{ {
@@ -200,17 +200,17 @@ void ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initializ
glLoadIdentity(); // Reset The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window // Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f); gluPerspective(45.0f, (float)width / (float)height, 0.1f, 100.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix
} }
int InitGL(void) // All Setup For OpenGL Goes Here bool InitGL(void) // All Setup For OpenGL Goes Here
{ {
if (!LoadGLTextures()) // Jump To Texture Loading Routine if (!LoadGLTextures()) // Jump To Texture Loading Routine
{ {
return 0; // If Texture Didn't Load Return FALSE return false;
} }
glEnable(GL_TEXTURE_2D); // Enable Texture Mapping glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
@@ -224,7 +224,7 @@ int InitGL(void) // All Setup For OpenGL
SetupWorld(); SetupWorld();
return 1; // Initialization Went OK return true; // Initialization Went OK
} }
void DrawGLScene(void) // Here's Where We Do All The Drawing void DrawGLScene(void) // Here's Where We Do All The Drawing
@@ -281,7 +281,7 @@ void KillGLWindow(void) // Properly Kill The Window
{ {
if (fullscreen) // Are We In Fullscreen Mode? if (fullscreen) // Are We In Fullscreen Mode?
{ {
SDL_SetWindowFullscreen(win, 0); // If So Switch Back To The Desktop SDL_SetWindowFullscreen(win, SDL_FALSE); // If So Switch Back To The Desktop
SDL_ShowCursor(); // Show Mouse Pointer SDL_ShowCursor(); // Show Mouse Pointer
} }