mirror of
https://github.com/glfw/glfw.git
synced 2026-11-18 12:54:54 +00:00
Made the pointer-ness of object handles explicit.
This commit is contained in:
+5
-5
@@ -39,7 +39,7 @@ static int cursor_x = 0, cursor_y = 0;
|
||||
static int window_width = 640, window_height = 480;
|
||||
static int swap_interval = 1;
|
||||
|
||||
static void set_swap_interval(GLFWwindow window, int interval)
|
||||
static void set_swap_interval(GLFWwindow* window, int interval)
|
||||
{
|
||||
char title[256];
|
||||
|
||||
@@ -56,7 +56,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* window, int width, int height)
|
||||
{
|
||||
window_width = width;
|
||||
window_height = height;
|
||||
@@ -68,13 +68,13 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
gluOrtho2D(0.f, window_width, 0.f, window_height);
|
||||
}
|
||||
|
||||
static void cursor_position_callback(GLFWwindow window, int x, int y)
|
||||
static void cursor_position_callback(GLFWwindow* window, int x, int y)
|
||||
{
|
||||
cursor_x = x;
|
||||
cursor_y = y;
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS)
|
||||
set_swap_interval(window, 1 - swap_interval);
|
||||
@@ -82,7 +82,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
int width, height;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
+5
-5
@@ -41,7 +41,7 @@ static void usage(void)
|
||||
printf("Usage: clipboard [-h]\n");
|
||||
}
|
||||
|
||||
static GLboolean control_is_down(GLFWwindow window)
|
||||
static GLboolean control_is_down(GLFWwindow* window)
|
||||
{
|
||||
return glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) ||
|
||||
glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL);
|
||||
@@ -52,13 +52,13 @@ static void error_callback(int error, const char* description)
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
static int window_close_callback(GLFWwindow* window)
|
||||
{
|
||||
closed = GL_TRUE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (action != GLFW_PRESS)
|
||||
return;
|
||||
@@ -93,7 +93,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
}
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int ch;
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
while ((ch = getopt(argc, argv, "h")) != -1)
|
||||
{
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ static void error_callback(int error, const char* description)
|
||||
int main(void)
|
||||
{
|
||||
int i, width, height;
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
|
||||
+14
-14
@@ -223,7 +223,7 @@ static void error_callback(int error, const char* description)
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_pos_callback(GLFWwindow window, int x, int y)
|
||||
static void window_pos_callback(GLFWwindow* window, int x, int y)
|
||||
{
|
||||
printf("%08x at %0.3f: Window position: %i %i\n",
|
||||
counter++,
|
||||
@@ -232,7 +232,7 @@ static void window_pos_callback(GLFWwindow window, int x, int y)
|
||||
y);
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
printf("%08x at %0.3f: Window size: %i %i\n",
|
||||
counter++,
|
||||
@@ -243,14 +243,14 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
static int window_close_callback(GLFWwindow* window)
|
||||
{
|
||||
printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime());
|
||||
|
||||
return closeable;
|
||||
}
|
||||
|
||||
static void window_refresh_callback(GLFWwindow window)
|
||||
static void window_refresh_callback(GLFWwindow* window)
|
||||
{
|
||||
printf("%08x at %0.3f: Window refresh\n", counter++, glfwGetTime());
|
||||
|
||||
@@ -261,7 +261,7 @@ static void window_refresh_callback(GLFWwindow window)
|
||||
}
|
||||
}
|
||||
|
||||
static void window_focus_callback(GLFWwindow window, int focused)
|
||||
static void window_focus_callback(GLFWwindow* window, int focused)
|
||||
{
|
||||
printf("%08x at %0.3f: Window %s\n",
|
||||
counter++,
|
||||
@@ -269,7 +269,7 @@ static void window_focus_callback(GLFWwindow window, int focused)
|
||||
focused ? "focused" : "defocused");
|
||||
}
|
||||
|
||||
static void window_iconify_callback(GLFWwindow window, int iconified)
|
||||
static void window_iconify_callback(GLFWwindow* window, int iconified)
|
||||
{
|
||||
printf("%08x at %0.3f: Window was %s\n",
|
||||
counter++,
|
||||
@@ -277,7 +277,7 @@ static void window_iconify_callback(GLFWwindow window, int iconified)
|
||||
iconified ? "iconified" : "restored");
|
||||
}
|
||||
|
||||
static void mouse_button_callback(GLFWwindow window, int button, int action)
|
||||
static void mouse_button_callback(GLFWwindow* window, int button, int action)
|
||||
{
|
||||
const char* name = get_button_name(button);
|
||||
|
||||
@@ -289,12 +289,12 @@ static void mouse_button_callback(GLFWwindow window, int button, int action)
|
||||
printf(" was %s\n", get_action_name(action));
|
||||
}
|
||||
|
||||
static void cursor_position_callback(GLFWwindow window, int x, int y)
|
||||
static void cursor_position_callback(GLFWwindow* window, int x, int y)
|
||||
{
|
||||
printf("%08x at %0.3f: Cursor position: %i %i\n", counter++, glfwGetTime(), x, y);
|
||||
}
|
||||
|
||||
static void cursor_enter_callback(GLFWwindow window, int entered)
|
||||
static void cursor_enter_callback(GLFWwindow* window, int entered)
|
||||
{
|
||||
printf("%08x at %0.3f: Cursor %s window\n",
|
||||
counter++,
|
||||
@@ -302,12 +302,12 @@ static void cursor_enter_callback(GLFWwindow window, int entered)
|
||||
entered ? "entered" : "left");
|
||||
}
|
||||
|
||||
static void scroll_callback(GLFWwindow window, double x, double y)
|
||||
static void scroll_callback(GLFWwindow* window, double x, double y)
|
||||
{
|
||||
printf("%08x at %0.3f: Scroll: %0.3f %0.3f\n", counter++, glfwGetTime(), x, y);
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
const char* name = get_key_name(key);
|
||||
|
||||
@@ -333,7 +333,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
}
|
||||
}
|
||||
|
||||
static void char_callback(GLFWwindow window, int character)
|
||||
static void char_callback(GLFWwindow* window, int character)
|
||||
{
|
||||
printf("%08x at %0.3f: Character 0x%04x (%s) input\n",
|
||||
counter++,
|
||||
@@ -342,7 +342,7 @@ static void char_callback(GLFWwindow window, int character)
|
||||
get_character_string(character));
|
||||
}
|
||||
|
||||
void monitor_callback(GLFWmonitor monitor, int event)
|
||||
void monitor_callback(GLFWmonitor* monitor, int event)
|
||||
{
|
||||
if (event == GLFW_CONNECTED)
|
||||
{
|
||||
@@ -370,7 +370,7 @@ void monitor_callback(GLFWmonitor monitor, int event)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
int width, height;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
+3
-3
@@ -43,12 +43,12 @@ 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* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (action != GLFW_PRESS)
|
||||
return;
|
||||
@@ -69,7 +69,7 @@ static void usage(void)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int ch, samples = 4;
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
while ((ch = getopt(argc, argv, "hs:")) != -1)
|
||||
{
|
||||
|
||||
+4
-4
@@ -40,14 +40,14 @@ static void error_callback(int error, const char* description)
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_focus_callback(GLFWwindow window, int focused)
|
||||
static void window_focus_callback(GLFWwindow* window, int focused)
|
||||
{
|
||||
printf("%0.3f: Window %s\n",
|
||||
glfwGetTime(),
|
||||
focused ? "focused" : "defocused");
|
||||
}
|
||||
|
||||
static void window_key_callback(GLFWwindow window, int key, int action)
|
||||
static void window_key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (action != GLFW_PRESS)
|
||||
return;
|
||||
@@ -70,7 +70,7 @@ static void window_key_callback(GLFWwindow window, int key, int action)
|
||||
}
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
static int window_close_callback(GLFWwindow* window)
|
||||
{
|
||||
printf("%0.3f: User closed window\n", glfwGetTime());
|
||||
running = GL_FALSE;
|
||||
@@ -79,7 +79,7 @@ static int window_close_callback(GLFWwindow window)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
|
||||
+5
-5
@@ -57,13 +57,13 @@ static void error_callback(int error, const char* description)
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
static int window_close_callback(GLFWwindow* window)
|
||||
{
|
||||
closed = GL_TRUE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (action != GLFW_PRESS)
|
||||
return;
|
||||
@@ -94,7 +94,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
}
|
||||
}
|
||||
|
||||
static void size_callback(GLFWwindow window, int width, int height)
|
||||
static void size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
@@ -102,8 +102,8 @@ static void size_callback(GLFWwindow window, int width, int height)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int width, height, ch;
|
||||
GLFWmonitor monitor = NULL;
|
||||
GLFWwindow window;
|
||||
GLFWmonitor* monitor = NULL;
|
||||
GLFWwindow* window;
|
||||
|
||||
while ((ch = getopt(argc, argv, "fh")) != -1)
|
||||
{
|
||||
|
||||
+1
-1
@@ -184,7 +184,7 @@ int main(int argc, char** argv)
|
||||
int ch, api = 0, profile = 0, strategy = 0, major = 1, minor = 0, revision;
|
||||
GLboolean debug = GL_FALSE, forward = GL_FALSE, list = GL_FALSE;
|
||||
GLint flags, mask;
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
if (!valid_version())
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
+7
-7
@@ -47,13 +47,13 @@ static void error_callback(int error, const char* description)
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
static int window_close_callback(GLFWwindow* window)
|
||||
{
|
||||
closed = GL_TRUE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
printf("%0.2f Key %s\n",
|
||||
glfwGetTime(),
|
||||
@@ -73,21 +73,21 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
}
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
printf("%0.2f Window resized to %ix%i\n", glfwGetTime(), width, height);
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
static void window_focus_callback(GLFWwindow window, int focused)
|
||||
static void window_focus_callback(GLFWwindow* window, int focused)
|
||||
{
|
||||
printf("%0.2f Window %s\n",
|
||||
glfwGetTime(),
|
||||
focused ? "focused" : "defocused");
|
||||
}
|
||||
|
||||
static void window_iconify_callback(GLFWwindow window, int iconified)
|
||||
static void window_iconify_callback(GLFWwindow* window, int iconified)
|
||||
{
|
||||
printf("%0.2f Window %s\n",
|
||||
glfwGetTime(),
|
||||
@@ -97,8 +97,8 @@ static void window_iconify_callback(GLFWwindow window, int iconified)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int width, height, ch;
|
||||
GLFWmonitor monitor = NULL;
|
||||
GLFWwindow window;
|
||||
GLFWmonitor* monitor = NULL;
|
||||
GLFWwindow* window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
|
||||
+3
-3
@@ -52,7 +52,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* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ static void draw_joystick(Joystick* j, int x, int y, int width, int height)
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_joysticks(GLFWwindow window)
|
||||
static void draw_joysticks(GLFWwindow* window)
|
||||
{
|
||||
int i, width, height;
|
||||
|
||||
@@ -186,7 +186,7 @@ static void refresh_joysticks(void)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
memset(joysticks, 0, sizeof(joysticks));
|
||||
|
||||
|
||||
+7
-7
@@ -35,7 +35,7 @@
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
static GLFWwindow window_handle = NULL;
|
||||
static GLFWwindow* window_handle = NULL;
|
||||
|
||||
enum Mode
|
||||
{
|
||||
@@ -68,20 +68,20 @@ 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* window, int width, int height)
|
||||
{
|
||||
printf("Window resized to %ix%i\n", width, height);
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
static int window_close_callback(GLFWwindow* window)
|
||||
{
|
||||
window_handle = NULL;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (key == GLFW_KEY_ESCAPE)
|
||||
{
|
||||
@@ -90,7 +90,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
}
|
||||
}
|
||||
|
||||
static void list_modes(GLFWmonitor monitor)
|
||||
static void list_modes(GLFWmonitor* monitor)
|
||||
{
|
||||
int count, widthMM, heightMM, dpi, i;
|
||||
GLFWvidmode mode;
|
||||
@@ -124,7 +124,7 @@ static void list_modes(GLFWmonitor monitor)
|
||||
}
|
||||
}
|
||||
|
||||
static void test_modes(GLFWmonitor monitor)
|
||||
static void test_modes(GLFWmonitor* monitor)
|
||||
{
|
||||
int i, count;
|
||||
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
|
||||
@@ -212,7 +212,7 @@ static void test_modes(GLFWmonitor monitor)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int ch, i, count, mode = LIST_MODE;
|
||||
const GLFWmonitor* monitors;
|
||||
GLFWmonitor** monitors;
|
||||
|
||||
while ((ch = getopt(argc, argv, "th")) != -1)
|
||||
{
|
||||
|
||||
+5
-5
@@ -36,13 +36,13 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
static GLboolean reopen = GL_FALSE;
|
||||
static GLFWwindow window_handle = NULL;
|
||||
static GLFWwindow* window_handle = NULL;
|
||||
static int cursor_x;
|
||||
static int cursor_y;
|
||||
|
||||
static GLboolean open_window(void);
|
||||
|
||||
static void toggle_cursor(GLFWwindow window)
|
||||
static void toggle_cursor(GLFWwindow* window)
|
||||
{
|
||||
if (glfwGetInputMode(window, GLFW_CURSOR_MODE) == GLFW_CURSOR_CAPTURED)
|
||||
{
|
||||
@@ -61,14 +61,14 @@ static void error_callback(int error, const char* description)
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void cursor_position_callback(GLFWwindow window, int x, int y)
|
||||
static void cursor_position_callback(GLFWwindow* window, int x, int y)
|
||||
{
|
||||
printf("Cursor moved to: %i %i (%i %i)\n", x, y, x - cursor_x, y - cursor_y);
|
||||
cursor_x = x;
|
||||
cursor_y = y;
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
@@ -90,7 +90,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
}
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
+6
-6
@@ -38,7 +38,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static GLFWwindow window_handle = NULL;
|
||||
static GLFWwindow* window_handle = NULL;
|
||||
static GLboolean closed = GL_FALSE;
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
@@ -46,19 +46,19 @@ 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* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
static int window_close_callback(GLFWwindow* window)
|
||||
{
|
||||
printf("Close callback triggered\n");
|
||||
closed = GL_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (action != GLFW_PRESS)
|
||||
return;
|
||||
@@ -72,7 +72,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
}
|
||||
}
|
||||
|
||||
static GLboolean open_window(int width, int height, GLFWmonitor monitor)
|
||||
static GLboolean open_window(int width, int height, GLFWmonitor* monitor)
|
||||
{
|
||||
double base;
|
||||
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char** argv)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
GLFWmonitor monitor = NULL;
|
||||
GLFWmonitor* monitor = NULL;
|
||||
|
||||
if (count & 1)
|
||||
monitor = glfwGetPrimaryMonitor();
|
||||
|
||||
+5
-5
@@ -36,7 +36,7 @@
|
||||
#define WIDTH 400
|
||||
#define HEIGHT 400
|
||||
|
||||
static GLFWwindow windows[2];
|
||||
static GLFWwindow* windows[2];
|
||||
static GLboolean closed = GL_FALSE;
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
@@ -44,21 +44,21 @@ static void error_callback(int error, const char* description)
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE)
|
||||
closed = GL_TRUE;
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
static int window_close_callback(GLFWwindow* window)
|
||||
{
|
||||
closed = GL_TRUE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static GLFWwindow open_window(const char* title, GLFWwindow share, int posX, int posY)
|
||||
static GLFWwindow* open_window(const char* title, GLFWwindow* share, int posX, int posY)
|
||||
{
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
glfwWindowHint(GLFW_POSITION_X, posX);
|
||||
glfwWindowHint(GLFW_POSITION_Y, posY);
|
||||
|
||||
+4
-4
@@ -36,7 +36,7 @@
|
||||
|
||||
static int swap_interval;
|
||||
|
||||
static void set_swap_interval(GLFWwindow window, int interval)
|
||||
static void set_swap_interval(GLFWwindow* window, int interval)
|
||||
{
|
||||
char title[256];
|
||||
|
||||
@@ -53,12 +53,12 @@ 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* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
static void key_callback(GLFWwindow* window, int key, int action)
|
||||
{
|
||||
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS)
|
||||
set_swap_interval(window, 1 - swap_interval);
|
||||
@@ -67,7 +67,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
int main(void)
|
||||
{
|
||||
float position;
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
const char* title;
|
||||
float r, g, b;
|
||||
thrd_t id;
|
||||
|
||||
+2
-2
@@ -37,14 +37,14 @@ 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* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
GLFWwindow* window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ int main(void)
|
||||
{
|
||||
int i;
|
||||
GLboolean running = GL_TRUE;
|
||||
GLFWwindow windows[4];
|
||||
GLFWwindow* windows[4];
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user