Browse Source

emscripten minor improves
added http requests to marmalade
enabled proxy to java http
enabled SDL screensaver

dmuratshin 10 years ago
parent
commit
2791491558

+ 2 - 2
.hg_archival.txt

@@ -1,5 +1,5 @@
 repo: b6d71054df5712e643a0685bc3ba54b123db5729
-node: 376d19dbf4aa91c2f36dd8f02c0a03ebcaaa8373
+node: caf41c056e3e32240761d7398f7bdb36c64fde51
 branch: default
 latesttag: oldrender
-latesttagdistance: 656
+latesttagdistance: 664

+ 1 - 0
.hgignore

@@ -41,3 +41,4 @@ examples/Demo/data/ext/res.xml.ox
 examples/*/proj.cmake/build/
 temp/
 examples/Game/*/proj.cmake/build/
+examples/HelloWorld/build_helloworld_*

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

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 add_executable(Demo ../src/entry_point.cpp ../src/example.cpp ../src/test.cpp  ../src/TestBox9Sprite.h ../src/TestClipRect.h ../src/TestDrag.h ../src/TestHttp.h ../src/TestInputText.h ../src/TestManageRes.h ../src/TestMask.h ../src/TestPerf.h ../src/TestPolygon.h ../src/TestProgressBar.h ../src/TestRender2Texture.h ../src/TestSliding.h ../src/TestTexel2Pixel.h ../src/TestText.h ../src/TestTextureFormat.h ../src/TestTweens.h ../src/TestUserShader.h ../src/TestUserShader2.h ../src/example.h ../src/test.h )
 

+ 2 - 1
examples/Demo/src/TestHttp.h

@@ -40,7 +40,8 @@ public:
 		task->addEventListener(HttpRequestTask::PROGRESS, CLOSURE(this, &TestHttp::progress));
 		task->run();
 		
