Browse Source

latest oxygine

[email protected] 7 years ago
parent
commit
95ef819145
2 changed files with 13 additions and 23 deletions
  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());    
     sprite->attachTo(getStage());    
 
 
     getStage()->addEventListener(TouchEvent::TOUCH_DOWN, [=](Event* ev) {
     getStage()->addEventListener(TouchEvent::TOUCH_DOWN, [=](Event* ev) {
-        log::messageln("touch down");
+        logs::messageln("touch down");
 
 
         TouchEvent *touch = (TouchEvent*)ev;
         TouchEvent *touch = (TouchEvent*)ev;
         downPos = touch->localPosition;
         downPos = touch->localPosition;
@@ -35,7 +35,7 @@ void example_init()
 
 
 
 
     getStage()->addEventListener(TouchEvent::TOUCH_UP, [=](Event*) {
     getStage()->addEventListener(TouchEvent::TOUCH_UP, [=](Event*) {
-        log::messageln("touch up");
+        logs::messageln("touch up");
         //sprite->addTween(Actor::TweenX(0), 1000);
         //sprite->addTween(Actor::TweenX(0), 1000);
         pressed = false;
         pressed = false;
     });
     });
@@ -49,7 +49,7 @@ void example_init()
         if (dir.x < -50)
         if (dir.x < -50)
         {
         {
             pressed = false;
             pressed = false;
-            log::messageln("swipe left");
+            logs::messageln("swipe left");
             
             
             spTween tween = sprite->addTween(Actor::TweenX(-sprite->getWidth()), 300);
             spTween tween = sprite->addTween(Actor::TweenX(-sprite->getWidth()), 300);
             tween->detachWhenDone();
             tween->detachWhenDone();
@@ -67,7 +67,7 @@ void example_init()
         if (dir.x > 50)
         if (dir.x > 50)
         {
         {
             pressed = false;
             pressed = false;
-            log::messageln("swipe right");
+            logs::messageln("swipe right");
 
 
             spTween tween = sprite->addTween(Actor::TweenX(sprite->getWidth()), 300);
             spTween tween = sprite->addTween(Actor::TweenX(sprite->getWidth()), 300);
             tween->detachWhenDone();
             tween->detachWhenDone();
@@ -94,6 +94,8 @@ void example_update()
 //called each frame from main.cpp
 //called each frame from main.cpp
 void example_destroy()
 void example_destroy()
 {
 {
+	//free ref go global object
+	sprite = 0;
     //free previously loaded resources
     //free previously loaded resources
     gameResources.free();
     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.
     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.
     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"
 #include "example.h"
 
 
 
 
@@ -50,12 +50,9 @@ void run()
     core::init_desc desc;
     core::init_desc desc;
     desc.title = "Oxygine Application";
     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.w = 960;
     desc.h = 640;
     desc.h = 640;
-    // Marmalade settings can be modified from the emulator's menu
-#endif
 
 
 
 
     example_preinit();
     example_preinit();
@@ -63,7 +60,7 @@ void run()
 
 
 
 
     // Create the stage. Stage is a root node for all updateable and drawable objects
     // 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();
     Point size = core::getDisplaySize();
     getStage()->setSize(size);
     getStage()->setSize(size);
 
 
@@ -85,7 +82,7 @@ void run()
 
 
 #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
 #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
     // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
     // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
-    return;
+    //return;
 #endif
 #endif
 
 
     // This is the main game loop.
     // This is the main game loop.
@@ -125,15 +122,6 @@ void run()
     //end
     //end
 }
 }
 
 
-#ifdef __S3E__
-int main(int argc, char* argv[])
-{
-    run();
-    return 0;
-}
-#endif
-
-
 #ifdef OXYGINE_SDL
 #ifdef OXYGINE_SDL
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
@@ -151,7 +139,7 @@ extern "C"
 
 
 #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
 #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.
         // 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
 #endif
 
 
 #if EMSCRIPTEN
 #if EMSCRIPTEN