2
0
dmuratshin 9 жил өмнө
parent
commit
cfc115cc08

+ 1 - 1
examples/Demo/src/main.cpp

@@ -68,7 +68,7 @@ void run()
     getStage()->setSize(size);
     getStage()->setSize(size);
 
 
     // DebugActor is a helper actor node. It shows FPS, memory usage and other useful stuff
     // DebugActor is a helper actor node. It shows FPS, memory usage and other useful stuff
-    //DebugActor::show();
+    DebugActor::show();
 
 
     // Initializes our example game. See example.cpp
     // Initializes our example game. See example.cpp
     example_init();
     example_init();

+ 8 - 15
examples/DemoBox2D/src/main.cpp

@@ -138,9 +138,12 @@ int main(int argc, char* argv[])
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
 #include "SDL.h"
 #include "SDL.h"
+
 extern "C"
 extern "C"
 {
 {
     void one(void* param) { mainloop(); }
     void one(void* param) { mainloop(); }
+    void oneEmsc() { mainloop(); }
+
     int main(int argc, char* argv[])
     int main(int argc, char* argv[])
     {
     {
 
 
@@ -151,21 +154,11 @@ extern "C"
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 #endif
 
 
+#if EMSCRIPTEN
+        emscripten_set_main_loop(oneEmsc, 0, 0);
+#endif
+
         return 0;
         return 0;
     }
     }
 };
 };
-#endif
-
-
-#ifdef EMSCRIPTEN
-#include <emscripten.h>
-
-void one() { mainloop(); }
-
-int main(int argc, char* argv[])
-{
-    run();
-    emscripten_set_main_loop(one, 0, 0);
-    return 0;
-}
-#endif
+#endif

+ 8 - 15
examples/Game/part1/src/main.cpp

@@ -138,9 +138,12 @@ int main(int argc, char* argv[])
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
 #include "SDL.h"
 #include "SDL.h"
+
 extern "C"
 extern "C"
 {
 {
     void one(void* param) { mainloop(); }
     void one(void* param) { mainloop(); }
+    void oneEmsc() { mainloop(); }
+
     int main(int argc, char* argv[])
     int main(int argc, char* argv[])
     {
     {
 
 
@@ -151,21 +154,11 @@ extern "C"
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 #endif
 
 
+#if EMSCRIPTEN
+        emscripten_set_main_loop(oneEmsc, 0, 0);
+#endif
+
         return 0;
         return 0;
     }
     }
 };
 };
-#endif
-
-
-#ifdef EMSCRIPTEN
-#include <emscripten.h>
-
-void one() { mainloop(); }
-
-int main(int argc, char* argv[])
-{
-    run();
-    emscripten_set_main_loop(one, 0, 0);
-    return 0;
-}
-#endif
+#endif

+ 8 - 15
examples/Game/part2/src/main.cpp

@@ -138,9 +138,12 @@ int main(int argc, char* argv[])
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
 #include "SDL.h"
 #include "SDL.h"
+
 extern "C"
 extern "C"
 {
 {
     void one(void* param) { mainloop(); }
     void one(void* param) { mainloop(); }
+    void oneEmsc() { mainloop(); }
+
     int main(int argc, char* argv[])
     int main(int argc, char* argv[])
     {
     {
 
 
@@ -151,21 +154,11 @@ extern "C"
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 #endif
 
 
+#if EMSCRIPTEN
+        emscripten_set_main_loop(oneEmsc, 0, 0);
+#endif
+
         return 0;
         return 0;
     }
     }
 };
 };
-#endif
-
-
-#ifdef EMSCRIPTEN
-#include <emscripten.h>
-
-void one() { mainloop(); }
-
-int main(int argc, char* argv[])
-{
-    run();
-    emscripten_set_main_loop(one, 0, 0);
-    return 0;
-}
-#endif
+#endif

+ 8 - 15
examples/Game/part3/src/main.cpp

@@ -138,9 +138,12 @@ int main(int argc, char* argv[])
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
 #include "SDL.h"
 #include "SDL.h"
+
 extern "C"
 extern "C"
 {
 {
     void one(void* param) { mainloop(); }
     void one(void* param) { mainloop(); }
+    void oneEmsc() { mainloop(); }
+
     int main(int argc, char* argv[])
     int main(int argc, char* argv[])
     {
     {
 
 
@@ -151,21 +154,11 @@ extern "C"
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 #endif
 
 
+#if EMSCRIPTEN
+        emscripten_set_main_loop(oneEmsc, 0, 0);
+#endif
+
         return 0;
         return 0;
     }
     }
 };
 };
