]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/opengl/penguin/lw.cpp
Don't hide the last TLW immediately as this
[wxWidgets.git] / samples / opengl / penguin / lw.cpp
index 7d83324bbd8d5e05d852b603df2d00cf2b884711..5d548e556ff2e7e3baea5e05105ae8b058666be6 100644 (file)
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifdef __WXMSW__
-#include <windows.h>
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #include "wx/wx.h"
 #endif
 
+#ifdef __WXMSW__
+#include <windows.h>
+#endif
+
 #include "lw.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
 
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
+#if wxUSE_GLCANVAS
 
 #define MK_ID(a,b,c,d) ((((wxUint32)(a))<<24)| \
             (((wxUint32)(b))<<16)| \
@@ -259,14 +253,9 @@ int lw_is_lwobject(const char *lw_file)
 
 lwObject *lw_object_read(const char *lw_file)
 {
-  FILE *f = NULL;
-  lwObject *lw_object = NULL;
-
-  wxInt32 form_bytes = 0;
-  wxInt32 read_bytes = 0;
 
   /* open file */
-  f = fopen(lw_file, "rb");
+  FILE *f = fopen(lw_file, "rb");
   if (f == NULL) {
     return NULL;
   }
@@ -276,7 +265,10 @@ lwObject *lw_object_read(const char *lw_file)
     fclose(f);
     return NULL;
   }
-  form_bytes = read_long(f);
+
+  wxInt32 read_bytes = 0;
+
+  wxInt32 form_bytes = read_long(f);
   read_bytes += 4;
 
   if (read_long(f) != ID_LWOB) {
@@ -285,7 +277,7 @@ lwObject *lw_object_read(const char *lw_file)
   }
 
   /* create new lwObject */
-  lw_object = (lwObject*) calloc(sizeof(lwObject),1);
+  lwObject *lw_object = (lwObject*) calloc(sizeof(lwObject),1);
 
   /* read chunks */
   while (read_bytes < form_bytes) {
@@ -443,4 +435,5 @@ void lw_object_scale(lwObject *lwo, GLfloat scale)
   }
 }
 
+#endif