[email protected] 7 лет назад
Родитель
Сommit
95ef819145
2 измененных файлов с 13 добавлено и 23 удалено
  1. 6 4
      src/example.cpp
  2. 7 19
      src/main.cpp

+ 6 - 4
src/example.cpp

@@ -26,7 +26,7 @@ void example_init()
     sprite->attachTo(getStage());    
 
     getStage()->addEventListener(TouchEvent::TOUCH_DOWN, [=](Event* ev) {
-        log::messageln("touch down");
+        logs::messageln("touch down");
 
         TouchEvent *touch = (TouchEvent*)ev;
         downPos = touch->localPosition;
@@ -35,7 +35,7 @@ void example_init()
 
 
     getStage()->addEventListener(TouchEvent::TOUCH_UP, [=](Event*) {
-        log::messageln("touch up");
+        logs::messageln("touch up");
         //sprite->addTween(Actor::TweenX(0), 1000);
         pressed = false;
     });
@@ -49,7 +49,7 @@ void example_init()
         if (dir.x < -50)
         {
             pressed = false;
-            log::messageln("swipe left");
+            logs::messageln("swipe left");
             
             spTween tween = sprite->addTween(Actor::TweenX(-sprite->getWidth()), 300);
             tween->detachWhenDone();
@@ -67,7 +67,7 @@ void example_init()
         if (dir.x > 50)
         {
             pressed = false;
-            log::messageln("swipe right");
+            logs::messageln("swipe right");
 
             spTween tween = sprite->addTween(Actor::TweenX(sprite->getWidth()), 300);
             tween->detachWhenDone();
@@ -94,6 +94,8 @@ void example_update()
 //called each frame from main.cpp
 void example_destroy()
 {
+	//free ref go global object
+	sprite = 0;
     //free previously loaded resources
     gameResources.free();
 }

+ 7 - 19
src/main.cpp

@@ -4,9 +4,9 @@
     If you just started here and don't understand the code completely, feel free to come back later.
     You can start from example.cpp and example.h, which main functions are called from here.
 */
-#include "core/oxygine.h"
-#include "Stage.h"
-#include "DebugActor.h"
+#include "ox/oxygine.hpp"
+#include "ox/Stage.hpp"
+#include "ox/DebugActor.hpp"
 #include "example.h"
 
 
@@ -50,12 +50,9 @@ void run()
     core::init_desc desc;
     desc.title = "Oxygine Application";
 
-#if OXYGINE_SDL || OXYGINE_EMSCRIPTEN
-    // The initial window size can be set up here on SDL builds
+    // The initial window size can be set up here on SDL builds, ignored on Mobile devices
     desc.w = 960;
     desc.h = 640;
-    // Marmalade settings can be modified from the emulator's menu
-#endif
 
 
     example_preinit();
@@ -63,7 +60,7 @@ void run()
 
 
     // Create the stage. Stage is a root node for all updateable and drawable objects
-    Stage::instance = new Stage(true);
+    Stage::instance = new Stage();
     Point size = core::getDisplaySize();
     getStage()->setSize(size);
 
@@ -85,7 +82,7 @@ void run()
 
 #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
     // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
-    return;
+    //return;
 #endif
 
     // This is the main game loop.
@@ -125,15 +122,6 @@ void run()
     //end
 }
 
-#ifdef __S3E__
-int main(int argc, char* argv[])
-{
-    run();
-    return 0;
-}
-#endif
-
-
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
@@ -151,7 +139,7 @@ extern "C"
 
 #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
         // If parameter 2 is set to 1, refresh rate will be 60 fps, 2 - 30 fps, 3 - 15 fps.
-        SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
+        //SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 
 #if EMSCRIPTEN