소스 검색

Merge branch 'dev'

dm 7 년 전
부모
커밋
459a3bf26a

+ 21 - 9
CMakeLists.txt

@@ -126,9 +126,15 @@ foreach(ITEM ${FOLDERS})
 endforeach(ITEM)
 
 
-set(OXYGINE_INCLUDE_DIRS
-	${THIRD_PARTY}/pthreads/include/
-	${THIRD_PARTY}/zlib)
+if (MINGW)
+	set(OXYGINE_INCLUDE_DIRS
+		${THIRD_PARTY}/zlib)
+else()
+	set(OXYGINE_INCLUDE_DIRS
+		${THIRD_PARTY}/pthreads/include/
+		${THIRD_PARTY}/zlib)
+endif()		
+
 
 
 set(OXYGINE_LIBRARY_DIRS
@@ -142,9 +148,7 @@ if (FORCE_GLES)
 endif(FORCE_GLES)
 
 
-if (MINGW) 
-	set(CORE_LIBS ${CORE_LIBS}	mingw32)
-endif(MINGW)
+
 
 
 set(CORE_LIBS 
@@ -161,15 +165,23 @@ if (OX_USE_SDL2)
 endif(OX_USE_SDL2)	
 
 
-if (WIN32)
+if (MINGW) 
+
+	set(CORE_LIBS mingw32 pthread ${CORE_LIBS} psapi
+		libcurl_imp
+		ws2_32)
+
+elseif (WIN32)
+
 	set(CORE_LIBS ${CORE_LIBS}
 		pthreadVCE2
 		libcurl_imp
 		ws2_32)
+
 elseif(EMSCRIPTEN)	
-else(WIN32)
+else()
 	set(CORE_LIBS ${CORE_LIBS} pthread)
-endif(WIN32)
+endif()
 
 
 

+ 1 - 1
examples/Demo/src/TestAlphaHitTest.h

@@ -26,7 +26,7 @@ public:
         sprite->setPosition(content->getSize() / 2);
 
         sprite->addEventListener(TouchEvent::OVER, CLOSURE(this, &TestAlphaHitTest::onEvent));
-        sprite->addEventListener(TouchEvent::OUT, CLOSURE(this, &TestAlphaHitTest::onEvent));
+        sprite->addEventListener(TouchEvent::OUTX, CLOSURE(this, &TestAlphaHitTest::onEvent));
         sprite->setTouchChildrenEnabled(false);
 
         txt = new TextField;

+ 2 - 2
examples/Demo/src/TestTouches.h

@@ -22,7 +22,7 @@ public:
         orange->attachTo(content);
         //orange->setAlpha(200);
         orange->addEventListener(TouchEvent::OVER, CLOSURE(this, &TestTouches::onOver));
-        orange->addEventListener(TouchEvent::OUT, CLOSURE(this, &TestTouches::onOver));
+        orange->addEventListener(TouchEvent::OUTX, CLOSURE(this, &TestTouches::onOver));
         orange->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &TestTouches::onDownUp));
         orange->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &TestTouches::onDownUp));
         orange->addEventListener(TouchEvent::MOVE, CLOSURE(this, &TestTouches::onMove));
@@ -90,7 +90,7 @@ public:
         spSprite s = safeSpCast<Sprite>(ev->currentTarget);
         spTextField tf = s->getChildT<TextField>("local");
 
-        if (ev->type != TouchEvent::OUT)
+        if (ev->type != TouchEvent::OUTX)
         {
             TouchEvent* te = safeCast<TouchEvent*>(ev);
             char str[255];

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

@@ -143,7 +143,7 @@ spButton Test::addButton(std::string id, std::string txt)
     });
 
 
-    button->addEventListener(TouchEvent::OUT, [ = ](Event*)
+    button->addEventListener(TouchEvent::OUTX, [ = ](Event*)
     {
         ptr->addTween(Sprite::TweenAddColor(Color(0, 0, 0, 0)), 300);
     });

+ 2 - 2
examples/HelloWorld/src/example.cpp

@@ -36,7 +36,7 @@ public:
         //animate mouse over and mouse out events
         cb = CLOSURE(this, &MainActor::buttonOverOut);
         button->addEventListener(TouchEvent::OVER, cb);
-        button->addEventListener(TouchEvent::OUT, cb);
+        button->addEventListener(TouchEvent::OUTX, cb);
 
 #ifdef CLOSURE_FUNCTION //if your compiler supports lambda
 
@@ -94,7 +94,7 @@ public:
             _button->addTween(Sprite::TweenAddColor(Color(64, 64, 64, 0)), 300);
         }
 
