From 37bd7b152aa51fb421ae614317ed2f5b52e8c33f Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 26 Oct 2012 17:00:22 +0200 Subject: [PATCH] [DEV] set etk::Vector2D and new Matrix(n,m) --- Sources/libagg | 2 +- Sources/libetk/etk/Debug.h | 6 +- Sources/libetk/etk/DebugInternal.h | 3 +- Sources/libetk/etk/MessageFifo.h | 6 +- Sources/libetk/etk/RegExp.h | 2 +- Sources/libetk/etk/Stream.h | 34 +- Sources/libetk/etk/Types.h | 2 +- Sources/libetk/etk/TypesCoordonate.h | 342 ------------------ Sources/libetk/etk/UString.cpp | 2 +- Sources/libetk/etk/UString.h | 1 + Sources/libetk/etk/Vector.h | 55 ++- Sources/libetk/etk/math/Matrix.h | 326 +++++++++++++++++ .../etk/{Matrix.cpp => math/Matrix4.cpp} | 24 +- .../libetk/etk/{Matrix.h => math/Matrix4.h} | 54 +-- .../etk/{Semaphore.cpp => math/Plane.h} | 0 Sources/libetk/etk/math/Vector2D.h | 185 ++++++++++ Sources/libetk/etk/math/Vector3D.h | 188 ++++++++++ Sources/libetk/etk/math/Vector4D.h | 34 ++ Sources/libetk/etk/math/math.h | 33 ++ Sources/libetk/etk/{ => os}/File.cpp | 2 +- Sources/libetk/etk/{ => os}/File.h | 2 +- Sources/libetk/etk/{ => os}/Memory.cpp | 2 +- Sources/libetk/etk/{ => os}/Memory.h | 2 +- Sources/libetk/etk/{ => os}/Mutex.Generic.cpp | 2 +- Sources/libetk/etk/{ => os}/Mutex.Windows.cpp | 2 +- Sources/libetk/etk/{ => os}/Mutex.h | 6 +- .../libetk/etk/{ => os}/Semaphore.Generic.cpp | 2 +- .../libetk/etk/{ => os}/Semaphore.Windows.cpp | 2 +- Sources/libetk/etk/os/Semaphore.cpp | 0 Sources/libetk/etk/{ => os}/Semaphore.h | 2 +- Sources/libetk/etk/tool.cpp | 2 +- Sources/libetk/file.mk | 25 +- Sources/libewol/ewol/ResourceManager.cpp | 4 +- Sources/libewol/ewol/ResourceManager.h | 2 +- Sources/libewol/ewol/audio/decWav.cpp | 2 +- Sources/libewol/ewol/ewol.cpp | 10 +- Sources/libewol/ewol/ewol.h | 8 +- .../libewol/ewol/font/DistantFieldFont.cpp | 42 +-- Sources/libewol/ewol/font/DistantFieldFont.h | 14 +- Sources/libewol/ewol/font/Font.h | 16 +- Sources/libewol/ewol/font/FontFreeType.cpp | 14 +- Sources/libewol/ewol/font/FontFreeType.h | 8 +- Sources/libewol/ewol/font/TexturedFont.cpp | 32 +- Sources/libewol/ewol/font/TexturedFont.h | 14 +- Sources/libewol/ewol/game/GameElement.cpp | 4 +- Sources/libewol/ewol/game/GameElement.h | 44 +-- Sources/libewol/ewol/game/GameElementLua.cpp | 16 +- Sources/libewol/ewol/game/GameElementLua.h | 4 +- Sources/libewol/ewol/game/SceneElement.cpp | 26 +- Sources/libewol/ewol/game/SceneElement.h | 16 +- Sources/libewol/ewol/oObject/2DColored.cpp | 14 +- Sources/libewol/ewol/oObject/2DColored.h | 6 +- .../libewol/ewol/oObject/2DTextColored.cpp | 14 +- Sources/libewol/ewol/oObject/2DTextColored.h | 10 +- Sources/libewol/ewol/oObject/2DTextShader.cpp | 14 +- Sources/libewol/ewol/oObject/2DTextShader.h | 10 +- Sources/libewol/ewol/oObject/2DTextured.cpp | 8 +- Sources/libewol/ewol/oObject/2DTextured.h | 2 +- Sources/libewol/ewol/oObject/3DTextured.cpp | 6 +- Sources/libewol/ewol/oObject/3DTextured.h | 10 +- Sources/libewol/ewol/oObject/OObject.h | 6 +- Sources/libewol/ewol/oObject/Sprite.cpp | 14 +- Sources/libewol/ewol/oObject/Sprite.h | 8 +- Sources/libewol/ewol/openGL/Program.cpp | 2 +- Sources/libewol/ewol/openGL/Program.h | 2 +- Sources/libewol/ewol/openGL/Shader.cpp | 2 +- .../ewol/openGL/VirtualBufferObject.cpp | 2 +- Sources/libewol/ewol/openGL/openGL.cpp | 18 +- Sources/libewol/ewol/openGL/openGL.h | 8 +- Sources/libewol/ewol/os/eSystem.cpp | 12 +- Sources/libewol/ewol/os/eSystem.h | 2 +- Sources/libewol/ewol/os/eSystemInput.cpp | 6 +- Sources/libewol/ewol/os/eSystemInput.h | 14 +- Sources/libewol/ewol/os/gui.Android.base.cpp | 6 +- Sources/libewol/ewol/os/gui.Windows.cpp | 10 +- Sources/libewol/ewol/os/gui.X11.cpp | 8 +- Sources/libewol/ewol/os/gui.h | 6 +- Sources/libewol/ewol/texture/Texture.cpp | 2 +- Sources/libewol/ewol/texture/Texture.h | 6 +- Sources/libewol/ewol/texture/TextureBMP.cpp | 12 +- Sources/libewol/ewol/texture/TextureBMP.h | 2 +- Sources/libewol/ewol/texture/TextureFile.cpp | 2 +- Sources/libewol/ewol/texture/TextureFile.h | 2 +- Sources/libewol/ewol/texture/TextureSVG.cpp | 2 +- Sources/libewol/ewol/texture/TextureSVG.h | 2 +- Sources/libewol/ewol/widget/Button.cpp | 8 +- Sources/libewol/ewol/widget/Button.h | 6 +- Sources/libewol/ewol/widget/ButtonColor.cpp | 10 +- Sources/libewol/ewol/widget/ButtonColor.h | 6 +- Sources/libewol/ewol/widget/ButtonImage.cpp | 4 +- Sources/libewol/ewol/widget/ButtonImage.h | 2 +- Sources/libewol/ewol/widget/CheckBox.cpp | 8 +- Sources/libewol/ewol/widget/CheckBox.h | 2 +- Sources/libewol/ewol/widget/ColorBar.cpp | 4 +- Sources/libewol/ewol/widget/ColorBar.h | 6 +- Sources/libewol/ewol/widget/ContextMenu.cpp | 22 +- Sources/libewol/ewol/widget/ContextMenu.h | 10 +- Sources/libewol/ewol/widget/Entry.cpp | 18 +- Sources/libewol/ewol/widget/Entry.h | 6 +- Sources/libewol/ewol/widget/Image.cpp | 4 +- Sources/libewol/ewol/widget/Image.h | 6 +- Sources/libewol/ewol/widget/Joystick.cpp | 4 +- Sources/libewol/ewol/widget/Joystick.h | 4 +- Sources/libewol/ewol/widget/Label.cpp | 6 +- Sources/libewol/ewol/widget/Label.h | 2 +- Sources/libewol/ewol/widget/Layer.cpp | 8 +- Sources/libewol/ewol/widget/Layer.h | 2 +- Sources/libewol/ewol/widget/List.cpp | 10 +- Sources/libewol/ewol/widget/List.h | 4 +- Sources/libewol/ewol/widget/Menu.cpp | 6 +- Sources/libewol/ewol/widget/PopUp.cpp | 18 +- Sources/libewol/ewol/widget/PopUp.h | 2 +- Sources/libewol/ewol/widget/Scene.cpp | 8 +- Sources/libewol/ewol/widget/Scene.h | 14 +- Sources/libewol/ewol/widget/SizerHori.cpp | 14 +- Sources/libewol/ewol/widget/SizerHori.h | 2 +- Sources/libewol/ewol/widget/SizerVert.cpp | 14 +- Sources/libewol/ewol/widget/SizerVert.h | 2 +- Sources/libewol/ewol/widget/Slider.cpp | 4 +- Sources/libewol/ewol/widget/Slider.h | 2 +- Sources/libewol/ewol/widget/Spacer.h | 2 +- Sources/libewol/ewol/widget/WSlider.cpp | 8 +- Sources/libewol/ewol/widget/WSlider.h | 4 +- Sources/libewol/ewol/widget/Widget.cpp | 18 +- Sources/libewol/ewol/widget/Widget.h | 30 +- .../libewol/ewol/widget/WidgetScrolled.cpp | 20 +- Sources/libewol/ewol/widget/WidgetScrolled.h | 12 +- Sources/libewol/ewol/widget/Windows.cpp | 6 +- Sources/libewol/ewol/widget/Windows.h | 2 +- .../ewol/widget/meta/ParameterList.cpp | 6 +- .../libewol/ewol/widget/meta/ParameterList.h | 2 +- Sources/libparsersvg | 2 +- 132 files changed, 1362 insertions(+), 874 deletions(-) delete mode 100644 Sources/libetk/etk/TypesCoordonate.h create mode 100644 Sources/libetk/etk/math/Matrix.h rename Sources/libetk/etk/{Matrix.cpp => math/Matrix4.cpp} (81%) rename Sources/libetk/etk/{Matrix.h => math/Matrix4.h} (81%) rename Sources/libetk/etk/{Semaphore.cpp => math/Plane.h} (100%) create mode 100644 Sources/libetk/etk/math/Vector2D.h create mode 100644 Sources/libetk/etk/math/Vector3D.h create mode 100644 Sources/libetk/etk/math/Vector4D.h create mode 100644 Sources/libetk/etk/math/math.h rename Sources/libetk/etk/{ => os}/File.cpp (99%) rename Sources/libetk/etk/{ => os}/File.h (99%) rename Sources/libetk/etk/{ => os}/Memory.cpp (98%) rename Sources/libetk/etk/{ => os}/Memory.h (99%) rename Sources/libetk/etk/{ => os}/Mutex.Generic.cpp (97%) rename Sources/libetk/etk/{ => os}/Mutex.Windows.cpp (97%) rename Sources/libetk/etk/{ => os}/Mutex.h (97%) rename Sources/libetk/etk/{ => os}/Semaphore.Generic.cpp (98%) rename Sources/libetk/etk/{ => os}/Semaphore.Windows.cpp (98%) create mode 100644 Sources/libetk/etk/os/Semaphore.cpp rename Sources/libetk/etk/{ => os}/Semaphore.h (97%) diff --git a/Sources/libagg b/Sources/libagg index 18e51a5e..4c65a104 160000 --- a/Sources/libagg +++ b/Sources/libagg @@ -1 +1 @@ -Subproject commit 18e51a5e97561222fd352db77cca65928c69e517 +Subproject commit 4c65a1049ab5f6d97f225ba44394c6b6444eddd7 diff --git a/Sources/libetk/etk/Debug.h b/Sources/libetk/etk/Debug.h index 17ca879a..995a9fcc 100644 --- a/Sources/libetk/etk/Debug.h +++ b/Sources/libetk/etk/Debug.h @@ -22,12 +22,12 @@ ******************************************************************************* */ -#ifndef __ETK_DEBUG_H__ -#define __ETK_DEBUG_H__ - #include #include +#ifndef __ETK_DEBUG_H__ +#define __ETK_DEBUG_H__ + // Log Message System For EDN void TOOLS_DisplayFuncName(int32_t ligne, const char* className, const char* funcName, const char* libName); void TOOLS_DisplayTime(void); diff --git a/Sources/libetk/etk/DebugInternal.h b/Sources/libetk/etk/DebugInternal.h index 78c767e8..38a54165 100644 --- a/Sources/libetk/etk/DebugInternal.h +++ b/Sources/libetk/etk/DebugInternal.h @@ -22,10 +22,11 @@ ******************************************************************************* */ +#include "etk/Debug.h" + #ifndef __ETK_DEBUG_INTERNAL_H__ #define __ETK_DEBUG_INTERNAL_H__ -#include "etk/Debug.h" extern const char * etkLibName; diff --git a/Sources/libetk/etk/MessageFifo.h b/Sources/libetk/etk/MessageFifo.h index f4b1748c..ea1d1433 100644 --- a/Sources/libetk/etk/MessageFifo.h +++ b/Sources/libetk/etk/MessageFifo.h @@ -1,6 +1,6 @@ /** ******************************************************************************* - * @file etk/Mutex.h + * @file etk/os/Mutex.h * @brief Ewol Tool Kit : basic mutex system (header) * @author Edouard DUPIN * @date 15/08/2012 @@ -25,8 +25,8 @@ #ifndef __ETK_MESSAGE_FIFO_H__ #define __ETK_MESSAGE_FIFO_H__ -#include -#include +#include +#include #include namespace etk diff --git a/Sources/libetk/etk/RegExp.h b/Sources/libetk/etk/RegExp.h index fc15c4e0..caadd9f1 100644 --- a/Sources/libetk/etk/RegExp.h +++ b/Sources/libetk/etk/RegExp.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff --git a/Sources/libetk/etk/Stream.h b/Sources/libetk/etk/Stream.h index d76d3e2a..75d4ed29 100644 --- a/Sources/libetk/etk/Stream.h +++ b/Sources/libetk/etk/Stream.h @@ -22,16 +22,29 @@ ******************************************************************************* */ +#ifndef __ETK_STREAM_DEC_H__ +#define __ETK_STREAM_DEC_H__ + +namespace etk{ + typedef enum { + LOG_LEVEL_NONE, + LOG_LEVEL_CRITICAL, + LOG_LEVEL_ERROR, + LOG_LEVEL_WARNING, + LOG_LEVEL_INFO, + LOG_LEVEL_DEBUG, + LOG_LEVEL_VERBOSE + } logLevel_te; +}; +#endif + +#include +#include +#include #ifndef __ETK_STREAM_H__ #define __ETK_STREAM_H__ -//#include -//#include -#include -#include -#include - #if defined(__TARGET_OS__Android) # include # define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "EWOL", __VA_ARGS__)) @@ -81,15 +94,6 @@ namespace etk{ class CEndl{}; class CHex{}; class CStart{}; - typedef enum { - LOG_LEVEL_NONE, - LOG_LEVEL_CRITICAL, - LOG_LEVEL_ERROR, - LOG_LEVEL_WARNING, - LOG_LEVEL_INFO, - LOG_LEVEL_DEBUG, - LOG_LEVEL_VERBOSE - } logLevel_te; class CCout{ private: bool hex; diff --git a/Sources/libetk/etk/Types.h b/Sources/libetk/etk/Types.h index 9487c14f..ba533942 100644 --- a/Sources/libetk/etk/Types.h +++ b/Sources/libetk/etk/Types.h @@ -82,4 +82,4 @@ typedef struct { #endif -#include +#include diff --git a/Sources/libetk/etk/TypesCoordonate.h b/Sources/libetk/etk/TypesCoordonate.h deleted file mode 100644 index 0582c500..00000000 --- a/Sources/libetk/etk/TypesCoordonate.h +++ /dev/null @@ -1,342 +0,0 @@ -/** - ******************************************************************************* - * @file etk/TypesCoordonate.h - * @brief Ewol Tool Kit : generique coordonate type abstraction for openGl - * @author Edouard DUPIN - * @date 07/06/2012 - * @par Project - * Ewol TK - * - * @par Copyright - * Copyright 2011 Edouard DUPIN, all right reserved - * - * This software is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY. - * - * Licence summary : - * You can modify and redistribute the sources code and binaries. - * You can send me the bug-fix - * - * Term of the licence in in the file licence.txt. - * - ******************************************************************************* - */ - -#ifndef __ETK_TYPES_COORDONATES_H__ -#define __ETK_TYPES_COORDONATES_H__ - - -template class Vector2D -{ - public: - T x; - T y; - public: - /***************************************************** - * Constructor - *****************************************************/ - Vector2D(void) : x(0), y(0) { }; - Vector2D(double _x, double _y) : x(_x), y(_y) { }; - Vector2D(float _x, float _y) : x(_x), y(_y) { }; - Vector2D(int32_t _x, int32_t _y) : x(_x), y(_y) { }; - Vector2D(const Vector2D& obj) : x((T)obj.x), y((T)obj.y) { }; - Vector2D(const Vector2D& obj) : x((T)obj.x), y((T)obj.y) { }; - Vector2D(const Vector2D& obj) : x((T)obj.x), y((T)obj.y) { }; - ~Vector2D(void) { }; - /***************************************************** - * = assigment - *****************************************************/ - const Vector2D& operator= (const Vector2D& obj ) { - x = (T)obj.x; - y = (T)obj.y; - return *this; - } - /***************************************************** - * == operator - *****************************************************/ - bool operator== (const Vector2D& obj) const { - if ((T)obj.x == x && (T)obj.y == y) { - return true; - } - return false; - } - /***************************************************** - * != operator - *****************************************************/ - bool operator!= (const Vector2D& obj) const { - if ((T)obj.x == x && (T)obj.y == y) { - return false; - } - return true; - } - /***************************************************** - * += operator - *****************************************************/ - const Vector2D& operator+= (const Vector2D& obj) { - x += (T)obj.x; - y += (T)obj.y; - return *this; - } - /***************************************************** - * + operator - *****************************************************/ - Vector2D operator+ (const Vector2D& obj) { - Vector2D tmpp(x,y); - tmpp.x += (T)obj.x; - tmpp.y += (T)obj.y; - return tmpp; - } - /***************************************************** - * -= operator - *****************************************************/ - const Vector2D& operator-= (const Vector2D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - return *this; - } - /***************************************************** - * - operator - *****************************************************/ - Vector2D operator- (const Vector2D& obj) { - Vector2D tmpp(x,y); - tmpp.x -= (T)obj.x; - tmpp.y -= (T)obj.y; - return tmpp; - } - /***************************************************** - * /= operator - *****************************************************/ - const Vector2D& operator/= (const Vector2D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - return *this; - } - /***************************************************** - * / operator - *****************************************************/ - Vector2D operator/ (const Vector2D& obj) { - Vector2D tmpp(x,y); - tmpp.x /= (T)obj.x; - tmpp.y /= (T)obj.y; - return tmpp; - } - /***************************************************** - * *= operator - *****************************************************/ - const Vector2D& operator*= (const Vector2D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - return *this; - } - /***************************************************** - * * operator - *****************************************************/ - Vector2D operator* (const Vector2D& obj) { - Vector2D tmpp(x,y); - tmpp.x *= (T)obj.x; - tmpp.y *= (T)obj.y; - return tmpp; - } - /***************************************************** - * ++ operator - *****************************************************/ - Vector2D& operator++() // prefix - { - ++x; - ++y; - return *this; - } - Vector2D operator++(int unused) // postfix - { - Vector2D result = *this; - ++(*this); - return result; - } - /***************************************************** - * -- operator - *****************************************************/ - Vector2D& operator--() // prefix - { - --x; - --y; - return *this; - } - - Vector2D operator--(int unused) // postfix - { - Vector2D result = *this; - --(*this); - return result; - } - - T QuadDist(void) - { - return x*x + y*y; - } - - T Dist(void) - { - return sqrt(x*x + y*y); - } -}; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////: - -template class Vector3D -{ - public: - T x; - T y; - T z; - public: - /***************************************************** - * Constructor - *****************************************************/ - Vector3D(void) : x(0), y(0), z(0) { }; - Vector3D(double _x, double _y, double _z) : x(_x), y(_y), z(_z) { }; - Vector3D(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { }; - Vector3D(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) { }; - Vector3D(const Vector3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; - Vector3D(const Vector3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; - Vector3D(const Vector3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; - ~Vector3D(void) { }; - /***************************************************** - * = assigment - *****************************************************/ - const Vector3D& operator= (const Vector3D& obj ) { - x = (T)obj.x; - y = (T)obj.y; - z = (T)obj.z; - return *this; - } - /***************************************************** - * == operator - *****************************************************/ - bool operator== (const Vector3D& obj) const { - if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { - return true; - } - return false; - } - /***************************************************** - * != operator - *****************************************************/ - bool operator!= (const Vector3D& obj) const { - if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { - return false; - } - return true; - } - /***************************************************** - * += operator - *****************************************************/ - const Vector3D& operator+= (const Vector3D& obj) { - x += (T)obj.x; - y += (T)obj.y; - z += (T)obj.z; - return *this; - } - /***************************************************** - * + operator - *****************************************************/ - Vector3D operator+ (const Vector3D& obj) { - Vector3D tmpp(x,y,y); - tmpp.x += (T)obj.x; - tmpp.y += (T)obj.y; - tmpp.z += (T)obj.z; - return *this; - } - /***************************************************** - * -= operator - *****************************************************/ - const Vector3D& operator-= (const Vector3D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - z -= (T)obj.z; - return *this; - } - /***************************************************** - * - operator - *****************************************************/ - Vector3D operator- (const Vector3D& obj) { - Vector3D tmpp(x,y,y); - tmpp.x -= (T)obj.x; - tmpp.y -= (T)obj.y; - tmpp.z -= (T)obj.z; - return *this; - } - /***************************************************** - * /= operator - *****************************************************/ - const Vector3D& operator/= (const Vector3D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - z /= (T)obj.z; - return *this; - } - /***************************************************** - * / operator - *****************************************************/ - Vector3D operator/ (const Vector3D& obj) { - Vector3D tmpp(x,y,y); - tmpp.x /= (T)obj.x; - tmpp.y /= (T)obj.y; - tmpp.z /= (T)obj.z; - return *this; - } - /***************************************************** - * *= operator - *****************************************************/ - const Vector3D& operator*= (const Vector3D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - z *= (T)obj.z; - return *this; - } - /***************************************************** - * * operator - *****************************************************/ - Vector3D operator* (const Vector3D& obj) { - Vector3D tmpp(x,y,y); - tmpp.x *= (T)obj.x; - tmpp.y *= (T)obj.y; - tmpp.z *= (T)obj.z; - return *this; - } - /***************************************************** - * ++ operator - *****************************************************/ - Vector3D& operator++() // prefix - { - ++x; - ++y; - ++z; - return *this; - } - Vector3D operator++(int unused) // postfix - { - Vector3D result = *this; - ++(*this); - return result; - } - /***************************************************** - * -- operator - *****************************************************/ - Vector3D& operator--() // prefix - { - --x; - --y; - --z; - return *this; - } - Vector3D operator--(int unused) // postfix - { - Vector3D result = *this; - --(*this); - return result; - } -}; - - - -#endif diff --git a/Sources/libetk/etk/UString.cpp b/Sources/libetk/etk/UString.cpp index 91d6690a..93762efc 100644 --- a/Sources/libetk/etk/UString.cpp +++ b/Sources/libetk/etk/UString.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include int32_t strlen(const uniChar_t * data) diff --git a/Sources/libetk/etk/UString.h b/Sources/libetk/etk/UString.h index f5a2a701..8a79fcb5 100644 --- a/Sources/libetk/etk/UString.h +++ b/Sources/libetk/etk/UString.h @@ -25,6 +25,7 @@ #ifndef __ETK_USTRING_H__ #define __ETK_USTRING_H__ +#include #include #include diff --git a/Sources/libetk/etk/Vector.h b/Sources/libetk/etk/Vector.h index fc288f2b..1029bc42 100644 --- a/Sources/libetk/etk/Vector.h +++ b/Sources/libetk/etk/Vector.h @@ -25,9 +25,9 @@ #ifndef __ETK_VECTOR_H__ #define __ETK_VECTOR_H__ -#include #include -#include +#include +#include #undef __class__ #define __class__ "etk::Vector" @@ -252,7 +252,7 @@ namespace etk /** * @brief Destructor of the current Class */ - ~Vector() + ~Vector(void) { if (NULL!=m_data) { delete [] m_data; @@ -695,6 +695,55 @@ namespace etk // set the new allocation size m_allocated = requestSize; } + public : + /***************************************************** + * == operator + *****************************************************/ + bool operator== (const Vector& obj) const + { + // check if it was the same pointer + if( this == &obj ) { + return true; + } + // fiist step : check the size ... + if (m_size!=obj.m_size) { + return false; + } + if( NULL==m_data + || NULL==obj.m_data) { + return false; + } + for (int32_t iii=0; iii& obj) const + { + // check if it was the same pointer + if( this == &obj ) { + return false; + } + // fiist step : check the size ... + if (m_size!=obj.m_size) { + return true; + } + if( NULL==m_data + || NULL==obj.m_data) { + return false; + } + for (int32_t iii=0; iii +#include +#include + +namespace etk { + template class Matrix + { + private: + Vector2D m_size; + Vector m_data; + public: + /***************************************************** + * Constructor + *****************************************************/ + Matrix(Vector2D size, T* defaultVal=NULL) : + m_size(size), + etk::Vector2D(size.x* size.y) + { + if (NULL != defaultVal) { + // copy all the elements + for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) { + // cast and set value : + m_data[iii] = (T)defaultVal++; + } + } else { + Clear(); + } + }; + Matrix(int32_t width=0, int32_t heigh=0, T* defaultVal=NULL) : + m_size(width, heigh), + etk::Vector2D(width*heigh) + { + if (NULL != defaultVal) { + // copy all the elements + for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) { + // cast and set value : + m_data[iii] = (T)defaultVal++; + } + } else { + Clear(); + } + }; + Matrix(const Matrix& obj) : + m_size(obj.m_size.x, obj.m_size.y), + etk::Vector2D(obj.m_size.x* obj.m_size.y) + { + // copy all the elements + for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) { + // cast and set value : + m_data[iii] = (T)obj.m_data[iii]; + } + }; + Matrix(const Matrix& obj) : + m_size(obj.m_size.x, obj.m_size.y), + etk::Vector2D(obj.m_size.x* obj.m_size.y) + { + // copy all the elements + for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) { + // cast and set value : + m_data[iii] = (T)obj.m_data[iii]; + } + }; + Matrix(const Matrix& obj) : + m_size(obj.m_size.x, obj.m_size.y), + etk::Vector2D(obj.m_size.x* obj.m_size.y) + { + // copy all the elements + for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) { + // cast and set value : + m_data[iii] = (T)obj.m_data[iii]; + } + }; + /***************************************************** + * Destructor + *****************************************************/ + virtual ~Matrix(void) {}; + + /***************************************************** + * = assigment + *****************************************************/ + const Matrix& operator= (const Matrix& obj ) + { + // check if it was the same pointer + if( this == &obj ) { + return *this; + } + // copy data : + m_size = obj.m_size; + m_data = obj.m_data; + return *this; + }; + /***************************************************** + * == operator + *****************************************************/ + bool operator== (const Matrix& obj) const + { + return (m_data == obj.m_data); + }; + /***************************************************** + * != operator + *****************************************************/ + bool operator!= (const Matrix& obj) const + { + return (m_data != obj.m_data); + }; + /***************************************************** + * += operator + *****************************************************/ + const Matrix& operator+= (const Matrix& obj) + { + if (m_size != obj.m_size) { + //TK_CRITICAL("add 2 Matrix with différent size ... ==> generate the max size of all the 2 matrix"); + etk::Matrix tmpMatrix(etk_max(m_size.x,obj.m_size.x), etk_max(m_size.y,obj.m_size.y)); + for (int32_t jjj=0; jjj< m_size.y; jjj++) { + T* tmpPointer = tmpMatrix[jjj]; + T* tmpPointerIn = (*this)[jjj]; + for (int32_t iii=0; iii< m_size.x; iii++) { + tmpPointer[iii] = tmpPointerIn[iii]; + } + } + for (int32_t jjj=0; jjj< obj.m_size.y; jjj++) { + T* tmpPointer = tmpMatrix[jjj]; + T* tmpPointerIn = obj[jjj]; + for (int32_t iii=0; iii< obj.m_size.x; iii++) { + tmpPointer[iii] += tmpPointerIn[iii]; + } + } + // copy in local : + m_size = tmpMatrix.m_size; + m_data = tmpMatrix.m_data; + } else { + // copy data for the same size : + for (int32_t iii=0; iii< m_data.Size(); iii++) { + m_data[iii] += obj.m_data[iii]; + } + } + return *this; + }; + /***************************************************** + * + operator + *****************************************************/ + Matrix operator+ (const Matrix& obj) { + Matrix tmpp(*this); + tmpp += obj; + return tmpp; + } + /***************************************************** + * -= operator + *****************************************************/ + const Matrix& operator-= (const Matrix& obj) + { + if (m_size != obj.m_size) { + //TK_CRITICAL("less 2 Matrix with différent size ... ==> generate the max size of all the 2 matrix"); + etk::Matrix tmpMatrix(etk_max(m_size.x,obj.m_size.x), etk_max(m_size.y,obj.m_size.y)); + for (int32_t jjj=0; jjj< m_size.y; jjj++) { + T* tmpPointer = tmpMatrix[jjj]; + T* tmpPointerIn = (*this)[jjj]; + for (int32_t iii=0; iii< m_size.x; iii++) { + tmpPointer[iii] = tmpPointerIn[iii]; + } + } + for (int32_t jjj=0; jjj< obj.m_size.y; jjj++) { + T* tmpPointer = tmpMatrix[jjj]; + T* tmpPointerIn = obj[jjj]; + for (int32_t iii=0; iii< obj.m_size.x; iii++) { + tmpPointer[iii] -= tmpPointerIn[iii]; + } + } + // copy in local : + m_size = tmpMatrix.m_size; + m_data = tmpMatrix.m_data; + } else { + // copy data for the same size : + for (int32_t iii=0; iii< m_data.Size(); iii++) { + m_data[iii] -= obj.m_data[iii]; + } + } + return *this; + }; + /***************************************************** + * - operator + *****************************************************/ + Matrix operator- (const Matrix& obj) { + Matrix tmpp(*this); + tmpp += obj; + return tmpp; + } + /***************************************************** + * *= operator + *****************************************************/ + const Matrix& operator*= (const Matrix& obj) + { + if( m_size.x != obj.m_size.y + || m_size.y != obj.m_size.x) { + //TK_CRITICAL("Error while multipliying 2 matrix with different size ==> impossible case ..."); + return *this; + } + etk::Matrix tmpMatrix(m_size); + for (int32_t jjj=0; jjj< obj.m_size.y; jjj++) { + for (int32_t iii=0; iii< obj.m_size.x; iii++) { + T tmpVal = 0; + for (int32_t kkk=0; kkk< obj.m_size.x; kkk++) { + tmpVal += (*this)[jjj][iii+kkk] * obj[jjj+kkk][iii]; + } + tmpMatrix[jjj][iii] = tmpVal; + } + } + // copy in local : + m_data = tmpMatrix.m_data; + return *this; + }; + /***************************************************** + * * operator + *****************************************************/ + Matrix operator* (const Matrix& obj) { + Matrix tmpp(*this); + tmpp *= obj; + return tmpp; + } + /***************************************************** + * [] operator + *****************************************************/ + const T* operator[] (int32_t line) const { + return &m_data[line*m_size.x]; + } + T* operator[] (int32_t line) { + return &m_data[line*m_size.x]; + } + /** + * @ brief Transpose Matrix + * @ return the transpose matrix + */ + Matrix Transpose(void) + { + // create a matrix with the inverted size + Matrix tmpMatrix(m_size.x, m_size.y); + for (int32_t jjj=0; jjj< m_size.y; jjj++) { + for (int32_t iii=0; iii< m_size.x; iii++) { + tmpMatrix[jjj][iii] = (*this)[iii][jjj]; + } + } + return tmpMatrix; + }; + /***************************************************** + * other stupid action : + *****************************************************/ + Vector2D Size(void) { return m_size; }; + void Clear(void) + { + // copy data for the same size : + for (int32_t iii=0; iii< m_size.x*m_size.y; iii++) { + m_data[iii] = (T)0; + } + }; + void Identity(void) + { + // copy data for the same size : + for (int32_t iii=0; iii< etk_min(m_size.x, m_size.y); iii++) { + (*this)[iii][iii] = (T)1; + } + }; + + void Set(int32_t iii, int32_t jjj, T value) + { + m_data[iii*m_size.x+jjj] = value; + } + T Get(int32_t iii, int32_t jjj) + { + return m_data[iii*m_size.x+jjj]; + } + void Display(void) + { + /* + TK_INFO("Matrix display : "); + for (int32_t jjj=0; jjj< m_size.y; jjj++) { + if (m_size.x == 0) { + TK_INFO(" --- , "); + } else if (m_size.x == 1) { + TK_INFO(" " << (*this)[jjj][0] << " , "); + } else if (m_size.x == 2) { + TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , "); + } else if (m_size.x == 3) { + TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , "); + } else if (m_size.x == 4) { + TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , " << (*this)[jjj][3] << " , "); + } else if (m_size.x == 5) { + TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , " << (*this)[jjj][3] << " , " << (*this)[jjj][4] << " , "); + } else if (m_size.x == 6) { + TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , " << (*this)[jjj][3] << " , " << (*this)[jjj][4] << " , " << (*this)[jjj][5] << " , "); + } else { + TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , " << (*this)[jjj][3] << " , " << (*this)[jjj][4] << " , " << (*this)[jjj][5] << " , " << (*this)[jjj][6] << " , "); + } + } + */ + }; + }; +}; + +#endif diff --git a/Sources/libetk/etk/Matrix.cpp b/Sources/libetk/etk/math/Matrix4.cpp similarity index 81% rename from Sources/libetk/etk/Matrix.cpp rename to Sources/libetk/etk/math/Matrix4.cpp index a7b30bfa..e69ac2a9 100644 --- a/Sources/libetk/etk/Matrix.cpp +++ b/Sources/libetk/etk/math/Matrix4.cpp @@ -1,7 +1,7 @@ /** ******************************************************************************* - * @file etk/Matix.cpp - * @brief Ewol Tool Kit : generique Matrix type (Sources) + * @file etk/math/Matix4.cpp + * @brief Ewol Tool Kit : generique Matrix4 type (Sources) * @author Edouard DUPIN * @date 29/08/2012 * @par Project @@ -25,13 +25,13 @@ #include -#include +#include #include #include -etk::Matrix etk::matrix::Perspective(float left, float right, float bottom, float top, float nearVal, float farVal) +etk::Matrix4 etk::matrix::Perspective(float left, float right, float bottom, float top, float nearVal, float farVal) { - etk::Matrix tmp; + etk::Matrix4 tmp; for(int32_t iii=0; iii<4*4 ; iii++) { tmp.m_mat[iii] = 0; } @@ -47,9 +47,9 @@ etk::Matrix etk::matrix::Perspective(float left, float right, float bottom, floa return tmp; } -etk::Matrix etk::matrix::Translate(float x, float y, float z) +etk::Matrix4 etk::matrix::Translate(float x, float y, float z) { - etk::Matrix tmp; + etk::Matrix4 tmp; // set translation : tmp.m_mat[3] = x; tmp.m_mat[7] = y; @@ -59,9 +59,9 @@ etk::Matrix etk::matrix::Translate(float x, float y, float z) return tmp; } -etk::Matrix etk::matrix::Scale(float x, float y, float z) +etk::Matrix4 etk::matrix::Scale(float x, float y, float z) { - etk::Matrix tmp; + etk::Matrix4 tmp; // set scale : tmp.m_mat[0] = x; tmp.m_mat[5] = y; @@ -71,9 +71,9 @@ etk::Matrix etk::matrix::Scale(float x, float y, float z) return tmp; } -etk::Matrix etk::matrix::rotate(float x, float y, float z, float angleRad) +etk::Matrix4 etk::matrix::rotate(float x, float y, float z, float angleRad) { - etk::Matrix tmp; + etk::Matrix4 tmp; float cosVal = cos(angleRad); float sinVal = sin(angleRad); float invVal = 1.0-cosVal; @@ -93,7 +93,7 @@ etk::Matrix etk::matrix::rotate(float x, float y, float z, float angleRad) } -void etk::matrix::Display(etk::Matrix& tmp) +void etk::matrix::Display(etk::Matrix4& tmp) { TK_INFO("matrix : (" << tmp.m_mat[0] << " , " << tmp.m_mat[1] << " , " << tmp.m_mat[2] << " , " << tmp.m_mat[3] << " , "); TK_INFO(" " << tmp.m_mat[4] << " , " << tmp.m_mat[5] << " , " << tmp.m_mat[6] << " , " << tmp.m_mat[7] << " , "); diff --git a/Sources/libetk/etk/Matrix.h b/Sources/libetk/etk/math/Matrix4.h similarity index 81% rename from Sources/libetk/etk/Matrix.h rename to Sources/libetk/etk/math/Matrix4.h index 1d230ef8..53db0603 100644 --- a/Sources/libetk/etk/Matrix.h +++ b/Sources/libetk/etk/math/Matrix4.h @@ -1,7 +1,7 @@ /** ******************************************************************************* - * @file etk/Matix.h - * @brief Ewol Tool Kit : generique Matrix type (header) + * @file etk/math/Matix4.h + * @brief Ewol Tool Kit : generique Matrix4 type (header) * @author Edouard DUPIN * @date 29/08/2012 * @par Project @@ -22,12 +22,12 @@ ******************************************************************************* */ -#ifndef __ETK_TYPES_MATRIX_H__ -#define __ETK_TYPES_MATRIX_H__ +#ifndef __ETK_TYPES_MATRIX4_H__ +#define __ETK_TYPES_MATRIX4_H__ namespace etk { - class Matrix + class Matrix4 { public: float m_mat[4*4]; @@ -43,15 +43,15 @@ namespace etk { /***************************************************** * Constructor *****************************************************/ - Matrix(void) { + Matrix4(void) { Identity(); } - Matrix(const Matrix& obj) { + Matrix4(const Matrix4& obj) { for(int32_t iii=0; iii<4*4 ; iii++) { m_mat[iii] = obj.m_mat[iii]; } } - Matrix(float a1, float b1, float c1, float d1, + Matrix4(float a1, float b1, float c1, float d1, float a2, float b2, float c2, float d2, float a3, float b3, float c3, float d3, float a4, float b4, float c4, float d4) { @@ -72,7 +72,7 @@ namespace etk { m_mat[14] = c4; m_mat[15] = d4; } - Matrix(float * obj) { + Matrix4(float * obj) { if (NULL == obj) { Identity(); return; @@ -84,13 +84,13 @@ namespace etk { /***************************************************** * Destructor *****************************************************/ - ~Matrix() { + virtual ~Matrix4(void) { } /***************************************************** * = assigment *****************************************************/ - const Matrix& operator= (const Matrix& obj ) { + const Matrix4& operator= (const Matrix4& obj ) { for(int32_t iii=0; iii<4*4 ; iii++) { m_mat[iii] = obj.m_mat[iii]; } @@ -99,7 +99,7 @@ namespace etk { /***************************************************** * == operator *****************************************************/ - bool operator== (const Matrix& obj) const { + bool operator== (const Matrix4& obj) const { for(int32_t iii=0; iii<4*4 ; iii++) { if(m_mat[iii] != obj.m_mat[iii]) { return false; @@ -110,7 +110,7 @@ namespace etk { /***************************************************** * != operator *****************************************************/ - bool operator!= (const Matrix& obj) const { + bool operator!= (const Matrix4& obj) const { for(int32_t iii=0; iii<4*4 ; iii++) { if(m_mat[iii] != obj.m_mat[iii]) { return true; @@ -121,7 +121,7 @@ namespace etk { /***************************************************** * += operator *****************************************************/ - const Matrix& operator+= (const Matrix& obj) { + const Matrix4& operator+= (const Matrix4& obj) { for(int32_t iii=0; iii<4*4 ; iii++) { m_mat[iii] += obj.m_mat[iii]; } @@ -130,15 +130,15 @@ namespace etk { /***************************************************** * + operator *****************************************************/ - Matrix operator+ (const Matrix& obj) { - Matrix tmpp(*this); + Matrix4 operator+ (const Matrix4& obj) { + Matrix4 tmpp(*this); tmpp += obj; return tmpp; } /***************************************************** * -= operator *****************************************************/ - const Matrix& operator-= (const Matrix& obj) { + const Matrix4& operator-= (const Matrix4& obj) { for(int32_t iii=0; iii<4*4 ; iii++) { m_mat[iii] -= obj.m_mat[iii]; } @@ -147,15 +147,15 @@ namespace etk { /***************************************************** * - operator *****************************************************/ - Matrix operator- (const Matrix& obj) { - Matrix tmpp(*this); + Matrix4 operator- (const Matrix4& obj) { + Matrix4 tmpp(*this); tmpp += obj; return tmpp; } /***************************************************** * *= operator *****************************************************/ - const Matrix& operator*= (const Matrix& obj) { + const Matrix4& operator*= (const Matrix4& obj) { // output Matrix float matrixOut[4*4]; for(int32_t jjj=0; jjj<4 ; jjj++) { @@ -181,8 +181,8 @@ namespace etk { /***************************************************** * * operator *****************************************************/ - Matrix operator* (const Matrix& obj) { - Matrix tmpp(*this); + Matrix4 operator* (const Matrix4& obj) { + Matrix4 tmpp(*this); tmpp *= obj; return tmpp; } @@ -218,11 +218,11 @@ namespace etk { } }; namespace matrix { - Matrix Perspective(float left, float right, float bottom, float top, float nearVal, float farVal); - Matrix Translate(float x=0.0, float y=0.0, float z=0.0); - Matrix Scale(float x=1.0, float y=1.0, float z=1.0); - Matrix rotate(float x, float y, float z, float angleRad=0.0); - void Display(Matrix& tmp); + Matrix4 Perspective(float left, float right, float bottom, float top, float nearVal, float farVal); + Matrix4 Translate(float x=0.0, float y=0.0, float z=0.0); + Matrix4 Scale(float x=1.0, float y=1.0, float z=1.0); + Matrix4 rotate(float x, float y, float z, float angleRad=0.0); + void Display(Matrix4& tmp); }; }; diff --git a/Sources/libetk/etk/Semaphore.cpp b/Sources/libetk/etk/math/Plane.h similarity index 100% rename from Sources/libetk/etk/Semaphore.cpp rename to Sources/libetk/etk/math/Plane.h diff --git a/Sources/libetk/etk/math/Vector2D.h b/Sources/libetk/etk/math/Vector2D.h new file mode 100644 index 00000000..76fe2b66 --- /dev/null +++ b/Sources/libetk/etk/math/Vector2D.h @@ -0,0 +1,185 @@ +/** + ******************************************************************************* + * @file etk/math/Vector2D.h + * @brief Ewol Tool Kit : Vector 2 dimention (x,y) + * @author Edouard DUPIN + * @date 26/10/2012 + * @par Project + * Ewol TK + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + +#ifndef __ETK_MATH_VECTOR2D_H__ +#define __ETK_MATH_VECTOR2D_H__ + +namespace etk +{ + template class Vector2D + { + public: + T x; + T y; + public: + /***************************************************** + * Constructor + *****************************************************/ + Vector2D(void) : x(0), y(0) { }; + Vector2D(double _x, double _y) : x(_x), y(_y) { }; + Vector2D(float _x, float _y) : x(_x), y(_y) { }; + Vector2D(int32_t _x, int32_t _y) : x(_x), y(_y) { }; + Vector2D(const Vector2D& obj) : x((T)obj.x), y((T)obj.y) { }; + Vector2D(const Vector2D& obj) : x((T)obj.x), y((T)obj.y) { }; + Vector2D(const Vector2D& obj) : x((T)obj.x), y((T)obj.y) { }; + ~Vector2D(void) { }; + /***************************************************** + * = assigment + *****************************************************/ + const Vector2D& operator= (const Vector2D& obj ) { + x = (T)obj.x; + y = (T)obj.y; + return *this; + } + /***************************************************** + * == operator + *****************************************************/ + bool operator== (const Vector2D& obj) const { + if ((T)obj.x == x && (T)obj.y == y) { + return true; + } + return false; + } + /***************************************************** + * != operator + *****************************************************/ + bool operator!= (const Vector2D& obj) const { + if ((T)obj.x == x && (T)obj.y == y) { + return false; + } + return true; + } + /***************************************************** + * += operator + *****************************************************/ + const Vector2D& operator+= (const Vector2D& obj) { + x += (T)obj.x; + y += (T)obj.y; + return *this; + } + /***************************************************** + * + operator + *****************************************************/ + Vector2D operator+ (const Vector2D& obj) { + Vector2D tmpp(x,y); + tmpp.x += (T)obj.x; + tmpp.y += (T)obj.y; + return tmpp; + } + /***************************************************** + * -= operator + *****************************************************/ + const Vector2D& operator-= (const Vector2D& obj) { + x -= (T)obj.x; + y -= (T)obj.y; + return *this; + } + /***************************************************** + * - operator + *****************************************************/ + Vector2D operator- (const Vector2D& obj) { + Vector2D tmpp(x,y); + tmpp.x -= (T)obj.x; + tmpp.y -= (T)obj.y; + return tmpp; + } + /***************************************************** + * /= operator + *****************************************************/ + const Vector2D& operator/= (const Vector2D& obj) { + x /= (T)obj.x; + y /= (T)obj.y; + return *this; + } + /***************************************************** + * / operator + *****************************************************/ + Vector2D operator/ (const Vector2D& obj) { + Vector2D tmpp(x,y); + tmpp.x /= (T)obj.x; + tmpp.y /= (T)obj.y; + return tmpp; + } + /***************************************************** + * *= operator + *****************************************************/ + const Vector2D& operator*= (const Vector2D& obj) { + x *= (T)obj.x; + y *= (T)obj.y; + return *this; + } + /***************************************************** + * * operator + *****************************************************/ + Vector2D operator* (const Vector2D& obj) { + Vector2D tmpp(x,y); + tmpp.x *= (T)obj.x; + tmpp.y *= (T)obj.y; + return tmpp; + } + /***************************************************** + * ++ operator + *****************************************************/ + Vector2D& operator++() // prefix + { + ++x; + ++y; + return *this; + } + Vector2D operator++(int unused) // postfix + { + Vector2D result = *this; + ++(*this); + return result; + } + /***************************************************** + * -- operator + *****************************************************/ + Vector2D& operator--() // prefix + { + --x; + --y; + return *this; + } + + Vector2D operator--(int unused) // postfix + { + Vector2D result = *this; + --(*this); + return result; + } + + T QuadDist(void) + { + return x*x + y*y; + } + + T Dist(void) + { + return sqrt(x*x + y*y); + } + }; +}; + +#endif diff --git a/Sources/libetk/etk/math/Vector3D.h b/Sources/libetk/etk/math/Vector3D.h new file mode 100644 index 00000000..4553d712 --- /dev/null +++ b/Sources/libetk/etk/math/Vector3D.h @@ -0,0 +1,188 @@ +/** + ******************************************************************************* + * @file etk/math/Vector3D.h + * @brief Ewol Tool Kit : Vector 3 dimention (x, y, z) + * @author Edouard DUPIN + * @date 26/10/2012 + * @par Project + * Ewol TK + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + +#ifndef __ETK_MATH_VECTOR3D_H__ +#define __ETK_MATH_VECTOR3D_H__ + +namespace etk +{ + template class Vector3D + { + public: + T x; + T y; + T z; + public: + /***************************************************** + * Constructor + *****************************************************/ + Vector3D(void) : x(0), y(0), z(0) { }; + Vector3D(double _x, double _y, double _z) : x(_x), y(_y), z(_z) { }; + Vector3D(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { }; + Vector3D(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) { }; + Vector3D(const Vector3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; + Vector3D(const Vector3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; + Vector3D(const Vector3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; + ~Vector3D(void) { }; + /***************************************************** + * = assigment + *****************************************************/ + const Vector3D& operator= (const Vector3D& obj ) { + x = (T)obj.x; + y = (T)obj.y; + z = (T)obj.z; + return *this; + } + /***************************************************** + * == operator + *****************************************************/ + bool operator== (const Vector3D& obj) const { + if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { + return true; + } + return false; + } + /***************************************************** + * != operator + *****************************************************/ + bool operator!= (const Vector3D& obj) const { + if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { + return false; + } + return true; + } + /***************************************************** + * += operator + *****************************************************/ + const Vector3D& operator+= (const Vector3D& obj) { + x += (T)obj.x; + y += (T)obj.y; + z += (T)obj.z; + return *this; + } + /***************************************************** + * + operator + *****************************************************/ + Vector3D operator+ (const Vector3D& obj) { + Vector3D tmpp(x,y,y); + tmpp.x += (T)obj.x; + tmpp.y += (T)obj.y; + tmpp.z += (T)obj.z; + return *this; + } + /***************************************************** + * -= operator + *****************************************************/ + const Vector3D& operator-= (const Vector3D& obj) { + x -= (T)obj.x; + y -= (T)obj.y; + z -= (T)obj.z; + return *this; + } + /***************************************************** + * - operator + *****************************************************/ + Vector3D operator- (const Vector3D& obj) { + Vector3D tmpp(x,y,y); + tmpp.x -= (T)obj.x; + tmpp.y -= (T)obj.y; + tmpp.z -= (T)obj.z; + return *this; + } + /***************************************************** + * /= operator + *****************************************************/ + const Vector3D& operator/= (const Vector3D& obj) { + x /= (T)obj.x; + y /= (T)obj.y; + z /= (T)obj.z; + return *this; + } + /***************************************************** + * / operator + *****************************************************/ + Vector3D operator/ (const Vector3D& obj) { + Vector3D tmpp(x,y,y); + tmpp.x /= (T)obj.x; + tmpp.y /= (T)obj.y; + tmpp.z /= (T)obj.z; + return *this; + } + /***************************************************** + * *= operator + *****************************************************/ + const Vector3D& operator*= (const Vector3D& obj) { + x *= (T)obj.x; + y *= (T)obj.y; + z *= (T)obj.z; + return *this; + } + /***************************************************** + * * operator + *****************************************************/ + Vector3D operator* (const Vector3D& obj) { + Vector3D tmpp(x,y,y); + tmpp.x *= (T)obj.x; + tmpp.y *= (T)obj.y; + tmpp.z *= (T)obj.z; + return *this; + } + /***************************************************** + * ++ operator + *****************************************************/ + Vector3D& operator++() // prefix + { + ++x; + ++y; + ++z; + return *this; + } + Vector3D operator++(int unused) // postfix + { + Vector3D result = *this; + ++(*this); + return result; + } + /***************************************************** + * -- operator + *****************************************************/ + Vector3D& operator--() // prefix + { + --x; + --y; + --z; + return *this; + } + Vector3D operator--(int unused) // postfix + { + Vector3D result = *this; + --(*this); + return result; + } + }; +}; + + + +#endif diff --git a/Sources/libetk/etk/math/Vector4D.h b/Sources/libetk/etk/math/Vector4D.h new file mode 100644 index 00000000..65cfd55c --- /dev/null +++ b/Sources/libetk/etk/math/Vector4D.h @@ -0,0 +1,34 @@ +/** + ******************************************************************************* + * @file etk/math/Vector4D.h + * @brief Ewol Tool Kit : Vector 4 dimention (x, y, z, w) or (x, y, width, height) + * @author Edouard DUPIN + * @date 26/10/2012 + * @par Project + * Ewol TK + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + +#ifndef __ETK_MATH_VECTOR4D_H__ +#define __ETK_MATH_VECTOR4D_H__ + +namespace etk +{ +//template class Vector4D +}; + +#endif + diff --git a/Sources/libetk/etk/math/math.h b/Sources/libetk/etk/math/math.h new file mode 100644 index 00000000..021d3c31 --- /dev/null +++ b/Sources/libetk/etk/math/math.h @@ -0,0 +1,33 @@ +/** + ******************************************************************************* + * @file etk/math/math.h + * @brief Ewol Tool Kit : Include all mathematic system of etk (header) + * @author Edouard DUPIN + * @date 29/10/2012 + * @par Project + * Ewol TK + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + + +#include +#include +#include +#include +#include +#include +#include + diff --git a/Sources/libetk/etk/File.cpp b/Sources/libetk/etk/os/File.cpp similarity index 99% rename from Sources/libetk/etk/File.cpp rename to Sources/libetk/etk/os/File.cpp index bef06733..64b2952f 100644 --- a/Sources/libetk/etk/File.cpp +++ b/Sources/libetk/etk/os/File.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include diff --git a/Sources/libetk/etk/File.h b/Sources/libetk/etk/os/File.h similarity index 99% rename from Sources/libetk/etk/File.h rename to Sources/libetk/etk/os/File.h index 7332ee4a..58b7a2a1 100644 --- a/Sources/libetk/etk/File.h +++ b/Sources/libetk/etk/os/File.h @@ -1,6 +1,6 @@ /** ******************************************************************************* - * @file etk/File.h + * @file etk/os/File.h * @brief Ewol Tool Kit : File folder and name abstraction (header) * @author Edouard DUPIN * @date 16/07/2011 diff --git a/Sources/libetk/etk/Memory.cpp b/Sources/libetk/etk/os/Memory.cpp similarity index 98% rename from Sources/libetk/etk/Memory.cpp rename to Sources/libetk/etk/os/Memory.cpp index 0a6a83ee..1cd0211f 100644 --- a/Sources/libetk/etk/Memory.cpp +++ b/Sources/libetk/etk/os/Memory.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include // General #if ETK_MEMORY_CHECKER > 0 diff --git a/Sources/libetk/etk/Memory.h b/Sources/libetk/etk/os/Memory.h similarity index 99% rename from Sources/libetk/etk/Memory.h rename to Sources/libetk/etk/os/Memory.h index 2b0617dc..4476f078 100644 --- a/Sources/libetk/etk/Memory.h +++ b/Sources/libetk/etk/os/Memory.h @@ -1,6 +1,6 @@ /** ******************************************************************************* - * @file etk/Memory.h + * @file etk/os/Memory.h * @brief Ewol Tool Kit : Memory implementation (headers) * @author Edouard DUPIN * @date 12/01/2011 diff --git a/Sources/libetk/etk/Mutex.Generic.cpp b/Sources/libetk/etk/os/Mutex.Generic.cpp similarity index 97% rename from Sources/libetk/etk/Mutex.Generic.cpp rename to Sources/libetk/etk/os/Mutex.Generic.cpp index 6fb38339..ba695782 100644 --- a/Sources/libetk/etk/Mutex.Generic.cpp +++ b/Sources/libetk/etk/os/Mutex.Generic.cpp @@ -22,7 +22,7 @@ ******************************************************************************* */ -#include +#include #include etk::Mutex::Mutex(void) diff --git a/Sources/libetk/etk/Mutex.Windows.cpp b/Sources/libetk/etk/os/Mutex.Windows.cpp similarity index 97% rename from Sources/libetk/etk/Mutex.Windows.cpp rename to Sources/libetk/etk/os/Mutex.Windows.cpp index 074662bb..998984e8 100644 --- a/Sources/libetk/etk/Mutex.Windows.cpp +++ b/Sources/libetk/etk/os/Mutex.Windows.cpp @@ -22,7 +22,7 @@ ******************************************************************************* */ -#include +#include etk::Mutex::Mutex(void) { diff --git a/Sources/libetk/etk/Mutex.h b/Sources/libetk/etk/os/Mutex.h similarity index 97% rename from Sources/libetk/etk/Mutex.h rename to Sources/libetk/etk/os/Mutex.h index 4796d149..1cc851a2 100644 --- a/Sources/libetk/etk/Mutex.h +++ b/Sources/libetk/etk/os/Mutex.h @@ -1,6 +1,6 @@ /** ******************************************************************************* - * @file etk/Mutex.h + * @file etk/os/Mutex.h * @brief Ewol Tool Kit : basic mutex system (header) * @author Edouard DUPIN * @date 15/08/2012 @@ -22,11 +22,11 @@ ******************************************************************************* */ +#include + #ifndef __ETK_MUTEX_H__ #define __ETK_MUTEX_H__ -#include - #ifdef __TARGET_OS__Windows #include #else diff --git a/Sources/libetk/etk/Semaphore.Generic.cpp b/Sources/libetk/etk/os/Semaphore.Generic.cpp similarity index 98% rename from Sources/libetk/etk/Semaphore.Generic.cpp rename to Sources/libetk/etk/os/Semaphore.Generic.cpp index 09e59eb8..38f0aac2 100644 --- a/Sources/libetk/etk/Semaphore.Generic.cpp +++ b/Sources/libetk/etk/os/Semaphore.Generic.cpp @@ -22,7 +22,7 @@ ******************************************************************************* */ -#include +#include #include #include diff --git a/Sources/libetk/etk/Semaphore.Windows.cpp b/Sources/libetk/etk/os/Semaphore.Windows.cpp similarity index 98% rename from Sources/libetk/etk/Semaphore.Windows.cpp rename to Sources/libetk/etk/os/Semaphore.Windows.cpp index 96cdd260..34f214bb 100644 --- a/Sources/libetk/etk/Semaphore.Windows.cpp +++ b/Sources/libetk/etk/os/Semaphore.Windows.cpp @@ -22,7 +22,7 @@ ******************************************************************************* */ -#include +#include #include etk::Semaphore::Semaphore(uint32_t nbBasicElement, uint32_t nbMessageMax) diff --git a/Sources/libetk/etk/os/Semaphore.cpp b/Sources/libetk/etk/os/Semaphore.cpp new file mode 100644 index 00000000..e69de29b diff --git a/Sources/libetk/etk/Semaphore.h b/Sources/libetk/etk/os/Semaphore.h similarity index 97% rename from Sources/libetk/etk/Semaphore.h rename to Sources/libetk/etk/os/Semaphore.h index d8edf842..ded5f8fe 100644 --- a/Sources/libetk/etk/Semaphore.h +++ b/Sources/libetk/etk/os/Semaphore.h @@ -1,6 +1,6 @@ /** ******************************************************************************* - * @file etk/Semaphore.h + * @file etk/os/Semaphore.h * @brief Ewol Tool Kit : basic semaphore system (header) * @author Edouard DUPIN * @date 15/08/2012 diff --git a/Sources/libetk/etk/tool.cpp b/Sources/libetk/etk/tool.cpp index 4ecdaff6..32b6b99a 100644 --- a/Sources/libetk/etk/tool.cpp +++ b/Sources/libetk/etk/tool.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include // for the rand ... #include #include diff --git a/Sources/libetk/file.mk b/Sources/libetk/file.mk index ad4aeea6..4d6dbba0 100644 --- a/Sources/libetk/file.mk +++ b/Sources/libetk/file.mk @@ -3,20 +3,29 @@ FILE_LIST = \ etk/Debug.cpp \ etk/DebugInternal.cpp \ - etk/Memory.cpp \ etk/unicode.cpp \ etk/unicodeTable.cpp \ etk/UString.cpp \ etk/Stream.cpp \ - etk/File.cpp \ etk/RegExp.cpp \ - etk/tool.cpp \ - etk/Matrix.cpp + etk/tool.cpp + + + +FILE_LIST+= \ + etk/math/Matrix4.cpp + + +FILE_LIST+= \ + etk/os/File.cpp \ + etk/os/Memory.cpp \ + + ifeq ("$(TARGET_OS)","Windows") - FILE_LIST += etk/Mutex.Windows.cpp - FILE_LIST += etk/Semaphore.Windows.cpp + FILE_LIST += etk/os/Mutex.Windows.cpp + FILE_LIST += etk/os/Semaphore.Windows.cpp else - FILE_LIST += etk/Mutex.Generic.cpp - FILE_LIST += etk/Semaphore.Generic.cpp + FILE_LIST += etk/os/Mutex.Generic.cpp + FILE_LIST += etk/os/Semaphore.Generic.cpp endif diff --git a/Sources/libewol/ewol/ResourceManager.cpp b/Sources/libewol/ewol/ResourceManager.cpp index 3e3a1e82..c14ca7ff 100644 --- a/Sources/libewol/ewol/ResourceManager.cpp +++ b/Sources/libewol/ewol/ResourceManager.cpp @@ -325,9 +325,9 @@ static int32_t nextP2(int32_t value) return val; } -bool ewol::resource::Keep(etk::UString& filename, ewol::TextureFile*& object, Vector2D size) +bool ewol::resource::Keep(etk::UString& filename, ewol::TextureFile*& object, etk::Vector2D size) { - Vector2D size2(nextP2(size.x), nextP2(size.y)); + etk::Vector2D size2(nextP2(size.x), nextP2(size.y)); etk::UString TmpFilename = filename; TmpFilename += ":"; TmpFilename += size2.x; diff --git a/Sources/libewol/ewol/ResourceManager.h b/Sources/libewol/ewol/ResourceManager.h index cf14c984..3ef83574 100644 --- a/Sources/libewol/ewol/ResourceManager.h +++ b/Sources/libewol/ewol/ResourceManager.h @@ -61,7 +61,7 @@ namespace ewol bool Keep(etk::UString& filename, ewol::DistantFieldFont*& object); #endif bool Keep(ewol::Texture*& object); // no name needed here ... - bool Keep(etk::UString& filename, ewol::TextureFile*& object, Vector2D size); + bool Keep(etk::UString& filename, ewol::TextureFile*& object, etk::Vector2D size); bool Keep(etk::UString& accesMode, ewol::VirtualBufferObject*& object); void Release(ewol::Resource*& object); diff --git a/Sources/libewol/ewol/audio/decWav.cpp b/Sources/libewol/ewol/audio/decWav.cpp index 00758ff2..f42cfee8 100644 --- a/Sources/libewol/ewol/audio/decWav.cpp +++ b/Sources/libewol/ewol/audio/decWav.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/Sources/libewol/ewol/ewol.cpp b/Sources/libewol/ewol/ewol.cpp index 14e6c36a..555b25c7 100644 --- a/Sources/libewol/ewol/ewol.cpp +++ b/Sources/libewol/ewol/ewol.cpp @@ -50,17 +50,17 @@ void ewol::Stop(void) } -void ewol::ChangeSize(Vector2D size) +void ewol::ChangeSize(etk::Vector2D size) { guiInterface::ChangeSize(size); } -void ewol::ChangePos(Vector2D pos) +void ewol::ChangePos(etk::Vector2D pos) { guiInterface::ChangePos(pos); } -void ewol::GetAbsPos(Vector2D& pos) +void ewol::GetAbsPos(etk::Vector2D& pos) { guiInterface::GetAbsPos(pos); } @@ -133,13 +133,13 @@ etk::UString ewol::GetVersion(void) int32_t ewol::GetCurrentWidth(void) { - Vector2D tmpSize = eSystem::GetSize(); + etk::Vector2D tmpSize = eSystem::GetSize(); return tmpSize.x; } int32_t ewol::GetCurrentHeight(void) { - Vector2D tmpSize = eSystem::GetSize(); + etk::Vector2D tmpSize = eSystem::GetSize(); return tmpSize.y; } diff --git a/Sources/libewol/ewol/ewol.h b/Sources/libewol/ewol/ewol.h index c809b2e4..cc6c1b88 100644 --- a/Sources/libewol/ewol/ewol.h +++ b/Sources/libewol/ewol/ewol.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include @@ -38,9 +38,9 @@ namespace ewol { void Stop(void); void DisplayWindows(ewol::Windows * windows); // only on computer - void ChangeSize(Vector2D size); - void ChangePos(Vector2D pos); - void GetAbsPos(Vector2D& pos); + void ChangeSize(etk::Vector2D size); + void ChangePos(etk::Vector2D pos); + void GetAbsPos(etk::Vector2D& pos); void KeyboardShow(void); void KeyboardHide(void); void ForceRedrawAll(void); diff --git a/Sources/libewol/ewol/font/DistantFieldFont.cpp b/Sources/libewol/ewol/font/DistantFieldFont.cpp index 366e825a..e6d571ba 100644 --- a/Sources/libewol/ewol/font/DistantFieldFont.cpp +++ b/Sources/libewol/ewol/font/DistantFieldFont.cpp @@ -129,17 +129,17 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) : EWOL_DEBUG("Generate a text texture for char(" << nbRaws << "," << nbLine << ") with size=(" << textureWidth << "," << textureHeight << ")"); // resize must be done on the texture ... - SetImageSize(Vector2D(textureWidth,textureHeight)); + SetImageSize(etk::Vector2D(textureWidth,textureHeight)); // now we can acces directly on the image m_data.SetFillColor(draw::Color(0xFFFFFF00)); m_data.Clear(); m_height = m_font->GetHeight(m_size); - draw::Image tmpUpScaledImage(Vector2D(1024,1024)); + draw::Image tmpUpScaledImage(etk::Vector2D(1024,1024)); int32_t CurrentLineHigh = 0; - Vector2D glyphPosition(1,1); + etk::Vector2D glyphPosition(1,1); for (int32_t iii=0; iiiGetGlyphProperty(m_size, m_listElement[iii].property)) { EWOL_DEBUG("Generate Font Element : '" << m_listElement[iii].property.m_UVal << "'= '" << (char)m_listElement[iii].property.m_UVal << "'"); @@ -165,7 +165,7 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) : CurrentLineHigh = 0; } // draw the glyph - m_font->DrawGlyph(tmpUpScaledImage, m_size*SPECIAL_UPSCALER, Vector2D(SPECIAL_BORDER*SPECIAL_UPSCALER,SPECIAL_BORDER*SPECIAL_UPSCALER), m_listElement[iii].property); + m_font->DrawGlyph(tmpUpScaledImage, m_size*SPECIAL_UPSCALER, etk::Vector2D(SPECIAL_BORDER*SPECIAL_UPSCALER,SPECIAL_BORDER*SPECIAL_UPSCALER), m_listElement[iii].property); // set video position m_listElement[iii].posStart.u = (float)(glyphPosition.x) / (float)textureWidth; m_listElement[iii].posStart.v = (float)(glyphPosition.y) / (float)textureHeight; @@ -179,12 +179,12 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) : EWOL_DEBUG(" m_advance =" << m_listElement[iii].property.m_advance ); */ // generate the distance field from this element ... - tmpUpScaledImage.DistanceField(Vector2D(0,0), m_listElement[iii].property.m_sizeTexture*Vector2D(SPECIAL_UPSCALER,SPECIAL_UPSCALER)+Vector2D(2*SPECIAL_BORDER*SPECIAL_UPSCALER,2*SPECIAL_BORDER*SPECIAL_UPSCALER), SPECIAL_UPSCALER, SPECIAL_UPSCALER/2); + tmpUpScaledImage.DistanceField(etk::Vector2D(0,0), m_listElement[iii].property.m_sizeTexture*etk::Vector2D(SPECIAL_UPSCALER,SPECIAL_UPSCALER)+etk::Vector2D(2*SPECIAL_BORDER*SPECIAL_UPSCALER,2*SPECIAL_BORDER*SPECIAL_UPSCALER), SPECIAL_UPSCALER, SPECIAL_UPSCALER/2); // copy data with downscaling : (subSampling) - Vector2D tmpPos(0,0); + etk::Vector2D tmpPos(0,0); for (tmpPos.y = 0; tmpPos.y(SPECIAL_UPSCALER,SPECIAL_UPSCALER) + Vector2D(SPECIAL_UPSCALER/2,SPECIAL_UPSCALER/2)) ); + m_data.Set(glyphPosition + tmpPos, tmpUpScaledImage.Get(tmpPos*etk::Vector2D(SPECIAL_UPSCALER,SPECIAL_UPSCALER) + etk::Vector2D(SPECIAL_UPSCALER/2,SPECIAL_UPSCALER/2)) ); } } @@ -204,11 +204,11 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) : draw::Color tlpppp(0xFF,0xFF,0xFF,0x00); for(int32_t jjj=0; jjj < textureHeight;jjj++) { for(int32_t iii=0; iii < textureWidth; iii++){ - tlpppp = m_data.Get(Vector2D(iii, jjj) ); + tlpppp = m_data.Get(etk::Vector2D(iii, jjj) ); // set only alpha : tlpppp.a = etk_min( tlpppp.a+0x60, 0xFF); // real set of color - m_data.Set(Vector2D(iii, jjj), tlpppp ); + m_data.Set(etk::Vector2D(iii, jjj), tlpppp ); } } #endif @@ -236,13 +236,13 @@ bool ewol::DistantFieldFont::HasName(etk::UString& fileName) -int32_t ewol::DistantFieldFont::Draw(Vector2D textPos, +int32_t ewol::DistantFieldFont::Draw(etk::Vector2D textPos, const etk::UString& unicodeString, - etk::Vector > & coord, + etk::Vector > & coord, etk::Vector & coordTex) { float totalSize = 0; - Vector2D tmpPos = textPos; + etk::Vector2D tmpPos = textPos; for(int32_t iii=0; iii textPos, * | | * 3------2 */ - Vector2D bitmapDrawPos[4]; + etk::Vector2D bitmapDrawPos[4]; bitmapDrawPos[0].x = 10; bitmapDrawPos[1].x = 400; bitmapDrawPos[2].x = 400; @@ -322,9 +322,9 @@ int32_t ewol::DistantFieldFont::Draw(Vector2D textPos, return totalSize; } -int32_t ewol::DistantFieldFont::Draw(Vector2D textPos, +int32_t ewol::DistantFieldFont::Draw(etk::Vector2D textPos, const uniChar_t unicodeChar, - etk::Vector > & coord, + etk::Vector > & coord, etk::Vector & coordTex) { float posDrawX = textPos.x; @@ -374,7 +374,7 @@ int32_t ewol::DistantFieldFont::Draw(Vector2D textPos, * | | * 3------2 */ - Vector2D bitmapDrawPos[4]; + etk::Vector2D bitmapDrawPos[4]; bitmapDrawPos[0].x = (int32_t)dxA; bitmapDrawPos[1].x = (int32_t)dxB; bitmapDrawPos[2].x = (int32_t)dxB; @@ -442,20 +442,20 @@ int32_t ewol::DistantFieldFont::Draw(Vector2D textPos, return sizeOut; } -Vector2D ewol::DistantFieldFont::GetSize(const etk::UString & unicodeString) +etk::Vector2D ewol::DistantFieldFont::GetSize(const etk::UString & unicodeString) { - Vector2D outputSize(0,m_height); + etk::Vector2D outputSize(0,m_height); for(int32_t iii=0; iii tmpp = GetSize(unicodeString[iii]); + etk::Vector2D tmpp = GetSize(unicodeString[iii]); outputSize.x += tmpp.x; } return outputSize; } -Vector2D ewol::DistantFieldFont::GetSize(const uniChar_t unicodeChar) +etk::Vector2D ewol::DistantFieldFont::GetSize(const uniChar_t unicodeChar) { - Vector2D outputSize(0,m_height); + etk::Vector2D outputSize(0,m_height); int32_t charIndex; if (unicodeChar >= 0x80) { charIndex = 0; diff --git a/Sources/libewol/ewol/font/DistantFieldFont.h b/Sources/libewol/ewol/font/DistantFieldFont.h index 3439bb34..4023b9f8 100644 --- a/Sources/libewol/ewol/font/DistantFieldFont.h +++ b/Sources/libewol/ewol/font/DistantFieldFont.h @@ -46,7 +46,7 @@ namespace ewol ewol::Font* m_font; etk::Vector m_listElement; // for the texture generation : - Vector2D m_lastGlyphPos; + etk::Vector2D m_lastGlyphPos; int32_t m_lastRawHeigh; public: DistantFieldFont(etk::UString fontName); @@ -54,16 +54,16 @@ namespace ewol virtual bool HasName(etk::UString& fileName); const char* GetType(void) { return "ewol::TexturedFont"; }; int32_t getFontSize(void) { return m_size; }; - int32_t Draw(Vector2D textPos, + int32_t Draw(etk::Vector2D textPos, const etk::UString& unicodeString, - etk::Vector > & coord, + etk::Vector > & coord, etk::Vector & coordTex); - int32_t Draw(Vector2D textPos, + int32_t Draw(etk::Vector2D textPos, const uniChar_t unicodeChar, - etk::Vector > & coord, + etk::Vector > & coord, etk::Vector & coordTex); - Vector2D GetSize(const etk::UString & unicodeString); - Vector2D GetSize(const uniChar_t unicodeChar); + etk::Vector2D GetSize(const etk::UString & unicodeString); + etk::Vector2D GetSize(const uniChar_t unicodeChar); // TODO : Remove this element, it is stupid ... int32_t GetHeight(void) { return m_height; }; int32_t GetFontSize(void) { return m_size; }; diff --git a/Sources/libewol/ewol/font/Font.h b/Sources/libewol/ewol/font/Font.h index 55c91f97..0dcd1e26 100644 --- a/Sources/libewol/ewol/font/Font.h +++ b/Sources/libewol/ewol/font/Font.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -72,9 +72,9 @@ namespace ewol typedef struct { uniChar_t m_UVal; // Unicode value int32_t m_glyphIndex; // Glyph index in the system - Vector2D m_sizeTexture; // size of the element to display - Vector2D m_bearing; // offset to display the data (can be negatif id the texture sise is bigger than the théoric places in the string) - Vector2D m_advance; // space use in the display for this specific char + etk::Vector2D m_sizeTexture; // size of the element to display + etk::Vector2D m_bearing; // offset to display the data (can be negatif id the texture sise is bigger than the théoric places in the string) + etk::Vector2D m_advance; // space use in the display for this specific char } GlyphProperty; class Font : public ewol::Resource @@ -85,21 +85,21 @@ namespace ewol const char* GetType(void) { return "ewol::Font"; }; virtual int32_t Draw(draw::Image& imageOut, int32_t fontSize, - Vector2D textPos, + etk::Vector2D textPos, const etk::UString& unicodeString, draw::Color& textColor) = 0; virtual int32_t Draw(draw::Image& imageOut, int32_t fontSize, - Vector2D textPos, + etk::Vector2D textPos, const uniChar_t unicodeChar, draw::Color& textColor) = 0; virtual bool GetGlyphProperty(int32_t fontSize, ewol::GlyphProperty& property) = 0; virtual bool DrawGlyph(draw::Image& imageOut, int32_t fontSize, - Vector2D glyphPosition, + etk::Vector2D glyphPosition, ewol::GlyphProperty& property) = 0; - virtual Vector2D GetSize(int32_t fontSize, const etk::UString & unicodeString) = 0; + virtual etk::Vector2D GetSize(int32_t fontSize, const etk::UString & unicodeString) = 0; virtual int32_t GetHeight(int32_t fontSize) = 0; }; }; diff --git a/Sources/libewol/ewol/font/FontFreeType.cpp b/Sources/libewol/ewol/font/FontFreeType.cpp index 46d80cb6..3aceff96 100644 --- a/Sources/libewol/ewol/font/FontFreeType.cpp +++ b/Sources/libewol/ewol/font/FontFreeType.cpp @@ -120,7 +120,7 @@ ewol::FontFreeType::~FontFreeType(void) int32_t ewol::FontFreeType::Draw(draw::Image& imageOut, int32_t fontSize, - Vector2D textPos, + etk::Vector2D textPos, const etk::UString& unicodeString, draw::Color& textColor) { @@ -133,7 +133,7 @@ int32_t ewol::FontFreeType::Draw(draw::Image& imageOut, int32_t ewol::FontFreeType::Draw(draw::Image& imageOut, int32_t fontSize, - Vector2D textPos, + etk::Vector2D textPos, const uniChar_t unicodeChar, draw::Color& textColor) { @@ -144,13 +144,13 @@ int32_t ewol::FontFreeType::Draw(draw::Image& imageOut, return 0; } -Vector2D ewol::FontFreeType::GetSize(int32_t fontSize, const etk::UString & unicodeString) +etk::Vector2D ewol::FontFreeType::GetSize(int32_t fontSize, const etk::UString & unicodeString) { if(false==m_init) { - return Vector2D(0,0); + return etk::Vector2D(0,0); } // TODO : ... - Vector2D outputSize(0,0); + etk::Vector2D outputSize(0,0); return outputSize; } @@ -206,7 +206,7 @@ bool ewol::FontFreeType::GetGlyphProperty(int32_t fontSize, bool ewol::FontFreeType::DrawGlyph(draw::Image& imageOut, int32_t fontSize, - Vector2D glyphPosition, + etk::Vector2D glyphPosition, ewol::GlyphProperty& property) { @@ -245,7 +245,7 @@ bool ewol::FontFreeType::DrawGlyph(draw::Image& imageOut, // set only alpha : tlpppp.a = slot->bitmap.buffer[iii + slot->bitmap.width*jjj]; // real set of color - imageOut.Set(Vector2D(glyphPosition.x+iii, glyphPosition.y+jjj), tlpppp ); + imageOut.Set(etk::Vector2D(glyphPosition.x+iii, glyphPosition.y+jjj), tlpppp ); } } return true; diff --git a/Sources/libewol/ewol/font/FontFreeType.h b/Sources/libewol/ewol/font/FontFreeType.h index 2cbe730c..1b447714 100644 --- a/Sources/libewol/ewol/font/FontFreeType.h +++ b/Sources/libewol/ewol/font/FontFreeType.h @@ -48,21 +48,21 @@ namespace ewol ~FontFreeType(void); int32_t Draw(draw::Image& imageOut, int32_t fontSize, - Vector2D textPos, + etk::Vector2D textPos, const etk::UString& unicodeString, draw::Color& textColor); int32_t Draw(draw::Image& imageOut, int32_t fontSize, - Vector2D textPos, + etk::Vector2D textPos, const uniChar_t unicodeChar, draw::Color& textColor); bool GetGlyphProperty(int32_t fontSize, ewol::GlyphProperty& property); bool DrawGlyph(draw::Image& imageOut, int32_t fontSize, - Vector2D glyphPosition, + etk::Vector2D glyphPosition, ewol::GlyphProperty& property); - Vector2D GetSize(int32_t fontSize, const etk::UString & unicodeString); + etk::Vector2D GetSize(int32_t fontSize, const etk::UString & unicodeString); int32_t GetHeight(int32_t fontSize); }; void FreeTypeInit(void); diff --git a/Sources/libewol/ewol/font/TexturedFont.cpp b/Sources/libewol/ewol/font/TexturedFont.cpp index 92af17a1..75a06fe2 100644 --- a/Sources/libewol/ewol/font/TexturedFont.cpp +++ b/Sources/libewol/ewol/font/TexturedFont.cpp @@ -127,7 +127,7 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) : EWOL_DEBUG("Generate a text texture for char(" << nbRaws << "," << nbLine << ") with size=(" << textureWidth << "," << textureHeight << ")"); // resize must be done on the texture ... - SetImageSize(Vector2D(textureWidth,textureHeight)); + SetImageSize(etk::Vector2D(textureWidth,textureHeight)); // now we can acces directly on the image m_data.SetFillColor(draw::Color(0xFFFFFF00)); m_data.Clear(); @@ -135,7 +135,7 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) : m_height = m_font->GetHeight(m_size); int32_t CurrentLineHigh = 0; - Vector2D glyphPosition(1,1); + etk::Vector2D glyphPosition(1,1); for (int32_t iii=0; iiiGetGlyphProperty(m_size, m_listElement[iii].property)) { /* @@ -187,11 +187,11 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) : draw::Color tlpppp(0xFF,0xFF,0xFF,0x00); for(int32_t jjj=0; jjj < textureHeight;jjj++) { for(int32_t iii=0; iii < textureWidth; iii++){ - tlpppp = m_data.Get(Vector2D(iii, jjj) ); + tlpppp = m_data.Get(etk::Vector2D(iii, jjj) ); // set only alpha : tlpppp.a = etk_min( tlpppp.a+0x60, 0xFF); // real set of color - m_data.Set(Vector2D(iii, jjj), tlpppp ); + m_data.Set(etk::Vector2D(iii, jjj), tlpppp ); } } #endif @@ -219,15 +219,15 @@ bool ewol::TexturedFont::HasName(etk::UString& fileName) -int32_t ewol::TexturedFont::Draw(Vector2D textPos, +int32_t ewol::TexturedFont::Draw(etk::Vector2D textPos, const etk::UString& unicodeString, - etk::Vector > & coord, + etk::Vector > & coord, etk::Vector & coordTex, bool hasClipping, clipping_ts& clipping) { float totalSize = 0; - Vector2D tmpPos = textPos; + etk::Vector2D tmpPos = textPos; for(int32_t iii=0; iii textPos, * | | * 3------2 */ - Vector2D bitmapDrawPos[4]; + etk::Vector2D bitmapDrawPos[4]; bitmapDrawPos[0].x = 10; bitmapDrawPos[1].x = 400; bitmapDrawPos[2].x = 400; @@ -307,9 +307,9 @@ int32_t ewol::TexturedFont::Draw(Vector2D textPos, return totalSize; } -int32_t ewol::TexturedFont::Draw(Vector2D textPos, +int32_t ewol::TexturedFont::Draw(etk::Vector2D textPos, const uniChar_t unicodeChar, - etk::Vector > & coord, + etk::Vector > & coord, etk::Vector & coordTex, bool hasClipping, clipping_ts& clipping) @@ -407,7 +407,7 @@ int32_t ewol::TexturedFont::Draw(Vector2D textPos, * | | * 3------2 */ - Vector2D bitmapDrawPos[4]; + etk::Vector2D bitmapDrawPos[4]; bitmapDrawPos[0].x = (int32_t)dxA; bitmapDrawPos[1].x = (int32_t)dxB; bitmapDrawPos[2].x = (int32_t)dxB; @@ -475,20 +475,20 @@ int32_t ewol::TexturedFont::Draw(Vector2D textPos, return sizeOut; } -Vector2D ewol::TexturedFont::GetSize(const etk::UString & unicodeString) +etk::Vector2D ewol::TexturedFont::GetSize(const etk::UString & unicodeString) { - Vector2D outputSize(0,m_height); + etk::Vector2D outputSize(0,m_height); for(int32_t iii=0; iii tmpp = GetSize(unicodeString[iii]); + etk::Vector2D tmpp = GetSize(unicodeString[iii]); outputSize.x += tmpp.x; } return outputSize; } -Vector2D ewol::TexturedFont::GetSize(const uniChar_t unicodeChar) +etk::Vector2D ewol::TexturedFont::GetSize(const uniChar_t unicodeChar) { - Vector2D outputSize(0,m_height); + etk::Vector2D outputSize(0,m_height); int32_t charIndex; if (unicodeChar >= 0x80) { charIndex = 0; diff --git a/Sources/libewol/ewol/font/TexturedFont.h b/Sources/libewol/ewol/font/TexturedFont.h index c086d791..2ced5ae3 100644 --- a/Sources/libewol/ewol/font/TexturedFont.h +++ b/Sources/libewol/ewol/font/TexturedFont.h @@ -46,7 +46,7 @@ namespace ewol ewol::Font* m_font; etk::Vector m_listElement; // for the texture generation : - Vector2D m_lastGlyphPos; + etk::Vector2D m_lastGlyphPos; int32_t m_lastRawHeigh; public: TexturedFont(etk::UString fontName); @@ -54,20 +54,20 @@ namespace ewol virtual bool HasName(etk::UString& fileName); const char* GetType(void) { return "ewol::TexturedFont"; }; int32_t getFontSize(void) { return m_size; }; - int32_t Draw(Vector2D textPos, + int32_t Draw(etk::Vector2D textPos, const etk::UString& unicodeString, - etk::Vector > & coord, + etk::Vector > & coord, etk::Vector & coordTex, bool hasClipping, clipping_ts& clipping); - int32_t Draw(Vector2D textPos, + int32_t Draw(etk::Vector2D textPos, const uniChar_t unicodeChar, - etk::Vector > & coord, + etk::Vector > & coord, etk::Vector & coordTex, bool hasClipping, clipping_ts& clipping); - Vector2D GetSize(const etk::UString & unicodeString); - Vector2D GetSize(const uniChar_t unicodeChar); + etk::Vector2D GetSize(const etk::UString & unicodeString); + etk::Vector2D GetSize(const uniChar_t unicodeChar); // TODO : Remove this element, it is stupid ... int32_t GetHeight(void) { return m_height; }; int32_t GetFontSize(void) { return m_size; }; diff --git a/Sources/libewol/ewol/game/GameElement.cpp b/Sources/libewol/ewol/game/GameElement.cpp index 2815f4e5..332987e5 100644 --- a/Sources/libewol/ewol/game/GameElement.cpp +++ b/Sources/libewol/ewol/game/GameElement.cpp @@ -57,7 +57,7 @@ ewol::GameElement::GameElement(SceneElement & sceneElement, etk::UString& tmpNam -float quadDist(Vector2D pos1, Vector2D pos2) +float quadDist(etk::Vector2D pos1, etk::Vector2D pos2) { float tmpVal1 = pos1.x - pos2.x; float tmpVal2 = pos1.y - pos2.y; @@ -66,7 +66,7 @@ float quadDist(Vector2D pos1, Vector2D pos2) } -bool ewol::GameElement::HaveImpact(int32_t group, int32_t type, Vector2D position, float size) +bool ewol::GameElement::HaveImpact(int32_t group, int32_t type, etk::Vector2D position, float size) { if (true != m_canHaveImpact) { return false; diff --git a/Sources/libewol/ewol/game/GameElement.h b/Sources/libewol/ewol/game/GameElement.h index ec3844e7..36b1ef45 100644 --- a/Sources/libewol/ewol/game/GameElement.h +++ b/Sources/libewol/ewol/game/GameElement.h @@ -42,23 +42,23 @@ namespace ewol { private: etk::UString m_fileNameConfig; protected: - SceneElement & m_sceneElement; //!< All element neede in the scene - uint16_t m_uniqueId; //!< General element ID (uint16_t, because all is reference with the groupId like this only a uint32_t reference an element) - uint16_t m_group; //!< General group Id More than 65000 group can be really interesting to create supid game ... - float m_life; //!< Current life of the element - int32_t m_type; //!< - float m_power; //!< Current power of the element - bool m_visible; //!< This is to know if the element is displayed or not ==> TODO : check if usefull ... - Vector2D m_position; //!< Current position of the element - float m_speed; //!< Speed of the element (only one value, the angle is generated by the m_angle - float m_angle; //!< Angle of the speed - float m_mass; //!< Current element Mass ==> for the physical calculation - float m_size; //!< Current size of the element more specific size can be done in the under class => this is for simplify calculation ==> all is consider like sphere... - float m_sizeDisplay; //!< Current diplay size of the element - bool m_canBeCibled; //!< This is for automatic finding on an ennemy - bool m_canHaveImpact; //!< detection of impact is done with this ... - float m_specialParam[NB_SPECIAL_PARAM]; //!< specific game user parameter - bool m_enable; //!< Use to add element that can not be detected by the other when user select a place + SceneElement & m_sceneElement; //!< All element neede in the scene + uint16_t m_uniqueId; //!< General element ID (uint16_t, because all is reference with the groupId like this only a uint32_t reference an element) + uint16_t m_group; //!< General group Id More than 65000 group can be really interesting to create supid game ... + float m_life; //!< Current life of the element + int32_t m_type; //!< + float m_power; //!< Current power of the element + bool m_visible; //!< This is to know if the element is displayed or not ==> TODO : check if usefull ... + etk::Vector2D m_position; //!< Current position of the element + float m_speed; //!< Speed of the element (only one value, the angle is generated by the m_angle + float m_angle; //!< Angle of the speed + float m_mass; //!< Current element Mass ==> for the physical calculation + float m_size; //!< Current size of the element more specific size can be done in the under class => this is for simplify calculation ==> all is consider like sphere... + float m_sizeDisplay; //!< Current diplay size of the element + bool m_canBeCibled; //!< This is for automatic finding on an ennemy + bool m_canHaveImpact; //!< detection of impact is done with this ... + float m_specialParam[NB_SPECIAL_PARAM]; //!< specific game user parameter + bool m_enable; //!< Use to add element that can not be detected by the other when user select a place public: /** * @brief Constructor : here are requested all the needed sprite and effect that can be used in the game @@ -83,8 +83,8 @@ namespace ewol { void SetVisible(bool state) { m_visible = state; StatusUpdate();}; bool IsEnable(void) { return m_enable; }; void SetEnable(bool state) { m_enable = state; StatusUpdate();}; - Vector2D PositionGet(void) { return m_position; }; - void PositionSet(Vector2D state) { m_position = state; StatusUpdate();}; + etk::Vector2D PositionGet(void) { return m_position; }; + void PositionSet(etk::Vector2D state) { m_position = state; StatusUpdate();}; void PositionSet(float xxx, float yyy) { m_position.x = xxx; m_position.y = yyy; StatusUpdate();}; float SpeedGet(void) { return m_speed; }; void SpeedSet(float state) { m_speed = state; StatusUpdate();}; @@ -145,8 +145,8 @@ namespace ewol { * @return --- */ virtual void RemoveElement(int32_t idOfElement) { }; - virtual bool HaveImpact(int32_t group, int32_t type, Vector2D position, float size); - virtual bool Explosion(int32_t group, int32_t type, Vector2D position, float pxAtenuation, float power) { return false; } ; + virtual bool HaveImpact(int32_t group, int32_t type, etk::Vector2D position, float size); + virtual bool Explosion(int32_t group, int32_t type, etk::Vector2D position, float pxAtenuation, float power) { return false; } ; virtual etk::UString Message(etk::UString control, etk::UString message) { return ""; } ; virtual void StatusUpdate(void) { }; @@ -156,6 +156,6 @@ namespace ewol { #include -float quadDist(Vector2D pos1, Vector2D pos2); +float quadDist(etk::Vector2D pos1, etk::Vector2D pos2); #endif diff --git a/Sources/libewol/ewol/game/GameElementLua.cpp b/Sources/libewol/ewol/game/GameElementLua.cpp index 6f3e9f97..458f3c5c 100644 --- a/Sources/libewol/ewol/game/GameElementLua.cpp +++ b/Sources/libewol/ewol/game/GameElementLua.cpp @@ -141,7 +141,7 @@ LUAMOD_API int lua_GetPos(lua_State *L) lua_pushnumber(L, (lua_Number)0 ); return 2; } - Vector2D tmpPos = tmpObj->PositionGet(); + etk::Vector2D tmpPos = tmpObj->PositionGet(); lua_pushnumber(L, (lua_Number)tmpPos.x ); lua_pushnumber(L, (lua_Number)tmpPos.y ); // return number of parameters @@ -156,7 +156,7 @@ LUAMOD_API int lua_SetPos(lua_State *L) } float x = luaL_checknumber(L, 1); float y = luaL_checknumber(L, 2); - Vector2D tmpPos; + etk::Vector2D tmpPos; tmpPos.x = x; tmpPos.y = y; tmpObj->PositionSet(tmpPos); @@ -354,7 +354,7 @@ LUAMOD_API int lua_SpriteUnLoad(lua_State *L) return 1; } float a = luaL_checkint(L, 1); - Vector2D tmpPos = tmpObj->PositionGet(); + etk::Vector2D tmpPos = tmpObj->PositionGet(); tmpPos.y = a; tmpObj->PositionSet(tmpPos); */ @@ -370,7 +370,7 @@ LUAMOD_API int lua_SpriteDraw(lua_State *L) return 0; } float spriteID = luaL_checknumber(L, 1); - Vector2D tmpPos; + etk::Vector2D tmpPos; tmpPos.x = luaL_checknumber(L, 2); tmpPos.y = luaL_checknumber(L, 3); float angle = luaL_checknumber(L, 4); @@ -424,7 +424,7 @@ LUAMOD_API int lua_ElementSetPos(lua_State *L) int32_t idElement = luaL_checkint(L, 1); ewol::GameElement* tmpElem = tmpScene->GetElement(idElement); if (NULL != tmpElem) { - Vector2D tmpPos; + etk::Vector2D tmpPos; tmpPos.x = luaL_checknumber(L, 2); tmpPos.y = luaL_checknumber(L, 3); tmpElem->PositionSet(tmpPos); @@ -447,7 +447,7 @@ LUAMOD_API int lua_ElementGetPos(lua_State *L) int32_t idElement = luaL_checkint(L, 1); ewol::GameElement* tmpElem = tmpScene->GetElement(idElement); if (NULL != tmpElem) { - Vector2D tmpPos = tmpElem->PositionGet(); + etk::Vector2D tmpPos = tmpElem->PositionGet(); lua_pushnumber(L, (lua_Number)tmpPos.x ); lua_pushnumber(L, (lua_Number)tmpPos.y ); } else { @@ -809,7 +809,7 @@ void ewol::GameElementLua::Draw(void) } -bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, Vector2D position, float size) +bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, etk::Vector2D position, float size) { // todo set a flag that permit lua to direct control of this ... if (false == ewol::GameElement::HaveImpact(group, type, position, size) ) { @@ -852,7 +852,7 @@ bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, Vector2D position, float pxAtenuation, float power) +bool ewol::GameElementLua::Explosion(int32_t group, int32_t type, etk::Vector2D position, float pxAtenuation, float power) { tmpObj = this; bool retVal = false; diff --git a/Sources/libewol/ewol/game/GameElementLua.h b/Sources/libewol/ewol/game/GameElementLua.h index 0e46935a..f3e8ce37 100644 --- a/Sources/libewol/ewol/game/GameElementLua.h +++ b/Sources/libewol/ewol/game/GameElementLua.h @@ -47,8 +47,8 @@ namespace ewol { virtual void UnInit(void); virtual bool Process(int64_t time, int32_t deltaTime); virtual void Draw(void); - virtual bool HaveImpact(int32_t group, int32_t type, Vector2D position, float size); - virtual bool Explosion(int32_t group, int32_t type, Vector2D position, float pxAtenuation, float power); + virtual bool HaveImpact(int32_t group, int32_t type, etk::Vector2D position, float size); + virtual bool Explosion(int32_t group, int32_t type, etk::Vector2D position, float pxAtenuation, float power); virtual etk::UString Message(etk::UString control, etk::UString message); }; void RegisterLuaElementInFolder(ewol::SceneElement & sceneElement, etk::UString folder); diff --git a/Sources/libewol/ewol/game/SceneElement.cpp b/Sources/libewol/ewol/game/SceneElement.cpp index 2eb8ff2d..0037654f 100644 --- a/Sources/libewol/ewol/game/SceneElement.cpp +++ b/Sources/libewol/ewol/game/SceneElement.cpp @@ -242,7 +242,7 @@ ewol::GameElement* ewol::SceneElement::GetElement(uint32_t idElement) } -uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D position, int32_t groupId, float maxRange) +uint32_t ewol::SceneElement::GetNearestEnemy(etk::Vector2D position, int32_t groupId, float maxRange) { uint32_t result = 0; float lastQuadDistance = 9999999999999999.0; @@ -261,7 +261,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D position, int32_t g if (NULL != listAnimatedElements[gId][iii]) { if( true == listAnimatedElements[gId][iii]->IsEnable() && true == listAnimatedElements[gId][iii]->CanBeCibledGet()) { - Vector2D tmpPos = listAnimatedElements[gId][iii]->PositionGet(); + etk::Vector2D tmpPos = listAnimatedElements[gId][iii]->PositionGet(); float distance = quadDist(position, tmpPos); if( distance <= lastQuadDistance && maxRange >= distance ) { @@ -276,7 +276,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D position, int32_t g return result; } -void ewol::SceneElement::GetNearestEnemy(Vector2D position, int32_t groupId, float maxRange, etk::Vector& list) +void ewol::SceneElement::GetNearestEnemy(etk::Vector2D position, int32_t groupId, float maxRange, etk::Vector& list) { // remove all elements.. list.Clear(); @@ -295,7 +295,7 @@ void ewol::SceneElement::GetNearestEnemy(Vector2D position, int32_t group if (NULL != listAnimatedElements[gId][iii]) { if( true == listAnimatedElements[gId][iii]->IsEnable() && true == listAnimatedElements[gId][iii]->CanBeCibledGet()) { - Vector2D tmpPos = listAnimatedElements[gId][iii]->PositionGet(); + etk::Vector2D tmpPos = listAnimatedElements[gId][iii]->PositionGet(); float distance = quadDist(position, tmpPos); if(maxRange >= distance) { uint32_t tmpp = createUniqueId(listAnimatedElements[gId][iii]->GetUniqueId(), iii); @@ -308,7 +308,7 @@ void ewol::SceneElement::GetNearestEnemy(Vector2D position, int32_t group } } -uint32_t ewol::SceneElement::GetNearestFriend(Vector2D position, int32_t groupId, uint32_t us) +uint32_t ewol::SceneElement::GetNearestFriend(etk::Vector2D position, int32_t groupId, uint32_t us) { uint32_t result = 0; float lastQuadDistance = 9999999999999999.0; @@ -321,7 +321,7 @@ uint32_t ewol::SceneElement::GetNearestFriend(Vector2D position, int32_t if (NULL != listAnimatedElements[gId][iii]) { if( true == listAnimatedElements[gId][iii]->IsEnable() && true == listAnimatedElements[gId][iii]->CanBeCibledGet()) { - Vector2D tmpPos = listAnimatedElements[gId][iii]->PositionGet(); + etk::Vector2D tmpPos = listAnimatedElements[gId][iii]->PositionGet(); float distance = quadDist(position, tmpPos); if( distance <= lastQuadDistance && us != listAnimatedElements[gId][iii]->GetUniqueId() ) { @@ -335,7 +335,7 @@ uint32_t ewol::SceneElement::GetNearestFriend(Vector2D position, int32_t } -void ewol::SceneElement::GetNearestFriend(Vector2D position, int32_t groupId, float maxRange, etk::Vector& list, uint32_t us) +void ewol::SceneElement::GetNearestFriend(etk::Vector2D position, int32_t groupId, float maxRange, etk::Vector& list, uint32_t us) { // remove all elements.. list.Clear(); @@ -348,7 +348,7 @@ void ewol::SceneElement::GetNearestFriend(Vector2D position, int32_t grou if (NULL != listAnimatedElements[groupId][iii]) { if( true == listAnimatedElements[groupId][iii]->IsEnable() && true == listAnimatedElements[groupId][iii]->CanBeCibledGet()) { - Vector2D tmpPos = listAnimatedElements[groupId][iii]->PositionGet(); + etk::Vector2D tmpPos = listAnimatedElements[groupId][iii]->PositionGet(); float distance = quadDist(position, tmpPos); if( maxRange >= distance && us != listAnimatedElements[groupId][iii]->GetUniqueId() ) { @@ -360,7 +360,7 @@ void ewol::SceneElement::GetNearestFriend(Vector2D position, int32_t grou } } -bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D position, float size) +bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, etk::Vector2D position, float size) { for (int32_t jjj=0; jjj return false; } -void ewol::SceneElement::Explosion(int32_t group, int32_t type, Vector2D position, float pxAtenuation, float power) +void ewol::SceneElement::Explosion(int32_t group, int32_t type, etk::Vector2D position, float pxAtenuation, float power) { for (int32_t jjj=0; jjj } -uint32_t ewol::SceneElement::GetElementAtPos(Vector2D position, int32_t maxDistanceDetection) +uint32_t ewol::SceneElement::GetElementAtPos(etk::Vector2D position, int32_t maxDistanceDetection) { uint32_t result = 0; float lastQuadDistance = 9999999999999999.0; @@ -400,7 +400,7 @@ uint32_t ewol::SceneElement::GetElementAtPos(Vector2D position, int32_t m for (int32_t iii=0; iiiIsEnable()) { - Vector2D tmpPos = listAnimatedElements[jjj][iii]->PositionGet(); + etk::Vector2D tmpPos = listAnimatedElements[jjj][iii]->PositionGet(); float distance = quadDist(position, tmpPos); if (distance <= lastQuadDistance) { lastQuadDistance = distance; @@ -416,7 +416,7 @@ uint32_t ewol::SceneElement::GetElementAtPos(Vector2D position, int32_t m return result; } -void ewol::SceneElement::SetEventInput(uint32_t id, Vector2D position) +void ewol::SceneElement::SetEventInput(uint32_t id, etk::Vector2D position) { EWOL_TODO("but when ..."); } diff --git a/Sources/libewol/ewol/game/SceneElement.h b/Sources/libewol/ewol/game/SceneElement.h index 5b4ac19e..54f48d47 100644 --- a/Sources/libewol/ewol/game/SceneElement.h +++ b/Sources/libewol/ewol/game/SceneElement.h @@ -67,14 +67,14 @@ namespace ewol { uint32_t AddElement(int32_t group, ewol::GameElement* newElement); uint32_t AddElementNamed(int32_t group, etk::UString &elementName); ewol::GameElement* GetElement(uint32_t idElement); - uint32_t GetNearestEnemy(Vector2D position, int32_t groupId, float maxRange=9999999999999999.0); - void GetNearestEnemy(Vector2D position, int32_t groupId, float maxRange, etk::Vector& list); - uint32_t GetNearestFriend(Vector2D position, int32_t groupId, uint32_t us); - void GetNearestFriend(Vector2D position, int32_t groupId, float maxRange, etk::Vector& list, uint32_t us); - bool HaveImpact(int32_t group, int32_t type, Vector2D position, float size); - void Explosion(int32_t group, int32_t type, Vector2D position, float pxAtenuation, float power); - uint32_t GetElementAtPos(Vector2D position, int32_t maxDistanceDetection); - void SetEventInput(uint32_t id, Vector2D position); + uint32_t GetNearestEnemy(etk::Vector2D position, int32_t groupId, float maxRange=9999999999999999.0); + void GetNearestEnemy(etk::Vector2D position, int32_t groupId, float maxRange, etk::Vector& list); + uint32_t GetNearestFriend(etk::Vector2D position, int32_t groupId, uint32_t us); + void GetNearestFriend(etk::Vector2D position, int32_t groupId, float maxRange, etk::Vector& list, uint32_t us); + bool HaveImpact(int32_t group, int32_t type, etk::Vector2D position, float size); + void Explosion(int32_t group, int32_t type, etk::Vector2D position, float pxAtenuation, float power); + uint32_t GetElementAtPos(etk::Vector2D position, int32_t maxDistanceDetection); + void SetEventInput(uint32_t id, etk::Vector2D position); void SetEventExternButton(uint32_t id, int32_t btId, int32_t state); void SetEventExternJoystick(uint32_t id, int32_t joyId, float angle, float distance, int32_t state); /** diff --git a/Sources/libewol/ewol/oObject/2DColored.cpp b/Sources/libewol/ewol/oObject/2DColored.cpp index 75e1c86c..f68c501b 100644 --- a/Sources/libewol/ewol/oObject/2DColored.cpp +++ b/Sources/libewol/ewol/oObject/2DColored.cpp @@ -71,7 +71,7 @@ void ewol::OObject2DColored::Draw(void) //glScalef(m_scaling.x, m_scaling.y, 1.0); m_GLprogram->Use(); // set Matrix : translation/positionMatrix - etk::Matrix tmpMatrix = ewol::openGL::GetMatrix(); + etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix(); m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // position : m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]); @@ -110,7 +110,7 @@ void ewol::OObject2DColored::Clear(void) } -void generatePolyGone(etk::Vector > & input, etk::Vector > & output ) +void generatePolyGone(etk::Vector > & input, etk::Vector > & output ) { if (input.Size()<3) { return; @@ -124,7 +124,7 @@ void generatePolyGone(etk::Vector > & input, etk::Vector " << output.Size() ); } -void SutherlandHodgman(etk::Vector > & input, etk::Vector > & output, float sx, float sy, float ex, float ey) +void SutherlandHodgman(etk::Vector > & input, etk::Vector > & output, float sx, float sy, float ex, float ey) { // with Sutherland-Hodgman-Algorithm if (input.Size() <0) { @@ -132,8 +132,8 @@ void SutherlandHodgman(etk::Vector > & input, etk::Vector destPoint; - Vector2D lastElement = input[input.Size()-1]; + etk::Vector2D destPoint; + etk::Vector2D lastElement = input[input.Size()-1]; bool inside = true; if (lastElement.x < sx) { inside = false; @@ -356,10 +356,10 @@ void ewol::OObject2DColored::SetColor(float red, float green, float blue, float } -void ewol::OObject2DColored::SetPoint(Vector2D point) +void ewol::OObject2DColored::SetPoint(etk::Vector2D point) { // TODO : Clean this : - Vector2D tmpElement; + etk::Vector2D tmpElement; tmpElement.x = point.x; tmpElement.y = point.y; m_triangle[m_triElement] = tmpElement; diff --git a/Sources/libewol/ewol/oObject/2DColored.h b/Sources/libewol/ewol/oObject/2DColored.h index 42b9ecfb..4dd49729 100644 --- a/Sources/libewol/ewol/oObject/2DColored.h +++ b/Sources/libewol/ewol/oObject/2DColored.h @@ -43,7 +43,7 @@ namespace ewol { int32_t m_GLMatrix; int32_t m_GLColor; #endif - etk::Vector > m_coord; //!< internal coord of the object + etk::Vector > m_coord; //!< internal coord of the object #ifdef __VIDEO__OPENGL_ES_2 etk::Vector m_coordColor; //!< internal color of the different point draw::Colorf m_color[3]; @@ -52,14 +52,14 @@ namespace ewol { draw::Color m_color[3]; #endif int32_t m_triElement; - Vector2D m_triangle[3]; + etk::Vector2D m_triangle[3]; void GenerateTriangle(void); void ResetCount(void); public: void Clear(void); void SetColor(float red, float green, float blue, float alpha = 1.0); void SetColor(draw::Color color); - void SetPoint(Vector2D point); + void SetPoint(etk::Vector2D point); void SetPoint(float x, float y); void Line(float sx, float sy, float ex, float ey, float thickness); void Rectangle(float x, float y, float w, float h); diff --git a/Sources/libewol/ewol/oObject/2DTextColored.cpp b/Sources/libewol/ewol/oObject/2DTextColored.cpp index 32e24c68..afe186c5 100644 --- a/Sources/libewol/ewol/oObject/2DTextColored.cpp +++ b/Sources/libewol/ewol/oObject/2DTextColored.cpp @@ -137,7 +137,7 @@ void ewol::OObject2DTextColored::Draw(void) } m_GLprogram->Use(); // set Matrix : translation/positionMatrix - etk::Matrix tmpMatrix = ewol::openGL::GetMatrix(); + etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix(); m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // TextureID m_GLprogram->SetTexture0(m_GLtexID, m_font->GetId()); @@ -175,7 +175,7 @@ void ewol::OObject2DTextColored::Clear(void) m_coordColor.Clear(); } -int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const etk::UString& unicodeString) +int32_t ewol::OObject2DTextColored::Text(etk::Vector2D textPos, const etk::UString& unicodeString) { if (m_font == NULL) { EWOL_ERROR("Font Id is not corectly defined"); @@ -191,7 +191,7 @@ int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const etk::USt return size; } -int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const uniChar_t unicodeChar) +int32_t ewol::OObject2DTextColored::Text(etk::Vector2D textPos, const uniChar_t unicodeChar) { if (m_font == NULL) { EWOL_ERROR("Font Id is not corectly defined"); @@ -218,20 +218,20 @@ void ewol::OObject2DTextColored::SetColor(float red, float green, float blue, fl m_color = draw::Color(red, green, blue, alpha); } -Vector2D ewol::OObject2DTextColored::GetSize(const uniChar_t unicodeChar) +etk::Vector2D ewol::OObject2DTextColored::GetSize(const uniChar_t unicodeChar) { if (m_font == NULL) { EWOL_ERROR("Font Id is not corectly defined"); - return Vector2D(0,0); + return etk::Vector2D(0,0); } return m_font->GetSize(unicodeChar); } -Vector2D ewol::OObject2DTextColored::GetSize(const etk::UString& unicodeString) +etk::Vector2D ewol::OObject2DTextColored::GetSize(const etk::UString& unicodeString) { if (m_font == NULL) { EWOL_ERROR("Font Id is not corectly defined"); - return Vector2D(0,0); + return etk::Vector2D(0,0); } return m_font->GetSize(unicodeString); } diff --git a/Sources/libewol/ewol/oObject/2DTextColored.h b/Sources/libewol/ewol/oObject/2DTextColored.h index 4e7607ab..2d9286f2 100644 --- a/Sources/libewol/ewol/oObject/2DTextColored.h +++ b/Sources/libewol/ewol/oObject/2DTextColored.h @@ -42,8 +42,8 @@ namespace ewol { void SetColor(draw::Color color); // set a specific text void Clear(void); - int32_t Text(Vector2D textPos, const etk::UString& unicodeString); - int32_t Text(Vector2D textPos, const uniChar_t unicodeChar); + int32_t Text(etk::Vector2D textPos, const etk::UString& unicodeString); + int32_t Text(etk::Vector2D textPos, const uniChar_t unicodeChar); protected: #ifdef __VIDEO__OPENGL_ES_2 ewol::Program* m_GLprogram; @@ -55,7 +55,7 @@ namespace ewol { #endif ewol::TexturedFont* m_font; //!< ewol font system draw::Color m_color; //!< tmp text color ... - etk::Vector > m_coord; //!< internal coord of the object + etk::Vector > m_coord; //!< internal coord of the object etk::Vector m_coordTex; //!< internal texture coordinate for every point #ifdef __VIDEO__OPENGL_ES_2 etk::Vector m_coordColor; //!< internal color of the different point @@ -67,8 +67,8 @@ namespace ewol { void SetSize(int32_t fontSize); void SetFontProperty(etk::UString fontName, int32_t fontSize); int32_t GetHeight(void) { return (NULL!=m_font)?m_font->GetHeight():10; }; - Vector2D GetSize(const uniChar_t unicodeChar); - Vector2D GetSize(const etk::UString& unicodeString); + etk::Vector2D GetSize(const uniChar_t unicodeChar); + etk::Vector2D GetSize(const etk::UString& unicodeString); }; }; diff --git a/Sources/libewol/ewol/oObject/2DTextShader.cpp b/Sources/libewol/ewol/oObject/2DTextShader.cpp index 3bafd1fa..392078ef 100644 --- a/Sources/libewol/ewol/oObject/2DTextShader.cpp +++ b/Sources/libewol/ewol/oObject/2DTextShader.cpp @@ -143,7 +143,7 @@ void ewol::OObject2DTextShader::Draw(void) } m_GLprogram->Use(); // set Matrix : translation/positionMatrix - etk::Matrix tmpMatrix = ewol::openGL::GetMatrix(); + etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix(); m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // TextureID m_GLprogram->SetTexture0(m_GLtexID, m_font->GetId()); @@ -169,7 +169,7 @@ void ewol::OObject2DTextShader::Clear(void) m_coordColor.Clear(); } -int32_t ewol::OObject2DTextShader::Text(Vector2D textPos, const etk::UString& unicodeString) +int32_t ewol::OObject2DTextShader::Text(etk::Vector2D textPos, const etk::UString& unicodeString) { if (m_font == NULL) { EWOL_ERROR("Font Id is not corectly defined"); @@ -189,7 +189,7 @@ int32_t ewol::OObject2DTextShader::Text(Vector2D textPos, const etk::UStr return size; } -int32_t ewol::OObject2DTextShader::Text(Vector2D textPos, const uniChar_t unicodeChar) +int32_t ewol::OObject2DTextShader::Text(etk::Vector2D textPos, const uniChar_t unicodeChar) { if (m_font == NULL) { EWOL_ERROR("Font Id is not corectly defined"); @@ -220,20 +220,20 @@ void ewol::OObject2DTextShader::SetColor(float red, float green, float blue, flo m_color = draw::Color(red, green, blue, alpha); } -Vector2D ewol::OObject2DTextShader::GetSize(const uniChar_t unicodeChar) +etk::Vector2D ewol::OObject2DTextShader::GetSize(const uniChar_t unicodeChar) { if (m_font == NULL) { EWOL_ERROR("Font Id is not corectly defined"); - return Vector2D(0,0); + return etk::Vector2D(0,0); } return m_font->GetSize(unicodeChar); } -Vector2D ewol::OObject2DTextShader::GetSize(const etk::UString& unicodeString) +etk::Vector2D ewol::OObject2DTextShader::GetSize(const etk::UString& unicodeString) { if (m_font == NULL) { EWOL_ERROR("Font Id is not corectly defined"); - return Vector2D(0,0); + return etk::Vector2D(0,0); } return m_font->GetSize(unicodeString); } diff --git a/Sources/libewol/ewol/oObject/2DTextShader.h b/Sources/libewol/ewol/oObject/2DTextShader.h index e31a648d..0be08455 100644 --- a/Sources/libewol/ewol/oObject/2DTextShader.h +++ b/Sources/libewol/ewol/oObject/2DTextShader.h @@ -44,8 +44,8 @@ namespace ewol { void SetColor(draw::Color color); // set a specific text void Clear(void); - int32_t Text(Vector2D textPos, const etk::UString& unicodeString); - int32_t Text(Vector2D textPos, const uniChar_t unicodeChar); + int32_t Text(etk::Vector2D textPos, const etk::UString& unicodeString); + int32_t Text(etk::Vector2D textPos, const uniChar_t unicodeChar); protected: ewol::Program* m_GLprogram; int32_t m_GLPosition; @@ -58,7 +58,7 @@ namespace ewol { int32_t m_GLSoftEdge; ewol::DistantFieldFont* m_font; //!< ewol font system draw::Color m_color; //!< tmp text color ... - etk::Vector > m_coord; //!< internal coord of the object + etk::Vector > m_coord; //!< internal coord of the object etk::Vector m_coordTex; //!< internal texture coordinate for every point etk::Vector m_coordColor; //!< internal color of the different point bool m_bold; @@ -70,8 +70,8 @@ namespace ewol { void SetSize(int32_t fontSize); void SetFontProperty(etk::UString fontName, int32_t fontSize); int32_t GetHeight(void) { return (NULL!=m_font)?m_font->GetHeight():10; }; - Vector2D GetSize(const uniChar_t unicodeChar); - Vector2D GetSize(const etk::UString& unicodeString); + etk::Vector2D GetSize(const uniChar_t unicodeChar); + etk::Vector2D GetSize(const etk::UString& unicodeString); }; }; diff --git a/Sources/libewol/ewol/oObject/2DTextured.cpp b/Sources/libewol/ewol/oObject/2DTextured.cpp index a20ee60a..15d439ce 100644 --- a/Sources/libewol/ewol/oObject/2DTextured.cpp +++ b/Sources/libewol/ewol/oObject/2DTextured.cpp @@ -34,7 +34,7 @@ ewol::OObject2DTextured::OObject2DTextured(etk::UString textureName, float sizeX { EWOL_VERBOSE("Create OObject textured : \"" << textureName << "\""); ewol::TextureFile* resourceFile = NULL; - if (false == ewol::resource::Keep(textureName, resourceFile, Vector2D(sizeX,sizeY)) ) { + if (false == ewol::resource::Keep(textureName, resourceFile, etk::Vector2D(sizeX,sizeY)) ) { EWOL_CRITICAL("can not get a resource Texture"); } m_resource = resourceFile; @@ -58,7 +58,7 @@ ewol::OObject2DTextured::OObject2DTextured( float sizeX, float sizeY) EWOL_CRITICAL("can not get a resource Texture"); } if (NULL!=m_resource) { - m_resource->SetImageSize(Vector2D(sizeX,sizeY)); + m_resource->SetImageSize(etk::Vector2D(sizeX,sizeY)); draw::Image& tmpImage = m_resource->Get(); tmpImage.SetFillColor(draw::color::black); tmpImage.Clear(); @@ -105,7 +105,7 @@ void ewol::OObject2DTextured::Draw(void) } m_GLprogram->Use(); // set Matrix : translation/positionMatrix - etk::Matrix tmpMatrix = ewol::openGL::GetMatrix(); + etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix(); m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // TextureID m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId()); @@ -159,7 +159,7 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa h -= 6; */ //EWOL_DEBUG("Add rectangle : ..."); - Vector2D point; + etk::Vector2D point; texCoord_ts tex; tex.u = texX; diff --git a/Sources/libewol/ewol/oObject/2DTextured.h b/Sources/libewol/ewol/oObject/2DTextured.h index 588f1f8b..ef57cc11 100644 --- a/Sources/libewol/ewol/oObject/2DTextured.h +++ b/Sources/libewol/ewol/oObject/2DTextured.h @@ -50,7 +50,7 @@ namespace ewol { int32_t m_GLtexID; #endif ewol::Texture* m_resource; //!< texture resources - etk::Vector > m_coord; //!< internal coord of the object + etk::Vector > m_coord; //!< internal coord of the object etk::Vector m_coordTex; //!< internal texture coordinate for every point #ifdef __VIDEO__OPENGL_ES_2 etk::Vector m_coordColor; //!< internal color of the different point diff --git a/Sources/libewol/ewol/oObject/3DTextured.cpp b/Sources/libewol/ewol/oObject/3DTextured.cpp index c2f25498..3f5ee78a 100644 --- a/Sources/libewol/ewol/oObject/3DTextured.cpp +++ b/Sources/libewol/ewol/oObject/3DTextured.cpp @@ -33,7 +33,7 @@ ewol::OObject3DTextured::OObject3DTextured(etk::UString textureName, float sizeX, float sizeY) { EWOL_VERBOSE("Create OObject textured : \"" << textureName << "\""); - if (false == ewol::resource::Keep(textureName, m_resource, Vector2D(sizeX,sizeY)) ) { + if (false == ewol::resource::Keep(textureName, m_resource, etk::Vector2D(sizeX,sizeY)) ) { EWOL_CRITICAL("can not get a resource Texture"); } #ifdef __VIDEO__OPENGL_ES_2 @@ -78,7 +78,7 @@ void ewol::OObject3DTextured::Draw(void) //EWOL_DEBUG(" Display " << m_coord.Size() << " elements" ); m_GLprogram->Use(); // set Matrix : translation/positionMatrix - etk::Matrix tmpMatrix = ewol::openGL::GetMatrix(); + etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix(); m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // TextureID m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId()); @@ -132,7 +132,7 @@ void ewol::OObject3DTextured::Rectangle(float x, float y, float w, float h, floa h -= 6; */ //EWOL_DEBUG("Add rectangle : ..."); - Vector3D point; + etk::Vector3D point; texCoord_ts tex; point.z = 0; diff --git a/Sources/libewol/ewol/oObject/3DTextured.h b/Sources/libewol/ewol/oObject/3DTextured.h index 0a324e33..a2fe6894 100644 --- a/Sources/libewol/ewol/oObject/3DTextured.h +++ b/Sources/libewol/ewol/oObject/3DTextured.h @@ -48,13 +48,13 @@ namespace ewol { int32_t m_GLtexture; int32_t m_GLtexID; #endif - ewol::TextureFile* m_resource; //!< texture resources - etk::Vector > m_coord; //!< internal coord of the object - etk::Vector m_coordTex; //!< internal texture coordinate for every point + ewol::TextureFile* m_resource; //!< texture resources + etk::Vector > m_coord; //!< internal coord of the object + etk::Vector m_coordTex; //!< internal texture coordinate for every point #ifdef __VIDEO__OPENGL_ES_2 - etk::Vector m_coordColor; //!< internal color of the different point + etk::Vector m_coordColor; //!< internal color of the different point #else - etk::Vector m_coordColor; //!< internal color of the different point + etk::Vector m_coordColor; //!< internal color of the different point #endif }; }; diff --git a/Sources/libewol/ewol/oObject/OObject.h b/Sources/libewol/ewol/oObject/OObject.h index 196539ab..605d7a6c 100644 --- a/Sources/libewol/ewol/oObject/OObject.h +++ b/Sources/libewol/ewol/oObject/OObject.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -47,14 +47,14 @@ namespace ewol { int32_t m_nbLoadedTime; //!< specific in case of non multiple allocation bool m_hasClipping; clipping_ts m_clipping; - Vector2D m_scaling; //!< scaling ol the object + etk::Vector2D m_scaling; //!< scaling ol the object public: OObject(void); virtual ~OObject(void); void clippingSet(clipping_ts clip) {m_clipping = clip; m_hasClipping = true;}; void clippingDisable(void) {m_hasClipping = false;}; void clippingEnable(void) {m_hasClipping = true;}; - void scalingSet(Vector2D scale) {m_scaling = scale;}; + void scalingSet(etk::Vector2D scale) {m_scaling = scale;}; virtual void Draw(void) = 0; /** * @brief Increase the number of element registered on this class ==> this is specific to decrese the memory usage in special case (scene) diff --git a/Sources/libewol/ewol/oObject/Sprite.cpp b/Sources/libewol/ewol/oObject/Sprite.cpp index 704686d8..63a94329 100644 --- a/Sources/libewol/ewol/oObject/Sprite.cpp +++ b/Sources/libewol/ewol/oObject/Sprite.cpp @@ -43,25 +43,25 @@ ewol::Sprite::~Sprite(void) } -void ewol::Sprite::Element(Vector2D pos, float size, float angle) +void ewol::Sprite::Element(etk::Vector2D pos, float size, float angle) { draw::Color tmpColor(0xFFFFFFFF); - Vector3D pos2; + etk::Vector3D pos2; pos2.x = pos.x; pos2.y = pos.y; pos2.z = 0.0; Element(pos2, size, angle, tmpColor); } -void ewol::Sprite::Element(Vector3D pos, float size, float angle) +void ewol::Sprite::Element(etk::Vector3D pos, float size, float angle) { draw::Color tmpColor(0xFFFFFFFF); Element(pos, size, angle, tmpColor); } -void ewol::Sprite::Element(Vector2D pos, float size, float angle, draw::Color tmpColor) +void ewol::Sprite::Element(etk::Vector2D pos, float size, float angle, draw::Color tmpColor) { - Vector3D pos2; + etk::Vector3D pos2; pos2.x = pos.x; pos2.y = pos.y; pos2.z = 0.0; @@ -69,7 +69,7 @@ void ewol::Sprite::Element(Vector2D pos, float size, float angle, draw::C } -void ewol::Sprite::Element(Vector3D pos, float size, float angle, draw::Color tmpColor) +void ewol::Sprite::Element(etk::Vector3D pos, float size, float angle, draw::Color tmpColor) { angle -= M_PI/4; size *= 0.7; @@ -88,7 +88,7 @@ void ewol::Sprite::Element(Vector3D pos, float size, float angle, draw::C #else draw::Color localColor = tmpColor; #endif - Vector3D point = pos; + etk::Vector3D point = pos; float yyySin = sin(angle) * size; float xxxCos = cos(angle) * size; diff --git a/Sources/libewol/ewol/oObject/Sprite.h b/Sources/libewol/ewol/oObject/Sprite.h index 0b99c371..ad712ec2 100644 --- a/Sources/libewol/ewol/oObject/Sprite.h +++ b/Sources/libewol/ewol/oObject/Sprite.h @@ -36,10 +36,10 @@ namespace ewol { public: Sprite(etk::UString spriteName, float sizeX=-1, float sizeY=-1); virtual ~Sprite(void); - void Element(Vector2D pos, float size, float angle); - void Element(Vector3D pos, float size, float angle); - void Element(Vector2D pos, float size, float angle, draw::Color tmpColor); - void Element(Vector3D pos, float size, float angle, draw::Color tmpColor); + void Element(etk::Vector2D pos, float size, float angle); + void Element(etk::Vector3D pos, float size, float angle); + void Element(etk::Vector2D pos, float size, float angle, draw::Color tmpColor); + void Element(etk::Vector3D pos, float size, float angle, draw::Color tmpColor); bool HasName(etk::UString& name) { return name == m_name; }; }; }; diff --git a/Sources/libewol/ewol/openGL/Program.cpp b/Sources/libewol/ewol/openGL/Program.cpp index d18ae833..7c449db9 100644 --- a/Sources/libewol/ewol/openGL/Program.cpp +++ b/Sources/libewol/ewol/openGL/Program.cpp @@ -301,7 +301,7 @@ void ewol::Program::SendAttribute(int32_t idElem, int32_t nbElement, void* point } -void ewol::Program::UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix _matrix, bool transpose) +void ewol::Program::UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix4 _matrix, bool transpose) { if (idElem<0 || idElem>m_elementList.Size()) { EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]"); diff --git a/Sources/libewol/ewol/openGL/Program.h b/Sources/libewol/ewol/openGL/Program.h index 36713f7e..878efc10 100644 --- a/Sources/libewol/ewol/openGL/Program.h +++ b/Sources/libewol/ewol/openGL/Program.h @@ -57,7 +57,7 @@ void SendAttribute(int32_t idElem, int32_t nbElement, void* pointer, int32_t jumpBetweenSample=0); int32_t GetUniform(etk::UString tmpElement); - void UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix pointer, bool transpose=true); + void UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix4 pointer, bool transpose=true); void Uniform1f(int32_t idElem, float value1); void Uniform2f(int32_t idElem, float value1, float value2); diff --git a/Sources/libewol/ewol/openGL/Shader.cpp b/Sources/libewol/ewol/openGL/Shader.cpp index 59455d1b..c2a7df30 100644 --- a/Sources/libewol/ewol/openGL/Shader.cpp +++ b/Sources/libewol/ewol/openGL/Shader.cpp @@ -25,7 +25,7 @@ #ifdef __VIDEO__OPENGL_ES_2 #include -#include +#include #include #include diff --git a/Sources/libewol/ewol/openGL/VirtualBufferObject.cpp b/Sources/libewol/ewol/openGL/VirtualBufferObject.cpp index 3ef0d130..b104f552 100644 --- a/Sources/libewol/ewol/openGL/VirtualBufferObject.cpp +++ b/Sources/libewol/ewol/openGL/VirtualBufferObject.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include #include diff --git a/Sources/libewol/ewol/openGL/openGL.cpp b/Sources/libewol/ewol/openGL/openGL.cpp index f3ef1c11..95cb061e 100644 --- a/Sources/libewol/ewol/openGL/openGL.cpp +++ b/Sources/libewol/ewol/openGL/openGL.cpp @@ -68,13 +68,13 @@ } #endif -etk::Vector l_matrixList; +etk::Vector l_matrixList; void ewol::openGL::Init(void) { // remove deprecated pb ... l_matrixList.Clear(); - etk::Matrix tmpMat; + etk::Matrix4 tmpMat; l_matrixList.PushBack(tmpMat); } @@ -84,7 +84,7 @@ void ewol::openGL::UnInit(void) l_matrixList.Clear(); } -void ewol::openGL::SetBasicMatrix(etk::Matrix& newOne) +void ewol::openGL::SetBasicMatrix(etk::Matrix4& newOne) { if (l_matrixList.Size()!=1) { EWOL_ERROR("matrix is not corect size in the stack : " << l_matrixList.Size()); @@ -93,7 +93,7 @@ void ewol::openGL::SetBasicMatrix(etk::Matrix& newOne) l_matrixList.PushBack(newOne); } -void ewol::openGL::SetMatrix(etk::Matrix& newOne) +void ewol::openGL::SetMatrix(etk::Matrix4& newOne) { if (l_matrixList.Size()==0) { EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size()); @@ -107,11 +107,11 @@ void ewol::openGL::Push(void) { if (l_matrixList.Size()==0) { EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size()); - etk::Matrix tmp; + etk::Matrix4 tmp; l_matrixList.PushBack(tmp); return; } - etk::Matrix tmp = l_matrixList[l_matrixList.Size()-1]; + etk::Matrix4 tmp = l_matrixList[l_matrixList.Size()-1]; l_matrixList.PushBack(tmp); } @@ -120,18 +120,18 @@ void ewol::openGL::Pop(void) if (l_matrixList.Size()<=1) { EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size()); l_matrixList.Clear(); - etk::Matrix tmp; + etk::Matrix4 tmp; l_matrixList.PushBack(tmp); return; } l_matrixList.PopBack(); } -etk::Matrix& ewol::openGL::GetMatrix(void) +etk::Matrix4& ewol::openGL::GetMatrix(void) { if (l_matrixList.Size()==0) { EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size()); - etk::Matrix tmp; + etk::Matrix4 tmp; l_matrixList.PushBack(tmp); } return l_matrixList[l_matrixList.Size()-1]; diff --git a/Sources/libewol/ewol/openGL/openGL.h b/Sources/libewol/ewol/openGL/openGL.h index f31b8270..47480b58 100644 --- a/Sources/libewol/ewol/openGL/openGL.h +++ b/Sources/libewol/ewol/openGL/openGL.h @@ -25,7 +25,7 @@ #ifndef __OPEN_GL_H__ #define __OPEN_GL_H__ -#include +#include #ifdef __cplusplus extern "C" { @@ -85,12 +85,12 @@ namespace ewol { void Init(void); void UnInit(void); // reset the basic element at this one ... remove all previous - void SetBasicMatrix(etk::Matrix& newOne); + void SetBasicMatrix(etk::Matrix4& newOne); // this is the same system as openGL-ES-1 but in openGL-ES-2 (here is the abstraction) - void SetMatrix(etk::Matrix& newOne); + void SetMatrix(etk::Matrix4& newOne); void Push(void); void Pop(void); - etk::Matrix& GetMatrix(void); + etk::Matrix4& GetMatrix(void); }; }; diff --git a/Sources/libewol/ewol/os/eSystem.cpp b/Sources/libewol/ewol/os/eSystem.cpp index 78b63c9b..3eed07aa 100644 --- a/Sources/libewol/ewol/os/eSystem.cpp +++ b/Sources/libewol/ewol/os/eSystem.cpp @@ -24,7 +24,7 @@ #include -#include +#include #include #include #include @@ -41,7 +41,7 @@ #include static ewol::Windows* windowsCurrent = NULL; -static Vector2D windowsSize(320, 480); +static etk::Vector2D windowsSize(320, 480); static ewol::eSystemInput l_managementInput; @@ -135,7 +135,7 @@ void ewolProcessEvents(void) case THREAD_INPUT_MOTION: //EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); { - Vector2D pos; + etk::Vector2D pos; pos.x = data.input.x; pos.y = data.input.y; l_managementInput.Motion(data.input.type, data.input.pointerID, pos); @@ -144,7 +144,7 @@ void ewolProcessEvents(void) case THREAD_INPUT_STATE: //EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); { - Vector2D pos; + etk::Vector2D pos; pos.x = data.input.x; pos.y = data.input.y; l_managementInput.State(data.input.type, data.input.pointerID, data.input.state, pos); @@ -583,7 +583,7 @@ ewol::Windows* eSystem::GetCurrentWindows(void) * @param --- * @return the current size ... */ -Vector2D eSystem::GetSize(void) +etk::Vector2D eSystem::GetSize(void) { return windowsSize; } @@ -598,7 +598,7 @@ void eSystem::ForceRedrawAll(void) { ewol::Windows* tmpWindows = eSystem::GetCurrentWindows(); if (NULL != tmpWindows) { - Vector2D tmpSize = eSystem::GetSize(); + etk::Vector2D tmpSize = eSystem::GetSize(); tmpWindows->CalculateSize(tmpSize.x, tmpSize.y); } } diff --git a/Sources/libewol/ewol/os/eSystem.h b/Sources/libewol/ewol/os/eSystem.h index be8cb8fa..a04e8901 100644 --- a/Sources/libewol/ewol/os/eSystem.h +++ b/Sources/libewol/ewol/os/eSystem.h @@ -115,7 +115,7 @@ namespace eSystem * @param --- * @return the current size ... */ - Vector2D GetSize(void); + etk::Vector2D GetSize(void); /** * @brief Redraw all the windows diff --git a/Sources/libewol/ewol/os/eSystemInput.cpp b/Sources/libewol/ewol/os/eSystemInput.cpp index c824f2fd..8924450a 100644 --- a/Sources/libewol/ewol/os/eSystemInput.cpp +++ b/Sources/libewol/ewol/os/eSystemInput.cpp @@ -89,7 +89,7 @@ void ewol::eSystemInput::CleanElement(InputPoperty_ts *eventTable, int32_t idInp * @param[in] pos position of the event * @return true if event has been greped */ -bool ewol::eSystemInput::localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D pos) +bool ewol::eSystemInput::localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D pos) { if (NULL != destWidget) { if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) { @@ -221,7 +221,7 @@ int32_t ewol::eSystemInput::localGetDestinationId(ewol::inputType_te type, ewol: } // note if id<0 ==> the it was finger event ... -void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, Vector2D pos) +void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vector2D pos) { // convert position in Open-GL coordonates ... pos.y = ewol::GetCurrentHeight() - pos.y; @@ -312,7 +312,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, Vector2D } } -void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDown, Vector2D pos) +void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDown, etk::Vector2D pos) { // convert position in Open-GL coordonates ... pos.y = ewol::GetCurrentHeight() - pos.y; diff --git a/Sources/libewol/ewol/os/eSystemInput.h b/Sources/libewol/ewol/os/eSystemInput.h index 81906b8e..262b2dd2 100644 --- a/Sources/libewol/ewol/os/eSystemInput.h +++ b/Sources/libewol/ewol/os/eSystemInput.h @@ -38,10 +38,10 @@ namespace ewol int32_t destinationInputId; int64_t lastTimeEvent; ewol::Widget* curentWidgetEvent; - Vector2D origin; - Vector2D size; - Vector2D downStart; - Vector2D posEvent; + etk::Vector2D origin; + etk::Vector2D size; + etk::Vector2D downStart; + etk::Vector2D posEvent; bool isDown; bool isInside; int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3 @@ -63,7 +63,7 @@ namespace ewol InputPoperty_ts m_eventInputSaved[MAX_MANAGE_INPUT]; InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT]; void CleanElement(InputPoperty_ts *eventTable, int32_t idInput); - bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D pos); + bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D pos); int32_t localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId); public: eSystemInput(void); @@ -72,8 +72,8 @@ namespace ewol void SetDpi(int32_t newDPI); // note if id<0 ==> the it was finger event ... - void Motion(ewol::inputType_te type, int pointerID, Vector2D pos ); - void State(ewol::inputType_te type, int pointerID, bool isDown, Vector2D pos); + void Motion(ewol::inputType_te type, int pointerID, etk::Vector2D pos ); + void State(ewol::inputType_te type, int pointerID, bool isDown, etk::Vector2D pos); /** * @brief Inform object that an other object is removed ... diff --git a/Sources/libewol/ewol/os/gui.Android.base.cpp b/Sources/libewol/ewol/os/gui.Android.base.cpp index 2fb946c2..fae6c600 100644 --- a/Sources/libewol/ewol/os/gui.Android.base.cpp +++ b/Sources/libewol/ewol/os/gui.Android.base.cpp @@ -607,17 +607,17 @@ void guiInterface::KeyboardHide(void) SendJava_KeyboardShow(false); } -void guiInterface::ChangeSize(Vector2D size) +void guiInterface::ChangeSize(etk::Vector2D size) { // The size can not be change on android platform } -void guiInterface::ChangePos(Vector2D size) +void guiInterface::ChangePos(etk::Vector2D size) { // The position can not be change on Android platform } -void guiInterface::GetAbsPos(Vector2D& size) +void guiInterface::GetAbsPos(etk::Vector2D& size) { size.x = 0; size.y = 0; diff --git a/Sources/libewol/ewol/os/gui.Windows.cpp b/Sources/libewol/ewol/os/gui.Windows.cpp index 661824c8..798dd0d1 100644 --- a/Sources/libewol/ewol/os/gui.Windows.cpp +++ b/Sources/libewol/ewol/os/gui.Windows.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -106,7 +106,7 @@ void guiInterface::KeyboardHide(void) * @param size The requested size * @return --- */ -void guiInterface::ChangeSize(Vector2D size) +void guiInterface::ChangeSize(etk::Vector2D size) { int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int title_size = GetSystemMetrics(SM_CYCAPTION); @@ -121,7 +121,7 @@ void guiInterface::ChangeSize(Vector2D size) * @param pos The position where the winsdows might be placed. * @return --- */ -void guiInterface::ChangePos(Vector2D pos) +void guiInterface::ChangePos(etk::Vector2D pos) { // TODO : Later } @@ -131,7 +131,7 @@ void guiInterface::ChangePos(Vector2D pos) * @param pos The position where the winsdows is. * @return --- */ -void guiInterface::GetAbsPos(Vector2D& size) +void guiInterface::GetAbsPos(etk::Vector2D& size) { // TODO : Later size.x = 0; @@ -346,7 +346,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { bool buttonIsDown = true; int32_t mouseButtonId = 0; - Vector2D pos; + etk::Vector2D pos; // to know all message : http://wiki.winehq.org/List_Of_Windows_Messages switch (message) { diff --git a/Sources/libewol/ewol/os/gui.X11.cpp b/Sources/libewol/ewol/os/gui.X11.cpp index 2fb6ed64..3c63f5e4 100644 --- a/Sources/libewol/ewol/os/gui.X11.cpp +++ b/Sources/libewol/ewol/os/gui.X11.cpp @@ -251,7 +251,7 @@ bool CreateX11Context(void) XSetWMProtocols(m_display, WindowHandle, &m_delAtom, 1); } - Vector2D tmpSize(400, 300); + etk::Vector2D tmpSize(400, 300); guiInterface::ChangeSize(tmpSize); return true; @@ -1088,7 +1088,7 @@ void guiInterface::KeyboardHide(void) * @param size The requested size * @return --- */ -void guiInterface::ChangeSize(Vector2D size) +void guiInterface::ChangeSize(etk::Vector2D size) { #ifdef DEBUG_X11_EVENT EWOL_INFO("X11: ChangeSize"); @@ -1102,7 +1102,7 @@ void guiInterface::ChangeSize(Vector2D size) * @param pos The position where the winsdows might be placed. * @return --- */ -void guiInterface::ChangePos(Vector2D pos) +void guiInterface::ChangePos(etk::Vector2D pos) { #ifdef DEBUG_X11_EVENT EWOL_INFO("X11: ChangePos"); @@ -1116,7 +1116,7 @@ void guiInterface::ChangePos(Vector2D pos) * @param pos The position where the winsdows is. * @return --- */ -void guiInterface::GetAbsPos(Vector2D& pos) +void guiInterface::GetAbsPos(etk::Vector2D& pos) { #ifdef DEBUG_X11_EVENT EWOL_INFO("X11: GetAbsPos"); diff --git a/Sources/libewol/ewol/os/gui.h b/Sources/libewol/ewol/os/gui.h index 3853cab9..c3185071 100644 --- a/Sources/libewol/ewol/os/gui.h +++ b/Sources/libewol/ewol/os/gui.h @@ -52,19 +52,19 @@ namespace guiInterface * @param size The requested size * @return --- */ - void ChangeSize(Vector2D size); + void ChangeSize(etk::Vector2D size); /** * @brief Change the current Windows position * @param pos The position where the winsdows might be placed. * @return --- */ - void ChangePos(Vector2D pos); + void ChangePos(etk::Vector2D pos); /** * @brief Get the current Windows position * @param pos The position where the winsdows is. * @return --- */ - void GetAbsPos(Vector2D& pos); + void GetAbsPos(etk::Vector2D& pos); /** * @brief Display the virtal keyboard (for touch system only) * @param --- diff --git a/Sources/libewol/ewol/texture/Texture.cpp b/Sources/libewol/ewol/texture/Texture.cpp index a9525ad8..9895f38d 100644 --- a/Sources/libewol/ewol/texture/Texture.cpp +++ b/Sources/libewol/ewol/texture/Texture.cpp @@ -123,7 +123,7 @@ void ewol::Texture::Flush(void) } -void ewol::Texture::SetImageSize(Vector2D newSize) +void ewol::Texture::SetImageSize(etk::Vector2D newSize) { newSize.x = nextP2(newSize.x); newSize.y = nextP2(newSize.y); diff --git a/Sources/libewol/ewol/texture/Texture.h b/Sources/libewol/ewol/texture/Texture.h index 4f186120..ae722cb4 100644 --- a/Sources/libewol/ewol/texture/Texture.h +++ b/Sources/libewol/ewol/texture/Texture.h @@ -39,7 +39,7 @@ namespace ewol { // OpenGl textureID : GLuint m_texId; // some image are not square ==> we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0 - Vector2D m_endPointSize; + etk::Vector2D m_endPointSize; // internal state of the openGl system : bool m_loaded; // Ewol internal API: @@ -50,14 +50,14 @@ namespace ewol { // middleware interface: public: GLuint GetId(void) { return m_texId; }; - Vector2D GetUsableSize(void) { return m_endPointSize; }; + etk::Vector2D GetUsableSize(void) { return m_endPointSize; }; // Public API: public: Texture(etk::UString tmpName); ~Texture(void); virtual const char* GetType(void) { return "ewol::Texture"; }; // you must set the size here, because it will be set in multiple of pow(2) - void SetImageSize(Vector2D newSize); + void SetImageSize(etk::Vector2D newSize); // get the reference on this image to draw nomething on it ... inline draw::Image& Get(void) { return m_data; }; // Flush the data to send it at the OpenGl system diff --git a/Sources/libewol/ewol/texture/TextureBMP.cpp b/Sources/libewol/ewol/texture/TextureBMP.cpp index 91a5dadd..a1399a64 100644 --- a/Sources/libewol/ewol/texture/TextureBMP.cpp +++ b/Sources/libewol/ewol/texture/TextureBMP.cpp @@ -135,7 +135,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag m_width = m_InfoHeader.biWidth; m_height = m_InfoHeader.biHeight; // reallocate the image - ouputImage.Resize(Vector2D(m_width,m_height)); + ouputImage.Resize(etk::Vector2D(m_width,m_height)); uint8_t* m_data = NULL; if(0 != m_InfoHeader.biSizeImage) @@ -161,7 +161,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag tmpColor.g = (int8_t)((*pointer & 0x07E0) >> 3); tmpColor.b = (int8_t)(*pointer << 3); tmpColor.a = 0xFF; - ouputImage.Set(Vector2D(xxx,yyy), tmpColor); + ouputImage.Set(etk::Vector2D(xxx,yyy), tmpColor); pointer++; } } @@ -176,7 +176,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag tmpColor.g = (int8_t)((*pointer & 0x03E0) >> 2); tmpColor.b = (int8_t)(*pointer << 3); tmpColor.a = 0xFF; - ouputImage.Set(Vector2D(xxx,yyy), tmpColor); + ouputImage.Set(etk::Vector2D(xxx,yyy), tmpColor); pointer++; } } @@ -191,7 +191,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag tmpColor.g = *pointer++; tmpColor.b = *pointer++; tmpColor.a = 0xFF; - ouputImage.Set(Vector2D(xxx,yyy), tmpColor); + ouputImage.Set(etk::Vector2D(xxx,yyy), tmpColor); } } } @@ -206,7 +206,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag tmpColor.g = *pointer++; tmpColor.b = *pointer++; tmpColor.a = 0xFF; - ouputImage.Set(Vector2D(xxx,yyy), tmpColor); + ouputImage.Set(etk::Vector2D(xxx,yyy), tmpColor); } } } @@ -220,7 +220,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag tmpColor.g = *pointer++; tmpColor.b = *pointer++; tmpColor.a = *pointer++; - ouputImage.Set(Vector2D(xxx,yyy), tmpColor); + ouputImage.Set(etk::Vector2D(xxx,yyy), tmpColor); } } } diff --git a/Sources/libewol/ewol/texture/TextureBMP.h b/Sources/libewol/ewol/texture/TextureBMP.h index 0b21da00..f238282a 100644 --- a/Sources/libewol/ewol/texture/TextureBMP.h +++ b/Sources/libewol/ewol/texture/TextureBMP.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include namespace ewol diff --git a/Sources/libewol/ewol/texture/TextureFile.cpp b/Sources/libewol/ewol/texture/TextureFile.cpp index 7e913cca..bce62ca0 100644 --- a/Sources/libewol/ewol/texture/TextureFile.cpp +++ b/Sources/libewol/ewol/texture/TextureFile.cpp @@ -32,7 +32,7 @@ //#include -ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, Vector2D size) : +ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, etk::Vector2D size) : Texture(genName) { // load data diff --git a/Sources/libewol/ewol/texture/TextureFile.h b/Sources/libewol/ewol/texture/TextureFile.h index 6084d580..589bc186 100644 --- a/Sources/libewol/ewol/texture/TextureFile.h +++ b/Sources/libewol/ewol/texture/TextureFile.h @@ -35,7 +35,7 @@ namespace ewol class TextureFile : public ewol::Texture { public: - TextureFile(etk::UString genName, etk::UString fileName, Vector2D size); + TextureFile(etk::UString genName, etk::UString fileName, etk::Vector2D size); ~TextureFile(void) { }; virtual const char* GetType(void) { return "ewol::TextureFile"; }; }; diff --git a/Sources/libewol/ewol/texture/TextureSVG.cpp b/Sources/libewol/ewol/texture/TextureSVG.cpp index 30a1a201..3b14f312 100644 --- a/Sources/libewol/ewol/texture/TextureSVG.cpp +++ b/Sources/libewol/ewol/texture/TextureSVG.cpp @@ -41,7 +41,7 @@ ewol::texture::TextureSVG::TextureSVG(etk::File & fileName, int32_t width, int32 m_loadOK = true; } if (width == -1) { - Vector2D elementSize = m_elementParsed.GetDefinedSize(); + etk::Vector2D elementSize = m_elementParsed.GetDefinedSize(); m_width = elementSize.x; m_height = elementSize.y; } else { diff --git a/Sources/libewol/ewol/texture/TextureSVG.h b/Sources/libewol/ewol/texture/TextureSVG.h index 4b46feee..6ffc6b6e 100644 --- a/Sources/libewol/ewol/texture/TextureSVG.h +++ b/Sources/libewol/ewol/texture/TextureSVG.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include namespace ewol diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index 48c09db5..06354adb 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -106,14 +106,14 @@ void ewol::Button::SetImage(etk::UString imageName) } -void ewol::Button::SetPadding(Vector2D newPadding) +void ewol::Button::SetPadding(etk::Vector2D newPadding) { m_padding = newPadding; } bool ewol::Button::CalculateMinSize(void) { - Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector2D minSize = m_oObjectText.GetSize(m_label); m_minSize.x = m_padding.x*2 + minSize.x; m_minSize.y = m_padding.y*2 + minSize.y; // Add the image element ... @@ -192,7 +192,7 @@ void ewol::Button::OnRegenerateDisplay(void) tmpSizeX -= 2*m_padding.x; tmpSizeY -= 2*m_padding.y; - Vector2D textPos(tmpTextOriginX, tmpTextOriginY); + etk::Vector2D textPos(tmpTextOriginX, tmpTextOriginY); /*ewol::OObject2DTextured * tmpImage = NULL; if (true == m_hasAnImage) { @@ -230,7 +230,7 @@ void ewol::Button::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::Button::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::Button::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { diff --git a/Sources/libewol/ewol/widget/Button.h b/Sources/libewol/ewol/widget/Button.h index 4df3417f..15ed505a 100644 --- a/Sources/libewol/ewol/widget/Button.h +++ b/Sources/libewol/ewol/widget/Button.h @@ -62,7 +62,7 @@ namespace ewol { void SetValue(bool val); bool GetValue(void); void SetAlignement(textAlignement_te typeAlign); - void SetPadding(Vector2D newPadding); + void SetPadding(etk::Vector2D newPadding); void SetColorBg(draw::Color newColor) { m_textColorBg = newColor; }; void SetColorFg(draw::Color newColor) { m_textColorFg = newColor; }; private: @@ -72,7 +72,7 @@ namespace ewol { bool m_hasAnImage; etk::UString m_imageSelected; textAlignement_te m_alignement; - Vector2D m_padding; + etk::Vector2D m_padding; etk::UString m_label; draw::Color m_textColorFg; //!< Text color draw::Color m_textColorBg; //!< Background color @@ -88,7 +88,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData); }; diff --git a/Sources/libewol/ewol/widget/ButtonColor.cpp b/Sources/libewol/ewol/widget/ButtonColor.cpp index 9865f4dc..6266c7c6 100644 --- a/Sources/libewol/ewol/widget/ButtonColor.cpp +++ b/Sources/libewol/ewol/widget/ButtonColor.cpp @@ -88,14 +88,14 @@ ewol::ButtonColor::~ButtonColor(void) } -void ewol::ButtonColor::SetPadding(Vector2D newPadding) +void ewol::ButtonColor::SetPadding(etk::Vector2D newPadding) { m_padding = newPadding; } bool ewol::ButtonColor::CalculateMinSize(void) { - Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector2D minSize = m_oObjectText.GetSize(m_label); m_minSize.x = m_padding.x*2 + minSize.x; m_minSize.y = m_padding.y*2 + minSize.y; MarkToRedraw(); @@ -167,7 +167,7 @@ void ewol::ButtonColor::OnRegenerateDisplay(void) } else { m_textColorFg = draw::color::white; } - Vector2D textPos; + etk::Vector2D textPos; textPos.x = tmpTextOriginX; textPos.y = tmpTextOriginY; clipping_ts drawClipping; @@ -195,7 +195,7 @@ void ewol::ButtonColor::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { @@ -213,7 +213,7 @@ bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, e return true; } // Get the button widget : - Vector2D newPosition; + etk::Vector2D newPosition; newPosition.x = m_origin.x + m_size.x/2; newPosition.y = m_origin.y; diff --git a/Sources/libewol/ewol/widget/ButtonColor.h b/Sources/libewol/ewol/widget/ButtonColor.h index 04edaf0c..9112f436 100644 --- a/Sources/libewol/ewol/widget/ButtonColor.h +++ b/Sources/libewol/ewol/widget/ButtonColor.h @@ -55,12 +55,12 @@ namespace ewol { void SetValue(bool val); bool GetValue(void); void SetAlignement(textAlignement_te typeAlign); - void SetPadding(Vector2D newPadding); + void SetPadding(etk::Vector2D newPadding); private: ewol::OObject2DTextColored m_oObjectText; ewol::OObject2DColored m_oObjectDecoration; textAlignement_te m_alignement; - Vector2D m_padding; + etk::Vector2D m_padding; etk::UString m_label; draw::Color m_textColorFg; //!< Text color draw::Color m_textColorBg; //!< Background color @@ -79,7 +79,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); draw::Color GetCurrentColor(void) { return m_selectedColor; }; void SetCurrentColor(draw::Color color); /** diff --git a/Sources/libewol/ewol/widget/ButtonImage.cpp b/Sources/libewol/ewol/widget/ButtonImage.cpp index b480d146..68a33172 100644 --- a/Sources/libewol/ewol/widget/ButtonImage.cpp +++ b/Sources/libewol/ewol/widget/ButtonImage.cpp @@ -212,7 +212,7 @@ void ewol::ButtonImage::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { @@ -246,7 +246,7 @@ bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, e } else if (0 == IdInput) { if( ewol::EVENT_INPUT_TYPE_ENTER == typeEvent || ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { - Vector2D relPos = RelativePosition(pos); + etk::Vector2D relPos = RelativePosition(pos); // check if over : int32_t tmpSizeX = m_minSize.x; diff --git a/Sources/libewol/ewol/widget/ButtonImage.h b/Sources/libewol/ewol/widget/ButtonImage.h index dfb3da8d..a30f6305 100644 --- a/Sources/libewol/ewol/widget/ButtonImage.h +++ b/Sources/libewol/ewol/widget/ButtonImage.h @@ -81,7 +81,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData); virtual void OnDraw(DrawProperty& displayProp); }; diff --git a/Sources/libewol/ewol/widget/CheckBox.cpp b/Sources/libewol/ewol/widget/CheckBox.cpp index 2cd1fd8b..25f3db9b 100644 --- a/Sources/libewol/ewol/widget/CheckBox.cpp +++ b/Sources/libewol/ewol/widget/CheckBox.cpp @@ -66,7 +66,7 @@ ewol::CheckBox::~CheckBox(void) bool ewol::CheckBox::CalculateMinSize(void) { - Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector2D minSize = m_oObjectText.GetSize(m_label); float boxSize = etk_max(20, minSize.y) + 5; m_minSize.x = boxSize+minSize.x; m_minSize.y = etk_max(boxSize, minSize.y)+3; @@ -110,14 +110,14 @@ void ewol::CheckBox::OnRegenerateDisplay(void) int32_t borderWidth = 2; - Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector2D minSize = m_oObjectText.GetSize(m_label); float boxSize = etk_max(20, minSize.y) + 5; //int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str()); int32_t posy = (m_size.y - minSize.y - 6)/2 + 3; //int32_t posx = (m_size.x - fontWidth - 6)/2 + 25; - Vector2D textPos; + etk::Vector2D textPos; textPos.x = boxSize+5; textPos.y = posy; clipping_ts drawClipping; @@ -150,7 +150,7 @@ void ewol::CheckBox::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on checkbox ..."); if (1 == IdInput) { diff --git a/Sources/libewol/ewol/widget/CheckBox.h b/Sources/libewol/ewol/widget/CheckBox.h index 06a3a16e..52d1252a 100644 --- a/Sources/libewol/ewol/widget/CheckBox.h +++ b/Sources/libewol/ewol/widget/CheckBox.h @@ -71,7 +71,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); virtual bool OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData); }; diff --git a/Sources/libewol/ewol/widget/ColorBar.cpp b/Sources/libewol/ewol/widget/ColorBar.cpp index 247afbab..ace67196 100644 --- a/Sources/libewol/ewol/widget/ColorBar.cpp +++ b/Sources/libewol/ewol/widget/ColorBar.cpp @@ -215,9 +215,9 @@ void ewol::ColorBar::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { relativePos.x = etk_max(etk_min(relativePos.x, m_size.x),0); diff --git a/Sources/libewol/ewol/widget/ColorBar.h b/Sources/libewol/ewol/widget/ColorBar.h index d0c3454e..2314b01f 100644 --- a/Sources/libewol/ewol/widget/ColorBar.h +++ b/Sources/libewol/ewol/widget/ColorBar.h @@ -49,8 +49,8 @@ namespace ewol { void SetCurrentColor(draw::Color newOne); private: draw::Color m_currentColor; - Vector2D m_currentUserPos; - Vector2D m_padding; + etk::Vector2D m_currentUserPos; + etk::Vector2D m_padding; public: virtual void OnRegenerateDisplay(void); public: @@ -63,7 +63,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); }; }; diff --git a/Sources/libewol/ewol/widget/ContextMenu.cpp b/Sources/libewol/ewol/widget/ContextMenu.cpp index a879a326..376e6948 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.cpp +++ b/Sources/libewol/ewol/widget/ContextMenu.cpp @@ -64,8 +64,8 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY) m_size.y = availlableY; if (NULL != m_subWidget) { - Vector2D subWidgetSize; - Vector2D subWidgetOrigin; + etk::Vector2D subWidgetSize; + etk::Vector2D subWidgetOrigin; subWidgetSize = m_subWidget->GetMinSize(); if (true == m_subWidget->CanExpentX()) { subWidgetSize.x = m_size.x; @@ -140,7 +140,7 @@ bool ewol::ContextMenu::CalculateMinSize(void) m_minSize.y = 50.0; if (NULL != m_subWidget) { m_subWidget->CalculateMinSize(); - Vector2D tmpSize = m_subWidget->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget->GetMinSize(); m_minSize.x = tmpSize.x; m_minSize.y = tmpSize.y; } @@ -202,8 +202,8 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) AddOObject(BGOObjects); if (NULL != m_subWidget) { - Vector2D tmpSize = m_subWidget->GetSize(); - Vector2D tmpOrigin = m_subWidget->GetOrigin(); + etk::Vector2D tmpSize = m_subWidget->GetSize(); + etk::Vector2D tmpOrigin = m_subWidget->GetOrigin(); // display border ... BGOObjects->SetColor(m_colorBorder); @@ -257,14 +257,14 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(Vector2D pos) +ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(etk::Vector2D pos) { // calculate relative position - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); // Check for sub Element if (NULL != m_subWidget) { - Vector2D tmpSize = m_subWidget->GetSize(); - Vector2D tmpOrigin = m_subWidget->GetOrigin(); + etk::Vector2D tmpSize = m_subWidget->GetSize(); + etk::Vector2D tmpOrigin = m_subWidget->GetOrigin(); if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x) && (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) ) { @@ -283,7 +283,7 @@ ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(Vector2D pos) * @return true the event is used * @return false the event is not used */ -bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { //EWOL_INFO("Event ouside the context menu"); if (IdInput > 0) { @@ -304,7 +304,7 @@ bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, e } -void ewol::ContextMenu::SetPositionMark(markPosition_te position, Vector2D arrowPos) +void ewol::ContextMenu::SetPositionMark(markPosition_te position, etk::Vector2D arrowPos) { EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")"); m_arrawBorder = position; diff --git a/Sources/libewol/ewol/widget/ContextMenu.h b/Sources/libewol/ewol/widget/ContextMenu.h index bdcf3319..a3e60c86 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.h +++ b/Sources/libewol/ewol/widget/ContextMenu.h @@ -59,15 +59,15 @@ namespace ewol { private: draw::Color m_colorBackGroung; draw::Color m_colorBorder; - Vector2D m_padding; - Vector2D m_arrowPos; + etk::Vector2D m_padding; + etk::Vector2D m_arrowPos; float m_offset; markPosition_te m_arrawBorder; ewol::Widget* m_subWidget; public: void SubWidgetSet(ewol::Widget* newWidget); void SubWidgetRemove(void); - void SetPositionMark(markPosition_te position, Vector2D arrowPos); + void SetPositionMark(markPosition_te position, etk::Vector2D arrowPos); protected: virtual void OnDraw(DrawProperty& displayProp); public: @@ -79,7 +79,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos); /** * @brief Event on an input of this Widget * @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...) @@ -89,7 +89,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); }; }; diff --git a/Sources/libewol/ewol/widget/Entry.cpp b/Sources/libewol/ewol/widget/Entry.cpp index 93b88236..75d169bf 100644 --- a/Sources/libewol/ewol/widget/Entry.cpp +++ b/Sources/libewol/ewol/widget/Entry.cpp @@ -137,7 +137,7 @@ etk::UString ewol::Entry::GetValue(void) void ewol::Entry::SetPoint(float x, float y) { - Vector2D triangle(x, y); + etk::Vector2D triangle(x, y); m_coord.PushBack(triangle); } @@ -205,7 +205,7 @@ void ewol::Entry::OnDraw(DrawProperty& displayProp) //glScalef(m_scaling.x, m_scaling.y, 1.0); m_GLprogram->Use(); // set Matrix : translation/positionMatrix - etk::Matrix tmpMatrix = ewol::openGL::GetMatrix(); + etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix(); m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // position : m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]); @@ -268,7 +268,7 @@ void ewol::Entry::OnRegenerateDisplay(void) tmpSizeY -= 2*m_paddingSize; - Vector2D textPos; + etk::Vector2D textPos; textPos.x = tmpTextOriginX + m_displayStartPosition; textPos.y = tmpTextOriginY; clipping_ts drawClipping; @@ -303,9 +303,9 @@ void ewol::Entry::OnRegenerateDisplay(void) m_oObjectDecoration.SetColor(m_textColorFg); m_oObjectDecoration.clippingSet(drawClipping); etk::UString tmpDisplay = m_data.Extract(0, pos1); - Vector2D minSize = m_oObjectText.GetSize(tmpDisplay); + etk::Vector2D minSize = m_oObjectText.GetSize(tmpDisplay); tmpDisplay = m_data.Extract(0, pos2); - Vector2D maxSize = m_oObjectText.GetSize(tmpDisplay); + etk::Vector2D maxSize = m_oObjectText.GetSize(tmpDisplay); int32_t XPos = minSize.x + m_borderSize + 2*m_paddingSize + m_displayStartPosition; int32_t XPosEnd = maxSize.x + m_borderSize + 2*m_paddingSize + m_displayStartPosition; @@ -318,7 +318,7 @@ void ewol::Entry::OnRegenerateDisplay(void) if (true == m_displayCursor) { m_oObjectDecoration.SetColor(m_textColorFg); etk::UString tmpDisplay = m_data.Extract(0, m_displayCursorPos); - Vector2D minSize = m_oObjectText.GetSize(tmpDisplay); + etk::Vector2D minSize = m_oObjectText.GetSize(tmpDisplay); int32_t XCursorPos = minSize.x + m_borderSize + 2*m_paddingSize + m_displayStartPosition; if (XCursorPos >= m_borderSize + 2*m_paddingSize) { m_oObjectDecoration.Line(XCursorPos, tmpTextOriginY, XCursorPos, tmpTextOriginY + minSize.y, 1); @@ -333,9 +333,9 @@ void ewol::Entry::OnRegenerateDisplay(void) * @note The display is automaticly requested when change apear. * @return --- */ -void ewol::Entry::UpdateCursorPosition(Vector2D& pos, bool selection) +void ewol::Entry::UpdateCursorPosition(etk::Vector2D& pos, bool selection) { - Vector2D relPos = RelativePosition(pos); + etk::Vector2D relPos = RelativePosition(pos); relPos.x += -m_displayStartPosition - 2*m_paddingSize - m_borderSize; // try to find the new cursor position : etk::UString tmpDisplay = m_data.Extract(0, m_displayStartPosition); @@ -424,7 +424,7 @@ void ewol::Entry::CopySelectionToClipBoard(ewol::clipBoard::clipboardListe_te cl * @return true the event is used * @return false the event is not used */ -bool ewol::Entry::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::Entry::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on Entry ... type=" << (int32_t)type << " id=" << IdInput); if (1 == IdInput) { diff --git a/Sources/libewol/ewol/widget/Entry.h b/Sources/libewol/ewol/widget/Entry.h index 890a70f4..b9a016a0 100644 --- a/Sources/libewol/ewol/widget/Entry.h +++ b/Sources/libewol/ewol/widget/Entry.h @@ -58,7 +58,7 @@ namespace ewol { float m_pos[4]; int32_t m_GLposText; int32_t m_GLstate; - etk::Vector > m_coord; //!< internal coord of the object + etk::Vector > m_coord; //!< internal coord of the object draw::Colorf m_color[3]; void SetPoint(float x, float y); void Rectangle(float x, float y, float w, float h); @@ -121,7 +121,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); /** * @brief Event on the keybord (if no shortcut has been detected before). * @param[in] type of the event (ewol::EVENT_KB_TYPE_DOWN or ewol::EVENT_KB_TYPE_UP) @@ -164,7 +164,7 @@ namespace ewol { * @note The display is automaticly requested when change apear. * @return --- */ - virtual void UpdateCursorPosition(Vector2D& pos, bool Selection=false); + virtual void UpdateCursorPosition(etk::Vector2D& pos, bool Selection=false); /** * @brief Update the display position start ==> depending of the position of the Cursor and the size of the Data inside * @param --- diff --git a/Sources/libewol/ewol/widget/Image.cpp b/Sources/libewol/ewol/widget/Image.cpp index 1e1767bf..3baccbcd 100644 --- a/Sources/libewol/ewol/widget/Image.cpp +++ b/Sources/libewol/ewol/widget/Image.cpp @@ -80,7 +80,7 @@ ewol::Image::~Image(void) } -void ewol::Image::SetPadding(Vector2D newPadding) +void ewol::Image::SetPadding(etk::Vector2D newPadding) { m_padding = newPadding; } @@ -153,7 +153,7 @@ void ewol::Image::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::Image::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::Image::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { diff --git a/Sources/libewol/ewol/widget/Image.h b/Sources/libewol/ewol/widget/Image.h index 2bbaa878..ce0bc917 100644 --- a/Sources/libewol/ewol/widget/Image.h +++ b/Sources/libewol/ewol/widget/Image.h @@ -47,10 +47,10 @@ namespace ewol { virtual ~Image(void); virtual bool CalculateMinSize(void); void SetFile(etk::UString newFile); - void SetPadding(Vector2D newPadding); + void SetPadding(etk::Vector2D newPadding); private: etk::UString m_imageSelected; - Vector2D m_padding; + etk::Vector2D m_padding; draw::Color m_textColorBg; //!< Background color int32_t m_imageSize; public: @@ -65,7 +65,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); }; /** diff --git a/Sources/libewol/ewol/widget/Joystick.cpp b/Sources/libewol/ewol/widget/Joystick.cpp index ca1111ac..04df2cf7 100644 --- a/Sources/libewol/ewol/widget/Joystick.cpp +++ b/Sources/libewol/ewol/widget/Joystick.cpp @@ -206,13 +206,13 @@ Tangent Function: tan(teta) = Opposite / Adjacent * @return true the event is used * @return false the event is not used */ -bool ewol::Joystick::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::Joystick::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { if (1 == IdInput) { if( ewol::EVENT_INPUT_TYPE_DOWN == typeEvent || ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { // get local relative position - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); float sizeElement = m_size.x*m_ratio; // Calculate the position of the cursor... m_displayPos.x = (relativePos.x-sizeElement)/(m_size.x-sizeElement*2)*2.0 - 1.0; diff --git a/Sources/libewol/ewol/widget/Joystick.h b/Sources/libewol/ewol/widget/Joystick.h index 8bef9e00..daa01de3 100644 --- a/Sources/libewol/ewol/widget/Joystick.h +++ b/Sources/libewol/ewol/widget/Joystick.h @@ -43,7 +43,7 @@ namespace ewol { private: draw::Color m_colorFg; //!< Forground color draw::Color m_colorBg; //!< Background color - Vector2D m_displayPos; //!< direction of the cursor ... + etk::Vector2D m_displayPos; //!< direction of the cursor ... float m_distance; //!< dintance from the center float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ... bool m_lock; //!< flag to mark the lock when the cursor is free when we are outside the circle @@ -82,7 +82,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); void SetLockMode(bool lockWhenOut) { m_lock = lockWhenOut; }; void SetDisplayMode(joystickMode_te newMode) { m_displayMode = newMode; }; /** diff --git a/Sources/libewol/ewol/widget/Label.cpp b/Sources/libewol/ewol/widget/Label.cpp index cf67e135..7396c6a4 100644 --- a/Sources/libewol/ewol/widget/Label.cpp +++ b/Sources/libewol/ewol/widget/Label.cpp @@ -64,7 +64,7 @@ ewol::Label::~Label(void) bool ewol::Label::CalculateMinSize(void) { - Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector2D minSize = m_oObjectText.GetSize(m_label); m_minSize.x = 3 + minSize.x; m_minSize.y = 3 + minSize.y; return true; @@ -102,7 +102,7 @@ void ewol::Label::OnRegenerateDisplay(void) tmpOriginY += paddingSize; - Vector2D textPos(tmpOriginX, tmpOriginY); + etk::Vector2D textPos(tmpOriginX, tmpOriginY); clipping_ts drawClipping; drawClipping.x = paddingSize; drawClipping.y = paddingSize; @@ -121,7 +121,7 @@ void ewol::Label::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::Label::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::Label::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on Label ..."); if (1 == IdInput) { diff --git a/Sources/libewol/ewol/widget/Label.h b/Sources/libewol/ewol/widget/Label.h index a40ed6a3..2c642f52 100644 --- a/Sources/libewol/ewol/widget/Label.h +++ b/Sources/libewol/ewol/widget/Label.h @@ -66,7 +66,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); }; }; diff --git a/Sources/libewol/ewol/widget/Layer.cpp b/Sources/libewol/ewol/widget/Layer.cpp index 9439711b..3391aac2 100644 --- a/Sources/libewol/ewol/widget/Layer.cpp +++ b/Sources/libewol/ewol/widget/Layer.cpp @@ -74,7 +74,7 @@ bool ewol::Layer::CalculateMinSize(void) if (true == m_subWidget[iii]->CanExpentY()) { m_userExpend.y = true; } - Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); m_minSize.x = etk_max(tmpSize.x, m_minSize.x); m_minSize.y = etk_max(tmpSize.y, m_minSize.y); } @@ -197,13 +197,13 @@ void ewol::Layer::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D pos) +ewol::Widget * ewol::Layer::GetWidgetAtPos(etk::Vector2D pos) { // for all element in the sizer ... for (int32_t iii=0; iii tmpSize = m_subWidget[iii]->GetSize(); - Vector2D tmpOrigin = m_subWidget[iii]->GetOrigin(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetSize(); + etk::Vector2D tmpOrigin = m_subWidget[iii]->GetOrigin(); if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x) && (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) ) { diff --git a/Sources/libewol/ewol/widget/Layer.h b/Sources/libewol/ewol/widget/Layer.h index ebd788e1..ae3d8536 100644 --- a/Sources/libewol/ewol/widget/Layer.h +++ b/Sources/libewol/ewol/widget/Layer.h @@ -70,7 +70,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos); /** * @brief Inform object that an other object is removed ... * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject diff --git a/Sources/libewol/ewol/widget/List.cpp b/Sources/libewol/ewol/widget/List.cpp index 2a6ba1ab..e20a65cd 100644 --- a/Sources/libewol/ewol/widget/List.cpp +++ b/Sources/libewol/ewol/widget/List.cpp @@ -164,7 +164,7 @@ void ewol::List::OnRegenerateDisplay(void) m_lineSize.Clear(); int32_t displayPositionY = m_size.y; int32_t displayPositionX = 0; - Vector2D tmpRegister(startRaw, displayPositionY); + etk::Vector2D tmpRegister(startRaw, displayPositionY); // add the default position raw : m_lineSize.PushBack(tmpRegister); @@ -187,10 +187,10 @@ void ewol::List::OnRegenerateDisplay(void) BGOObjects->Rectangle(displayPositionX, displayPositionY, m_size.x-displayPositionX, tmpFontHeight+2*m_paddingSizeY); // get the maximum size of the colomn : - Vector2D textSize = tmpText->GetSize(myTextToWrite); + etk::Vector2D textSize = tmpText->GetSize(myTextToWrite); sizeColom = etk_max(sizeColom, textSize.x); - Vector2D textPos; + etk::Vector2D textPos; textPos.x = tmpOriginX + displayPositionX; textPos.y = displayPositionY; tmpText->SetColor(fg); @@ -226,9 +226,9 @@ void ewol::List::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::List::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::List::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); if (true == WidgetScrooled::OnEventInput(type, IdInput, typeEvent, pos)) { ewol::widgetManager::FocusKeep(this); diff --git a/Sources/libewol/ewol/widget/List.h b/Sources/libewol/ewol/widget/List.h index 1c9c23ff..0f605c43 100644 --- a/Sources/libewol/ewol/widget/List.h +++ b/Sources/libewol/ewol/widget/List.h @@ -49,7 +49,7 @@ namespace ewol { // Drawing capabilities .... private: etk::Vector m_listOObject; //!< generic element to display... - etk::Vector > m_lineSize; + etk::Vector > m_lineSize; public: void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); @@ -72,7 +72,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); protected: // function call to display the list : virtual draw::Color GetBasicBG(void) { diff --git a/Sources/libewol/ewol/widget/Menu.cpp b/Sources/libewol/ewol/widget/Menu.cpp index 42e0e587..e1a108d1 100644 --- a/Sources/libewol/ewol/widget/Menu.cpp +++ b/Sources/libewol/ewol/widget/Menu.cpp @@ -171,11 +171,11 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve return; } // Get the button widget : - Vector2D newPosition; + etk::Vector2D newPosition; ewol::Widget * eventFromWidget = static_cast(CallerObject); if (NULL != eventFromWidget) { - Vector2D tmpOri = eventFromWidget->GetOrigin(); - Vector2D tmpSize = eventFromWidget->GetSize(); + etk::Vector2D tmpOri = eventFromWidget->GetOrigin(); + etk::Vector2D tmpSize = eventFromWidget->GetSize(); // calculate the correct position newPosition.x = tmpOri.x + tmpSize.x/2; newPosition.y = tmpOri.y; diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index 60e76f4b..8ead68cb 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -61,8 +61,8 @@ bool ewol::PopUp::CalculateSize(float availlableX, float availlableY) m_size.y = availlableY; if (NULL != m_subWidget) { - Vector2D subWidgetSize; - Vector2D subWidgetOrigin; + etk::Vector2D subWidgetSize; + etk::Vector2D subWidgetOrigin; subWidgetSize = m_subWidget->GetMinSize(); if (true == m_subWidget->CanExpentX()) { subWidgetSize.x = m_size.x; @@ -98,7 +98,7 @@ bool ewol::PopUp::CalculateMinSize(void) m_minSize.y = 50.0; if (NULL != m_subWidget) { m_subWidget->CalculateMinSize(); - Vector2D tmpSize = m_subWidget->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget->GetMinSize(); m_minSize.x = tmpSize.x; m_minSize.y = tmpSize.y; } @@ -169,8 +169,8 @@ void ewol::PopUp::OnRegenerateDisplay(void) BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); // set the area in white ... if (NULL != m_subWidget) { - Vector2D tmpSize = m_subWidget->GetSize(); - Vector2D tmpOrigin = m_subWidget->GetOrigin(); + etk::Vector2D tmpSize = m_subWidget->GetSize(); + etk::Vector2D tmpOrigin = m_subWidget->GetOrigin(); BGOObjects->SetColor(m_colorBorder); BGOObjects->Rectangle(tmpOrigin.x-BORDER_SIZE_TMP, tmpOrigin.y-BORDER_SIZE_TMP, tmpSize.x+2*BORDER_SIZE_TMP, tmpSize.y+2*BORDER_SIZE_TMP); BGOObjects->SetColor(m_colorBackGroung); @@ -188,14 +188,14 @@ void ewol::PopUp::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::PopUp::GetWidgetAtPos(Vector2D pos) +ewol::Widget * ewol::PopUp::GetWidgetAtPos(etk::Vector2D pos) { // calculate relative position - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); // for the element in the pop-up ... if (NULL != m_subWidget) { - Vector2D tmpSize = m_subWidget->GetSize(); - Vector2D tmpOrigin = m_subWidget->GetOrigin(); + etk::Vector2D tmpSize = m_subWidget->GetSize(); + etk::Vector2D tmpOrigin = m_subWidget->GetOrigin(); if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x) && (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) ) { diff --git a/Sources/libewol/ewol/widget/PopUp.h b/Sources/libewol/ewol/widget/PopUp.h index cb9c843a..0b6d6abb 100644 --- a/Sources/libewol/ewol/widget/PopUp.h +++ b/Sources/libewol/ewol/widget/PopUp.h @@ -71,7 +71,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos); /** * @brief Inform object that an other object is removed ... * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject diff --git a/Sources/libewol/ewol/widget/Scene.cpp b/Sources/libewol/ewol/widget/Scene.cpp index 20189d1d..ca1521cb 100644 --- a/Sources/libewol/ewol/widget/Scene.cpp +++ b/Sources/libewol/ewol/widget/Scene.cpp @@ -170,7 +170,7 @@ void ewol::Scene::GenDraw(DrawProperty displayProp) m_zoom = 1.0/1000.0; //EWOL_INFO("ratio : " << ratio); #ifdef __VIDEO__OPENGL_ES_2 - etk::Matrix tmpProjection; + etk::Matrix4 tmpProjection; if (ratio >= 1.0) { tmpProjection = etk::matrix::Perspective(-ratio, ratio, -1, 1, -1, 1); @@ -178,8 +178,8 @@ void ewol::Scene::GenDraw(DrawProperty displayProp) ratio = 1.0/ratio; tmpProjection = etk::matrix::Perspective(-1, 1, -ratio, ratio, -1, 1); } - etk::Matrix tmpScale = etk::matrix::Scale(m_zoom, m_zoom, m_zoom); - etk::Matrix tmpMat = tmpProjection * tmpScale; + etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, m_zoom); + etk::Matrix4 tmpMat = tmpProjection * tmpScale; // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); #else @@ -214,7 +214,7 @@ void ewol::Scene::GenDraw(DrawProperty displayProp) * @param[in] pos Absolute position that you request convertion * @return the relative position */ -Vector2D ewol::Scene::RelativePosition(Vector2D pos) +etk::Vector2D ewol::Scene::RelativePosition(etk::Vector2D pos) { // Remove origin of the widget pos.x -= m_origin.x; diff --git a/Sources/libewol/ewol/widget/Scene.h b/Sources/libewol/ewol/widget/Scene.h index 4b3506ac..4a0463d6 100644 --- a/Sources/libewol/ewol/widget/Scene.h +++ b/Sources/libewol/ewol/widget/Scene.h @@ -100,12 +100,12 @@ namespace ewol { virtual void ScenePeriodicCall(int64_t localTime, int32_t deltaTime) { }; // camera properties : private: - Vector3D m_camRotation; - Vector3D m_camTranslation; - float m_camAngleView; - float m_camdistanceViewStart; - float m_camdistanceViewStop; - float m_zoom; + etk::Vector3D m_camRotation; + etk::Vector3D m_camTranslation; + float m_camAngleView; + float m_camdistanceViewStart; + float m_camdistanceViewStop; + float m_zoom; public: void SetCamaraTranslation(); void SetCamaraRotation(); @@ -117,7 +117,7 @@ namespace ewol { * @param[in] pos Absolute position that you request convertion * @return the relative position */ - virtual Vector2D RelativePosition(Vector2D pos); + virtual etk::Vector2D RelativePosition(etk::Vector2D pos); }; /** diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index 47a6f438..8b5824f6 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -53,7 +53,7 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY) int32_t nbWidgetNotFixedSize=0; for (int32_t iii=0; iii tmpSize = m_subWidget[iii]->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); unexpendableSize += tmpSize.x; if (false == m_subWidget[iii]->CanExpentX()) { nbWidgetFixedSize++; @@ -70,12 +70,12 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY) sizeToAddAtEveryOne=0; } } - Vector2D tmpOrigin; + etk::Vector2D tmpOrigin; tmpOrigin.x = m_origin.x; tmpOrigin.y = m_origin.y; for (int32_t iii=0; iii tmpSize = m_subWidget[iii]->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); // Set the origin : //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); @@ -110,7 +110,7 @@ bool ewol::SizerHori::CalculateMinSize(void) if (true == m_subWidget[iii]->CanExpentY()) { m_userExpend.y = true; } - Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); m_minSize.x += tmpSize.x; if (tmpSize.y>m_minSize.y) { m_minSize.y = tmpSize.y; @@ -239,7 +239,7 @@ void ewol::SizerHori::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D pos) +ewol::Widget * ewol::SizerHori::GetWidgetAtPos(etk::Vector2D pos) { if (true == IsHide()) { return NULL; @@ -247,8 +247,8 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D pos) // for all element in the sizer ... for (int32_t iii=0; iii tmpSize = m_subWidget[iii]->GetSize(); - Vector2D tmpOrigin = m_subWidget[iii]->GetOrigin(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetSize(); + etk::Vector2D tmpOrigin = m_subWidget[iii]->GetOrigin(); if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x) && (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) ) { diff --git a/Sources/libewol/ewol/widget/SizerHori.h b/Sources/libewol/ewol/widget/SizerHori.h index 78012c4c..008e7f42 100644 --- a/Sources/libewol/ewol/widget/SizerHori.h +++ b/Sources/libewol/ewol/widget/SizerHori.h @@ -70,7 +70,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos); /** * @brief Inform object that an other object is removed ... * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index 94669201..8b684b9e 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -54,7 +54,7 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY) int32_t nbWidgetNotFixedSize=0; for (int32_t iii=0; iii tmpSize = m_subWidget[iii]->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); unexpendableSize += tmpSize.y; if (false == m_subWidget[iii]->CanExpentY()) { nbWidgetFixedSize++; @@ -72,12 +72,12 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY) sizeToAddAtEveryOne=0; } } - Vector2D tmpOrigin; + etk::Vector2D tmpOrigin; tmpOrigin.x = m_origin.x; tmpOrigin.y = m_origin.y; for (int32_t iii=0; iii tmpSize = m_subWidget[iii]->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); // Set the origin : //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); @@ -112,7 +112,7 @@ bool ewol::SizerVert::CalculateMinSize(void) if (true == m_subWidget[iii]->CanExpentY()) { m_userExpend.y = true; } - Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); //EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")"); m_minSize.y += tmpSize.y; if (tmpSize.x>m_minSize.x) { @@ -239,7 +239,7 @@ void ewol::SizerVert::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D pos) +ewol::Widget * ewol::SizerVert::GetWidgetAtPos(etk::Vector2D pos) { if (true == IsHide()) { return NULL; @@ -247,8 +247,8 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D pos) // for all element in the sizer ... for (int32_t iii=0; iii tmpSize = m_subWidget[iii]->GetSize(); - Vector2D tmpOrigin = m_subWidget[iii]->GetOrigin(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetSize(); + etk::Vector2D tmpOrigin = m_subWidget[iii]->GetOrigin(); if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x) && (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) ) { diff --git a/Sources/libewol/ewol/widget/SizerVert.h b/Sources/libewol/ewol/widget/SizerVert.h index 8fb0354b..361974c8 100644 --- a/Sources/libewol/ewol/widget/SizerVert.h +++ b/Sources/libewol/ewol/widget/SizerVert.h @@ -70,7 +70,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos); /** * @brief Inform object that an other object is removed ... * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject diff --git a/Sources/libewol/ewol/widget/Slider.cpp b/Sources/libewol/ewol/widget/Slider.cpp index c950d0e3..d7351e2b 100644 --- a/Sources/libewol/ewol/widget/Slider.cpp +++ b/Sources/libewol/ewol/widget/Slider.cpp @@ -129,9 +129,9 @@ void ewol::Slider::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::Slider::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::Slider::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); //EWOL_DEBUG("Event on Slider ..."); if (1 == IdInput) { if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent diff --git a/Sources/libewol/ewol/widget/Slider.h b/Sources/libewol/ewol/widget/Slider.h index bbfbb1f0..94798364 100644 --- a/Sources/libewol/ewol/widget/Slider.h +++ b/Sources/libewol/ewol/widget/Slider.h @@ -68,7 +68,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); }; }; diff --git a/Sources/libewol/ewol/widget/Spacer.h b/Sources/libewol/ewol/widget/Spacer.h index ef2061cc..93e10db8 100644 --- a/Sources/libewol/ewol/widget/Spacer.h +++ b/Sources/libewol/ewol/widget/Spacer.h @@ -51,7 +51,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos) { return NULL; }; + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos) { return NULL; }; virtual void OnRegenerateDisplay(void); void SetColor(draw::Color newColor) { m_color = newColor; MarkToRedraw(); }; private: diff --git a/Sources/libewol/ewol/widget/WSlider.cpp b/Sources/libewol/ewol/widget/WSlider.cpp index ffd3c6ca..a449fca6 100644 --- a/Sources/libewol/ewol/widget/WSlider.cpp +++ b/Sources/libewol/ewol/widget/WSlider.cpp @@ -100,7 +100,7 @@ bool ewol::WSlider::CalculateMinSize(void) if (true == m_subWidget[iii]->CanExpentY()) { m_underExpend.y = true; } - Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetMinSize(); m_minSize.x = etk_max(tmpSize.x, m_minSize.x); m_minSize.y = etk_max(tmpSize.y, m_minSize.y); } @@ -296,7 +296,7 @@ void ewol::WSlider::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D pos) +ewol::Widget * ewol::WSlider::GetWidgetAtPos(etk::Vector2D pos) { // TODO : Review this ... if (m_windowsDestination<0 || m_windowsDestination > m_subWidget.Size()) { @@ -306,8 +306,8 @@ ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D pos) int32_t iii = m_windowsDestination; if (NULL != m_subWidget[iii]) { - Vector2D tmpSize = m_subWidget[iii]->GetSize(); - Vector2D tmpOrigin = m_subWidget[iii]->GetOrigin(); + etk::Vector2D tmpSize = m_subWidget[iii]->GetSize(); + etk::Vector2D tmpOrigin = m_subWidget[iii]->GetOrigin(); if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x) && (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) ) { diff --git a/Sources/libewol/ewol/widget/WSlider.h b/Sources/libewol/ewol/widget/WSlider.h index 5914d8c4..351248cf 100644 --- a/Sources/libewol/ewol/widget/WSlider.h +++ b/Sources/libewol/ewol/widget/WSlider.h @@ -43,7 +43,7 @@ namespace ewol { */ virtual const char * const GetObjectType(void) { return "EwolWSlider"; }; private: - Vector2D m_underExpend; // expend of the uner elements ... + etk::Vector2D m_underExpend; // expend of the uner elements ... public: virtual bool CalculateSize(float availlableX, float availlableY); // this generate the current size ... virtual bool CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer @@ -76,7 +76,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos); /** * @brief Inform object that an other object is removed ... * @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject diff --git a/Sources/libewol/ewol/widget/Widget.cpp b/Sources/libewol/ewol/widget/Widget.cpp index 894cd60a..5dcfe44e 100644 --- a/Sources/libewol/ewol/widget/Widget.cpp +++ b/Sources/libewol/ewol/widget/Widget.cpp @@ -253,10 +253,10 @@ void ewol::Widget::GenDraw(DrawProperty displayProp) tmpclipX, m_size.y); #ifdef __VIDEO__OPENGL_ES_2 - etk::Matrix tmpTranslate = etk::matrix::Translate(-tmpclipX/2 - (tmpOriginX-m_origin.x), -m_size.y/2, -1.0); - etk::Matrix tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0); - etk::Matrix tmpProjection = etk::matrix::Perspective(-tmpclipX/2, tmpclipX/2, -m_size.y/2, m_size.y/2, -1, 1); - etk::Matrix tmpMat = tmpProjection * tmpScale * tmpTranslate; + etk::Matrix4 tmpTranslate = etk::matrix::Translate(-tmpclipX/2 - (tmpOriginX-m_origin.x), -m_size.y/2, -1.0); + etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0); + etk::Matrix4 tmpProjection = etk::matrix::Perspective(-tmpclipX/2, tmpclipX/2, -m_size.y/2, m_size.y/2, -1, 1); + etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate; // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); #else @@ -282,12 +282,12 @@ void ewol::Widget::GenDraw(DrawProperty displayProp) m_size.y); #ifdef __VIDEO__OPENGL_ES_2 #if 1 - etk::Matrix tmpTranslate = etk::matrix::Translate(-m_size.x/2, -m_size.y/2, -1.0); - etk::Matrix tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0); - etk::Matrix tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1); - etk::Matrix tmpMat = tmpProjection * tmpScale * tmpTranslate; + etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_size.x/2, -m_size.y/2, -1.0); + etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0); + etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1); + etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate; #else - etk::Matrix tmpMat = etk::matrix::Perspective(0, m_size.x, 0, m_size.y, -1, 1); + etk::Matrix4 tmpMat = etk::matrix::Perspective(0, m_size.x, 0, m_size.y, -1, 1); #endif // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); diff --git a/Sources/libewol/ewol/widget/Widget.h b/Sources/libewol/ewol/widget/Widget.h index 9f6e7ed8..452613c5 100644 --- a/Sources/libewol/ewol/widget/Widget.h +++ b/Sources/libewol/ewol/widget/Widget.h @@ -106,9 +106,9 @@ namespace ewol { class DrawProperty{ public : - Vector2D m_windowsSize; - Vector2D m_origin; - Vector2D m_size; + etk::Vector2D m_windowsSize; + etk::Vector2D m_origin; + etk::Vector2D m_size; }; typedef struct { @@ -177,13 +177,13 @@ namespace ewol { protected: // internal element calculated by the system float m_zoom; //!< generic widget zoom - Vector2D m_origin; //!< internal ... I do not really known how i can use it ... - Vector2D m_size; //!< internal : current size of the widget - Vector2D m_minSize; //!< user define the minimum size of the widget + etk::Vector2D m_origin; //!< internal ... I do not really known how i can use it ... + etk::Vector2D m_size; //!< internal : current size of the widget + etk::Vector2D m_minSize; //!< user define the minimum size of the widget // user configuaration - Vector2D m_userMinSize; //!< user define the minimum size of the widget - Vector2D m_userExpend; - Vector2D m_userFill; + etk::Vector2D m_userMinSize; //!< user define the minimum size of the widget + etk::Vector2D m_userExpend; + etk::Vector2D m_userFill; public: /** * @brief Set the zoom property of the widget @@ -210,13 +210,13 @@ namespace ewol { * @param --- * @return coordonate of the origin requested */ - Vector2D GetOrigin(void) { return m_origin; }; + etk::Vector2D GetOrigin(void) { return m_origin; }; /** * @brief Convert the absolute position in the local Position (Relative) * @param[in] pos Absolute position that you request convertion * @return the relative position */ - virtual Vector2D RelativePosition(Vector2D pos) { pos.x -= m_origin.x; pos.y -= m_origin.y; return pos; }; + virtual etk::Vector2D RelativePosition(etk::Vector2D pos) { pos.x -= m_origin.x; pos.y -= m_origin.y; return pos; }; /** * @brief Parrent set the possible diplay size of the current widget whith his own possibilities * By default this save the widget availlable size in the widget size @@ -247,13 +247,13 @@ namespace ewol { * @param --- * @return re size requested */ - Vector2D GetMinSize(void) { if (false==IsHide()) { return m_minSize; } return Vector2D(0,0); }; + etk::Vector2D GetMinSize(void) { if (false==IsHide()) { return m_minSize; } return etk::Vector2D(0,0); }; /** * @brief Get the widget size * @param --- * @return Requested size */ - Vector2D GetSize(void) { if (false==IsHide()) { return m_size; } return Vector2D(0,0); }; + etk::Vector2D GetSize(void) { if (false==IsHide()) { return m_size; } return etk::Vector2D(0,0); }; /** * @brief Set the horizontal expend capacity * @param[in] newExpend new Expend state @@ -423,7 +423,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos) { if (false==IsHide()) { return this; } return NULL; }; + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos) { if (false==IsHide()) { return this; } return NULL; }; /** * @brief Event on an input of this Widget * @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...) @@ -433,7 +433,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { return false; }; + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { return false; }; /** * @brief Event on the keybord (if no shortcut has been detected before). * @param[in] type of the event (ewol::EVENT_KB_TYPE_DOWN or ewol::EVENT_KB_TYPE_UP) diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.cpp b/Sources/libewol/ewol/widget/WidgetScrolled.cpp index 262e1296..8f59e411 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.cpp +++ b/Sources/libewol/ewol/widget/WidgetScrolled.cpp @@ -98,9 +98,9 @@ void ewol::WidgetScrooled::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D pos) +bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D pos) { - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); // corection due to the open Gl invertion ... relativePos.y = m_size.y - relativePos.y; if (SCROLL_MODE_NORMAL == m_scroollingMode) { @@ -376,10 +376,10 @@ void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp) m_size.x, m_size.y); #ifdef __VIDEO__OPENGL_ES_2 - etk::Matrix tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1); - etk::Matrix tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0); - etk::Matrix tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0); - etk::Matrix tmpMat = tmpProjection * tmpScale * tmpTranslate; + etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1); + etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0); + etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0); + etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate; // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); #else @@ -401,9 +401,9 @@ void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp) m_size.y); #ifdef __VIDEO__OPENGL_ES_2 - etk::Matrix tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1); - etk::Matrix tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0); - etk::Matrix tmpMat = tmpProjection * tmpTranslate; + etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1); + etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0); + etk::Matrix4 tmpMat = tmpProjection * tmpTranslate; // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); #else @@ -435,7 +435,7 @@ void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp) * @param[in] center True if the position might be at the center of the widget * @return --- */ -void ewol::WidgetScrooled::SetScrollingPositionDynamic(Vector2D borderWidth, Vector2D currentPosition, bool center) +void ewol::WidgetScrooled::SetScrollingPositionDynamic(etk::Vector2D borderWidth, etk::Vector2D currentPosition, bool center) { if (true == center) { borderWidth.x = m_size.x / 2 - borderWidth.x; diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.h b/Sources/libewol/ewol/widget/WidgetScrolled.h index 394183db..01e99aa5 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.h +++ b/Sources/libewol/ewol/widget/WidgetScrolled.h @@ -51,13 +51,13 @@ namespace ewol { void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); protected: - Vector2D m_originScrooled; - Vector2D m_maxSize; + etk::Vector2D m_originScrooled; + etk::Vector2D m_maxSize; float m_limitScrolling; private: scrollingMode_te m_scroollingMode; //!< mode of management of the scrooling float m_pixelScrolling; - Vector2D m_highSpeedStartPos; + etk::Vector2D m_highSpeedStartPos; highSpeedMode_te m_highSpeedMode; int32_t m_highSpeedButton; ewol::inputType_te m_highSpeedType; @@ -82,7 +82,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D pos); /** * @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) * This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget @@ -109,7 +109,7 @@ namespace ewol { * @param[in] localSize new Maximum size * @return --- */ - void SetMaxSize(Vector2D localSize) { m_maxSize = localSize; }; + void SetMaxSize(etk::Vector2D localSize) { m_maxSize = localSize; }; /** * @brief Request a specific position for the scrolling of the current windows. * @param[in] borderWidth Size of the border that requested the element might not to be @@ -117,7 +117,7 @@ namespace ewol { * @param[in] center True if the position might be at the center of the widget * @return --- */ - void SetScrollingPositionDynamic(Vector2D borderWidth, Vector2D currentPosition, bool center = false); + void SetScrollingPositionDynamic(etk::Vector2D borderWidth, etk::Vector2D currentPosition, bool center = false); /** * @brief Set the scrolling limit when arriving at he end of the widget * @param[in] poucentageLimit pourcent of the limit of view nothing in the widget when arriving at the end ... diff --git a/Sources/libewol/ewol/widget/Windows.cpp b/Sources/libewol/ewol/widget/Windows.cpp index b88336b8..94afb9dc 100644 --- a/Sources/libewol/ewol/widget/Windows.cpp +++ b/Sources/libewol/ewol/widget/Windows.cpp @@ -96,10 +96,10 @@ bool ewol::Windows::CalculateSize(float availlableX, float availlableY) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::Windows::GetWidgetAtPos(Vector2D pos) +ewol::Widget * ewol::Windows::GetWidgetAtPos(etk::Vector2D pos) { // calculate relative position - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); // event go directly on the pop-up if (0 < m_popUpWidgetList.Size()) { if (NULL == m_popUpWidgetList[m_popUpWidgetList.Size()-1]) { @@ -126,7 +126,7 @@ void ewol::Windows::SysDraw(void) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // clear the matrix system : - etk::Matrix newOne; + etk::Matrix4 newOne; ewol::openGL::SetBasicMatrix(newOne); ewol::DrawProperty displayProp; diff --git a/Sources/libewol/ewol/widget/Windows.h b/Sources/libewol/ewol/widget/Windows.h index 13f3412a..9765db7c 100644 --- a/Sources/libewol/ewol/widget/Windows.h +++ b/Sources/libewol/ewol/widget/Windows.h @@ -64,7 +64,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); + virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D pos); private: bool m_hasDecoration; public: diff --git a/Sources/libewol/ewol/widget/meta/ParameterList.cpp b/Sources/libewol/ewol/widget/meta/ParameterList.cpp index 1f0157f3..a3064964 100644 --- a/Sources/libewol/ewol/widget/meta/ParameterList.cpp +++ b/Sources/libewol/ewol/widget/meta/ParameterList.cpp @@ -186,7 +186,7 @@ void ewol::ParameterList::OnRegenerateDisplay(void) ewol::OObject2DTextColored * tmpText = new ewol::OObject2DTextColored(); - Vector2D textPos; + etk::Vector2D textPos; textPos.x = (int32_t)tmpOriginX; if (m_list[iii]->m_group == false) { textPos.x += minHeight; @@ -213,7 +213,7 @@ void ewol::ParameterList::OnRegenerateDisplay(void) * @return true the event is used * @return false the event is not used */ -bool ewol::ParameterList::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) +bool ewol::ParameterList::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) { if (true == WidgetScrooled::OnEventInput(type, IdInput, typeEvent, pos)) { ewol::widgetManager::FocusKeep(this); @@ -221,7 +221,7 @@ bool ewol::ParameterList::OnEventInput(ewol::inputType_te type, int32_t IdInput, return true; } if (IdInput == 1 && typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) { - Vector2D relativePos = RelativePosition(pos); + etk::Vector2D relativePos = RelativePosition(pos); // corection for the openGl abstraction relativePos.y = m_size.y - relativePos.y; // TODO : Rework this ... diff --git a/Sources/libewol/ewol/widget/meta/ParameterList.h b/Sources/libewol/ewol/widget/meta/ParameterList.h index 6cf0c77f..9943a948 100644 --- a/Sources/libewol/ewol/widget/meta/ParameterList.h +++ b/Sources/libewol/ewol/widget/meta/ParameterList.h @@ -93,7 +93,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); + bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); protected: void OnGetFocus(void); void OnLostFocus(void); diff --git a/Sources/libparsersvg b/Sources/libparsersvg index 8f07ec9b..34d4ccc1 160000 --- a/Sources/libparsersvg +++ b/Sources/libparsersvg @@ -1 +1 @@ -Subproject commit 8f07ec9b7c9720c55743128a6e1ed97f81242770 +Subproject commit 34d4ccc15fa262ccc3b061010512c3ceaabfd22e