[dasher] DashIntf::WriteTrainFileFull made public; iPhone calls on entering background



commit b212e30682a5a66048f08dc1aa27e9f4ed1ecfdc
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Wed Nov 24 13:34:24 2010 +0000

    DashIntf::WriteTrainFileFull made public; iPhone calls on entering background
    
    Hopefully this will enable "multitasking" (task-switching) on iOS 4. Don't have
    a new enough device to test, however...

 Src/DasherCore/DasherInterfaceBase.h    |    6 ++++--
 Src/iPhone/Classes/DasherAppDelegate.mm |    8 ++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/Src/DasherCore/DasherInterfaceBase.h b/Src/DasherCore/DasherInterfaceBase.h
index aaad70b..21d9a91 100644
--- a/Src/DasherCore/DasherInterfaceBase.h
+++ b/Src/DasherCore/DasherInterfaceBase.h
@@ -396,6 +396,10 @@ public:
 
   void ImportTrainingText(const std::string &strPath);
   
+  ///Making this public for e.g. iPhone, which needs to flush
+  /// the trainfile buffer when app is sent into background.
+  void WriteTrainFileFull();
+  
 protected:
 
   /// @name Startup
@@ -562,8 +566,6 @@ protected:
   void DestroyActionButtons();
   void PositionActionButtons();
   bool DrawActionButtons();
-
-  void WriteTrainFileFull();
   
   std::deque<std::string> m_deGameModeStrings;
 
diff --git a/Src/iPhone/Classes/DasherAppDelegate.mm b/Src/iPhone/Classes/DasherAppDelegate.mm
index 81cdffe..fd77a80 100644
--- a/Src/iPhone/Classes/DasherAppDelegate.mm
+++ b/Src/iPhone/Classes/DasherAppDelegate.mm
@@ -367,6 +367,14 @@
   if (doneSetup) [glView startAnimation];//glView.animationInterval = 1.0 / 60.0;
 }
 
+-(void)applicationDidEnterBackground:(UIApplication *)application {
+  self.dasherInterface->WriteTrainFileFull();
+}
+
+-(void)applicationWillTerminate:(UIApplication *)application {
+  self.dasherInterface->StartShutdown();
+}
+
 - (void)newFrameAt:(unsigned long)time ForceRedraw:(BOOL)bForce {
 	self.dasherInterface->NewFrame(time, bForce);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]