-        if (e->type == TouchEvent::OUT)
+        if (e->type == TouchEvent::OUTX)
         {
             _button->addTween(Sprite::TweenAddColor(Color(0, 0, 0, 0)), 300);
         }

+ 2 - 2
oxygine/src/oxygine/Draggable.h

@@ -44,7 +44,7 @@ namespace oxygine
         RectF _bounds;
         Vector2 _dragPos;
         Vector2 _clientPos;
-        
+
         Actor* _dragClient;
         Actor* _actor;
         timeMS _startTm;
@@ -54,7 +54,7 @@ namespace oxygine
         bool _pressed;
         bool _singleDrag;
         bool _ignoreTouchUp;
-        
+
 
 
 

+ 0 - 2
oxygine/src/oxygine/Event.h

@@ -4,8 +4,6 @@
 #include "Input.h"
 #include "closure/closure.h"
 
-#undef OUT
-
 namespace oxygine
 {
     class Event

+ 1 - 1
oxygine/src/oxygine/HttpRequestTask.h

@@ -104,7 +104,7 @@ namespace oxygine
         std::vector<unsigned char> _postData;
 
         bool _continueDownload;
-        
+
         size_t _expectedContentSize;
         size_t _receivedContentSize;
         file::handle _fhandle;

+ 5 - 5
oxygine/src/oxygine/STDRenderer.cpp

@@ -42,12 +42,12 @@ namespace oxygine
         reset();
     }
 
-	void RenderStateCache::setDriver(IVideoDriver *d)
-	{
-		_driver = d;
-	}
+    void RenderStateCache::setDriver(IVideoDriver* d)
+    {
+        _driver = d;
+    }
 
-	void RenderStateCache::reset()
+    void RenderStateCache::reset()
     {
         resetTextures();
 

+ 3 - 2
oxygine/src/oxygine/STDRenderer.h

@@ -2,6 +2,7 @@
 #include "oxygine-include.h"
 #include "Material.h"
 #include "core/Renderer.h"
+#include <functional>
 
 namespace oxygine
 {
@@ -10,7 +11,7 @@ namespace oxygine
     public:
         RenderStateCache();
 
-		void setDriver(IVideoDriver *d);
+        void setDriver(IVideoDriver* d);
 
         const spNativeTexture& getTexture(int sampler) { return _textures[sampler]; }
 
@@ -161,4 +162,4 @@ namespace oxygine
     typedef void(*render_texture_hook)(const spNativeTexture& nt);
     void set_render_texture_hook(render_texture_hook);
     render_texture_hook get_render_texture_hook();
-}
+}

+ 2 - 4
oxygine/src/oxygine/TouchEvent.h

@@ -1,8 +1,6 @@
 #pragma once
 #include "oxygine-include.h"
 #include "Event.h"
-
-#undef OUT
 namespace oxygine
 {
     class TouchEvent : public Event
@@ -14,7 +12,7 @@ namespace oxygine
 
             CLICK,
             OVER,
-            OUT,
+            OUTX,//OUT, X - avoid conflicts with WinAPI
             MOVE,
             TOUCH_DOWN,
             TOUCH_UP,
@@ -44,7 +42,7 @@ namespace oxygine
 
         bool __clickDispatched;
         Vector2 wheelDirection;//actual only for WHEEL_DIR event
-        
+
         float __localScale;
     };
 }

+ 1 - 1
oxygine/src/oxygine/actor/Actor.cpp

@@ -329,7 +329,7 @@ namespace oxygine
         _getStage()->removeEventListener(TouchEvent::MOVE, CLOSURE(this, &Actor::_onGlobalTouchMoveEvent));
 
         TouchEvent up = *te;
-        up.type = TouchEvent::OUT;
+        up.type = TouchEvent::OUTX;
         up.bubbles = false;
         up.localPosition = stage2local(te->localPosition, _getStage());
         dispatchEvent(&up);

+ 2 - 2
oxygine/src/oxygine/actor/Button.cpp

@@ -20,7 +20,7 @@ namespace oxygine
         EventCallback ncb = CLOSURE(this, &Button::_mouseEvent);
         addEventListener(TouchEvent::TOUCH_DOWN, ncb);
         addEventListener(TouchEvent::OVER, ncb);
