diff render/render.d @ 28:1cc6b8c0acd2

fixed window close
author zzzzrrr <mason.green@gmail.com>
date Mon, 30 Mar 2009 12:48:45 -0400
parents d63faa81a5e4
children
line wrap: on
line diff
--- a/render/render.d	Mon Mar 30 12:41:29 2009 -0400
+++ b/render/render.d	Mon Mar 30 12:48:45 2009 -0400
@@ -98,6 +98,7 @@
     bool full = false;
     Settings settings;
     Ship ship1, ship2;
+    bool running = true;
     
     this(bzWorld world, Ship s1, Ship s2, Human h, Settings settings) {
         
@@ -126,6 +127,9 @@
         glfwSetWindowTitle("OpenMelee");
         glfwEnable(GLFW_STICKY_KEYS);
         
+        GLFWkeyfun cbfun;
+        cbfun = &key;
+        glfwSetKeyCallback(cbfun);
     }
     
     ~this() {
@@ -137,12 +141,7 @@
         glfwSwapInterval(1);
         draw();
         glfwSwapBuffers();
-    }
-    
-    void keys() {
-        GLFWkeyfun cbfun;
-        cbfun = &key;
-        glfwSetKeyCallback(cbfun);
+        running = cast(bool) glfwGetWindowParam(GLFW_OPENED);
     }
 
     void drawCircle(bzVec2 center, float radius, bool water = false, float theta = float.nan)