dmuratshin 9 年之前
父节点
当前提交
ae329a7414

+ 1 - 1
examples/HelloFlow/proj.android/jni/src/Android.mk

@@ -6,7 +6,7 @@ LOCAL_MODULE := main
 #SDK_ROOT points to folder with SDL and oxygine-framework
 #SDK_ROOT points to folder with SDL and oxygine-framework
 LOCAL_SRC_FILES := ../../../../../..//SDL/src/main/android/SDL_android_main.c
 LOCAL_SRC_FILES := ../../../../../..//SDL/src/main/android/SDL_android_main.c
 
 
-LOCAL_SRC_FILES += ../../../src/entry_point.cpp ../../../src/example.cpp 
+LOCAL_SRC_FILES += ../../../src/main.cpp ../../../src/example.cpp 
 
 
 
 
 LOCAL_STATIC_LIBRARIES := oxygine-flow_static oxygine-framework_static 
 LOCAL_STATIC_LIBRARIES := oxygine-flow_static oxygine-framework_static 

+ 1 - 1
examples/HelloFlow/proj.cmake/CMakeLists.txt

@@ -11,7 +11,7 @@ include_directories(${OXYGINE_FLOW_INCLUDE_DIRS})
 
 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 add_executable(HelloFlow
 add_executable(HelloFlow
-	../src/entry_point.cpp
+	../src/main.cpp
 	../src/example.h 
 	../src/example.h 
 	../src/example.cpp)
 	../src/example.cpp)
 
 

+ 1 - 1
examples/HelloFlow/proj.emscripten/CMakeLists.txt

@@ -15,7 +15,7 @@ SET(CMAKE_EXECUTABLE_SUFFIX ".html")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-warn-absolute-paths")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-warn-absolute-paths")
 
 
 add_executable(HelloFlow
 add_executable(HelloFlow
-	../src/entry_point.cpp
+	../src/main.cpp
 	../src/example.h 
 	../src/example.h 
 	../src/example.cpp)
 	../src/example.cpp)
 
 

+ 4 - 4
examples/HelloFlow/proj.ios/HelloFlow_ios.xcodeproj/project.pbxproj

@@ -21,7 +21,7 @@
 		04998EF817F8B6F3003441C3 /* libjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 04998EF617F8B6F3003441C3 /* libjpeg.a */; };
 		04998EF817F8B6F3003441C3 /* libjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 04998EF617F8B6F3003441C3 /* libjpeg.a */; };
 		049B52B11871EBFA00EF3C66 /* liboxygine_ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 049B52AD1871EBBA00EF3C66 /* liboxygine_ios.a */; };
 		049B52B11871EBFA00EF3C66 /* liboxygine_ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 049B52AD1871EBBA00EF3C66 /* liboxygine_ios.a */; };
 		04E9AD3F1876FE84006A7317 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04E9AD3E1876FE84006A7317 /* Images.xcassets */; };
 		04E9AD3F1876FE84006A7317 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04E9AD3E1876FE84006A7317 /* Images.xcassets */; };
-		2DC477AC10D6C07B3FE008F6 /* entry_point.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 360377333740D8A2FD15BBE6 /* entry_point.cpp */; };
+		2DC477AC10D6C07B3FE008F6 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 360377333740D8A2FD15BBE6 /* main.cpp */; };
 		920CC7E21C3F38E0005B261E /* flow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7DC1C3F38E0005B261E /* flow.cpp */; };
 		920CC7E21C3F38E0005B261E /* flow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7DC1C3F38E0005B261E /* flow.cpp */; };
 		920CC7E31C3F38E0005B261E /* Scene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7DE1C3F38E0005B261E /* Scene.cpp */; };
 		920CC7E31C3F38E0005B261E /* Scene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7DE1C3F38E0005B261E /* Scene.cpp */; };
 		920CC7E41C3F38E0005B261E /* Transition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7E01C3F38E0005B261E /* Transition.cpp */; };
 		920CC7E41C3F38E0005B261E /* Transition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7E01C3F38E0005B261E /* Transition.cpp */; };