-		OX_ASSERT(!file::exists("somefile.abc"));
+		//OX_ASSERT(!file::exists("somefile.abc"));
+		file::deleteFile("somefile.abc", ep_ignore_error);
 
 		_bar = new ProgressBar;
 		_bar->setResAnim(resources.getResAnim("slide"));

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

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 file(GLOB_RECURSE BOX2DSRC
 		../box2d/*.cpp

+ 1 - 1
examples/Game/part1/proj.emscripten/CMakeLists.txt

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 add_executable(GamePart1 ../src/Game.cpp ../src/Joystick.cpp ../src/Player.cpp ../src/Unit.cpp ../src/entry_point.cpp ../src/example.cpp ../src/res.cpp  ../src/Game.h ../src/Joystick.h ../src/Player.h ../src/Unit.h ../src/example.h ../src/res.h )
 

+ 1 - 1
examples/Game/part2/proj.emscripten/CMakeLists.txt

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 add_executable(GamePart2 ../src/Enemy.cpp ../src/Game.cpp ../src/Joystick.cpp ../src/Player.cpp ../src/Rocket.cpp ../src/Unit.cpp ../src/entry_point.cpp ../src/example.cpp ../src/res.cpp  ../src/Enemy.h ../src/Game.h ../src/Joystick.h ../src/Player.h ../src/Rocket.h ../src/Unit.h ../src/example.h ../src/res.h )
 

+ 1 - 1
examples/Game/part3/proj.emscripten/CMakeLists.txt

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 add_executable(GamePart3 ../src/Enemy.cpp ../src/Game.cpp ../src/GameScene.cpp ../src/Joystick.cpp ../src/MainMenuScene.cpp ../src/MyButton.cpp ../src/Player.cpp ../src/Rocket.cpp ../src/Scene.cpp ../src/Unit.cpp ../src/entry_point.cpp ../src/example.cpp ../src/res.cpp  ../src/Enemy.h ../src/Game.h ../src/GameScene.h ../src/Joystick.h ../src/MainMenuScene.h ../src/MyButton.h ../src/Player.h ../src/Rocket.h ../src/Scene.h ../src/Unit.h ../src/example.h ../src/res.h )
 

+ 1 - 1
examples/Game/part4/proj.emscripten/CMakeLists.txt

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 add_executable(GamePart4 ../src/Enemy.cpp ../src/Game.cpp ../src/GameMenu.cpp ../src/GameScene.cpp ../src/Joystick.cpp ../src/MainMenuScene.cpp ../src/MyButton.cpp ../src/Player.cpp ../src/Rocket.cpp ../src/Scene.cpp ../src/Unit.cpp ../src/entry_point.cpp ../src/example.cpp ../src/res.cpp  ../src/Enemy.h ../src/Game.h ../src/GameMenu.h ../src/GameScene.h ../src/Joystick.h ../src/MainMenuScene.h ../src/MyButton.h ../src/Player.h ../src/Rocket.h ../src/Scene.h ../src/Unit.h ../src/example.h ../src/res.h )
 

+ 1 - 1
examples/Game/part5/proj.emscripten/CMakeLists.txt

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 add_executable(GamePart5 ../src/Enemy.cpp ../src/Game.cpp ../src/GameMenu.cpp ../src/GameScene.cpp ../src/Joystick.cpp ../src/MainMenuScene.cpp ../src/MyButton.cpp ../src/Player.cpp ../src/Rocket.cpp ../src/Scene.cpp ../src/Unit.cpp ../src/entry_point.cpp ../src/example.cpp ../src/res.cpp  ../src/Enemy.h ../src/Game.h ../src/GameMenu.h ../src/GameScene.h ../src/Joystick.h ../src/MainMenuScene.h ../src/MyButton.h ../src/Player.h ../src/Rocket.h ../src/Scene.h ../src/Unit.h ../src/example.h ../src/res.h )
 

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

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

+ 3 - 0
examples/HelloWorld/src/example.cpp

@@ -31,11 +31,14 @@ public:
 		EventCallback cb = CLOSURE(this, &MainActor::buttonClicked);
 		button->addEventListener(TouchEvent::CLICK, cb);
 
+#ifdef CLOSURE_FUNCTION //if your compiler supports lambda
 
 		button->addEventListener(TouchEvent::CLICK, [](Event* e)->void{
 			log::messageln("button clicked");
 		});
 
+#endif
+
 		//attach button as child to current actor
 		addChild(button);
 

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

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 add_executable(Match3 ../src/entry_point.cpp ../src/example.cpp ../src/gameframe.cpp ../src/jewels.cpp ../src/shared.cpp  ../src/example.h ../src/gameframe.h ../src/jewels.h ../src/shared.h )
 

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

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

+ 0 - 4
oxygine/SDL/android/lib/src/org/oxygine/lib/HttpRequests.java

@@ -64,9 +64,6 @@ class HttpRequest extends AsyncTask<RequestDetails, Integer, String> {
 
     private Proxy detectProxy() 
     {
-        return null;
-        //experimental
-        /*
         try {
             ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
             NetworkInfo ni = cm.getActiveNetworkInfo();
@@ -83,7 +80,6 @@ class HttpRequest extends AsyncTask<RequestDetails, Integer, String> {
         {
         }
         return null;
-        */
     }
 
     @Override

+ 7 - 2
oxygine/marmalade/oxygine-framework.mkf

@@ -7,13 +7,13 @@ options
 
 subproject iwutil
 subproject iwgl
+subproject iwhttp
 
 debug_define MARMALADE
 define MARMALADE
 
 define OX_HAVE_LIBJPEG
 define OX_HAVE_LIBPNG
-define OX_NO_HTTP
 
 files
 {
@@ -57,6 +57,11 @@ files
 	"*.h"
 	"*.cpp"	
 
+	[src/core/s3e]
+	(../src/core/s3e)
+	"*.h"
+	"*.cpp"	
+
 	[src/core/gl]
 	(../src/core/gl)
 	"*.h"
@@ -80,4 +85,4 @@ files
 	(../src/dev_tools)
 	"*.h"
 	"*.cpp"
-}
+}

