]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/opengl/penguin/lw.cpp
added wxDC::DrawPolyPolygon() (patch 882189)
[wxWidgets.git] / samples / opengl / penguin / lw.cpp
index 44c2dd32b4e93a73648df4ef2339514172cf98b4..5d548e556ff2e7e3baea5e05105ae8b058666be6 100644 (file)
@@ -36,6 +36,8 @@
 #include <stdio.h>
 #include <math.h>
 
+#if wxUSE_GLCANVAS
+
 #define MK_ID(a,b,c,d) ((((wxUint32)(a))<<24)| \
             (((wxUint32)(b))<<16)| \
             (((wxUint32)(c))<< 8)| \
@@ -251,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;
   }
@@ -268,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) {
@@ -277,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) {
@@ -435,4 +435,5 @@ void lw_object_scale(lwObject *lwo, GLfloat scale)
   }
 }
 
+#endif