mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 00:30:57 +00:00
Merge branch 'master' into tls
This commit is contained in:
+1
-3
@@ -46,9 +46,7 @@ static void set_swap_interval(GLFWwindow window, int interval)
|
||||
swap_interval = interval;
|
||||
glfwSwapInterval(swap_interval);
|
||||
|
||||
sprintf(title,
|
||||
"Cursor Inaccuracy Detector (interval %i)",
|
||||
swap_interval);
|
||||
sprintf(title, "Cursor Inaccuracy Detector (interval %i)", swap_interval);
|
||||
|
||||
glfwSetWindowTitle(window, title);
|
||||
}
|
||||
|
||||
+4
-7
@@ -30,25 +30,22 @@
|
||||
//========================================================================
|
||||
|
||||
#include <GL/glfw3.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef GL_ARB_multisample
|
||||
#define GL_SAMPLES_ARB 0x80A9
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int param;
|
||||
char* ext;
|
||||
char* name;
|
||||
const char* ext;
|
||||
const char* name;
|
||||
} ParamGL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int param;
|
||||
char* name;
|
||||
const char* name;
|
||||
} ParamGLFW;
|
||||
|
||||
static ParamGL gl_params[] =
|
||||
|
||||
+11
-11
@@ -37,7 +37,7 @@
|
||||
|
||||
#define STEP_SIZE 0.1f
|
||||
|
||||
static GLfloat gamma = 1.0f;
|
||||
static GLfloat gamma_value = 1.0f;
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
@@ -46,9 +46,9 @@ static void usage(void)
|
||||
|
||||
static void set_gamma(float value)
|
||||
{
|
||||
gamma = value;
|
||||
printf("Gamma: %f\n", gamma);
|
||||
glfwSetGamma(gamma);
|
||||
gamma_value = value;
|
||||
printf("Gamma: %f\n", gamma_value);
|
||||
glfwSetGamma(gamma_value);
|
||||
}
|
||||
|
||||
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_Q:
|
||||
{
|
||||
set_gamma(gamma + STEP_SIZE);
|
||||
set_gamma(gamma_value + STEP_SIZE);
|
||||
break;
|
||||
}
|
||||
|
||||
case GLFW_KEY_KP_SUBTRACT:
|
||||
case GLFW_KEY_W:
|
||||
{
|
||||
if (gamma - STEP_SIZE > 0.f)
|
||||
set_gamma(gamma - STEP_SIZE);
|
||||
if (gamma_value - STEP_SIZE > 0.f)
|
||||
set_gamma(gamma_value - STEP_SIZE);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -119,10 +119,10 @@ int main(int argc, char** argv)
|
||||
|
||||
if (mode == GLFW_FULLSCREEN)
|
||||
{
|
||||
GLFWvidmode mode;
|
||||
glfwGetDesktopMode(&mode);
|
||||
width = mode.width;
|
||||
height = mode.height;
|
||||
GLFWvidmode desktop_mode;
|
||||
glfwGetDesktopMode(&desktop_mode);
|
||||
width = desktop_mode.width;
|
||||
height = desktop_mode.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+4
-6
@@ -100,10 +100,10 @@ int main(int argc, char** argv)
|
||||
|
||||
if (mode == GLFW_FULLSCREEN)
|
||||
{
|
||||
GLFWvidmode mode;
|
||||
glfwGetDesktopMode(&mode);
|
||||
width = mode.width;
|
||||
height = mode.height;
|
||||
GLFWvidmode desktop_mode;
|
||||
glfwGetDesktopMode(&desktop_mode);
|
||||
width = desktop_mode.width;
|
||||
height = desktop_mode.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -130,8 +130,6 @@ int main(int argc, char** argv)
|
||||
|
||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
||||
{
|
||||
int width, height;
|
||||
|
||||
if (iconified != glfwGetWindowParam(window, GLFW_ICONIFIED) ||
|
||||
active != glfwGetWindowParam(window, GLFW_ACTIVE))
|
||||
{
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static void error_callback(int error, const char* 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);
|
||||
|
||||
|
||||
+1
-3
@@ -43,9 +43,7 @@ static void set_swap_interval(GLFWwindow window, int interval)
|
||||
swap_interval = interval;
|
||||
glfwSwapInterval(swap_interval);
|
||||
|
||||
sprintf(title,
|
||||
"Tearing detector (interval %i)",
|
||||
swap_interval);
|
||||
sprintf(title, "Tearing detector (interval %i)", swap_interval);
|
||||
|
||||
glfwSetWindowTitle(window, title);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user