mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 02:38:52 -05:00
Fix various warnings reported by gcc
Shadowed variables, const warnings
This commit is contained in:
parent
c8c36f6ec0
commit
c2729181a2
|
@ -330,7 +330,7 @@ void DrawBoingBall( void )
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Bounce the ball.
|
* Bounce the ball.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void BounceBall( double dt )
|
void BounceBall( double delta_t )
|
||||||
{
|
{
|
||||||
GLfloat sign;
|
GLfloat sign;
|
||||||
GLfloat deg;
|
GLfloat deg;
|
||||||
|
@ -358,8 +358,8 @@ void BounceBall( double dt )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update ball position */
|
/* Update ball position */
|
||||||
ball_x += ball_x_inc * ((float)dt*ANIMATION_SPEED);
|
ball_x += ball_x_inc * ((float)delta_t*ANIMATION_SPEED);
|
||||||
ball_y += ball_y_inc * ((float)dt*ANIMATION_SPEED);
|
ball_y += ball_y_inc * ((float)delta_t*ANIMATION_SPEED);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simulate the effects of gravity on Y movement.
|
* Simulate the effects of gravity on Y movement.
|
||||||
|
|
|
@ -442,7 +442,6 @@ static void mouseButtonFun(GLFWwindow window, int button, int action)
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow window;
|
||||||
int width, height;
|
|
||||||
|
|
||||||
// Initialise GLFW
|
// Initialise GLFW
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
|
|
|
@ -83,7 +83,7 @@ void _glfwInitJoysticks(void)
|
||||||
{
|
{
|
||||||
#ifdef _GLFW_USE_LINUX_JOYSTICKS
|
#ifdef _GLFW_USE_LINUX_JOYSTICKS
|
||||||
int k, n, fd, joy_count;
|
int k, n, fd, joy_count;
|
||||||
char* joy_base_name;
|
const char* joy_base_name;
|
||||||
char joy_dev_name[20];
|
char joy_dev_name[20];
|
||||||
int driver_version = 0x000800;
|
int driver_version = 0x000800;
|
||||||
char ret_data;
|
char ret_data;
|
||||||
|
|
|
@ -41,7 +41,10 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
|
/* 2012-08-12 Lambert Clara <lambert.clara@yahoo.fr>
|
||||||
|
*
|
||||||
|
* Constify third argument of getopt.
|
||||||
|
*/
|
||||||
/* 2011-07-27 Camilla Berglund <elmindreda@elmindreda.org>
|
/* 2011-07-27 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
*
|
*
|
||||||
* Added _CRT_SECURE_NO_WARNINGS macro.
|
* Added _CRT_SECURE_NO_WARNINGS macro.
|
||||||
|
@ -102,7 +105,7 @@ static int permute_argv_once()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getopt(int argc, char** argv, char* optstr)
|
int getopt(int argc, char** argv, const char* optstr)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ extern int optind;
|
||||||
extern int opterr;
|
extern int opterr;
|
||||||
extern int optopt;
|
extern int optopt;
|
||||||
|
|
||||||
int getopt(int argc, char** argv, char* optstr);
|
int getopt(int argc, char** argv, const char* optstr);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -41,14 +41,14 @@
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int param;
|
int param;
|
||||||
char* ext;
|
const char* ext;
|
||||||
char* name;
|
const char* name;
|
||||||
} ParamGL;
|
} ParamGL;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int param;
|
int param;
|
||||||
char* name;
|
const char* name;
|
||||||
} ParamGLFW;
|
} ParamGLFW;
|
||||||
|
|
||||||
static ParamGL gl_params[] =
|
static ParamGL gl_params[] =
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#define STEP_SIZE 0.1f
|
#define STEP_SIZE 0.1f
|
||||||
|
|
||||||
static GLfloat gamma = 1.0f;
|
static GLfloat gamma_value = 1.0f;
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
|
@ -46,9 +46,9 @@ static void usage(void)
|
||||||
|
|
||||||
static void set_gamma(float value)
|
static void set_gamma(float value)
|
||||||
{
|
{
|
||||||
gamma = value;
|
gamma_value = value;
|
||||||
printf("Gamma: %f\n", gamma);
|
printf("Gamma: %f\n", gamma_value);
|
||||||
glfwSetGamma(gamma);
|
glfwSetGamma(gamma_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow window, int key, int action)
|
||||||
|
@ -67,15 +67,15 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||||
case GLFW_KEY_KP_ADD:
|
case GLFW_KEY_KP_ADD:
|
||||||
case GLFW_KEY_Q:
|
case GLFW_KEY_Q:
|
||||||
{
|
{
|
||||||
set_gamma(gamma + STEP_SIZE);
|
set_gamma(gamma_value + STEP_SIZE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GLFW_KEY_KP_SUBTRACT:
|
case GLFW_KEY_KP_SUBTRACT:
|
||||||
case GLFW_KEY_W:
|
case GLFW_KEY_W:
|
||||||
{
|
{
|
||||||
if (gamma - STEP_SIZE > 0.f)
|
if (gamma_value - STEP_SIZE > 0.f)
|
||||||
set_gamma(gamma - STEP_SIZE);
|
set_gamma(gamma_value - STEP_SIZE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,10 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (mode == GLFW_FULLSCREEN)
|
if (mode == GLFW_FULLSCREEN)
|
||||||
{
|
{
|
||||||
GLFWvidmode mode;
|
GLFWvidmode desktop_mode;
|
||||||
glfwGetDesktopMode(&mode);
|
glfwGetDesktopMode(&desktop_mode);
|
||||||
width = mode.width;
|
width = desktop_mode.width;
|
||||||
height = mode.height;
|
height = desktop_mode.height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,10 +100,10 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (mode == GLFW_FULLSCREEN)
|
if (mode == GLFW_FULLSCREEN)
|
||||||
{
|
{
|
||||||
GLFWvidmode mode;
|
GLFWvidmode desktop_mode;
|
||||||
glfwGetDesktopMode(&mode);
|
glfwGetDesktopMode(&desktop_mode);
|
||||||
width = mode.width;
|
width = desktop_mode.width;
|
||||||
height = mode.height;
|
height = desktop_mode.height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,8 +130,6 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
||||||
{
|
{
|
||||||
int width, height;
|
|
||||||
|
|
||||||
if (iconified != glfwGetWindowParam(window, GLFW_ICONIFIED) ||
|
if (iconified != glfwGetWindowParam(window, GLFW_ICONIFIED) ||
|
||||||
active != glfwGetWindowParam(window, GLFW_ACTIVE))
|
active != glfwGetWindowParam(window, GLFW_ACTIVE))
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,7 @@ static void error_callback(int error, const char* description)
|
||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow in_window, int width, int height)
|
||||||
{
|
{
|
||||||
printf("Window resized to %ix%i\n", width, height);
|
printf("Window resized to %ix%i\n", width, height);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user