+ 0 - 92
oxygine/marmalade/oxygine.mkf

@@ -1,92 +0,0 @@
-#it is old style project for oxygine please don't use it
-#use oxygine-framework.mkf
-
-
-includepath ../src/
-includepath ../src/pugixml
-includepath ../src/closure
-includepath ../src/math
-includepath ../src/core
-includepath ../src/res
-includepath ../src/utils
-
-options
-{
-	module_path="../third_party/marmalade/"
-}
-
-subproject iwutil
-subproject iwgl
-
-debug_define MARMALADE
-define MARMALADE
-define OX_HAVE_LIBJPEG
-define OX_HAVE_LIBPNG
-define OX_NO_HTTP
-
-files
-{
-	[src]
-	(../src)
-	"*.h"
-	"*.cpp"
-	
-	[src]
-	(../src)
-	"*.h"
-	"*.cpp"	
-		
-	[src/pugixml]
-	(../src/pugixml)
-	"*.hpp"
-	"*.cpp"	
-
-	[src/minizip]
-	(../src/minizip)
-	"*.h"
-	"*.c"	
-	
-	[src/text_utils]
-	(../src/text_utils)
-	"*.h"
-	"*.cpp"	
-		
-	[src/utils]
-	(../src/utils)
-	"*.h"
-	"*.cpp"	
-	
-	[src/math]
-	(../src/math)
-	"*.h"
-	"*.cpp"	
-	
-	[src/core]
-	(../src/core)
-	"*.h"
-	"*.cpp"	
-
-	[src/core/gl]
-	(../src/core/gl)
-	"*.h"
-	"*.cpp"	
-	
-	[src/closure]
-	(../src/closure)
-	"*.h"
-	
-	[src/winnie_alloc]
-	(../src/winnie_alloc)
-	"*.h"
-	"*.cpp"	
-	
-	[src/res]
-	(../src/res)
-	"*.h"
-	"*.cpp"	
-	
-	[src/dev_tools]
-	(../src/dev_tools)
-	"*.h"
-	"*.cpp"
-}

+ 0 - 4
oxygine/marmalade/oxygine_lib.mkb

@@ -1,4 +0,0 @@
-option lib
-option enable-exceptions=1
-
-subproject oxygine

+ 0 - 56
oxygine/marmalade/oxygine_lib.mkf

@@ -1,56 +0,0 @@
-includepath ../src/
-
-library
-{
-	".,oxygine_lib"
-}
-
-debug_define MARMALADE
-define MARMALADE
-
-debug_define OXYGINE_MARMALADE
-define OXYGINE_MARMALADE
-
-define OX_HAVE_LIBJPEG
-define OX_HAVE_LIBPNG
-define OX_NO_HTTP
-
-files
-{
-	[src]
-	(../src)
-	"*.h"
-			
-	[src/pugixml]
-	(../src/pugixml)
-	"*.hpp"
-		
-	
-	[src/closure]
-	(../src/closure)
-	"*.h"
-	
-	[src/math]
-	(../src/math)
-	"*.h"
-	
-	[src/core]
-	(../src/core)
-	"*.h"
-
-	[src/core/gl]
-	(../src/core/gl)
-	"*.h"
-	
-	[src/res]
-	(../src/res)
-	"*.h"
-	
-	[src/utils]
-	(../src/utils)
-	"*.h"
-	
-	[src/dev_tools]
-	(../src/dev_tools)
-	"*.h"
-}

+ 2 - 2
oxygine/src/Actor.cpp

@@ -1348,11 +1348,11 @@ namespace oxygine
 		return convert_global2local(actor, root, pos);
 	}
 
