Kaynağa Gözat

updated entry point for ios

dmuratshin 9 yıl önce
ebeveyn
işleme
fb833e58df

+ 21 - 6
examples/Demo/src/main.cpp

@@ -7,7 +7,6 @@
 #include "core/oxygine.h"
 #include "Stage.h"
 #include "DebugActor.h"
-
 #include "example.h"
 
 
@@ -17,6 +16,11 @@ using namespace oxygine;
 // This function is called each frame
 int mainloop()
 {
+    // Update engine-internal components
+    // If input events are available, they are passed to Stage::instance.handleEvent
+    // If the function returns true, it means that the user requested the application to terminate
+    bool done = core::update();
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -34,11 +38,6 @@ int mainloop()
         core::swapDisplayBuffers();
     }
 
-    // Update engine-internal components
-    // If input events are available, they are passed to Stage::instance.handleEvent
-    // If the function returns true, it means that the user requested the application to terminate
-    bool done = core::update();
-
     return done ? 1 : 0;
 }
 
@@ -83,6 +82,12 @@ void run()
 #endif
 
 
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+    // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
+    return;
+#endif
+
     // This is the main game loop.
     while (1)
     {
@@ -132,16 +137,26 @@ int main(int argc, char* argv[])
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
+#include "SDL.h"
 extern "C"
 {
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
+
         run();
+
+#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);
+#endif
+
         return 0;
     }
 };
 #endif
 
+
 #ifdef EMSCRIPTEN
 #include <emscripten.h>
 

+ 21 - 6
examples/DemoBox2D/src/main.cpp

@@ -7,7 +7,6 @@
 #include "core/oxygine.h"
 #include "Stage.h"
 #include "DebugActor.h"
-
 #include "example.h"
 
 
@@ -17,6 +16,11 @@ using namespace oxygine;
 // This function is called each frame
 int mainloop()
 {
+    // Update engine-internal components
+    // If input events are available, they are passed to Stage::instance.handleEvent
+    // If the function returns true, it means that the user requested the application to terminate
+    bool done = core::update();
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -34,11 +38,6 @@ int mainloop()
         core::swapDisplayBuffers();
     }
 
-    // Update engine-internal components
-    // If input events are available, they are passed to Stage::instance.handleEvent
-    // If the function returns true, it means that the user requested the application to terminate
-    bool done = core::update();
-
     return done ? 1 : 0;
 }
 
@@ -83,6 +82,12 @@ void run()
 #endif
 
 
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+    // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
+    return;
+#endif
+
     // This is the main game loop.
     while (1)
     {
@@ -132,16 +137,26 @@ int main(int argc, char* argv[])
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
+#include "SDL.h"
 extern "C"
 {
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
+
         run();
+
+#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);
+#endif
+
         return 0;
     }
 };
 #endif
 
+
 #ifdef EMSCRIPTEN
 #include <emscripten.h>
 

+ 21 - 6
examples/Game/part1/src/main.cpp

@@ -7,7 +7,6 @@
 #include "core/oxygine.h"
 #include "Stage.h"
 #include "DebugActor.h"
-
 #include "example.h"
 
 
@@ -17,6 +16,11 @@ using namespace oxygine;
 // This function is called each frame
 int mainloop()
 {
+    // Update engine-internal components
+    // If input events are available, they are passed to Stage::instance.handleEvent
+    // If the function returns true, it means that the user requested the application to terminate
+    bool done = core::update();
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -34,11 +38,6 @@ int mainloop()
         core::swapDisplayBuffers();
     }
 
-    // Update engine-internal components
-    // If input events are available, they are passed to Stage::instance.handleEvent
-    // If the function returns true, it means that the user requested the application to terminate
-    bool done = core::update();
-
     return done ? 1 : 0;
 }
 
@@ -83,6 +82,12 @@ void run()
 #endif
 
 
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+    // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
+    return;
+#endif
+
     // This is the main game loop.
     while (1)
     {
@@ -132,16 +137,26 @@ int main(int argc, char* argv[])
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
+#include "SDL.h"
 extern "C"
 {
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
+
         run();
+
+#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);
+#endif
+
         return 0;
     }
 };
 #endif
 