@@ -78,7 +78,7 @@
 		04998EF617F8B6F3003441C3 /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = "../../../../oxygine-framework//oxygine/third_party/ios/libraries/libjpeg.a"; sourceTree = "<group>"; };
 		04998EF617F8B6F3003441C3 /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = "../../../../oxygine-framework//oxygine/third_party/ios/libraries/libjpeg.a"; sourceTree = "<group>"; };
 		04E9AD3E1876FE84006A7317 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = HelloFlow/Images.xcassets; sourceTree = "<group>"; };
 		04E9AD3E1876FE84006A7317 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = HelloFlow/Images.xcassets; sourceTree = "<group>"; };
 		0BF9628FC8D38F9748F0CDEB /* example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = example.cpp; path = ../src/example.cpp; sourceTree = "<group>"; };
 		0BF9628FC8D38F9748F0CDEB /* example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = example.cpp; path = ../src/example.cpp; sourceTree = "<group>"; };
-		360377333740D8A2FD15BBE6 /* entry_point.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = entry_point.cpp; path = ../src/entry_point.cpp; sourceTree = "<group>"; };
+		360377333740D8A2FD15BBE6 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../src/main.cpp; sourceTree = "<group>"; };
 		4DA100C319512824B7570663 /* example.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = example.h; path = ../src/example.h; sourceTree = "<group>"; };
 		4DA100C319512824B7570663 /* example.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = example.h; path = ../src/example.h; sourceTree = "<group>"; };
 		920CC7DC1C3F38E0005B261E /* flow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = flow.cpp; path = ../../../src/flow/flow.cpp; sourceTree = "<group>"; };
 		920CC7DC1C3F38E0005B261E /* flow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = flow.cpp; path = ../../../src/flow/flow.cpp; sourceTree = "<group>"; };
 		920CC7DD1C3F38E0005B261E /* flow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flow.h; path = ../../../src/flow/flow.h; sourceTree = "<group>"; };
 		920CC7DD1C3F38E0005B261E /* flow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flow.h; path = ../../../src/flow/flow.h; sourceTree = "<group>"; };
@@ -181,7 +181,7 @@
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
 				920CC7DB1C3F38D4005B261E /* flow */,
 				920CC7DB1C3F38D4005B261E /* flow */,
-				360377333740D8A2FD15BBE6 /* entry_point.cpp */,
+				360377333740D8A2FD15BBE6 /* main.cpp */,
 				0BF9628FC8D38F9748F0CDEB /* example.cpp */,
 				0BF9628FC8D38F9748F0CDEB /* example.cpp */,
 				4DA100C319512824B7570663 /* example.h */,
 				4DA100C319512824B7570663 /* example.h */,
 			);
 			);
@@ -304,7 +304,7 @@
 			files = (
 			files = (
 				920CC7E31C3F38E0005B261E /* Scene.cpp in Sources */,
 				920CC7E31C3F38E0005B261E /* Scene.cpp in Sources */,
 				920CC7E41C3F38E0005B261E /* Transition.cpp in Sources */,
 				920CC7E41C3F38E0005B261E /* Transition.cpp in Sources */,
-				2DC477AC10D6C07B3FE008F6 /* entry_point.cpp in Sources */,
+				2DC477AC10D6C07B3FE008F6 /* main.cpp in Sources */,
 				DA49ED8903C628BA578C8670 /* example.cpp in Sources */,
 				DA49ED8903C628BA578C8670 /* example.cpp in Sources */,
 				920CC7E21C3F38E0005B261E /* flow.cpp in Sources */,
 				920CC7E21C3F38E0005B261E /* flow.cpp in Sources */,
 			);
 			);

+ 4 - 4
examples/HelloFlow/proj.macosx/HelloFlow_macosx.xcodeproj/project.pbxproj

@@ -15,7 +15,7 @@
 		0405A00118720D2200BA6557 /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 04059FF11872031A00BA6557 /* libpng.a */; };
 		0405A00118720D2200BA6557 /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 04059FF11872031A00BA6557 /* libpng.a */; };
 		049B57321871FBE900EF3C66 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 049B57311871FBE900EF3C66 /* Cocoa.framework */; };
 		049B57321871FBE900EF3C66 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 049B57311871FBE900EF3C66 /* Cocoa.framework */; };
 		049B574A1871FBE900EF3C66 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 049B57491871FBE900EF3C66 /* Images.xcassets */; };
 		049B574A1871FBE900EF3C66 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 049B57491871FBE900EF3C66 /* Images.xcassets */; };
