瀏覽代碼

still tweaking

David Rose 16 年之前
父節點
當前提交
33c56918d6

+ 0 - 6
panda/src/iphone/Sources.pp

@@ -27,9 +27,3 @@
     main.mm
     main.mm
 
 
 #end bin_target
 #end bin_target
-
-//#begin bin_target
-//  #define TARGET iphone_pview
-//  #define SOURCES main.mm
-//#end bin_target
-

+ 6 - 0
panda/src/iphone/eaglView.mm

@@ -100,6 +100,12 @@
         NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
         NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
         return NO;
         return NO;
     }
     }
+
+    // Make sure the buffer is initially cleared, so we don't look at
+    // whatever happened to be in the framebuffer.
+    glClearColor(0, 0, 0, 1);
+    glClear(GL_COLOR_BUFFER_BIT);
+    [context presentRenderbuffer:GL_RENDERBUFFER_OES];
     
     
     return YES;
     return YES;
 }
 }

+ 29 - 1
panda/src/iphone/pview_delegate.mm

@@ -30,7 +30,31 @@ PandaFramework framework;
 int argc = 0;
 int argc = 0;
 char **argv = NULL;
 char **argv = NULL;
 
 
-- (void)applicationDidFinishLaunching:(UIApplication *)application { 
+void 
+signal_handler(int i) {
+  nout << "Caught signal " << i << "\n";
+  exit(1);
+}
+
+- (void)applicationDidFinishLaunching: (UIApplication *)application { 
+  ConfigVariableBool pview_trap_signals("pview-trap-signals", false);
+  if (pview_trap_signals) {
+    // Set up a signal handler on every signal, so we can report this to
+    // the log.
+    struct sigaction sa;
+    sa.sa_handler = signal_handler;
+    sigemptyset(&sa.sa_mask);
+    sa.sa_flags = 0;
+    for (int i = 1; i < 32; ++i) {
+      if (sigaction(i, &sa, NULL) < 0) {
+        ostringstream strm;
+        strm << "sigaction(" << i << ")";
+        perror(strm.str().c_str());
+      }
+    }
+  }
+
+  // Parse the "command-line arguments" provided in the Config file.
   ConfigVariableString pview_args("pview-args", "");
   ConfigVariableString pview_args("pview-args", "");
   argc = pview_args.get_num_words() + 1;
   argc = pview_args.get_num_words() + 1;
   typedef char *charp;
   typedef char *charp;
@@ -49,6 +73,10 @@ char **argv = NULL;
   [self startAnimation];
   [self startAnimation];
 } 
 } 
 
 
+- (void)applicationDidReceiveMemoryWarning: (UIApplication *)application { 
+  nout << "applicationDidReceiveMemoryWarning\n";
+}
+
 - (void)startAnimation {
 - (void)startAnimation {
     self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self selector:@selector(drawView) userInfo:nil repeats:YES];
     self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self selector:@selector(drawView) userInfo:nil repeats:YES];
 }
 }

+ 2 - 0
panda/src/iphone/viewController.h

@@ -12,6 +12,8 @@
 //
 //
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
+#include "pandabase.h"
+
 #import <UIKit/UIKit.h> 
 #import <UIKit/UIKit.h> 
 #import <UIKit/UITextView.h> 
 #import <UIKit/UITextView.h> 
 
 

+ 2 - 0
panda/src/iphone/viewController.mm

@@ -13,6 +13,7 @@
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
 #import "viewController.h" 
 #import "viewController.h" 
+#include "pnotify.h"
 
 
 @implementation ControllerDemoViewController 
 @implementation ControllerDemoViewController 
 
 
@@ -65,6 +66,7 @@
 - (void)didReceiveMemoryWarning { 
 - (void)didReceiveMemoryWarning { 
     [ super didReceiveMemoryWarning ]; 
     [ super didReceiveMemoryWarning ]; 
     /* Add custom low-memory code here */ 
     /* Add custom low-memory code here */ 
+    nout << "low-memory handler in view controller\n";
 } 
 } 
 
 
 - (void)dealloc { 
 - (void)dealloc {