Merge branch 'master' into joystickname

This commit is contained in:
Camilla Berglund
2012-12-02 16:36:44 +01:00
36 changed files with 1332 additions and 653 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Clipboard Test", NULL);
window = glfwCreateWindow(200, 200, GLFW_WINDOWED, "Clipboard Test", NULL);
if (!window)
{
glfwTerminate();
+1 -1
View File
@@ -85,7 +85,7 @@ int main(void)
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Defaults", NULL);
window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Defaults", NULL);
if (!window)
{
glfwTerminate();
+13 -26
View File
@@ -41,8 +41,6 @@
#include <locale.h>
// These must match the input mode defaults
static GLboolean keyrepeat = GL_FALSE;
static GLboolean systemkeys = GL_TRUE;
static GLboolean closeable = GL_TRUE;
// Event index
@@ -220,6 +218,15 @@ static const char* get_character_string(int character)
return result;
}
static void window_pos_callback(GLFWwindow window, int x, int y)
{
printf("%08x at %0.3f: Window position: %i %i\n",
counter++,
glfwGetTime(),
x,
y);
}
static void window_size_callback(GLFWwindow window, int width, int height)
{
printf("%08x at %0.3f: Window size: %i %i\n",
@@ -249,12 +256,12 @@ static void window_refresh_callback(GLFWwindow window)
}
}
static void window_focus_callback(GLFWwindow window, int activated)
static void window_focus_callback(GLFWwindow window, int focused)
{
printf("%08x at %0.3f: Window %s\n",
counter++,
glfwGetTime(),
activated ? "activated" : "deactivated");
focused ? "focused" : "defocused");
}
static void window_iconify_callback(GLFWwindow window, int iconified)
@@ -311,24 +318,6 @@ static void key_callback(GLFWwindow window, int key, int action)
switch (key)
{
case GLFW_KEY_R:
{
keyrepeat = !keyrepeat;
glfwSetInputMode(window, GLFW_KEY_REPEAT, keyrepeat);
printf("(( key repeat %s ))\n", keyrepeat ? "enabled" : "disabled");
break;
}
case GLFW_KEY_S:
{
systemkeys = !systemkeys;
glfwSetInputMode(window, GLFW_SYSTEM_KEYS, systemkeys);
printf("(( system keys %s ))\n", systemkeys ? "enabled" : "disabled");
break;
}
case GLFW_KEY_C:
{
closeable = !closeable;
@@ -363,7 +352,7 @@ int main(void)
printf("Library initialized\n");
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Event Linter", NULL);
window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Event Linter", NULL);
if (!window)
{
glfwTerminate();
@@ -374,6 +363,7 @@ int main(void)
printf("Window opened\n");
glfwSetWindowPosCallback(window, window_pos_callback);
glfwSetWindowSizeCallback(window, window_size_callback);
glfwSetWindowCloseCallback(window, window_close_callback);
glfwSetWindowRefreshCallback(window, window_refresh_callback);
@@ -392,9 +382,6 @@ int main(void)
glfwGetWindowSize(window, &width, &height);
printf("Window size should be %ix%i\n", width, height);
printf("Key repeat should be %s\n", keyrepeat ? "enabled" : "disabled");
printf("System keys should be %s\n", systemkeys ? "enabled" : "disabled");
printf("Main loop starting\n");
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
+3 -3
View File
@@ -23,7 +23,7 @@
//
//========================================================================
//
// This test is used to test window activation and iconfication for
// This test is used to test window focusing and iconfication for
// fullscreen windows with a video mode differing from the desktop mode
//
//========================================================================
@@ -35,11 +35,11 @@
static GLboolean running = GL_TRUE;
static void window_focus_callback(GLFWwindow window, int activated)
static void window_focus_callback(GLFWwindow window, int focused)
{
printf("%0.3f: Window %s\n",
glfwGetTime(),
activated ? "activated" : "deactivated");
focused ? "focused" : "defocused");
}
static void window_key_callback(GLFWwindow window, int key, int action)
+2 -2
View File
@@ -133,8 +133,8 @@ int main(int argc, char** argv)
}
else
{
width = 0;
height = 0;
width = 200;
height = 200;
}
window = glfwCreateWindow(width, height, mode, "Gamma Test", NULL);
+1 -1
View File
@@ -268,7 +268,7 @@ int main(int argc, char** argv)
// We assume here that we stand a better chance of success by leaving all
// possible details of pixel format selection to GLFW
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Version", NULL);
window = glfwCreateWindow(200, 200, GLFW_WINDOWED, "Version", NULL);
if (!window)
{
glfwTerminate();
+5 -5
View File
@@ -75,11 +75,11 @@ static void window_size_callback(GLFWwindow window, int width, int height)
glViewport(0, 0, width, height);
}
static void window_focus_callback(GLFWwindow window, int activated)
static void window_focus_callback(GLFWwindow window, int focused)
{
printf("%0.2f Window %s\n",
glfwGetTime(),
activated ? "activated" : "deactivated");
focused ? "focused" : "defocused");
}
static void window_iconify_callback(GLFWwindow window, int iconified)
@@ -128,8 +128,8 @@ int main(int argc, char** argv)
}
else
{
width = 0;
height = 0;
width = 640;
height = 480;
}
window = glfwCreateWindow(width, height, mode, "Iconify", NULL);
@@ -152,7 +152,7 @@ int main(int argc, char** argv)
printf("Window is %s and %s\n",
glfwGetWindowParam(window, GLFW_ICONIFIED) ? "iconified" : "restored",
glfwGetWindowParam(window, GLFW_ACTIVE) ? "active" : "inactive");
glfwGetWindowParam(window, GLFW_FOCUSED) ? "focused" : "defocused");
glEnable(GL_SCISSOR_TEST);
+1 -1
View File
@@ -191,7 +191,7 @@ int main(void)
exit(EXIT_FAILURE);
}
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Joystick Test", NULL);
window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Joystick Test", NULL);
if (!window)
{
glfwTerminate();
+1 -1
View File
@@ -92,7 +92,7 @@ static void window_size_callback(GLFWwindow window, int width, int height)
static GLboolean open_window(void)
{
window_handle = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Peter Detector", NULL);
window_handle = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Peter Detector", NULL);
if (!window_handle)
return GL_FALSE;
+10 -9
View File
@@ -51,10 +51,12 @@ static int window_close_callback(GLFWwindow window)
return GL_FALSE;
}
static GLFWwindow open_window(const char* title, GLFWwindow share)
static GLFWwindow open_window(const char* title, GLFWwindow share, int posX, int posY)
{
GLFWwindow window;
glfwWindowHint(GLFW_POSITION_X, posX);
glfwWindowHint(GLFW_POSITION_Y, posY);
window = glfwCreateWindow(WIDTH, HEIGHT, GLFW_WINDOWED, title, share);
if (!window)
return NULL;
@@ -125,7 +127,6 @@ static void draw_quad(GLuint texture)
int main(int argc, char** argv)
{
GLuint texture;
int x, y;
if (!glfwInit())
{
@@ -133,7 +134,7 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
windows[0] = open_window("First", NULL);
windows[0] = open_window("First", NULL, 0, 0);
if (!windows[0])
{
fprintf(stderr, "Failed to open first GLFW window: %s\n", glfwErrorString(glfwGetError()));
@@ -147,7 +148,8 @@ int main(int argc, char** argv)
// It will then be shared with the second context, created below
texture = create_texture();
windows[1] = open_window("Second", windows[0]);
// Put the second window to the right of the first one
windows[1] = open_window("Second", windows[0], WIDTH + 50, 0);
if (!windows[1])
{
fprintf(stderr, "Failed to open second GLFW window: %s\n", glfwErrorString(glfwGetError()));
@@ -156,14 +158,13 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
// Set drawing color for the first context and copy it to the second
// Set drawing color for both contexts
glfwMakeContextCurrent(windows[0]);
glColor3f(0.6f, 0.f, 0.6f);
glfwCopyContext(windows[0], windows[1], GL_CURRENT_BIT);
glfwMakeContextCurrent(windows[1]);
glColor3f(0.6f, 0.6f, 0.f);
// Put the second window to the right of the first one
glfwGetWindowPos(windows[0], &x, &y);
glfwSetWindowPos(windows[1], x + WIDTH + 50, y);
glfwMakeContextCurrent(windows[0]);
while (!closed)
{
+1 -1
View File
@@ -70,7 +70,7 @@ int main(void)
exit(EXIT_FAILURE);
}
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "", NULL);
window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "", NULL);
if (!window)
{
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
+2 -2
View File
@@ -89,6 +89,8 @@ int main(void)
for (i = 0; i < count; i++)
{
glfwWindowHint(GLFW_POSITION_X, 200 + 250 * i);
glfwWindowHint(GLFW_POSITION_Y, 200);
threads[i].window = glfwCreateWindow(200, 200,
GLFW_WINDOWED,
threads[i].title,
@@ -100,8 +102,6 @@ int main(void)
exit(EXIT_FAILURE);
}
glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
if (thrd_create(&threads[i].id, thread_main, threads + i) !=
thrd_success)
{
+1 -1
View File
@@ -47,7 +47,7 @@ int main(void)
exit(EXIT_FAILURE);
}
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "English 日本語 русский язык 官話", NULL);
window = glfwCreateWindow(400, 400, GLFW_WINDOWED, "English 日本語 русский язык 官話", NULL);
if (!window)
{
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
+2 -2
View File
@@ -55,6 +55,8 @@ int main(void)
for (i = 0; i < 4; i++)
{
glfwWindowHint(GLFW_POSITION_X, 100 + (i & 1) * 300);
glfwWindowHint(GLFW_POSITION_Y, 100 + (i >> 1) * 300);
windows[i] = glfwCreateWindow(200, 200, GLFW_WINDOWED, titles[i], NULL);
if (!windows[i])
{
@@ -70,8 +72,6 @@ int main(void)
(GLclampf) (i >> 1),
i ? 0.f : 1.f,
0.f);
glfwSetWindowPos(windows[i], 100 + (i & 1) * 300, 100 + (i >> 1) * 300);
}
while (running)