+
 #ifdef EMSCRIPTEN
 #include <emscripten.h>
 

+ 21 - 6
examples/Game/part2/src/main.cpp

@@ -7,7 +7,6 @@
 #include "core/oxygine.h"
 #include "Stage.h"
 #include "DebugActor.h"
-
 #include "example.h"
 
 
@@ -17,6 +16,11 @@ using namespace oxygine;
 // This function is called each frame
 int mainloop()
 {
+    // Update engine-internal components
+    // If input events are available, they are passed to Stage::instance.handleEvent
+    // If the function returns true, it means that the user requested the application to terminate
+    bool done = core::update();
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -34,11 +38,6 @@ int mainloop()
         core::swapDisplayBuffers();
     }
 
-    // Update engine-internal components
-    // If input events are available, they are passed to Stage::instance.handleEvent
-    // If the function returns true, it means that the user requested the application to terminate
-    bool done = core::update();
-
     return done ? 1 : 0;
 }
 
@@ -83,6 +82,12 @@ void run()
 #endif
 
 
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+    // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
+    return;
+#endif
+
     // This is the main game loop.
     while (1)
     {
@@ -132,16 +137,26 @@ int main(int argc, char* argv[])
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
+#include "SDL.h"
 extern "C"
 {
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
+
         run();
+
+#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);
+#endif
+
         return 0;
     }
 };
 #endif
 
+
 #ifdef EMSCRIPTEN
 #include <emscripten.h>
 

+ 21 - 6
examples/Game/part3/src/main.cpp

@@ -7,7 +7,6 @@
 #include "core/oxygine.h"
 #include "Stage.h"
 #include "DebugActor.h"
-
 #include "example.h"
 
 
@@ -17,6 +16,11 @@ using namespace oxygine;
 // This function is called each frame
 int mainloop()
 {
+    // Update engine-internal components
+    // If input events are available, they are passed to Stage::instance.handleEvent
+    // If the function returns true, it means that the user requested the application to terminate
+    bool done = core::update();
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -34,11 +38,6 @@ int mainloop()
         core::swapDisplayBuffers();
     }
 
-    // Update engine-internal components
-    // If input events are available, they are passed to Stage::instance.handleEvent
-    // If the function returns true, it means that the user requested the application to terminate
-    bool done = core::update();
-
     return done ? 1 : 0;
 }
 
@@ -83,6 +82,12 @@ void run()
 #endif
 
 
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+    // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
+    return;
+#endif
+
     // This is the main game loop.
     while (1)
     {
@@ -132,16 +137,26 @@ int main(int argc, char* argv[])
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
+#include "SDL.h"
 extern "C"
 {
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
+
         run();
+
+#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);
+#endif
+
         return 0;
     }
 };
 #endif
 
+
 #ifdef EMSCRIPTEN
 #include <emscripten.h>
 

+ 21 - 6
examples/Game/part4/src/main.cpp

@@ -7,7 +7,6 @@
 #include "core/oxygine.h"
 #include "Stage.h"
 #include "DebugActor.h"
-
 #include "example.h"
 
 
@@ -17,6 +16,11 @@ using namespace oxygine;
 // This function is called each frame
 int mainloop()
 {
+    // Update engine-internal components
+    // If input events are available, they are passed to Stage::instance.handleEvent
+    // If the function returns true, it means that the user requested the application to terminate
+    bool done = core::update();
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -34,11 +38,6 @@ int mainloop()
         core::swapDisplayBuffers();
     }
 
-    // Update engine-internal components
-    // If input events are available, they are passed to Stage::instance.handleEvent
-    // If the function returns true, it means that the user requested the application to terminate
-    bool done = core::update();
-
     return done ? 1 : 0;
 }
 
@@ -83,6 +82,12 @@ void run()
 #endif
 
 
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+    // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
+    return;
+#endif
+
     // This is the main game loop.
     while (1)
     {
@@ -132,16 +137,26 @@ int main(int argc, char* argv[])
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
+#include "SDL.h"
 extern "C"
 {
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
+
         run();
+
+#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);
+#endif
+
         return 0;
     }
 };
 #endif
 