-	Renderer::transform getGlobalTransform(spActor child)
+	Renderer::transform getGlobalTransform(spActor child, spActor parent)
 	{
 		Renderer::transform t;
 		t.identity();
-		while (child)
+		while (child != parent)
 		{
 			t = t * child->getTransform();
 			child = child->getParent();

+ 3 - 3
oxygine/src/Actor.h

@@ -262,8 +262,8 @@ namespace oxygine
 		Stage* _stage;
 		void added2stage(Stage*);
 		void removedFromStage();
-		virtual void onAdded2Stage(){};
-		virtual void onRemovedFromStage(){};
+		virtual void onAdded2Stage(){}
+		virtual void onRemovedFromStage(){}
 		
 
 		typedef intrusive_list<spActor> children;
@@ -348,7 +348,7 @@ namespace oxygine
 
 
 
-	Renderer::transform getGlobalTransform(spActor child);
+	Renderer::transform getGlobalTransform(spActor child, spActor parent = 0);
 
 	void	changeParentAndSavePosition(spActor mutualParent, spActor actor, spActor newParent);
 	

+ 2 - 0
oxygine/src/core/ThreadMessages.cpp

@@ -32,6 +32,8 @@ namespace oxygine
 		pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 
 		pthread_mutex_init(&_mutex, &attr);
+
+		_events.reserve(10);
 	}
 
 	ThreadMessages::~ThreadMessages()

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

@@ -295,6 +295,8 @@ namespace oxygine
 			log::messageln("SDL build");
 			
 
+			SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
+
 			SDL_Init(SDL_INIT_VIDEO);
 
 

+ 15 - 0
oxygine/src/res/ResAnim.cpp

@@ -129,4 +129,19 @@ namespace oxygine
 		if (i < (int)_frames.size())
 			_frames[i] = frame;
 	}
+
+	const Vector2&	ResAnim::getSize() const
+	{
+		OX_ASSERT(!_frames.empty());
+		return _frames[0].getSize();
+	}
+	float	ResAnim::getWidth() const
+	{
+		return getSize().x;
+	}
+
+	float	ResAnim::getHeight() const
+	{
+		return getSize().y;
+	}
 }

+ 4 - 0
oxygine/src/res/ResAnim.h

@@ -37,6 +37,10 @@ namespace oxygine
 		const AnimationFrame&	getFrame(int index) const;
 		/**Returns atlas where this ResAnim was created*/
 		Resource*				getAtlas(){return _atlas;}
+		/**Returns size of frame*/
+		const Vector2&			getSize() const;
+		float					getWidth() const;
+		float					getHeight() const;
 
 		void setFrame(int col, int row, const AnimationFrame &frame);
 

+ 5 - 2
oxygine/src/res/ResFontBM.cpp

@@ -211,8 +211,11 @@ namespace oxygine
 			char tail[255];
 			char head[255];
 			path::split(path.c_str(), head, tail);
-			p.file = head;
-			p.file += "//";
+			if (*head)
+			{
+				p.file = head;
+				p.file += "//";
+			}
 			p.file += textureFile;
 
 			p.texture = IVideoDriver::instance->createTexture();

+ 1 - 1
tools/others/gen_templates.py

@@ -12,7 +12,7 @@ def gen(path, project = ""):
 	#projs = ("win32", )
 	projs = ("cmake", )	
 	#projs = ("android", )
-	#projs = ("emscripten", )
+	projs = ("emscripten", )
 
 	for platform in projs:
 		dest = "../../examples/" + path + "/proj." + platform

+ 1 - 1
tools/templates/proj.emscripten/CMakeLists.txt

@@ -7,7 +7,7 @@ include_directories(${OXYGINE_INCLUDE_DIRS})
 link_directories(${OXYGINE_LIBRARY_DIRS})
 
 SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths")
+set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-warn-absolute-paths -std=c++11")
 
 add_executable(${PROJECT} ${SRC} ${INCLUDE})