Updated example and test programs to new API.

This commit is contained in:
Camilla Berglund
2010-09-14 03:10:59 +02:00
parent 0f80e066ea
commit e244ad3d41
15 changed files with 17 additions and 48 deletions
+1 -2
View File
@@ -65,7 +65,7 @@ int main(void)
exit(EXIT_FAILURE);
}
window = glfwOpenWindow(window_width, window_height, GLFW_WINDOWED);
window = glfwOpenWindow(window_width, window_height, GLFW_WINDOWED, "Cursor Inaccuracy Detector");
if (!window)
{
glfwTerminate();
@@ -74,7 +74,6 @@ int main(void)
exit(EXIT_FAILURE);
}
glfwSetWindowTitle(window, "Cursor Inaccuracy Detector");
glfwSetMousePosCallback(window, mouse_position_callback);
glfwSetWindowSizeCallback(window, window_size_callback);
glfwSwapInterval(1);
+1 -1
View File
@@ -75,7 +75,7 @@ int main(void)
exit(1);
}
window = glfwOpenWindow(0, 0, GLFW_WINDOWED);
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Defaults");
if (!window)
{
glfwTerminate();
+1 -2
View File
@@ -274,7 +274,7 @@ int main(void)
printf("Library initialized\n");
window = glfwOpenWindow(0, 0, GLFW_WINDOWED);
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Event Linter");
if (!window)
{
glfwTerminate();
@@ -285,7 +285,6 @@ int main(void)
printf("Window opened\n");
glfwSetWindowTitle(window, "Event Linter");
glfwSwapInterval(1);
glfwSetWindowSizeCallback(window, window_size_callback);
+1 -2
View File
@@ -56,7 +56,7 @@ int main(void)
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
window = glfwOpenWindow(400, 400, GLFW_WINDOWED);
window = glfwOpenWindow(400, 400, GLFW_WINDOWED, "Aliasing Detector");
if (!window)
{
glfwTerminate();
@@ -65,7 +65,6 @@ int main(void)
exit(EXIT_FAILURE);
}
glfwSetWindowTitle(window, "Aliasing Detector");
glfwSetWindowSizeCallback(window, window_size_callback);
glfwSwapInterval(1);
+1 -2
View File
@@ -109,7 +109,7 @@ int main(int argc, char** argv)
height = 0;
}
window = glfwOpenWindow(width, height, mode);
window = glfwOpenWindow(width, height, mode, "Iconify");
if (!window)
{
glfwTerminate();
@@ -118,7 +118,6 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
glfwSetWindowTitle(window, "Iconify");
glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback);
glfwSetWindowSizeCallback(window, size_callback);
+1 -3
View File
@@ -89,12 +89,10 @@ static GLboolean open_window(void)
{
int x, y;
window_handle = glfwOpenWindow(0, 0, GLFW_WINDOWED);
window_handle = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Peter Detector");
if (!window_handle)
return GL_FALSE;
glfwSetWindowTitle(window_handle, "Peter Detector");
glfwGetMousePos(window_handle, &x, &y);
printf("Mouse position: %i %i\n", x, y);
+1 -2
View File
@@ -84,14 +84,13 @@ static int open_window(int width, int height, int mode)
{
double base = glfwGetTime();
window_handle = glfwOpenWindow(width, height, mode);
window_handle = glfwOpenWindow(width, height, mode, "Window Re-opener");
if (!window_handle)
{
fprintf(stderr, "Failed to open %s mode GLFW window: %s\n", get_mode_name(mode), glfwErrorString(glfwGetError()));
return 0;
}
glfwSetWindowTitle(window_handle, "Window Re-opener");
glfwSetWindowSizeCallback(window_handle, window_size_callback);
glfwSetWindowCloseCallback(window_handle, window_close_callback);
glfwSetKeyCallback(window_handle, key_callback);
+1 -2
View File
@@ -50,7 +50,7 @@ int main(void)
exit(EXIT_FAILURE);
}
window = glfwOpenWindow(0, 0, GLFW_WINDOWED);
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Tearing Detector");
if (!window)
{
glfwTerminate();
@@ -59,7 +59,6 @@ int main(void)
exit(EXIT_FAILURE);
}
glfwSetWindowTitle(window, "Tearing Detector");
glfwSetWindowSizeCallback(window, window_size_callback);
glfwSwapInterval(1);
+1 -1
View File
@@ -183,7 +183,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
if (!glfwOpenWindow(0, 0, GLFW_WINDOWED))
if (!glfwOpenWindow(0, 0, GLFW_WINDOWED, "Version"))
{
glfwTerminate();
+3 -16
View File
@@ -40,20 +40,6 @@ static const char* titles[] =
"Quux"
};
static GLFWwindow open_window(int width, int height, const char* title)
{
GLFWwindow window = glfwOpenWindow(width, height, GLFW_WINDOWED);
if (!window)
{
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
return NULL;
}
glfwSetWindowTitle(window, title);
return window;
}
int main(void)
{
int i;
@@ -62,16 +48,17 @@ int main(void)
if (!glfwInit())
{
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
exit(EXIT_FAILURE);
}
for (i = 0; i < 4; i++)
{
windows[i] = open_window(200, 200, titles[i]);
windows[i] = glfwOpenWindow(200, 200, GLFW_WINDOWED, titles[i]);
if (!windows[i])
{
glfwTerminate();
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
exit(EXIT_FAILURE);
}