-		2DC477AC10D6C07B3FE008F6 /* entry_point.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 360377333740D8A2FD15BBE6 /* entry_point.cpp */; };
+		2DC477AC10D6C07B3FE008F6 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 360377333740D8A2FD15BBE6 /* main.cpp */; };
 		920CC7F31C3F3A6F005B261E /* flow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7ED1C3F3A6F005B261E /* flow.cpp */; };
 		920CC7F31C3F3A6F005B261E /* flow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7ED1C3F3A6F005B261E /* flow.cpp */; };
 		920CC7F41C3F3A6F005B261E /* Scene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7EF1C3F3A6F005B261E /* Scene.cpp */; };
 		920CC7F41C3F3A6F005B261E /* Scene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7EF1C3F3A6F005B261E /* Scene.cpp */; };
 		920CC7F51C3F3A6F005B261E /* Transition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7F11C3F3A6F005B261E /* Transition.cpp */; };
 		920CC7F51C3F3A6F005B261E /* Transition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 920CC7F11C3F3A6F005B261E /* Transition.cpp */; };
@@ -92,7 +92,7 @@
 		04A57D761871FFEB0068B1E5 /* oxygine_macosx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = oxygine_macosx.xcodeproj; path = "../../../../oxygine-framework//oxygine/SDL/macosx/oxygine_macosx/oxygine_macosx.xcodeproj"; sourceTree = "<group>"; };
 		04A57D761871FFEB0068B1E5 /* oxygine_macosx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = oxygine_macosx.xcodeproj; path = "../../../../oxygine-framework//oxygine/SDL/macosx/oxygine_macosx/oxygine_macosx.xcodeproj"; sourceTree = "<group>"; };
 		04A57D7E1872012A0068B1E5 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = "../../../..//SDL/Xcode/SDL/SDL.xcodeproj"; sourceTree = "<group>"; };
 		04A57D7E1872012A0068B1E5 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = "../../../..//SDL/Xcode/SDL/SDL.xcodeproj"; sourceTree = "<group>"; };
 		0BF9628FC8D38F9748F0CDEB /* example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = example.cpp; path = ../src/example.cpp; sourceTree = "<group>"; };
 		0BF9628FC8D38F9748F0CDEB /* example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = example.cpp; path = ../src/example.cpp; sourceTree = "<group>"; };
-		360377333740D8A2FD15BBE6 /* entry_point.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = entry_point.cpp; path = ../src/entry_point.cpp; sourceTree = "<group>"; };
+		360377333740D8A2FD15BBE6 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../src/main.cpp; sourceTree = "<group>"; };
 		4DA100C319512824B7570663 /* example.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = example.h; path = ../src/example.h; sourceTree = "<group>"; };
 		4DA100C319512824B7570663 /* example.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = example.h; path = ../src/example.h; sourceTree = "<group>"; };
 		920CC7ED1C3F3A6F005B261E /* flow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = flow.cpp; path = ../../../src/flow/flow.cpp; sourceTree = "<group>"; };
 		920CC7ED1C3F3A6F005B261E /* flow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = flow.cpp; path = ../../../src/flow/flow.cpp; sourceTree = "<group>"; };
 		920CC7EE1C3F3A6F005B261E /* flow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flow.h; path = ../../../src/flow/flow.h; sourceTree = "<group>"; };
 		920CC7EE1C3F3A6F005B261E /* flow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flow.h; path = ../../../src/flow/flow.h; sourceTree = "<group>"; };
@@ -187,7 +187,7 @@
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
 				920CC7E91C3F3A63005B261E /* flow */,
 				920CC7E91C3F3A63005B261E /* flow */,
-				360377333740D8A2FD15BBE6 /* entry_point.cpp */,
+				360377333740D8A2FD15BBE6 /* main.cpp */,
 				0BF9628FC8D38F9748F0CDEB /* example.cpp */,
 				0BF9628FC8D38F9748F0CDEB /* example.cpp */,
 				4DA100C319512824B7570663 /* example.h */,
 				4DA100C319512824B7570663 /* example.h */,
 			);
 			);