-        addEventListener(TouchEvent::OUT, ncb);
+        addEventListener(TouchEvent::OUTX, ncb);
         addEventListener(TouchEvent::CLICK, ncb);
 
         if (DebugActor::resSystem)
@@ -64,7 +64,7 @@ namespace oxygine
                 }
             }
             break;
-            case TouchEvent::OUT:
+            case TouchEvent::OUTX:
             {
                 if (_btnOvered == me->index)
                 {

+ 1 - 1
oxygine/src/oxygine/actor/Button.h

@@ -34,7 +34,7 @@ namespace oxygine
         state _state;
         const ResAnim* _resAnim;
         int _row;
-        
+
     private:
         pointer_index _btnPressed;
         pointer_index _btnOvered;

+ 1 - 0
oxygine/src/oxygine/actor/DebugActor.cpp

@@ -481,6 +481,7 @@ namespace oxygine
         cr->setSize(actor->getSize());
         cr->addTween(ColorRectSprite::TweenColor(Color(Color::White, 200)), 700, 1, true, 0, Tween::ease_inCubic)->detachWhenDone();
         cr->setTransform(tr);
+        cr->setPriority(999);
         getStage()->addChild(cr);
         std::string dmp = actor->dump(0);
         logs::messageln(">>>>>>>>>>>>>>>>>>>>\ntouched actor '%s' local pos: (%.0f,%.0f), pos: (%.0f,%.0f)\n%s",

+ 1 - 1
oxygine/src/oxygine/actor/SlidingActor.h

@@ -63,7 +63,7 @@ namespace oxygine
         float _rad;
         float _maxSpeed;
         timeMS _downTime;
-        
+
         bool _ignoreTouchUp;
 
         Vector2 _downPos;

+ 2 - 0
oxygine/src/oxygine/actor/TextField.cpp

@@ -286,6 +286,8 @@ namespace oxygine
             return _root;
 
 
+        globalScale = scalar::abs(globalScale);
+
         float scale = 1.0f;
         const Font* font = _style.font->getClosestFont(globalScale, _style.fontSize, scale);
 

+ 3 - 0
oxygine/src/oxygine/core/gl/NativeTextureGLES.cpp

@@ -363,6 +363,9 @@ namespace oxygine
 
     void NativeTextureGLES::updateRegion(int x, int y, const ImageData& data_)
     {
+        if (data_.w == 0 || data_.h == 0)
+            return;
+
         ImageData data = data_;
         assert(_width >= data.w - x);
         assert(_height >= data.h - y);

+ 2 - 2
oxygine/src/oxygine/core/gl/oxgl.cpp

@@ -92,7 +92,7 @@ extern "C"
     {}
     GLAPI void APIENTRY def_glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
     {}
-    GLAPI void APIENTRY def_glDrawBuffers( 	GLsizei n,const GLenum *bufs)
+    GLAPI void APIENTRY def_glDrawBuffers(GLsizei n, const GLenum* bufs)
     {}
     GLAPI void APIENTRY def_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
     {}
@@ -222,7 +222,7 @@ int initGLExtensions(myGetProcAdress func)
     GETFUNC(_glBindBuffer, def_glBindBuffer, PFNGLBINDBUFFERPROC, "glBindBuffer");
     GETFUNC(_glGenBuffers, def_glGenBuffers, PFNGLGENBUFFERSPROC, "glGenBuffers");
     GETFUNC(_glBufferData, def_glBufferData, PFNGLBUFFERDATAPROC, "glBufferData");
-	GETFUNC(_glDrawBuffers, def_glDrawBuffers, PFNGLDRAWBUFFERSPROC, "glDrawBuffers");
+    GETFUNC(_glDrawBuffers, def_glDrawBuffers, PFNGLDRAWBUFFERSPROC, "glDrawBuffers");
     GETFUNC(_glGetProgramiv, def_glGetProgramiv, PFNGLGETPROGRAMIVPROC, "glGetProgramiv");
     GETFUNC(_glGenerateMipmap, def_glGenerateMipmap, PFNGLGENERATEMIPMAPPROC, "glGenerateMipmap");
     GETFUNC(_glStencilOpSeparate, def_glStencilOpSeparate, PFNGLSTENCILOPSEPARATEPROC, "glStencilOpSeparate");

+ 7 - 3
oxygine/src/oxygine/core/oxygine.cpp

@@ -318,9 +318,12 @@ namespace oxygine
                 flags |= SDL_WINDOW_FULLSCREEN;
 
 
-            Event ev(EVENT_PRECREATEWINDOW);
+            PreCreateWindowEvent ev;
+            ev.flags = flags;
             _dispatcher->dispatchEvent(&ev);
 
+            flags = ev.flags;
+
 
 #if TARGET_OS_IPHONE
             //ios bug workaround
@@ -417,7 +420,7 @@ namespace oxygine
 
             CHECKGL();
 
-			rsCache().setDriver(IVideoDriver::instance);
+            rsCache().setDriver(IVideoDriver::instance);
 
 
             STDRenderer::initialize();
@@ -781,7 +784,7 @@ namespace oxygine
 #endif
 
             rsCache().reset();
-			rsCache().setDriver(0);
+            rsCache().setDriver(0);
             _threadMessages.clear();
             _uiMessages.clear();
 
@@ -826,6 +829,7 @@ namespace oxygine
             SDL_Quit();
 #endif
 
+            _dispatcher->removeAllEventListeners();
             _dispatcher = 0;
         }
 

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

@@ -1,6 +1,7 @@
 #pragma once
 #include "../oxygine-include.h"
 #include "../EventDispatcher.h"
+#include "../Event.h"
 #include "../math/Vector2.h"
 #include <string>
 
@@ -137,6 +138,13 @@ namespace oxygine
             EVENT_EXIT = sysEventID('c', 'E', 'x'), //dispatched from core::release
         };
 
+        class PreCreateWindowEvent : public Event
+        {
+        public:
+            PreCreateWindowEvent(): Event(EVENT_PRECREATEWINDOW) {}
+            int flags;
+        };
+
         spEventDispatcher getDispatcher();
 
         void init0();

+ 3 - 2
oxygine/src/oxygine/oxygine-include.h

@@ -79,9 +79,10 @@
 #   define OXYGINE_DEBUG_TRACE_LEAKS 1
 #   define OXYGINE_DEBUG_T2P 1
 #   define OXYGINE_DEBUG_SAFECAST 1
-#   define OXYGINE_TRACE_VIDEO_STATS 1
 #endif
 
+#   define OXYGINE_TRACE_VIDEO_STATS 1
+
 #define OXYGINE_ASSERT2LOG 1
 
 #ifdef EMSCRIPTEN
@@ -114,7 +115,7 @@ namespace ox = oxygine;
 
 #define OXYGINE_RENDERER 5
 
-#define OXYGINE_VERSION 9
+#define OXYGINE_VERSION 10
 
 #ifdef __GNUC__
 #   define OXYGINE_DEPRECATED __attribute__((deprecated))

+ 12 - 13
readme/readme.txt

@@ -1,15 +1,14 @@
-If you are using:
-	- SDL2:
-		1. Download latest SDL2 source snapshot from http://libsdl.org/hg.php
-		2. Your folder structure should be organized like this:
-			any/path/
-					/oxygine-framework
-					/SDL
+1. Download latest SDL2 source snapshot from http://libsdl.org/hg.php or
+   RECOMMENDED: oxygine/SDL fork from https://github.com/oxygine/SDL 
 
-		3. Check other instructions for your platform:
-			- VisualStudio.txt has instructions on how to build Oxygine with Visual Studio on Windows
-			- Android.txt has instructions on how to build Oxygine for Android
-			- CMake.txt has instructions on how to build Oxygine with CMake on Windows and Linux
-			- iOS.txt and MacOSX.txt have instructions on how to build Oxygine with XCode
+2. Your folder structure should be organized like this:
+	any/path/
+			/oxygine-framework
+			/SDL
 
-	- Marmalade: Read Marmalade.txt
+3. Check other instructions for your platform:
+	- VisualStudio.txt has instructions on how to build Oxygine with Visual Studio on Windows
+	- Android.txt has instructions on how to build Oxygine for Android
+	- CMake.txt has instructions on how to build Oxygine with CMake on Windows/Linux
+	- CMake+MinGW.txt has instructions on how to build Oxygine with CMake on Windows using MinGW compiler and create project compatible with CodeBlocks/CLion/etc IDE
+	- iOS.txt and MacOSX.txt have instructions on how to build Oxygine with XCode