+
 #ifdef EMSCRIPTEN
 #include <emscripten.h>
 

+ 21 - 6
examples/Game/part5/src/main.cpp

@@ -7,7 +7,6 @@
 #include "core/oxygine.h"
 #include "Stage.h"
 #include "DebugActor.h"
-
 #include "example.h"
 
 
@@ -17,6 +16,11 @@ using namespace oxygine;
 // This function is called each frame
 int mainloop()
 {
+    // Update engine-internal components
+    // If input events are available, they are passed to Stage::instance.handleEvent
+    // If the function returns true, it means that the user requested the application to terminate
+    bool done = core::update();
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -34,11 +38,6 @@ int mainloop()
         core::swapDisplayBuffers();
     }
 
-    // Update engine-internal components
-    // If input events are available, they are passed to Stage::instance.handleEvent
-    // If the function returns true, it means that the user requested the application to terminate
-    bool done = core::update();
-
     return done ? 1 : 0;
 }
 
@@ -83,6 +82,12 @@ void run()
 #endif
 
 
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+    // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
+    return;
+#endif
+
     // This is the main game loop.
     while (1)
     {
@@ -132,16 +137,26 @@ int main(int argc, char* argv[])
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
+#include "SDL.h"
 extern "C"
 {
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
+
         run();
+
+#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);
+#endif
+
         return 0;
     }
 };
 #endif
 
+
 #ifdef EMSCRIPTEN
 #include <emscripten.h>
 

+ 8 - 8
examples/HelloWorld/src/main.cpp

@@ -15,12 +15,12 @@ using namespace oxygine;
 
 // This function is called each frame
 int mainloop()
-{   
+{
     // Update engine-internal components
     // If input events are available, they are passed to Stage::instance.handleEvent
     // If the function returns true, it means that the user requested the application to terminate
     bool done = core::update();
-    
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -82,12 +82,12 @@ void run()
 #endif
 
 
-    
+
 #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
     // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
     return;
 #endif
-   
+
     // This is the main game loop.
     while (1)
     {
@@ -140,17 +140,17 @@ int main(int argc, char* argv[])
 #include "SDL.h"
 extern "C"
 {
-    void one(void *param) { mainloop(); }
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
-        
+
         run();
-        
+
 #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);
 #endif
-        
+
         return 0;
     }
 };

+ 21 - 6
examples/Match3/src/main.cpp

@@ -7,7 +7,6 @@
 #include "core/oxygine.h"
 #include "Stage.h"
 #include "DebugActor.h"
-
 #include "example.h"
 
 
@@ -17,6 +16,11 @@ using namespace oxygine;
 // This function is called each frame
 int mainloop()
 {
+    // Update engine-internal components
+    // If input events are available, they are passed to Stage::instance.handleEvent
+    // If the function returns true, it means that the user requested the application to terminate
+    bool done = core::update();
+
     // It gets passed to our example game implementation
     example_update();
 
@@ -34,11 +38,6 @@ int mainloop()
         core::swapDisplayBuffers();
     }
 
-    // Update engine-internal components
-    // If input events are available, they are passed to Stage::instance.handleEvent
-    // If the function returns true, it means that the user requested the application to terminate
-    bool done = core::update();
-
     return done ? 1 : 0;
 }
 
@@ -83,6 +82,12 @@ void run()
 #endif
 
 
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+    // On iPhone mainloop is called automatically by CADisplayLink, see int main() below
+    return;
+#endif
+
     // This is the main game loop.
     while (1)
     {
@@ -132,16 +137,26 @@ int main(int argc, char* argv[])
 #ifdef OXYGINE_SDL
 
 #include "SDL_main.h"
+#include "SDL.h"
 extern "C"
 {
+    void one(void* param) { mainloop(); }
     int main(int argc, char* argv[])
     {
+
         run();
+
+#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);
+#endif
+
         return 0;
     }
 };
 #endif
 
+
 #ifdef EMSCRIPTEN
 #include <emscripten.h>