@@ -333,7 +333,7 @@
 			files = (
 			files = (
 				920CC7F41C3F3A6F005B261E /* Scene.cpp in Sources */,
 				920CC7F41C3F3A6F005B261E /* Scene.cpp in Sources */,
 				920CC7F51C3F3A6F005B261E /* Transition.cpp in Sources */,
 				920CC7F51C3F3A6F005B261E /* Transition.cpp in Sources */,
-				2DC477AC10D6C07B3FE008F6 /* entry_point.cpp in Sources */,
+				2DC477AC10D6C07B3FE008F6 /* main.cpp in Sources */,
 				DA49ED8903C628BA578C8670 /* example.cpp in Sources */,
 				DA49ED8903C628BA578C8670 /* example.cpp in Sources */,
 				920CC7F31C3F3A6F005B261E /* flow.cpp in Sources */,
 				920CC7F31C3F3A6F005B261E /* flow.cpp in Sources */,
 			);
 			);

+ 1 - 1
examples/HelloFlow/proj.win32/HelloFlow.vcxproj

@@ -110,11 +110,11 @@
     </ProjectReference>
     </ProjectReference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <ClCompile Include="../src/entry_point.cpp" />
     <ClCompile Include="../src/example.cpp" />
     <ClCompile Include="../src/example.cpp" />
     <ClCompile Include="..\..\..\src\flow\flow.cpp" />
     <ClCompile Include="..\..\..\src\flow\flow.cpp" />
     <ClCompile Include="..\..\..\src\flow\Scene.cpp" />
     <ClCompile Include="..\..\..\src\flow\Scene.cpp" />
     <ClCompile Include="..\..\..\src\flow\Transition.cpp" />
     <ClCompile Include="..\..\..\src\flow\Transition.cpp" />
+    <ClCompile Include="..\src\main.cpp" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="../src/example.h" />
     <ClInclude Include="../src/example.h" />

+ 3 - 3
examples/HelloFlow/proj.win32/HelloFlow.vcxproj.filters

@@ -18,9 +18,6 @@
     </Filter>
     </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <ClCompile Include="../src/entry_point.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="../src/example.cpp">
     <ClCompile Include="../src/example.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>
     </ClCompile>
     </ClCompile>
@@ -33,6 +30,9 @@
     <ClCompile Include="..\..\..\src\flow\Transition.cpp">
     <ClCompile Include="..\..\..\src\flow\Transition.cpp">
       <Filter>flow</Filter>
       <Filter>flow</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="..\src\main.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="../src/example.h">
     <ClInclude Include="../src/example.h">

+ 0 - 152
examples/HelloFlow/src/entry_point.cpp

