mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 12:02:00 +00:00
Removed ill-advised use of glfwGetCurrentContext.
This commit is contained in:
parent
f71daaa14b
commit
3216661da7
@ -40,11 +40,17 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
// These must match the input mode defaults
|
||||||
static GLboolean keyrepeat = GL_FALSE;
|
static GLboolean keyrepeat = GL_FALSE;
|
||||||
static GLboolean systemkeys = GL_TRUE;
|
static GLboolean systemkeys = GL_TRUE;
|
||||||
static GLboolean closeable = GL_TRUE;
|
static GLboolean closeable = GL_TRUE;
|
||||||
|
|
||||||
|
// Event index
|
||||||
static unsigned int counter = 0;
|
static unsigned int counter = 0;
|
||||||
|
|
||||||
|
// Should we keep running?
|
||||||
|
static GLboolean running = GL_TRUE;
|
||||||
|
|
||||||
static const char* get_key_name(int key)
|
static const char* get_key_name(int key)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
@ -231,6 +237,10 @@ static void window_size_callback(GLFWwindow window, int width, int 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());
|
printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime());
|
||||||
|
|
||||||
|
if (closeable)
|
||||||
|
running = GL_FALSE;
|
||||||
|
|
||||||
return closeable;
|
return closeable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +399,7 @@ int main(void)
|
|||||||
|
|
||||||
printf("Main loop starting\n");
|
printf("Main loop starting\n");
|
||||||
|
|
||||||
while (glfwGetCurrentContext())
|
while (running)
|
||||||
glfwWaitEvents();
|
glfwWaitEvents();
|
||||||
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
Loading…
Reference in New Issue
Block a user