-#endif
-
-
-#ifdef EMSCRIPTEN
-#include <emscripten.h>
-
-void one() { mainloop(); }
-
-int main(int argc, char* argv[])
-{
-    run();
-    emscripten_set_main_loop(one, 0, 0);
-    return 0;
-}
-#endif
+#endif

+ 8 - 15
examples/Game/part4/src/main.cpp

@@ -138,9 +138,12 @@ int main(int argc, char* argv[])
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
 #include "SDL.h"
 #include "SDL.h"
+
 extern "C"
 extern "C"
 {
 {
     void one(void* param) { mainloop(); }
     void one(void* param) { mainloop(); }
+    void oneEmsc() { mainloop(); }
+
     int main(int argc, char* argv[])
     int main(int argc, char* argv[])
     {
     {
 
 
@@ -151,21 +154,11 @@ extern "C"
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 #endif
 
 
+#if EMSCRIPTEN
+        emscripten_set_main_loop(oneEmsc, 0, 0);
+#endif
+
         return 0;
         return 0;
     }
     }
 };
 };
-#endif
-
-
-#ifdef EMSCRIPTEN
-#include <emscripten.h>
-
-void one() { mainloop(); }
-
-int main(int argc, char* argv[])
-{
-    run();
-    emscripten_set_main_loop(one, 0, 0);
-    return 0;
-}
-#endif
+#endif

+ 8 - 15
examples/Game/part5/src/main.cpp

@@ -138,9 +138,12 @@ int main(int argc, char* argv[])
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
 #include "SDL.h"
 #include "SDL.h"
+
 extern "C"
 extern "C"
 {
 {
     void one(void* param) { mainloop(); }
     void one(void* param) { mainloop(); }
+    void oneEmsc() { mainloop(); }
+
     int main(int argc, char* argv[])
     int main(int argc, char* argv[])
     {
     {
 
 
@@ -151,21 +154,11 @@ extern "C"
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 #endif
 
 
+#if EMSCRIPTEN
+        emscripten_set_main_loop(oneEmsc, 0, 0);
+#endif
+
         return 0;
         return 0;
     }
     }
 };
 };
-#endif
-
-
-#ifdef EMSCRIPTEN
-#include <emscripten.h>
-
-void one() { mainloop(); }
-
-int main(int argc, char* argv[])
-{
-    run();
-    emscripten_set_main_loop(one, 0, 0);
-    return 0;
-}
-#endif
+#endif

+ 8 - 15
examples/Match3/src/main.cpp

@@ -138,9 +138,12 @@ int main(int argc, char* argv[])
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
 #include "SDL.h"
 #include "SDL.h"
+
 extern "C"
 extern "C"
 {
 {
     void one(void* param) { mainloop(); }
     void one(void* param) { mainloop(); }
+    void oneEmsc() { mainloop(); }
+
     int main(int argc, char* argv[])
     int main(int argc, char* argv[])
     {
     {
 
 
@@ -151,21 +154,11 @@ extern "C"
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 #endif
 
 
+#if EMSCRIPTEN
+        emscripten_set_main_loop(oneEmsc, 0, 0);
+#endif
+
         return 0;
         return 0;
     }
     }
 };
 };
-#endif
-
-
-#ifdef EMSCRIPTEN
-#include <emscripten.h>
-
-void one() { mainloop(); }
-
-int main(int argc, char* argv[])
-{
-    run();
-    emscripten_set_main_loop(one, 0, 0);
-    return 0;
-}
-#endif
+#endif

+ 8 - 0
oxygine/src/core/file.h

@@ -119,5 +119,13 @@ namespace oxygine
 
 
             handle _handle;
             handle _handle;
         };
         };
+
+
+
+        /**you don't need to call "file::init" yourself. It would be called from core::init. Use it only when you need access to filesystem before core::init*/
+        void init(const char* company, const char* app);
+
+        /**for internal purposes*/
+        void free();
     }
     }
 }
 }

+ 0 - 6
oxygine/src/core/oxygine.cpp

@@ -81,12 +81,6 @@ extern "C"
 
 
 namespace oxygine
 namespace oxygine
 {
 {
-    namespace file
-    {
-        void init(const char* company, const char* app);
-        void free();
-    }
-
     IVideoDriver::Stats _videoStats;
     IVideoDriver::Stats _videoStats;
 
 
     static ThreadDispatcher _threadMessages;
     static ThreadDispatcher _threadMessages;