@@ -1,152 +0,0 @@
-/**
-Attention!
-This file has Oxygine initialization stuff.
-If you just started you don't need to understand it exactly you could check it later.
-You could start from example.cpp and example.h it has main functions being called from there
-*/
-#include "core/oxygine.h"
-#include "Stage.h"
-#include "DebugActor.h"
-
-#include "example.h"
-
-
-using namespace oxygine;
-
-
-//called each frame
-int mainloop()
-{
-    example_update();
-    //update our stage
-    //update all actors. Actor::update would be called also for all children
-    getStage()->update();
-
-    if (core::beginRendering())
-    {
-        Color clearColor(32, 32, 32, 255);
-        Rect viewport(Point(0, 0), core::getDisplaySize());
-        //render all actors. Actor::render would be called also for all children
-        getStage()->render(clearColor, viewport);
-
-        core::swapDisplayBuffers();
-    }
-
-    //update internal components
-    //all input events would be passed to Stage::instance.handleEvent
-    //if done is true then User requests quit from app.
-    bool done = core::update();
-
-    return done ? 1 : 0;
-}
-
-//it is application entry point
-void run()
-{
-    ObjectBase::__startTracingLeaks();
-
-    //initialize Oxygine's internal stuff
-    core::init_desc desc;
-    desc.title = "Oxygine Application";
-
-#if OXYGINE_SDL || OXYGINE_EMSCRIPTEN
-    //we could setup initial window size on SDL builds
-    desc.w = 960;
-    desc.h = 640;
-    //marmalade settings could be changed from emulator's menu
-#endif
-
-
-    example_preinit();
-    core::init(&desc);
-
-
-    //create Stage. Stage is a root node
-    Stage::instance = new Stage(true);
-    Point size = core::getDisplaySize();
-    getStage()->setSize(size);
-
-    //DebugActor is a helper actor node. It shows FPS, memory usage and other useful stuff
-    DebugActor::show();
-
-    //initialize this example stuff. see example.cpp
-    example_init();
-
-#ifdef EMSCRIPTEN
-    /*
-    if you build for Emscripten mainloop would be called automatically outside.
-    see emscripten_set_main_loop below
-    */
-    return;
-#endif
-
-
-    //here is main game loop
-    while (1)
-    {
-        int done = mainloop();
-        if (done)
-            break;
-    }
-    //user wants to leave application...
-
-    //lets dump all created objects into log
-    //all created and not freed resources would be displayed
-    ObjectBase::dumpCreatedObjects();
-
-    //lets cleanup everything right now and call ObjectBase::dumpObjects() again
-    //we need to free all allocated resources and delete all created actors
-    //all actors/sprites are smart pointer objects and actually you don't need it remove them by hands
-    //but now we want delete it by hands
-
-    //check example.cpp
-    example_destroy();
-
-
-    //renderer.cleanup();
-
-    /**releases all internal components and Stage*/
-    core::release();
-
-    //dump list should be empty now
-    //we deleted everything and could be sure that there aren't any memory leaks
-    ObjectBase::dumpCreatedObjects();
-
-    ObjectBase::__stopTracingLeaks();
-    //end
-}
-
-#ifdef __S3E__
-int main(int argc, char* argv[])
-{
-    run();
-    return 0;
-}
-#endif
-
-
-#ifdef OXYGINE_SDL
-
-#include "SDL_main.h"
-extern "C"
-{
-    int main(int argc, char* argv[])
-    {
-        run();
-        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

+ 171 - 0
examples/HelloFlow/src/main.cpp

@@ -0,0 +1,171 @@
+/**
+    Attention!
+    This file initializes the Oxygine engine.
+    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 "example.h"
+
+
+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();
+
+    // Update our stage
+    // Update all actors. Actor::update will also be called for all its children
+    getStage()->update();
+
+    if (core::beginRendering())
+    {
+        Color clearColor(32, 32, 32, 255);
+        Rect viewport(Point(0, 0), core::getDisplaySize());
+        // Render all actors inside the stage. Actor::render will also be called for all its children
+        getStage()->render(clearColor, viewport);
+
+        core::swapDisplayBuffers();
+    }
+
+    return done ? 1 : 0;
+}
+
+// Application entry point
+void run()
+{
+    ObjectBase::__startTracingLeaks();
+
+    // Initialize Oxygine's internal stuff
+    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
+    desc.w = 960;
+    desc.h = 640;
+    // Marmalade settings can be modified from the emulator's menu
+#endif
+
+
+    example_preinit();
+    core::init(&desc);
+
+
+    // Create the stage. Stage is a root node for all updateable and drawable objects
+    Stage::instance = new Stage(true);
+    Point size = core::getDisplaySize();
+    getStage()->setSize(size);
+
+    // DebugActor is a helper actor node. It shows FPS, memory usage and other useful stuff
+    DebugActor::show();
+
+    // Initializes our example game. See example.cpp
+    example_init();
+
+#ifdef EMSCRIPTEN
+    /*
+    If you build for Emscripten, mainloop is called automatically and shouldn't be called here.
+    See emscripten_set_main_loop in the EMSCRIPTEN section below
+    */
+    return;
+#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)
+    {
+        int done = mainloop();
+        if (done)
+            break;
+    }
+    /*
+     If we get here, the user has requested the Application to terminate.
+     We dump and log all our created objects that have not been freed yet
+    */
+    ObjectBase::dumpCreatedObjects();
+
+    /*
+    Let's clean up everything right now and call ObjectBase::dumpObjects() again.
+    We need to free all allocated resources and delete all created actors.
+    All actors/sprites are smart-pointer objects and don't need to be removed by hand.
+    But now we want to delete it by hand.
+    */
+
+    // See example.cpp for the shutdown function implementation
+    example_destroy();
+
+
+    //renderer.cleanup();
+
+    // Releases all internal components and the stage
+    core::release();
+
+    // The dump list should be empty by now,
+    // we want to make sure that there aren't any memory leaks, so we call it again.
+    ObjectBase::dumpCreatedObjects();
+
+    ObjectBase::__stopTracingLeaks();
+    //end
+}
+
+#ifdef __S3E__
+int main(int argc, char* argv[])
+{
+    run();
+    return 0;
+}
+#endif
+
+
+#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>
+
+void one() { mainloop(); }
+
+int main(int argc, char* argv[])
+{
+    run();
+    emscripten_set_main_loop(one, 0, 0);
+    return 0;
+}
+#endif