mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Removed glfwIsWindow.
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ int main(void)
|
||||
glfwSetWindowSizeCallback(window_size_callback);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
while (glfwIsWindow(window))
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ int main(int argc, char** argv)
|
||||
|
||||
glClearColor(0.5f, 0.5f, 0.5f, 0);
|
||||
|
||||
while (glfwIsWindow(window))
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
+1
-1
@@ -385,7 +385,7 @@ int main(void)
|
||||
|
||||
printf("Main loop starting\n");
|
||||
|
||||
while (glfwIsWindow(window) == GL_TRUE)
|
||||
while (glfwGetCurrentContext())
|
||||
glfwWaitEvents();
|
||||
|
||||
glfwTerminate();
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ int main(int argc, char** argv)
|
||||
gluOrtho2D(0.f, 1.f, 0.f, 0.5f);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
while (glfwIsWindow(window))
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
GLfloat time = (GLfloat) glfwGetTime();
|
||||
|
||||
|
||||
+2
-1
@@ -68,6 +68,7 @@ static void window_key_callback(GLFWwindow window, int key, int action)
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
{
|
||||
printf("%0.3f: User closed window\n", glfwGetTime());
|
||||
running = GL_FALSE;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -97,7 +98,7 @@ int main(void)
|
||||
glfwSetKeyCallback(window_key_callback);
|
||||
glfwSetWindowCloseCallback(window_close_callback);
|
||||
|
||||
while (running && glfwIsWindow(window) == GL_TRUE)
|
||||
while (running)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers();
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ int main(int argc, char** argv)
|
||||
|
||||
glClearColor(0.5f, 0.5f, 0.5f, 0);
|
||||
|
||||
while (glfwIsWindow(window))
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ int main(int argc, char** argv)
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
while (glfwIsWindow(window))
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
int width, height;
|
||||
|
||||
|
||||
+1
-2
@@ -44,7 +44,6 @@ typedef struct Joystick
|
||||
} Joystick;
|
||||
|
||||
static Joystick joysticks[GLFW_JOYSTICK_LAST - GLFW_JOYSTICK_1 + 1];
|
||||
|
||||
static int joystick_count = 0;
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
@@ -199,7 +198,7 @@ int main(void)
|
||||
glfwSetWindowSizeCallback(window_size_callback);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
while (glfwIsWindow(window))
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ int main(void)
|
||||
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
while (glfwIsWindow(window_handle))
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
+20
-2
@@ -36,12 +36,30 @@
|
||||
#define WIDTH 400
|
||||
#define HEIGHT 400
|
||||
|
||||
static GLFWwindow windows[2];
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
{
|
||||
if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE)
|
||||
glfwCloseWindow(window);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (windows[i] == window)
|
||||
{
|
||||
windows[i] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static GLFWwindow open_window(const char* title, GLFWwindow share)
|
||||
{
|
||||
GLFWwindow window;
|
||||
@@ -50,6 +68,7 @@ static GLFWwindow open_window(const char* title, GLFWwindow share)
|
||||
if (!window)
|
||||
return NULL;
|
||||
|
||||
glfwSetWindowCloseCallback(window_close_callback);
|
||||
glfwSetKeyCallback(key_callback);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
@@ -112,7 +131,6 @@ static void draw_quad(GLuint texture)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
GLFWwindow windows[2];
|
||||
GLuint texture;
|
||||
int x, y;
|
||||
|
||||
@@ -150,7 +168,7 @@ int main(int argc, char** argv)
|
||||
glfwGetWindowPos(windows[0], &x, &y);
|
||||
glfwSetWindowPos(windows[1], x + WIDTH + 50, y);
|
||||
|
||||
while (glfwIsWindow(windows[0]) && glfwIsWindow(windows[1]))
|
||||
while (windows[0] && windows[1])
|
||||
{
|
||||
glfwMakeContextCurrent(windows[0]);
|
||||
draw_quad(texture);
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ int main(void)
|
||||
glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
while (glfwIsWindow(window) == GL_TRUE)
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ int main(void)
|
||||
|
||||
glfwSetWindowSizeCallback(window_size_callback);
|
||||
|
||||
while (glfwIsWindow(window) == GL_TRUE)
|
||||
while (glfwGetCurrentContext())
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers();
|
||||
|
||||
+10
-7
@@ -32,6 +32,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static GLboolean running = GL_TRUE;
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
{
|
||||
running = GL_FALSE;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static const char* titles[] =
|
||||
{
|
||||
"Foo",
|
||||
@@ -43,7 +51,6 @@ static const char* titles[] =
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
GLboolean running = GL_TRUE;
|
||||
GLFWwindow windows[4];
|
||||
|
||||
if (!glfwInit())
|
||||
@@ -53,6 +60,8 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwSetWindowCloseCallback(window_close_callback);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
windows[i] = glfwOpenWindow(200, 200, GLFW_WINDOWED, titles[i], NULL);
|
||||
@@ -82,12 +91,6 @@ int main(void)
|
||||
}
|
||||
|
||||
glfwPollEvents();
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (!glfwIsWindow(windows[i]))
|
||||
running = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
glfwTerminate();
|
||||
|
||||
Reference in New Issue
Block a user