From ba09b090a9644c0e8e643aef0aa506709ddd5dd6 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Fri, 8 Jun 2012 18:24:11 +0200 Subject: [PATCH] vendredi soir --- Sources/libetk/etk/Color.cpp | 8 +- Sources/libetk/etk/Stream.h | 59 +- Sources/libetk/etk/Types.h | 71 +- Sources/libetk/etk/TypesCoordonate.h | 778 ++++++++---------- Sources/libewol/ewol/Font.h | 16 +- Sources/libewol/ewol/FontFreeType.cpp | 28 +- Sources/libewol/ewol/Game/GameElement.cpp | 6 +- Sources/libewol/ewol/Game/GameElement.h | 20 +- Sources/libewol/ewol/Game/GameElementLua.cpp | 22 +- Sources/libewol/ewol/Game/GameElementLua.h | 4 +- Sources/libewol/ewol/Game/SceneElement.cpp | 14 +- Sources/libewol/ewol/Game/SceneElement.h | 16 +- Sources/libewol/ewol/OObject.h | 4 +- Sources/libewol/ewol/OObject/2DColored.cpp | 19 +- Sources/libewol/ewol/OObject/2DColored.h | 12 +- Sources/libewol/ewol/OObject/2DText.cpp | 4 +- Sources/libewol/ewol/OObject/2DText.h | 6 +- .../libewol/ewol/OObject/2DTextColored.cpp | 4 +- Sources/libewol/ewol/OObject/2DTextColored.h | 6 +- Sources/libewol/ewol/OObject/2DTextured.cpp | 2 +- Sources/libewol/ewol/OObject/2DTextured.h | 2 +- Sources/libewol/ewol/OObject/Sprite.cpp | 4 +- Sources/libewol/ewol/OObject/Sprite.h | 4 +- Sources/libewol/ewol/Texture/TextureSVG.cpp | 4 +- Sources/libewol/ewol/Widget.h | 20 +- Sources/libewol/ewol/Windows.cpp | 4 +- Sources/libewol/ewol/Windows.h | 2 +- Sources/libewol/ewol/base/MainThread.cpp | 4 +- .../ewol/base/eventInputManagement.cpp | 12 +- .../libewol/ewol/base/eventInputManagement.h | 4 +- Sources/libewol/ewol/widget/Button.cpp | 6 +- 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 | 6 +- Sources/libewol/ewol/widget/ButtonImage.h | 2 +- Sources/libewol/ewol/widget/CheckBox.cpp | 4 +- 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 | 24 +- Sources/libewol/ewol/widget/ContextMenu.h | 10 +- Sources/libewol/ewol/widget/Entry.cpp | 4 +- Sources/libewol/ewol/widget/Entry.h | 2 +- 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 | 4 +- 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 | 6 +- Sources/libewol/ewol/widget/List.h | 2 +- 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/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 | 2 +- .../libewol/ewol/widget/WidgetScrolled.cpp | 6 +- Sources/libewol/ewol/widget/WidgetScrolled.h | 12 +- Sources/libparsersvg/parserSVG/Base.cpp | 4 +- Sources/libparsersvg/parserSVG/Base.h | 4 +- Sources/libparsersvg/parserSVG/Circle.cpp | 2 +- Sources/libparsersvg/parserSVG/Circle.h | 6 +- Sources/libparsersvg/parserSVG/Ellipse.cpp | 2 +- Sources/libparsersvg/parserSVG/Ellipse.h | 6 +- Sources/libparsersvg/parserSVG/Group.cpp | 8 +- Sources/libparsersvg/parserSVG/Group.h | 2 +- Sources/libparsersvg/parserSVG/Line.cpp | 2 +- Sources/libparsersvg/parserSVG/Line.h | 6 +- Sources/libparsersvg/parserSVG/Path.cpp | 2 +- Sources/libparsersvg/parserSVG/Path.h | 4 +- Sources/libparsersvg/parserSVG/Polygon.cpp | 4 +- Sources/libparsersvg/parserSVG/Polygon.h | 6 +- Sources/libparsersvg/parserSVG/Polyline.cpp | 4 +- Sources/libparsersvg/parserSVG/Polyline.h | 4 +- Sources/libparsersvg/parserSVG/Rectangle.cpp | 2 +- Sources/libparsersvg/parserSVG/Rectangle.h | 8 +- Sources/libparsersvg/parserSVG/Renderer.h | 6 +- Sources/libparsersvg/parserSVG/Text.cpp | 2 +- Sources/libparsersvg/parserSVG/Text.h | 2 +- Sources/libparsersvg/parserSVG/parserSVG.cpp | 6 +- Sources/libparsersvg/parserSVG/parserSVG.h | 4 +- 91 files changed, 661 insertions(+), 822 deletions(-) diff --git a/Sources/libetk/etk/Color.cpp b/Sources/libetk/etk/Color.cpp index 12e0a26d..d063ca45 100644 --- a/Sources/libetk/etk/Color.cpp +++ b/Sources/libetk/etk/Color.cpp @@ -488,10 +488,10 @@ color_ts etk::color::Create(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t color_ts etk::color::Create(etkFloat_t _red, etkFloat_t _green, etkFloat_t _blue, etkFloat_t _alpha) { color_ts tmpColor; - _red = etk_avg(0.0, _red, 1.0); - _green = etk_avg(0.0, _green, 1.0); - _blue = etk_avg(0.0, _blue, 1.0); - _alpha = etk_avg(0.0, _alpha, 1.0); + _red = etk_avg((float)0, (float)_red, (float)1); + _green = etk_avg((float)0, (float)_green, (float)1); + _blue = etk_avg((float)0, (float)_blue, (float)1); + _alpha = etk_avg((float)0, (float)_alpha, (float)1); tmpColor.red =(uint8_t)(_red*255); tmpColor.green=(uint8_t)(_green*255); tmpColor.blue =(uint8_t)(_blue*255); diff --git a/Sources/libetk/etk/Stream.h b/Sources/libetk/etk/Stream.h index 8495c18e..ab2e0c9f 100644 --- a/Sources/libetk/etk/Stream.h +++ b/Sources/libetk/etk/Stream.h @@ -167,82 +167,33 @@ namespace etk{ return *this; } - CCout& operator << (Coord2D t) { + CCout& operator << (Vector2D t) { snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f)", t.x, t.y); strncat(m_tmpChar, tmp, MAX_LOG_SIZE); return *this; } - CCout& operator << (Coord2D t) { + CCout& operator << (Vector2D t) { snprintf(tmp, MAX_LOG_SIZE_TMP, "(%i,%i)", t.x, t.y); strncat(m_tmpChar, tmp, MAX_LOG_SIZE); return *this; } - CCout& operator << (Coord2D t) { - snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f)", (float)t.x, (float)t.y); - strncat(m_tmpChar, tmp, MAX_LOG_SIZE); - return *this; - } - CCout& operator << (Coord3D t) { + CCout& operator << (Vector3D t) { snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f,%f)", t.x, t.y, t.z); strncat(m_tmpChar, tmp, MAX_LOG_SIZE); return *this; } - CCout& operator << (Coord3D t) { + CCout& operator << (Vector3D t) { snprintf(tmp, MAX_LOG_SIZE_TMP, "(%i,%i,%i)", t.x, t.y, t.z); strncat(m_tmpChar, tmp, MAX_LOG_SIZE); return *this; } - CCout& operator << (Coord3D t) { - snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f,%f)", (float)t.x, (float)t.y, (float)t.z); - strncat(m_tmpChar, tmp, MAX_LOG_SIZE); - return *this; - } - CCout& operator << (coord2D_ts t) { - #if defined(EWOL_PECISION_FIXPOINT) - snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f)", UNFIXED(t.x), UNFIXED(t.y)); - #elif defined(EWOL_PECISION_DOUBLE) - snprintf(tmp, MAX_LOG_SIZE_TMP, "(%lf,%lf)", t.x, t.y); - #else - snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f)", t.x, t.y); - #endif - strncat(m_tmpChar, tmp, MAX_LOG_SIZE); - return *this; - } - CCout& operator << (coord3D_ts t) { - #if defined(EWOL_PECISION_FIXPOINT) - snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f,%f)", UNFIXED(t.x), UNFIXED(t.y), UNFIXED(t.z)); - #elif defined(EWOL_PECISION_DOUBLE) - snprintf(tmp, MAX_LOG_SIZE_TMP, "(%lf,%lf,%lf)", t.x, t.y, t.z); - #else - snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f,%f)", t.x, t.y, t.z); - #endif - strncat(m_tmpChar, tmp, MAX_LOG_SIZE); - return *this; - } - CCout& operator << (texCoord_ts t) { - #if defined(EWOL_PECISION_FIXPOINT) - snprintf(tmp, MAX_LOG_SIZE_TMP, "{%f,%f}", UNFIXED(t.u), UNFIXED(t.v)); - #elif defined(EWOL_PECISION_DOUBLE) - snprintf(tmp, MAX_LOG_SIZE_TMP, "{%lf,%lf}", t.u, t.v); - #else - snprintf(tmp, MAX_LOG_SIZE_TMP, "{%f,%f}", t.u, t.v); - #endif - strncat(m_tmpChar, tmp, MAX_LOG_SIZE); - return *this; - } CCout& operator << (color_ts t) { snprintf(tmp, MAX_LOG_SIZE_TMP, "#%02X%02X%02X%02X", t.red, t.green, t.blue, t.alpha); strncat(m_tmpChar, tmp, MAX_LOG_SIZE); return *this; } CCout& operator << (clipping_ts t) { - #if defined(EWOL_PECISION_FIXPOINT) - snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", UNFIXED(t.x), UNFIXED(t.y), UNFIXED(t.w), UNFIXED(t.h)); - #elif defined(EWOL_PECISION_DOUBLE) - snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%lf,%lf) size=(%lf,%lf)", t.x, t.y, t.w, t.h); - #else - snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h); - #endif + snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h); strncat(m_tmpChar, tmp, MAX_LOG_SIZE); return *this; } diff --git a/Sources/libetk/etk/Types.h b/Sources/libetk/etk/Types.h index 6343129d..2653ae88 100644 --- a/Sources/libetk/etk/Types.h +++ b/Sources/libetk/etk/Types.h @@ -73,50 +73,33 @@ typedef enum { #include -extern "C" -{ - #if defined(EWOL_PECISION_FIXPOINT) - // TODO : Remove deprecated elements : - typedef int32_t etkFloat_t; - #define oglTypeFloat_t GL_FIXED - #else - // TODO : Remove deprecated elements : - typedef float etkFloat_t; - #define oglTypeFloat_t GL_FLOAT - #endif - // TODO : Remove deprecated elements : - typedef struct { - etkFloat_t x; - etkFloat_t y; - etkFloat_t z; - }coord3D_ts; - - // TODO : Remove deprecated elements : - typedef struct { - etkFloat_t x; - etkFloat_t y; - }coord2D_ts; - - // TODO : Remove deprecated elements : - typedef struct { - etkFloat_t u; - etkFloat_t v; - }texCoord_ts; - - typedef struct { - etkFloat_t x; - etkFloat_t y; - etkFloat_t w; - etkFloat_t h; - }clipping_ts; - - typedef struct color_ts { - uint8_t red; - uint8_t green; - uint8_t blue; - uint8_t alpha; - }color_ts; -} +typedef oglt etkFloat_t; + +#if defined(EWOL_PECISION_FIXPOINT) + #define oglTypeFloat_t GL_FIXED +#else + #define oglTypeFloat_t GL_FLOAT +#endif + +typedef struct { + float u; + float v; +}texCoord_ts; + +typedef struct { + float x; + float y; + float w; + float h; +}clipping_ts; + +typedef struct color_ts { + uint8_t red; + uint8_t green; + uint8_t blue; + uint8_t alpha; +}color_ts; + #include diff --git a/Sources/libetk/etk/TypesCoordonate.h b/Sources/libetk/etk/TypesCoordonate.h index c7a3ef99..18fc71b2 100644 --- a/Sources/libetk/etk/TypesCoordonate.h +++ b/Sources/libetk/etk/TypesCoordonate.h @@ -25,10 +25,13 @@ #ifndef __ETK_TYPES_COORDONATES_H__ #define __ETK_TYPES_COORDONATES_H__ +typedef float oglt; + +#if 0 class oglt { public: - #if defined(EWOL_PECISION_FIXPOINT) + #if defined(EWOL_PECISION_FIXPOINT32) int32_t val; #elseif defined(EWOL_PECISION_DOUBLE) double val; @@ -42,20 +45,20 @@ class oglt oglt(void) : val(0) { }; oglt(const oglt& obj) : val(obj.val) { }; ~oglt(void) { }; - #if defined(EWOL_PECISION_FIXPOINT) + #if defined(EWOL_PECISION_FIXPOINT32) oglt(const int32_t val) : val(val << 16) { }; oglt(const float val) : val(val*65536.0) { }; oglt(const double val) : val(val*65536.0) { }; - operator int32_t() const { return val>>16; } + //operator int32_t() const { return val>>16; } operator float() const { return (float)((float)val/(float)65536.0); } - operator double() const { return (double)((double)val/(double)65536.0); } + //operator double() const { return (double)((double)val/(double)65536.0); } #else oglt(const int32_t val) : val(val) { }; oglt(const float val) : val(val) { }; oglt(const double val) : val(val) { }; - operator int32_t() const { return (int32_t)val; } + //operator int32_t() const { return (int32_t)val; } operator float() const { return (float)val; } - operator double() const { return (double)val; } + //operator double() const { return (double)val; } #endif /***************************************************** * = assigment @@ -64,17 +67,141 @@ class oglt val = obj.val; return *this; } + const oglt& operator= (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val = ((int32_t)(value<<16); + #else + val = value; + #endif + return *this; + } + const oglt& operator= (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val = ((int32_t)(value*65636.0); + #else + val = value; + #endif + return *this; + } /***************************************************** * == operator *****************************************************/ const bool operator== (const oglt& obj) const { return (obj.val == val) ? true : false; } + const bool operator== (const int32_t value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value<<16) == val) ? false : true; + #else + return (value == val) ? false : true; + #endif + } + const bool operator== (const float value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value*65636.0) == val) ? false : true; + #else + return (value == val) ? false : true; + #endif + } /***************************************************** * != operator *****************************************************/ - bool operator!= (const oglt& obj) const { - return (obj.val == val) ? false : true; + const bool operator!= (const oglt& obj) const { + return (obj.val != val) ? false : true; + } + const bool operator!= (const int32_t value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value<<16) != val) ? false : true; + #else + return (value != val) ? false : true; + #endif + } + const bool operator!= (const float value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value*65636.0) != val) ? false : true; + #else + return (value != val) ? false : true; + #endif + } + /***************************************************** + * <= operator + *****************************************************/ + const bool operator<= (const oglt& obj) const { + return (obj.val <= val) ? false : true; + } + const bool operator<= (const int32_t value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value<<16) <= val) ? false : true; + #else + return (value <= val) ? false : true; + #endif + } + const bool operator<= (const float value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value*65636.0) <= val) ? false : true; + #else + return (value <= val) ? false : true; + #endif + } + /***************************************************** + * < operator + *****************************************************/ + const bool operator< (const oglt& obj) const { + return (obj.val < val) ? false : true; + } + const bool operator< (const int32_t value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value<<16) < val) ? false : true; + #else + return (value < val) ? false : true; + #endif + } + const bool operator< (const float value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value*65636.0) < val) ? false : true; + #else + return (value < val) ? false : true; + #endif + } + /***************************************************** + * >= operator + *****************************************************/ + const bool operator>= (const oglt& obj) const { + return (obj.val >= val) ? false : true; + } + const bool operator>= (const int32_t value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value<<16) >= val) ? false : true; + #else + return (value >= val) ? false : true; + #endif + } + const bool operator>= (const float value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value*65636.0) >= val) ? false : true; + #else + return (value >= val) ? false : true; + #endif + } + /***************************************************** + * > operator + *****************************************************/ + const bool operator> (const oglt& obj) const { + return (obj.val > val) ? false : true; + } + const bool operator> (const int32_t value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value<<16) > val) ? false : true; + #else + return (value > val) ? false : true; + #endif + } + const bool operator> (const float value) const { + #if defined(EWOL_PECISION_FIXPOINT32) + return ((int32_t)(value*65636.0) > val) ? false : true; + #else + return (value > val) ? false : true; + #endif } /***************************************************** * += operator @@ -83,6 +210,22 @@ class oglt val += obj.val; return *this; } + const oglt& operator+= (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val += (value<<16); + #else + val += value; + #endif + return *this; + } + const oglt& operator+= (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val += (int32_t)(value*65636.0); + #else + val += value; + #endif + return *this; + } /***************************************************** * + operator *****************************************************/ @@ -90,6 +233,29 @@ class oglt val += obj.val; return *this; } + const oglt& operator+ (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val += (value<<16); + #else + val += value; + #endif + return *this; + } + const oglt operator+ (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val += (int32_t)(value*65636.0); + #else + val += value; + #endif + return *this; + } + /* + oglt operator+ (const oglt& obj, const oglt& obj2) { + oglt tmpVal = obj; + tmpVal += obj2; + return tmpVal; + } + */ /***************************************************** * -= operator *****************************************************/ @@ -97,6 +263,22 @@ class oglt val -= obj.val; return *this; } + const oglt& operator-= (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val -= (value<<16); + #else + val -= value; + #endif + return *this; + } + const oglt& operator-= (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val -= (int32_t)(value*65636.0); + #else + val -= value; + #endif + return *this; + } /***************************************************** * - operator *****************************************************/ @@ -104,33 +286,81 @@ class oglt val -= obj.val; return *this; } + const oglt& operator- (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val -= (value<<16); + #else + val -= value; + #endif + return *this; + } + const oglt& operator- (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val -= (int32_t)(value*65636.0); + #else + val -= value; + #endif + return *this; + } /***************************************************** * /= operator *****************************************************/ const oglt& operator/= (const oglt& obj) { - #if defined(EWOL_PECISION_FIXPOINT) + #if defined(EWOL_PECISION_FIXPOINT32) val = ((int64_t)val<<16) / obj.val; #else val /= obj.val; #endif return *this; } + const oglt& operator/= (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val = val / value; + #else + val /= (float)value; + #endif + return *this; + } + const oglt& operator/= (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val = ((int64_t)val<<16) / (int32_t)(value); + #else + val /= value; + #endif + return *this; + } /***************************************************** * / operator *****************************************************/ - const oglt& operator/ (const oglt& obj) { - #if defined(EWOL_PECISION_FIXPOINT) + oglt operator/ (const oglt& obj) { + #if defined(EWOL_PECISION_FIXPOINT32) val = ((int64_t)val<<16) / obj.val; #else val /= obj.val; #endif return *this; } + oglt operator/ (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val = val / value; + #else + val /= (float)value; + #endif + return *this; + } + oglt operator/ (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val = ((int64_t)val<<16) / (int32_t)(value); + #else + val /= value; + #endif + return *this; + } /***************************************************** * *= operator *****************************************************/ const oglt& operator*= (const oglt& obj) { - #if defined(EWOL_PECISION_FIXPOINT) + #if defined(EWOL_PECISION_FIXPOINT32) int64_t tmpVal = (int64_t)val * (int64_t)obj.val; val = tmpVal >> 16; #else @@ -138,11 +368,28 @@ class oglt #endif return *this; } + const oglt& operator*= (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val = (int32_t)((int64_t)val * (int64_t)value); + #else + val *= (float)value; + #endif + return *this; + } + const oglt& operator*= (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + int64_t tmpVal = (int64_t)val * (int64_t)(value*65636.0); + val = tmpVal >> 16; + #else + val *= value; + #endif + return *this; + } /***************************************************** * * operator *****************************************************/ - const oglt& operator* (const oglt& obj) { - #if defined(EWOL_PECISION_FIXPOINT) + oglt operator* (const oglt& obj) { + #if defined(EWOL_PECISION_FIXPOINT32) int64_t tmpVal = (int64_t)val * (int64_t)obj.val; val = tmpVal >> 16; #else @@ -150,6 +397,23 @@ class oglt #endif return *this; } + oglt operator* (const int32_t value) { + #if defined(EWOL_PECISION_FIXPOINT32) + val = (int32_t)((int64_t)val * (int64_t)value); + #else + val *= (float)value; + #endif + return *this; + } + oglt operator* (const float value) { + #if defined(EWOL_PECISION_FIXPOINT32) + int64_t tmpVal = (int64_t)val * (int64_t)(value*65636.0); + val = tmpVal >> 16; + #else + val *= value; + #endif + return *this; + } /***************************************************** * ++ operator *****************************************************/ @@ -179,9 +443,16 @@ class oglt return result; } }; +/* +inline explicit operator*(const float val, const oglt& obj) { + float val2 = val; + val2 *= (float)obj.val; + return val2; +} +*/ +#endif - -template class Coord2D +template class Vector2D { public: T x; @@ -190,34 +461,19 @@ template class Coord2D /***************************************************** * Constructor *****************************************************/ - Coord2D(void) : x(0), y(0) { }; - Coord2D(double _x, double _y) : x(_x), y(_y) { }; - Coord2D(float _x, float _y) : x(_x), y(_y) { }; - Coord2D(int32_t _x, int32_t _y) : x(_x), y(_y) { }; - Coord2D(const Coord2D& obj) : x((T)obj.x), y((T)obj.y) { }; - Coord2D(const Coord2D& obj) : x((T)obj.x), y((T)obj.y) { }; - Coord2D(const Coord2D& obj) : x((T)obj.x), y((T)obj.y) { }; - Coord2D(const Coord2D& obj) : x((T)obj.x), y((T)obj.y) { }; - ~Coord2D(void) { }; + 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(const Vector2D& obj) : x((T)obj.x), y((T)obj.y) { }; + ~Vector2D(void) { }; /***************************************************** * = assigment *****************************************************/ - const Coord2D& operator= (const Coord2D& obj ) { - x = (T)obj.x; - y = (T)obj.y; - return *this; - } - const Coord2D& operator= (const Coord2D& obj ) { - x = (T)obj.x; - y = (T)obj.y; - return *this; - } - const Coord2D& operator= (const Coord2D& obj ) { - x = (T)obj.x; - y = (T)obj.y; - return *this; - } - const Coord2D& operator= (const Coord2D& obj ) { + const Vector2D& operator= (const Vector2D& obj ) { x = (T)obj.x; y = (T)obj.y; return *this; @@ -225,25 +481,7 @@ template class Coord2D /***************************************************** * == operator *****************************************************/ - bool operator== (const Coord2D& obj) const { - if ((T)obj.x == x && (T)obj.y == y) { - return true; - } - return false; - } - bool operator== (const Coord2D& obj) const { - if ((T)obj.x == x && (T)obj.y == y) { - return true; - } - return false; - } - bool operator== (const Coord2D& obj) const { - if ((T)obj.x == x && (T)obj.y == y) { - return true; - } - return false; - } - bool operator== (const Coord2D& obj) const { + bool operator== (const Vector2D& obj) const { if ((T)obj.x == x && (T)obj.y == y) { return true; } @@ -252,25 +490,7 @@ template class Coord2D /***************************************************** * != operator *****************************************************/ - bool operator!= (const Coord2D& obj) const { - if ((T)obj.x == x && (T)obj.y == y) { - return false; - } - return true; - } - bool operator!= (const Coord2D& obj) const { - if ((T)obj.x == x && (T)obj.y == y) { - return false; - } - return true; - } - bool operator!= (const Coord2D& obj) const { - if ((T)obj.x == x && (T)obj.y == y) { - return false; - } - return true; - } - bool operator!= (const Coord2D& obj) const { + bool operator!= (const Vector2D& obj) const { if ((T)obj.x == x && (T)obj.y == y) { return false; } @@ -279,22 +499,7 @@ template class Coord2D /***************************************************** * += operator *****************************************************/ - const Coord2D& operator+= (const Coord2D& obj) { - x += (T)obj.x; - y += (T)obj.y; - return *this; - } - const Coord2D& operator+= (const Coord2D& obj) { - x += (T)obj.x; - y += (T)obj.y; - return *this; - } - const Coord2D& operator+= (const Coord2D& obj) { - x += (T)obj.x; - y += (T)obj.y; - return *this; - } - const Coord2D& operator+= (const Coord2D& obj) { + const Vector2D& operator+= (const Vector2D& obj) { x += (T)obj.x; y += (T)obj.y; return *this; @@ -302,22 +507,7 @@ template class Coord2D /***************************************************** * + operator *****************************************************/ - Coord2D operator+ (const Coord2D& obj) { - x += (T)obj.x; - y += (T)obj.y; - return *this; - } - Coord2D operator+ (const Coord2D& obj) { - x += (T)obj.x; - y += (T)obj.y; - return *this; - } - Coord2D operator+ (const Coord2D& obj) { - x += (T)obj.x; - y += (T)obj.y; - return *this; - } - Coord2D operator+ (const Coord2D& obj) { + Vector2D operator+ (const Vector2D& obj) { x += (T)obj.x; y += (T)obj.y; return *this; @@ -325,22 +515,7 @@ template class Coord2D /***************************************************** * -= operator *****************************************************/ - const Coord2D& operator-= (const Coord2D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - return *this; - } - const Coord2D& operator-= (const Coord2D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - return *this; - } - const Coord2D& operator-= (const Coord2D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - return *this; - } - const Coord2D& operator-= (const Coord2D& obj) { + const Vector2D& operator-= (const Vector2D& obj) { x -= (T)obj.x; y -= (T)obj.y; return *this; @@ -348,22 +523,7 @@ template class Coord2D /***************************************************** * - operator *****************************************************/ - Coord2D operator- (const Coord2D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - return *this; - } - Coord2D operator- (const Coord2D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - return *this; - } - Coord2D operator- (const Coord2D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - return *this; - } - Coord2D operator- (const Coord2D& obj) { + Vector2D operator- (const Vector2D& obj) { x -= (T)obj.x; y -= (T)obj.y; return *this; @@ -371,22 +531,7 @@ template class Coord2D /***************************************************** * /= operator *****************************************************/ - const Coord2D& operator/= (const Coord2D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - return *this; - } - const Coord2D& operator/= (const Coord2D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - return *this; - } - const Coord2D& operator/= (const Coord2D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - return *this; - } - const Coord2D& operator/= (const Coord2D& obj) { + const Vector2D& operator/= (const Vector2D& obj) { x /= (T)obj.x; y /= (T)obj.y; return *this; @@ -394,22 +539,7 @@ template class Coord2D /***************************************************** * / operator *****************************************************/ - Coord2D operator/ (const Coord2D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - return *this; - } - Coord2D operator/ (const Coord2D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - return *this; - } - Coord2D operator/ (const Coord2D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - return *this; - } - Coord2D operator/ (const Coord2D& obj) { + Vector2D operator/ (const Vector2D& obj) { x /= (T)obj.x; y /= (T)obj.y; return *this; @@ -417,22 +547,7 @@ template class Coord2D /***************************************************** * *= operator *****************************************************/ - const Coord2D& operator*= (const Coord2D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - return *this; - } - const Coord2D& operator*= (const Coord2D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - return *this; - } - const Coord2D& operator*= (const Coord2D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - return *this; - } - const Coord2D& operator*= (const Coord2D& obj) { + const Vector2D& operator*= (const Vector2D& obj) { x *= (T)obj.x; y *= (T)obj.y; return *this; @@ -440,22 +555,7 @@ template class Coord2D /***************************************************** * * operator *****************************************************/ - Coord2D operator* (const Coord2D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - return *this; - } - Coord2D operator* (const Coord2D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - return *this; - } - Coord2D operator* (const Coord2D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - return *this; - } - Coord2D operator* (const Coord2D& obj) { + Vector2D operator* (const Vector2D& obj) { x *= (T)obj.x; y *= (T)obj.y; return *this; @@ -463,31 +563,31 @@ template class Coord2D /***************************************************** * ++ operator *****************************************************/ - Coord2D& operator++() // prefix + Vector2D& operator++() // prefix { ++x; ++y; return *this; } - Coord2D operator++(int unused) // postfix + Vector2D operator++(int unused) // postfix { - Coord2D result = *this; + Vector2D result = *this; ++(*this); return result; } /***************************************************** * -- operator *****************************************************/ - Coord2D& operator--() // prefix + Vector2D& operator--() // prefix { --x; --y; return *this; } - Coord2D operator--(int unused) // postfix + Vector2D operator--(int unused) // postfix { - Coord2D result = *this; + Vector2D result = *this; --(*this); return result; } @@ -496,7 +596,7 @@ template class Coord2D ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////: -template class Coord3D +template class Vector3D { public: T x; @@ -506,37 +606,19 @@ template class Coord3D /***************************************************** * Constructor *****************************************************/ - Coord3D(void) : x(0), y(0), z(0) { }; - Coord3D(double _x, double _y, double _z) : x(_x), y(_y), z(_z) { }; - Coord3D(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { }; - Coord3D(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) { }; - Coord3D(const Coord3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; - Coord3D(const Coord3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; - Coord3D(const Coord3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; - Coord3D(const Coord3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; - ~Coord3D(void) { }; + 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(const Vector3D& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { }; + ~Vector3D(void) { }; /***************************************************** * = assigment *****************************************************/ - const Coord3D& operator= (const Coord3D& obj ) { - x = (T)obj.x; - y = (T)obj.y; - z = (T)obj.z; - return *this; - } - const Coord3D& operator= (const Coord3D& obj ) { - x = (T)obj.x; - y = (T)obj.y; - z = (T)obj.z; - return *this; - } - const Coord3D& operator= (const Coord3D& obj ) { - x = (T)obj.x; - y = (T)obj.y; - z = (T)obj.z; - return *this; - } - const Coord3D& operator= (const Coord3D& obj ) { + const Vector3D& operator= (const Vector3D& obj ) { x = (T)obj.x; y = (T)obj.y; z = (T)obj.z; @@ -545,25 +627,7 @@ template class Coord3D /***************************************************** * == operator *****************************************************/ - bool operator== (const Coord3D& obj) const { - if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { - return true; - } - return false; - } - bool operator== (const Coord3D& obj) const { - if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { - return true; - } - return false; - } - bool operator== (const Coord3D& obj) const { - if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { - return true; - } - return false; - } - bool operator== (const Coord3D& obj) const { + bool operator== (const Vector3D& obj) const { if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { return true; } @@ -572,25 +636,7 @@ template class Coord3D /***************************************************** * != operator *****************************************************/ - bool operator!= (const Coord3D& obj) const { - if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { - return false; - } - return true; - } - bool operator!= (const Coord3D& obj) const { - if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { - return false; - } - return true; - } - bool operator!= (const Coord3D& obj) const { - if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { - return false; - } - return true; - } - bool operator!= (const Coord3D& obj) const { + bool operator!= (const Vector3D& obj) const { if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) { return false; } @@ -599,25 +645,7 @@ template class Coord3D /***************************************************** * += operator *****************************************************/ - const Coord3D& operator+= (const Coord3D& obj) { - x += (T)obj.x; - y += (T)obj.y; - z += (T)obj.z; - return *this; - } - const Coord3D& operator+= (const Coord3D& obj) { - x += (T)obj.x; - y += (T)obj.y; - z += (T)obj.z; - return *this; - } - const Coord3D& operator+= (const Coord3D& obj) { - x += (T)obj.x; - y += (T)obj.y; - z += (T)obj.z; - return *this; - } - const Coord3D& operator+= (const Coord3D& obj) { + const Vector3D& operator+= (const Vector3D& obj) { x += (T)obj.x; y += (T)obj.y; z += (T)obj.z; @@ -626,25 +654,7 @@ template class Coord3D /***************************************************** * + operator *****************************************************/ - Coord3D operator+ (const Coord3D& obj) { - x += (T)obj.x; - y += (T)obj.y; - z += (T)obj.z; - return *this; - } - Coord3D operator+ (const Coord3D& obj) { - x += (T)obj.x; - y += (T)obj.y; - z += (T)obj.z; - return *this; - } - Coord3D operator+ (const Coord3D& obj) { - x += (T)obj.x; - y += (T)obj.y; - z += (T)obj.z; - return *this; - } - Coord3D operator+ (const Coord3D& obj) { + Vector3D operator+ (const Vector3D& obj) { x += (T)obj.x; y += (T)obj.y; z += (T)obj.z; @@ -653,25 +663,7 @@ template class Coord3D /***************************************************** * -= operator *****************************************************/ - const Coord3D& operator-= (const Coord3D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - z -= (T)obj.z; - return *this; - } - const Coord3D& operator-= (const Coord3D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - z -= (T)obj.z; - return *this; - } - const Coord3D& operator-= (const Coord3D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - z -= (T)obj.z; - return *this; - } - const Coord3D& operator-= (const Coord3D& obj) { + const Vector3D& operator-= (const Vector3D& obj) { x -= (T)obj.x; y -= (T)obj.y; z -= (T)obj.z; @@ -680,25 +672,7 @@ template class Coord3D /***************************************************** * - operator *****************************************************/ - Coord3D operator- (const Coord3D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - z -= (T)obj.z; - return *this; - } - Coord3D operator- (const Coord3D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - z -= (T)obj.z; - return *this; - } - Coord3D operator- (const Coord3D& obj) { - x -= (T)obj.x; - y -= (T)obj.y; - z -= (T)obj.z; - return *this; - } - Coord3D operator- (const Coord3D& obj) { + Vector3D operator- (const Vector3D& obj) { x -= (T)obj.x; y -= (T)obj.y; z -= (T)obj.z; @@ -707,25 +681,7 @@ template class Coord3D /***************************************************** * /= operator *****************************************************/ - const Coord3D& operator/= (const Coord3D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - z /= (T)obj.z; - return *this; - } - const Coord3D& operator/= (const Coord3D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - z /= (T)obj.z; - return *this; - } - const Coord3D& operator/= (const Coord3D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - z /= (T)obj.z; - return *this; - } - const Coord3D& operator/= (const Coord3D& obj) { + const Vector3D& operator/= (const Vector3D& obj) { x /= (T)obj.x; y /= (T)obj.y; z /= (T)obj.z; @@ -734,25 +690,7 @@ template class Coord3D /***************************************************** * / operator *****************************************************/ - Coord3D operator/ (const Coord3D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - z /= (T)obj.z; - return *this; - } - Coord3D operator/ (const Coord3D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - z /= (T)obj.z; - return *this; - } - Coord3D operator/ (const Coord3D& obj) { - x /= (T)obj.x; - y /= (T)obj.y; - z /= (T)obj.z; - return *this; - } - Coord3D operator/ (const Coord3D& obj) { + Vector3D operator/ (const Vector3D& obj) { x /= (T)obj.x; y /= (T)obj.y; z /= (T)obj.z; @@ -761,25 +699,7 @@ template class Coord3D /***************************************************** * *= operator *****************************************************/ - const Coord3D& operator*= (const Coord3D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - z *= (T)obj.z; - return *this; - } - const Coord3D& operator*= (const Coord3D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - z *= (T)obj.z; - return *this; - } - const Coord3D& operator*= (const Coord3D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - z *= (T)obj.z; - return *this; - } - const Coord3D& operator*= (const Coord3D& obj) { + const Vector3D& operator*= (const Vector3D& obj) { x *= (T)obj.x; y *= (T)obj.y; z *= (T)obj.z; @@ -788,25 +708,7 @@ template class Coord3D /***************************************************** * * operator *****************************************************/ - Coord3D operator* (const Coord3D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - z *= (T)obj.z; - return *this; - } - Coord3D operator* (const Coord3D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - z *= (T)obj.z; - return *this; - } - Coord3D operator* (const Coord3D& obj) { - x *= (T)obj.x; - y *= (T)obj.y; - z *= (T)obj.z; - return *this; - } - Coord3D operator* (const Coord3D& obj) { + Vector3D operator* (const Vector3D& obj) { x *= (T)obj.x; y *= (T)obj.y; z *= (T)obj.z; @@ -815,32 +717,32 @@ template class Coord3D /***************************************************** * ++ operator *****************************************************/ - Coord3D& operator++() // prefix + Vector3D& operator++() // prefix { ++x; ++y; ++z; return *this; } - Coord3D operator++(int unused) // postfix + Vector3D operator++(int unused) // postfix { - Coord3D result = *this; + Vector3D result = *this; ++(*this); return result; } /***************************************************** * -- operator *****************************************************/ - Coord3D& operator--() // prefix + Vector3D& operator--() // prefix { --x; --y; --z; return *this; } - Coord3D operator--(int unused) // postfix + Vector3D operator--(int unused) // postfix { - Coord3D result = *this; + Vector3D result = *this; --(*this); return result; } diff --git a/Sources/libewol/ewol/Font.h b/Sources/libewol/ewol/Font.h index db7352ec..acf5b4a0 100644 --- a/Sources/libewol/ewol/Font.h +++ b/Sources/libewol/ewol/Font.h @@ -53,30 +53,30 @@ namespace ewol int32_t GetWidth(int32_t fontID, const etk::UString& unicodeString); int32_t GetHeight(int32_t fontID); int32_t DrawText(int32_t fontID, - coord2D_ts textPos, + Vector2D textPos, clipping_ts & drawClipping, const etk::UString & unicodeString, int32_t & fontTextureId, - etk::VectorType & coord, + etk::VectorType > & coord, etk::VectorType & coordTex); int32_t DrawText(int32_t fontID, - coord2D_ts textPos, + Vector2D textPos, clipping_ts & drawClipping, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType & coord, + etk::VectorType > & coord, etk::VectorType & coordTex); int32_t DrawText(int32_t fontID, - coord2D_ts textPos, + Vector2D textPos, const etk::UString & unicodeString, int32_t & fontTextureId, - etk::VectorType & coord, + etk::VectorType > & coord, etk::VectorType & coordTex); int32_t DrawText(int32_t fontID, - coord2D_ts textPos, + Vector2D textPos, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType & coord, + etk::VectorType > & coord, etk::VectorType & coordTex); int32_t LoadFont(etk::File fontFileName); }; diff --git a/Sources/libewol/ewol/FontFreeType.cpp b/Sources/libewol/ewol/FontFreeType.cpp index baa570bd..2de43555 100644 --- a/Sources/libewol/ewol/FontFreeType.cpp +++ b/Sources/libewol/ewol/FontFreeType.cpp @@ -45,8 +45,8 @@ extern "C" uniChar_t unicodeCharVal; texCoord_ts posStart; texCoord_ts posStop; - coord2D_ts bearing; - coord2D_ts size; + Vector2D bearing; + Vector2D size; int32_t advance; }freeTypeFontElement_ts; }; @@ -572,11 +572,11 @@ void ewol::UnloadFont(int32_t id) } int32_t ewol::DrawText(int32_t fontID, - coord2D_ts textPos, + Vector2D textPos, clipping_ts & drawClipping, const etk::UString& unicodeString, int32_t & fontTextureId, - etk::VectorType & coord, + etk::VectorType> & coord, etk::VectorType & coordTex) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) { @@ -682,7 +682,7 @@ int32_t ewol::DrawText(int32_t fontID, * | | * 3------2 */ - coord2D_ts bitmapDrawPos[4]; + Vector2D bitmapDrawPos[4]; bitmapDrawPos[0].x = dxA; bitmapDrawPos[1].x = dxB; bitmapDrawPos[2].x = dxB; @@ -753,11 +753,11 @@ int32_t ewol::DrawText(int32_t fontID, // TODO : Simplify this ... int32_t ewol::DrawText(int32_t fontID, - coord2D_ts textPos, + Vector2D textPos, clipping_ts & drawClipping, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType & coord, + etk::VectorType> & coord, etk::VectorType & coordTex) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) { @@ -838,7 +838,7 @@ int32_t ewol::DrawText(int32_t fontID, * | | * 3------2 */ - coord2D_ts bitmapDrawPos[4]; + Vector2D bitmapDrawPos[4]; bitmapDrawPos[0].x = dxA; bitmapDrawPos[1].x = dxB; bitmapDrawPos[2].x = dxB; @@ -907,10 +907,10 @@ int32_t ewol::DrawText(int32_t fontID, int32_t ewol::DrawText(int32_t fontID, - coord2D_ts textPos, + Vector2D textPos, const etk::UString& unicodeString, int32_t & fontTextureId, - etk::VectorType & coord, + etk::VectorType> & coord, etk::VectorType & coordTex) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) { @@ -971,7 +971,7 @@ int32_t ewol::DrawText(int32_t fontID, * | | * 3------2 */ - coord2D_ts bitmapDrawPos[4]; + Vector2D bitmapDrawPos[4]; bitmapDrawPos[0].x = dxA; bitmapDrawPos[1].x = dxB; bitmapDrawPos[2].x = dxB; @@ -1041,10 +1041,10 @@ int32_t ewol::DrawText(int32_t fontID, // TODO : Simplify this ... int32_t ewol::DrawText(int32_t fontID, - coord2D_ts textPos, + Vector2D textPos, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType & coord, + etk::VectorType> & coord, etk::VectorType & coordTex) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) { @@ -1101,7 +1101,7 @@ int32_t ewol::DrawText(int32_t fontID, * | | * 3------2 */ - coord2D_ts bitmapDrawPos[4]; + Vector2D bitmapDrawPos[4]; bitmapDrawPos[0].x = dxA; bitmapDrawPos[1].x = dxB; bitmapDrawPos[2].x = dxB; diff --git a/Sources/libewol/ewol/Game/GameElement.cpp b/Sources/libewol/ewol/Game/GameElement.cpp index df37e6a3..6a19a725 100644 --- a/Sources/libewol/ewol/Game/GameElement.cpp +++ b/Sources/libewol/ewol/Game/GameElement.cpp @@ -60,7 +60,7 @@ ewol::GameElement::GameElement(SceneElement & sceneElement, etk::UString& tmpNam * @param[in] maxSize maximum size of the sprite * @return the id of the sprite requested or -1 if it does not existed */ -int32_t ewol::GameElement::LoadSprite(etk::VectorType listOfElement[NB_BOUBLE_BUFFER], etk::UString fileName, coord2D_ts maxSize) +int32_t ewol::GameElement::LoadSprite(etk::VectorType listOfElement[NB_BOUBLE_BUFFER], etk::UString fileName, Vector2D maxSize) { for (int32_t iii=0; iii listOfEleme } -etkFloat_t quadDist(coord2D_ts pos1, coord2D_ts pos2) +etkFloat_t quadDist(Vector2D pos1, Vector2D pos2) { etkFloat_t tmpVal1 = pos1.x - pos2.x; etkFloat_t tmpVal2 = pos1.y - pos2.y; @@ -105,7 +105,7 @@ void ewol::GameElement::GetElementProperty(gameElementGenericProperty_ts &elemen } -bool ewol::GameElement::HaveImpact(int32_t group, int32_t type, coord2D_ts position, etkFloat_t size) +bool ewol::GameElement::HaveImpact(int32_t group, int32_t type, Vector2D position, etkFloat_t size) { // check if it was in the same group if (group == m_group) { diff --git a/Sources/libewol/ewol/Game/GameElement.h b/Sources/libewol/ewol/Game/GameElement.h index 45fcef26..5fc3dd0b 100644 --- a/Sources/libewol/ewol/Game/GameElement.h +++ b/Sources/libewol/ewol/Game/GameElement.h @@ -46,8 +46,8 @@ namespace ewol { int32_t m_type; int32_t m_power; bool m_visible; - coord2D_ts m_position; - coord2D_ts m_speed; + Vector2D m_position; + Vector2D m_speed; etkFloat_t m_size; etkFloat_t m_angle; etkFloat_t m_gravity; @@ -75,11 +75,11 @@ namespace ewol { bool HasName(etk::UString tmpName) { return (tmpName == m_fileNameConfig); }; bool IsVisible(void) { return m_visible; }; void SetVisible(bool state) { m_visible = state; }; - coord2D_ts PositionGet(void) { return m_position; }; - void PositionSet(coord2D_ts state) { m_position = state; }; + Vector2D PositionGet(void) { return m_position; }; + void PositionSet(Vector2D state) { m_position = state; }; void PositionSet(etkFloat_t xxx, etkFloat_t yyy) { m_position.x = xxx; m_position.y = yyy; }; - coord2D_ts SpeedGet(void) { return m_speed; }; - void SpeedSet(coord2D_ts state) { m_speed = state; }; + Vector2D SpeedGet(void) { return m_speed; }; + void SpeedSet(Vector2D state) { m_speed = state; }; void SpeedSet(etkFloat_t xxx, etkFloat_t yyy) { m_speed.x = xxx; m_speed.y = yyy; }; etkFloat_t SizeGet(void) { return m_size; }; void SizeSet(etkFloat_t state) { m_size = state; }; @@ -122,8 +122,8 @@ namespace ewol { * @return --- */ virtual void RemoveElement(int32_t idOfElement) { }; - virtual bool HaveImpact(int32_t group, int32_t type, coord2D_ts position, etkFloat_t size); - virtual bool Explosion(int32_t group, int32_t type, coord2D_ts position, etkFloat_t pxAtenuation, etkFloat_t power) { return false; } ; + virtual bool HaveImpact(int32_t group, int32_t type, Vector2D position, etkFloat_t size); + virtual bool Explosion(int32_t group, int32_t type, Vector2D position, etkFloat_t pxAtenuation, etkFloat_t power) { return false; } ; /** * @brief Requuest the draw of the current element, it will be done on the current Sprite list * @param[in,out] listOfElement Reference on the list of sprite that we need to find if it exist or added a new one @@ -131,7 +131,7 @@ namespace ewol { * @param[in] maxSize maximum size of the sprite * @return the id of the sprite requested or -1 if it does not existed */ - int32_t LoadSprite(etk::VectorType listOfElement[NB_BOUBLE_BUFFER], etk::UString fileName, coord2D_ts maxSize); + int32_t LoadSprite(etk::VectorType listOfElement[NB_BOUBLE_BUFFER], etk::UString fileName, Vector2D maxSize); virtual void Message(etk::UString control, etk::UString message) { } ; }; @@ -140,6 +140,6 @@ namespace ewol { #include -etkFloat_t quadDist(coord2D_ts pos1, coord2D_ts pos2); +etkFloat_t quadDist(Vector2D pos1, Vector2D pos2); #endif diff --git a/Sources/libewol/ewol/Game/GameElementLua.cpp b/Sources/libewol/ewol/Game/GameElementLua.cpp index 0f8f9b46..c0731af4 100644 --- a/Sources/libewol/ewol/Game/GameElementLua.cpp +++ b/Sources/libewol/ewol/Game/GameElementLua.cpp @@ -142,7 +142,7 @@ LUAMOD_API int lua_GetPos(lua_State *L) lua_pushnumber(L, (lua_Number)0 ); return 2; } - coord2D_ts tmpPos = tmpObj->PositionGet(); + Vector2D tmpPos = tmpObj->PositionGet(); lua_pushnumber(L, (lua_Number)tmpPos.x ); lua_pushnumber(L, (lua_Number)tmpPos.y ); // return number of parameters @@ -157,7 +157,7 @@ LUAMOD_API int lua_SetPos(lua_State *L) } float x = luaL_checknumber(L, 1); float y = luaL_checknumber(L, 2); - coord2D_ts tmpPos; + Vector2D tmpPos; tmpPos.x = x; tmpPos.y = y; tmpObj->PositionSet(tmpPos); @@ -173,7 +173,7 @@ LUAMOD_API int lua_GetSpeed(lua_State *L) lua_pushnumber(L, (lua_Number)0 ); return 2; } - coord2D_ts tmpPos = tmpObj->SpeedGet(); + Vector2D tmpPos = tmpObj->SpeedGet(); lua_pushnumber(L, (lua_Number)tmpPos.x ); lua_pushnumber(L, (lua_Number)tmpPos.y ); // return number of parameters @@ -188,7 +188,7 @@ LUAMOD_API int lua_SetSpeed(lua_State *L) } float x = luaL_checknumber(L, 1); float y = luaL_checknumber(L, 2); - coord2D_ts tmpPos; + Vector2D tmpPos; tmpPos.x = x; tmpPos.y = y; tmpObj->SpeedSet(tmpPos); @@ -343,7 +343,7 @@ LUAMOD_API int lua_SpriteLoad(lua_State *L) } const char *filename = luaL_checkstring(L, 1); int32_t maxSize = luaL_checkint(L, 2); - coord2D_ts size; + Vector2D size; size.x = maxSize; size.y = size.x; int32_t spriteID = tmpObj->LoadSprite( tmpScene->animated, filename, size); @@ -364,7 +364,7 @@ LUAMOD_API int lua_SpriteUnLoad(lua_State *L) return 1; } float a = luaL_checkint(L, 1); - coord2D_ts tmpPos = tmpObj->PositionGet(); + Vector2D tmpPos = tmpObj->PositionGet(); tmpPos.y = a; tmpObj->PositionSet(tmpPos); */ @@ -380,7 +380,7 @@ LUAMOD_API int lua_SpriteDraw(lua_State *L) return 0; } float spriteID = luaL_checknumber(L, 1); - coord2D_ts tmpPos; + Vector2D tmpPos; tmpPos.x = luaL_checknumber(L, 2); tmpPos.y = luaL_checknumber(L, 3); float angle = luaL_checknumber(L, 4); @@ -436,7 +436,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) { - coord2D_ts tmpPos; + Vector2D tmpPos; tmpPos.x = luaL_checknumber(L, 2); tmpPos.y = luaL_checknumber(L, 3); tmpElem->PositionSet(tmpPos); @@ -459,7 +459,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) { - coord2D_ts tmpPos = tmpElem->PositionGet(); + Vector2D tmpPos = tmpElem->PositionGet(); lua_pushnumber(L, (lua_Number)tmpPos.x ); lua_pushnumber(L, (lua_Number)tmpPos.y ); } else { @@ -827,7 +827,7 @@ void ewol::GameElementLua::Draw(etk::VectorType & listOfSprite, e } -bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, coord2D_ts position, etkFloat_t size) +bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, Vector2D position, etkFloat_t size) { // todo set a flag that permit lua to direct control of this ... if (false == ewol::GameElement::HaveImpact(group, type, position, size) ) { @@ -870,7 +870,7 @@ bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, coord2D_ts po } -bool ewol::GameElementLua::Explosion(int32_t group, int32_t type, coord2D_ts position, etkFloat_t pxAtenuation, etkFloat_t power) +bool ewol::GameElementLua::Explosion(int32_t group, int32_t type, Vector2D position, etkFloat_t pxAtenuation, etkFloat_t power) { tmpObj = this; bool retVal = false; diff --git a/Sources/libewol/ewol/Game/GameElementLua.h b/Sources/libewol/ewol/Game/GameElementLua.h index b069156e..e9936646 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(etk::VectorType & listOfSprite, etk::VectorType & listOfEffects); - virtual bool HaveImpact(int32_t group, int32_t type, coord2D_ts position, etkFloat_t size); - virtual bool Explosion(int32_t group, int32_t type, coord2D_ts position, etkFloat_t pxAtenuation, etkFloat_t power); + virtual bool HaveImpact(int32_t group, int32_t type, Vector2D position, etkFloat_t size); + virtual bool Explosion(int32_t group, int32_t type, Vector2D position, etkFloat_t pxAtenuation, etkFloat_t power); virtual void 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 c96292c5..82d67536 100644 --- a/Sources/libewol/ewol/Game/SceneElement.cpp +++ b/Sources/libewol/ewol/Game/SceneElement.cpp @@ -232,7 +232,7 @@ ewol::GameElement* ewol::SceneElement::GetElement(uint32_t idElement) } -uint32_t ewol::SceneElement::GetNearestEnemy(coord2D_ts position, int32_t groupId) +uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D position, int32_t groupId) { uint32_t result = 0; etkFloat_t lastQuadDistance = 9999999999999999.0; @@ -245,7 +245,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(coord2D_ts position, int32_t groupI for (int32_t iii=0; iiiCanBeCibledGet()) { - coord2D_ts tmpPos = listAnimatedElements[groupEnemy[groupId][jjj]][iii]->PositionGet(); + Vector2D tmpPos = listAnimatedElements[groupEnemy[groupId][jjj]][iii]->PositionGet(); etkFloat_t distance = quadDist(position, tmpPos); if (distance <= lastQuadDistance) { lastQuadDistance = distance; @@ -260,7 +260,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(coord2D_ts position, int32_t groupI } -bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, coord2D_ts position, etkFloat_t size) +bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D position, etkFloat_t size) { for (int32_t jjj=0; jjj position, etkFloat_t pxAtenuation, etkFloat_t power) { for (int32_t jjj=0; jjj position, int32_t maxDistanceDetection) { uint32_t result = 0; etkFloat_t lastQuadDistance = 9999999999999999.0; for (int32_t jjj=0; jjjPositionGet(); + Vector2D tmpPos = listAnimatedElements[jjj][iii]->PositionGet(); etkFloat_t distance = quadDist(position, tmpPos); if (distance <= lastQuadDistance) { lastQuadDistance = distance; @@ -312,7 +312,7 @@ uint32_t ewol::SceneElement::GetElementAtPos(coord2D_ts position, int32_t maxDis return result; } -void ewol::SceneElement::SetEventInput(uint32_t id, coord2D_ts position) +void ewol::SceneElement::SetEventInput(uint32_t id, Vector2D position) { EWOL_TODO("but when ..."); } diff --git a/Sources/libewol/ewol/Game/SceneElement.h b/Sources/libewol/ewol/Game/SceneElement.h index 2d0da9a1..78113efd 100644 --- a/Sources/libewol/ewol/Game/SceneElement.h +++ b/Sources/libewol/ewol/Game/SceneElement.h @@ -37,9 +37,9 @@ namespace ewol { uint32_t id; //!< unique id of the element int32_t group; //!< element group int32_t type; //!< element type - coord2D_ts position; //!< current position - coord2D_ts speed; //!< current speed - coord2D_ts size; //!< curent size of the element + Vector2D position; //!< current position + Vector2D speed; //!< current speed + Vector2D size; //!< curent size of the element etkFloat_t angle; //!< element angle } gameElementGenericProperty_ts; @@ -76,11 +76,11 @@ 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(coord2D_ts position, int32_t groupId); - bool HaveImpact(int32_t group, int32_t type, coord2D_ts position, etkFloat_t size); - void Explosion(int32_t group, int32_t type, coord2D_ts position, etkFloat_t pxAtenuation, etkFloat_t power); - uint32_t GetElementAtPos(coord2D_ts position, int32_t maxDistanceDetection); - void SetEventInput(uint32_t id, coord2D_ts position); + uint32_t GetNearestEnemy(Vector2D position, int32_t groupId); + bool HaveImpact(int32_t group, int32_t type, Vector2D position, etkFloat_t size); + void Explosion(int32_t group, int32_t type, Vector2D position, etkFloat_t pxAtenuation, etkFloat_t power); + uint32_t GetElementAtPos(Vector2D position, int32_t maxDistanceDetection); + void SetEventInput(uint32_t id, Vector2D position); void SetEventExternButton(uint32_t id, int32_t btId, int32_t state); void SetEventExternJoystick(uint32_t id, int32_t joyId, etkFloat_t angle, etkFloat_t distance, int32_t state); }; diff --git a/Sources/libewol/ewol/OObject.h b/Sources/libewol/ewol/OObject.h index ddf47c23..d9e8f03b 100644 --- a/Sources/libewol/ewol/OObject.h +++ b/Sources/libewol/ewol/OObject.h @@ -45,14 +45,14 @@ namespace ewol { protected: bool m_hasClipping; clipping_ts m_clipping; - coord2D_ts m_scaling; //!< scaling ol the object + 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(coord2D_ts scale) {m_scaling = scale;}; + void scalingSet(Vector2D scale) {m_scaling = scale;}; virtual void Draw(void) = 0; }; }; diff --git a/Sources/libewol/ewol/OObject/2DColored.cpp b/Sources/libewol/ewol/OObject/2DColored.cpp index 8a4c098d..a74de6be 100644 --- a/Sources/libewol/ewol/OObject/2DColored.cpp +++ b/Sources/libewol/ewol/OObject/2DColored.cpp @@ -80,22 +80,21 @@ void ewol::OObject2DColored::Clear(void) } -void generatePolyGone(etk::VectorType & input, etk::VectorType & output ) +void generatePolyGone(etk::VectorType > & input, etk::VectorType > & output ) { if (input.Size()<3) { return; } - coord2D_ts basePoint = input[0]; // TODO : Regenerate a linear poligone generation for (int32_t iii=1; iii " << output.Size() ); } -void SutherlandHodgman(etk::VectorType & input, etk::VectorType & output, etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey) +void SutherlandHodgman(etk::VectorType > & input, etk::VectorType > & output, etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey) { // with Sutherland-Hodgman-Algorithm if (input.Size() <0) { @@ -103,8 +102,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType destPoint; + Coord2D lastElement = input[input.Size()-1]; bool inside = true; if (lastElement.x < sx) { inside = false; @@ -336,9 +335,13 @@ void ewol::OObject2DColored::SetColor(etkFloat_t red, etkFloat_t green, etkFloat } -void ewol::OObject2DColored::SetPoint(coord2D_ts point) +void ewol::OObject2DColored::SetPoint(Vector2D point) { - m_triangle[m_triElement] = point; + // TODO : Clean this : + Coord2D tmpElement; + tmpElement.x = point.x; + tmpElement.y = point.y; + m_triangle[m_triElement] = tmpElement; m_triElement++; if (m_triElement>=3) { GenerateTriangle(); diff --git a/Sources/libewol/ewol/OObject/2DColored.h b/Sources/libewol/ewol/OObject/2DColored.h index 14cf40c6..90c9d328 100644 --- a/Sources/libewol/ewol/OObject/2DColored.h +++ b/Sources/libewol/ewol/OObject/2DColored.h @@ -36,19 +36,19 @@ namespace ewol { public: virtual void Draw(void); protected: - etk::VectorType m_coord; //!< internal coord of the object - etk::VectorType m_coordColor; //!< internal color of the different point + etk::VectorType > m_coord; //!< internal coord of the object + etk::VectorType m_coordColor; //!< internal color of the different point //etk::VectorType m_linkCoord; //!< internal link between point to generate triangle - int32_t m_triElement; - color_ts m_color[3]; - coord2D_ts m_triangle[3]; + int32_t m_triElement; + color_ts m_color[3]; + Coord2D m_triangle[3]; void GenerateTriangle(void); void ResetCount(void); public: void Clear(void); void SetColor(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha = 1.0); void SetColor(color_ts color); - void SetPoint(coord2D_ts point); + void SetPoint(Vector2D point); void SetPoint(etkFloat_t x, etkFloat_t y); void Line(etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey, etkFloat_t thickness); void Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h); diff --git a/Sources/libewol/ewol/OObject/2DText.cpp b/Sources/libewol/ewol/OObject/2DText.cpp index 45ee6570..58dba654 100644 --- a/Sources/libewol/ewol/OObject/2DText.cpp +++ b/Sources/libewol/ewol/OObject/2DText.cpp @@ -83,7 +83,7 @@ void ewol::OObject2DText::Clear(void) m_coordTex.Clear(); } -int32_t ewol::OObject2DText::Text(coord2D_ts textPos, clipping_ts drawClipping, const etk::UString& unicodeString) +int32_t ewol::OObject2DText::Text(Vector2D textPos, clipping_ts drawClipping, const etk::UString& unicodeString) { m_FontTextureId = 0; if (m_FontId == -1) { @@ -93,7 +93,7 @@ int32_t ewol::OObject2DText::Text(coord2D_ts textPos, clipping_ts drawClipping, return ewol::DrawText(m_FontId, textPos, drawClipping, unicodeString, m_FontTextureId, m_coord, m_coordTex); } -int32_t ewol::OObject2DText::Text(coord2D_ts textPos, clipping_ts drawClipping, const uniChar_t unicodeChar) +int32_t ewol::OObject2DText::Text(Vector2D textPos, clipping_ts drawClipping, const uniChar_t unicodeChar) { m_FontTextureId = 0; if (m_FontId == -1) { diff --git a/Sources/libewol/ewol/OObject/2DText.h b/Sources/libewol/ewol/OObject/2DText.h index f1d5e06a..6a5f7c80 100644 --- a/Sources/libewol/ewol/OObject/2DText.h +++ b/Sources/libewol/ewol/OObject/2DText.h @@ -39,13 +39,13 @@ namespace ewol { virtual void Draw(void); // set a specific text void Clear(void); - int32_t Text(coord2D_ts textPos, clipping_ts drawClipping, const etk::UString& unicodeString); - int32_t Text(coord2D_ts textPos, clipping_ts drawClipping, const uniChar_t unicodeChar); + int32_t Text(Vector2D textPos, clipping_ts drawClipping, const etk::UString& unicodeString); + int32_t Text(Vector2D textPos, clipping_ts drawClipping, const uniChar_t unicodeChar); protected: int32_t m_FontId; //!< font internal ID color_ts m_textColorFg; //!< text color ... int32_t m_FontTextureId; //!< font internal Texture ID - etk::VectorType m_coord; //!< internal coord of the object + etk::VectorType > m_coord; //!< internal coord of the object etk::VectorType m_coordTex; //!< internal texture coordinate for every point }; }; diff --git a/Sources/libewol/ewol/OObject/2DTextColored.cpp b/Sources/libewol/ewol/OObject/2DTextColored.cpp index e6abf384..388d822f 100644 --- a/Sources/libewol/ewol/OObject/2DTextColored.cpp +++ b/Sources/libewol/ewol/OObject/2DTextColored.cpp @@ -99,7 +99,7 @@ void ewol::OObject2DTextColored::Clear(void) m_coordColor.Clear(); } -int32_t ewol::OObject2DTextColored::Text(coord2D_ts textPos, const etk::UString& unicodeString) +int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const etk::UString& unicodeString) { m_FontTextureId = 0; if (m_FontId == -1) { @@ -119,7 +119,7 @@ int32_t ewol::OObject2DTextColored::Text(coord2D_ts textPos, const etk::UString& return size; } -int32_t ewol::OObject2DTextColored::Text(coord2D_ts textPos, const uniChar_t unicodeChar) +int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const uniChar_t unicodeChar) { m_FontTextureId = 0; if (m_FontId == -1) { diff --git a/Sources/libewol/ewol/OObject/2DTextColored.h b/Sources/libewol/ewol/OObject/2DTextColored.h index 9fbe9413..6ada3b4a 100644 --- a/Sources/libewol/ewol/OObject/2DTextColored.h +++ b/Sources/libewol/ewol/OObject/2DTextColored.h @@ -41,13 +41,13 @@ namespace ewol { void SetColor(color_ts color); // set a specific text void Clear(void); - int32_t Text(coord2D_ts textPos, const etk::UString& unicodeString); - int32_t Text(coord2D_ts textPos, const uniChar_t unicodeChar); + int32_t Text(Vector2D textPos, const etk::UString& unicodeString); + int32_t Text(Vector2D textPos, const uniChar_t unicodeChar); protected: int32_t m_FontId; //!< font internal ID color_ts m_color; //!< tmp text color ... int32_t m_FontTextureId; //!< font internal Texture ID - etk::VectorType m_coord; //!< internal coord of the object + etk::VectorType > m_coord; //!< internal coord of the object etk::VectorType m_coordTex; //!< internal texture coordinate for every point etk::VectorType m_coordColor; //!< internal color of the different point public: diff --git a/Sources/libewol/ewol/OObject/2DTextured.cpp b/Sources/libewol/ewol/OObject/2DTextured.cpp index a4804d44..002073e4 100644 --- a/Sources/libewol/ewol/OObject/2DTextured.cpp +++ b/Sources/libewol/ewol/OObject/2DTextured.cpp @@ -83,7 +83,7 @@ void ewol::OObject2DTextured::Clear(void) void ewol::OObject2DTextured::Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t texX, etkFloat_t texY, etkFloat_t texSX, etkFloat_t texSY) { //EWOL_DEBUG("Add rectangle : ..."); - coord2D_ts point; + 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 2119b018..76f5e293 100644 --- a/Sources/libewol/ewol/OObject/2DTextured.h +++ b/Sources/libewol/ewol/OObject/2DTextured.h @@ -40,7 +40,7 @@ namespace ewol { void Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t texX=0.0, etkFloat_t texY=0.0, etkFloat_t texSX=1.0, etkFloat_t texSY=1.0); protected: int32_t m_textureId; //!< texture internal ID - etk::VectorType m_coord; //!< internal coord of the object + etk::VectorType > m_coord; //!< internal coord of the object etk::VectorType m_coordTex; //!< internal texture coordinate for every point }; }; diff --git a/Sources/libewol/ewol/OObject/Sprite.cpp b/Sources/libewol/ewol/OObject/Sprite.cpp index 48da3b18..71ff5c1f 100644 --- a/Sources/libewol/ewol/OObject/Sprite.cpp +++ b/Sources/libewol/ewol/OObject/Sprite.cpp @@ -84,7 +84,7 @@ void ewol::Sprite::Clear(void) m_coordTex.Clear(); } -void ewol::Sprite::Element(coord2D_ts pos, etkFloat_t size, etkFloat_t angle) +void ewol::Sprite::Element(Vector2D pos, etkFloat_t size, etkFloat_t angle) { angle -= M_PI/4; size *= 0.7; @@ -98,7 +98,7 @@ void ewol::Sprite::Element(coord2D_ts pos, etkFloat_t size, etkFloat_t angle) texD.u = 1.0; texD.v = 0.0; - coord2D_ts point; + Vector2D point; etkFloat_t yyySin = sin(angle) * size; etkFloat_t xxxCos = cos(angle) * size; diff --git a/Sources/libewol/ewol/OObject/Sprite.h b/Sources/libewol/ewol/OObject/Sprite.h index ac981882..8caa2e2d 100644 --- a/Sources/libewol/ewol/OObject/Sprite.h +++ b/Sources/libewol/ewol/OObject/Sprite.h @@ -38,11 +38,11 @@ namespace ewol { virtual ~Sprite(void); virtual void Draw(void); void Clear(void); - void Element(coord2D_ts pos, etkFloat_t size, etkFloat_t angle); + void Element(Vector2D pos, etkFloat_t size, etkFloat_t angle); bool HasName(etk::UString& name) { return name == m_name; }; protected: int32_t m_textureId; //!< texture internal ID - etk::VectorType m_coord; //!< internal coord of the object + etk::VectorType > m_coord; //!< internal coord of the object etk::VectorType m_coordTex; //!< internal texture coordinate for every point }; }; diff --git a/Sources/libewol/ewol/Texture/TextureSVG.cpp b/Sources/libewol/ewol/Texture/TextureSVG.cpp index 85cb0622..7788c2b3 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) { - coord2D_ts elementSize = m_elementParsed.GetDefinedSize(); + Vector2D elementSize = m_elementParsed.GetDefinedSize(); m_width = elementSize.x; m_height = elementSize.y; } else { @@ -83,4 +83,4 @@ uint32_t ewol::texture::TextureSVG::DataSize(void) void ewol::texture::TextureSVG::Display(void) { EWOL_DEBUG("SVG Texture : (" << m_width << "," << m_height << ") loadedOK=" << m_loadOK); -} \ No newline at end of file +} diff --git a/Sources/libewol/ewol/Widget.h b/Sources/libewol/ewol/Widget.h index 7d33267d..2ab5a190 100644 --- a/Sources/libewol/ewol/Widget.h +++ b/Sources/libewol/ewol/Widget.h @@ -146,11 +146,11 @@ namespace ewol { // ---------------------------------------------------------------------------------------------------------------- protected: // internal element calculated by the system - coord2D_ts m_origin; //!< internal ... I do not really known how i can use it ... - coord2D_ts m_size; //!< internal : current size of the widget - coord2D_ts m_minSize; //!< user define the minimum size of the widget + 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 // user configuaration - coord2D_ts m_userMinSize; //!< user define the minimum size of the widget + Vector2D m_userMinSize; //!< user define the minimum size of the widget bool m_userExpendX; bool m_userExpendY; bool m_userFillX; @@ -169,13 +169,13 @@ namespace ewol { * @param --- * @return coordonate of the origin requested */ - coord2D_ts GetOrigin(void) { return m_origin; }; + 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 */ - coord2D_ts RelativePosition(coord2D_ts pos) { pos.x -= m_origin.x; pos.y -= m_origin.y; return pos; }; + Vector2D RelativePosition(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 @@ -206,13 +206,13 @@ namespace ewol { * @param --- * @return re size requested */ - coord2D_ts GetMinSize(void) { return m_minSize; }; + Vector2D GetMinSize(void) { return m_minSize; }; /** * @brief Get the widget size * @param --- * @return Requested size */ - coord2D_ts GetSize(void) { return m_size; }; + Vector2D GetSize(void) { return m_size; }; /** * @brief Set the horizontal expend capacity * @param[in] newExpend new Expend state @@ -340,7 +340,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos) { return this; }; + virtual ewol::Widget * GetWidgetAtPos(Vector2D pos) { return this; }; /** * @brief Event on an input of this Widget * @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...) @@ -350,7 +350,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, coord2D_ts pos) { return false; }; + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { return false; }; /** * @brief Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref OnEventKb) * @param[in] shift The key Shift (left or/and right) is pressed (if true) diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index e3f90c99..447169ef 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -134,10 +134,10 @@ bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::Windows::GetWidgetAtPos(coord2D_ts pos) +ewol::Widget * ewol::Windows::GetWidgetAtPos(Vector2D pos) { // calculate relative position - coord2D_ts relativePos = RelativePosition(pos); + Vector2D relativePos = RelativePosition(pos); // event go directly on the pop-up if (0 < m_popUpWidgetList[m_currentCreateId].Size()) { if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]) { diff --git a/Sources/libewol/ewol/Windows.h b/Sources/libewol/ewol/Windows.h index c459cd63..cfd70a62 100644 --- a/Sources/libewol/ewol/Windows.h +++ b/Sources/libewol/ewol/Windows.h @@ -72,7 +72,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); + virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); private: bool m_hasDecoration; public: diff --git a/Sources/libewol/ewol/base/MainThread.cpp b/Sources/libewol/ewol/base/MainThread.cpp index c0f1f461..40dba014 100644 --- a/Sources/libewol/ewol/base/MainThread.cpp +++ b/Sources/libewol/ewol/base/MainThread.cpp @@ -149,7 +149,7 @@ static void* BaseAppEntry(void* param) //EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); { eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data; - coord2D_ts pos; + Vector2D pos; pos.x = tmpData->x; pos.y = tmpData->y; ewol::eventInput::Motion(tmpData->type, tmpData->pointerID, pos); @@ -159,7 +159,7 @@ static void* BaseAppEntry(void* param) //EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); { eventInputState_ts * tmpData = (eventInputState_ts*)data.data; - coord2D_ts pos; + Vector2D pos; pos.x = tmpData->x; pos.y = tmpData->y; ewol::eventInput::State(tmpData->type, tmpData->pointerID, tmpData->state, pos); diff --git a/Sources/libewol/ewol/base/eventInputManagement.cpp b/Sources/libewol/ewol/base/eventInputManagement.cpp index 13459003..d349ee30 100644 --- a/Sources/libewol/ewol/base/eventInputManagement.cpp +++ b/Sources/libewol/ewol/base/eventInputManagement.cpp @@ -47,9 +47,9 @@ typedef struct { int32_t destinationInputId; int64_t lastTimeEvent; ewol::Widget* curentWidgetEvent; - coord2D_ts origin; - coord2D_ts size; - coord2D_ts downStart; + Vector2D origin; + Vector2D size; + Vector2D downStart; bool isDown; bool isInside; int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3 @@ -145,7 +145,7 @@ extern ewol::Windows* gui_uniqueWindows; * @param[in] pos position of the event * @return true if event has been greped */ -static bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos) +static bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D pos) { if (NULL != destWidget) { if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) { @@ -190,7 +190,7 @@ extern int32_t offsetMoveClicked; extern int32_t offsetMoveClickedDouble; // note if id<0 ==> the it was finger event ... -void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, coord2D_ts pos) +void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, Vector2D pos) { InputPoperty_ts *eventTable = NULL; if (type == ewol::INPUT_TYPE_MOUSE) { @@ -245,7 +245,7 @@ void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, coord2D_ts } } -void ewol::eventInput::State(ewol::inputType_te type, int pointerID, bool isDown, coord2D_ts pos) +void ewol::eventInput::State(ewol::inputType_te type, int pointerID, bool isDown, Vector2D pos) { InputPoperty_ts *eventTable = NULL; if (type == ewol::INPUT_TYPE_MOUSE) { diff --git a/Sources/libewol/ewol/base/eventInputManagement.h b/Sources/libewol/ewol/base/eventInputManagement.h index 2c4a1436..b9513b95 100644 --- a/Sources/libewol/ewol/base/eventInputManagement.h +++ b/Sources/libewol/ewol/base/eventInputManagement.h @@ -39,8 +39,8 @@ namespace ewol void Init(void); void UnInit(void); // note if id<0 ==> the it was finger event ... - void Motion(ewol::inputType_te type, int pointerID, coord2D_ts pos ); - void State(ewol::inputType_te type, int pointerID, bool isDown, coord2D_ts pos); + void Motion(ewol::inputType_te type, int pointerID, Vector2D pos ); + void State(ewol::inputType_te type, int pointerID, bool isDown, Vector2D pos); /** * @brief Inform object that an other object is removed ... diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index 63af1c10..657932f5 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -142,7 +142,7 @@ const char * const ewol::Button::GetObjectType(void) } -void ewol::Button::SetPadding(coord2D_ts newPadding) +void ewol::Button::SetPadding(Vector2D newPadding) { m_padding = newPadding; } @@ -226,7 +226,7 @@ void ewol::Button::OnRegenerateDisplay(void) int32_t fontHeight = ewol::GetHeight(fontId); int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str()); */ - coord2D_ts textPos; + Vector2D textPos; textPos.x = tmpTextOriginX; textPos.y = tmpTextOriginY; @@ -275,7 +275,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, coord2D_ts pos) +bool ewol::Button::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, 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 9658dfa3..f81e05c2 100644 --- a/Sources/libewol/ewol/widget/Button.h +++ b/Sources/libewol/ewol/widget/Button.h @@ -69,12 +69,12 @@ namespace ewol { void SetValue(bool val); bool GetValue(void); void SetAlignement(textAlignement_te typeAlign); - void SetPadding(coord2D_ts newPadding); + void SetPadding(Vector2D newPadding); private: bool m_hasAnImage; etk::UString m_imageSelected; textAlignement_te m_alignement; - coord2D_ts m_padding; + Vector2D m_padding; etk::UString m_label; color_ts m_textColorFg; //!< Text color color_ts m_textColorBg; //!< Background color @@ -90,7 +90,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, 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 25781389..eed584f8 100644 --- a/Sources/libewol/ewol/widget/ButtonColor.cpp +++ b/Sources/libewol/ewol/widget/ButtonColor.cpp @@ -126,7 +126,7 @@ const char * const ewol::ButtonColor::GetObjectType(void) -void ewol::ButtonColor::SetPadding(coord2D_ts newPadding) +void ewol::ButtonColor::SetPadding(Vector2D newPadding) { m_padding = newPadding; } @@ -214,7 +214,7 @@ void ewol::ButtonColor::OnRegenerateDisplay(void) int32_t fontHeight = ewol::GetHeight(fontId); int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str()); */ - coord2D_ts textPos; + Vector2D textPos; textPos.x = tmpTextOriginX; textPos.y = tmpTextOriginY; clipping_ts drawClipping; @@ -246,7 +246,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, coord2D_ts pos) +bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { @@ -264,7 +264,7 @@ bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, e return true; } // Get the button widget : - coord2D_ts newPosition; + Vector2D newPosition; newPosition.x = m_origin.x + m_size.x/2; newPosition.y = m_origin.y; @@ -327,4 +327,4 @@ void ewol::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const cha GenerateEventId(ewolEventButtonColorChange); } } -} \ No newline at end of file +} diff --git a/Sources/libewol/ewol/widget/ButtonColor.h b/Sources/libewol/ewol/widget/ButtonColor.h index 6f3aa054..6c59cbaa 100644 --- a/Sources/libewol/ewol/widget/ButtonColor.h +++ b/Sources/libewol/ewol/widget/ButtonColor.h @@ -62,10 +62,10 @@ namespace ewol { void SetValue(bool val); bool GetValue(void); void SetAlignement(textAlignement_te typeAlign); - void SetPadding(coord2D_ts newPadding); + void SetPadding(Vector2D newPadding); private: textAlignement_te m_alignement; - coord2D_ts m_padding; + Vector2D m_padding; etk::UString m_label; color_ts m_textColorFg; //!< Text color color_ts m_textColorBg; //!< Background color @@ -83,7 +83,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); color_ts GetCurrentColor(void) { return m_selectedColor; }; void SetCurrentColor(color_ts color); /** diff --git a/Sources/libewol/ewol/widget/ButtonImage.cpp b/Sources/libewol/ewol/widget/ButtonImage.cpp index a6eaa25f..0dfdf2c7 100644 --- a/Sources/libewol/ewol/widget/ButtonImage.cpp +++ b/Sources/libewol/ewol/widget/ButtonImage.cpp @@ -217,7 +217,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, coord2D_ts pos) +bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { @@ -242,7 +242,7 @@ bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, e } } else if (0 == IdInput) { if(ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { - coord2D_ts relPos = RelativePosition(pos); + Vector2D relPos = RelativePosition(pos); // check if over : int32_t tmpSizeX = m_minSize.x; @@ -332,4 +332,4 @@ void ewol::ButtonImage::OnFlipFlopEvent(void) } } } -} \ No newline at end of file +} diff --git a/Sources/libewol/ewol/widget/ButtonImage.h b/Sources/libewol/ewol/widget/ButtonImage.h index 49d551d1..71adb298 100644 --- a/Sources/libewol/ewol/widget/ButtonImage.h +++ b/Sources/libewol/ewol/widget/ButtonImage.h @@ -80,7 +80,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData); /** * @brief Event generated to inform a flip-flop has occured on the current widget diff --git a/Sources/libewol/ewol/widget/CheckBox.cpp b/Sources/libewol/ewol/widget/CheckBox.cpp index 31eef537..be2f3fa5 100644 --- a/Sources/libewol/ewol/widget/CheckBox.cpp +++ b/Sources/libewol/ewol/widget/CheckBox.cpp @@ -152,7 +152,7 @@ void ewol::CheckBox::OnRegenerateDisplay(void) //int32_t posx = (m_size.x - fontWidth - 6)/2 + 25; - coord2D_ts textPos; + Vector2D textPos; textPos.x = boxSize+5; textPos.y = posy; clipping_ts drawClipping; @@ -189,7 +189,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, coord2D_ts pos) +bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, 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 26e56372..80b4d91c 100644 --- a/Sources/libewol/ewol/widget/CheckBox.h +++ b/Sources/libewol/ewol/widget/CheckBox.h @@ -75,7 +75,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, 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 f9b0a0b8..591cf9d1 100644 --- a/Sources/libewol/ewol/widget/ColorBar.cpp +++ b/Sources/libewol/ewol/widget/ColorBar.cpp @@ -257,9 +257,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, coord2D_ts pos) +bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { - coord2D_ts relativePos = RelativePosition(pos); + 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 eba74749..5375cfbd 100644 --- a/Sources/libewol/ewol/widget/ColorBar.h +++ b/Sources/libewol/ewol/widget/ColorBar.h @@ -57,8 +57,8 @@ namespace ewol { void SetCurrentColor(color_ts newOne); private: color_ts m_currentColor; - coord2D_ts m_currentUserPos; - coord2D_ts m_padding; + Vector2D m_currentUserPos; + Vector2D m_padding; public: virtual void OnRegenerateDisplay(void); public: @@ -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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); }; extern const char * const TYPE_EOBJECT_WIDGET_COLOR_BAR; diff --git a/Sources/libewol/ewol/widget/ContextMenu.cpp b/Sources/libewol/ewol/widget/ContextMenu.cpp index 511beddf..f1a96dc2 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.cpp +++ b/Sources/libewol/ewol/widget/ContextMenu.cpp @@ -103,8 +103,8 @@ bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availla m_size.y = availlableY; if (NULL != m_subWidget[m_currentCreateId]) { - coord2D_ts subWidgetSize; - coord2D_ts subWidgetOrigin; + Vector2D subWidgetSize; + Vector2D subWidgetOrigin; subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize(); if (true == m_subWidget[m_currentCreateId]->CanExpentX()) { subWidgetSize.x = m_size.x; @@ -179,7 +179,7 @@ bool ewol::ContextMenu::CalculateMinSize(void) m_minSize.y = 50.0; if (NULL != m_subWidget[m_currentCreateId]) { m_subWidget[m_currentCreateId]->CalculateMinSize(); - coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId]->GetMinSize(); m_minSize.x = tmpSize.x; m_minSize.y = tmpSize.y; } @@ -241,8 +241,8 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) AddOObject(BGOObjects); if (NULL != m_subWidget[m_currentCreateId]) { - coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); + Vector2D tmpSize = m_subWidget[m_currentCreateId]->GetSize(); + Vector2D tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); // display border ... BGOObjects->SetColor(m_colorBorder); @@ -297,14 +297,14 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(coord2D_ts pos) +ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(Vector2D pos) { // calculate relative position - coord2D_ts relativePos = RelativePosition(pos); + Vector2D relativePos = RelativePosition(pos); // Check for sub Element if (NULL != m_subWidget[m_currentCreateId]) { - coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); + Vector2D tmpSize = m_subWidget[m_currentCreateId]->GetSize(); + Vector2D tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x) && (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) ) { @@ -323,7 +323,7 @@ ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(coord2D_ts 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, coord2D_ts pos) +bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { //EWOL_INFO("Event ouside the context menu"); if (IdInput > 0) { @@ -344,7 +344,7 @@ bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, e } -void ewol::ContextMenu::SetPositionMark(markPosition_te position, coord2D_ts arrowPos) +void ewol::ContextMenu::SetPositionMark(markPosition_te position, Vector2D arrowPos) { EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")"); m_arrawBorder = position; @@ -372,4 +372,4 @@ void ewol::ContextMenu::OnFlipFlopEvent(void) if (NULL != m_subWidget[m_currentDrawId]) { m_subWidget[m_currentDrawId]->OnFlipFlopEvent(); } -} \ No newline at end of file +} diff --git a/Sources/libewol/ewol/widget/ContextMenu.h b/Sources/libewol/ewol/widget/ContextMenu.h index bfe3e8a9..73d88a29 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.h +++ b/Sources/libewol/ewol/widget/ContextMenu.h @@ -67,15 +67,15 @@ namespace ewol { private: color_ts m_colorBackGroung; color_ts m_colorBorder; - coord2D_ts m_padding; - coord2D_ts m_arrowPos; + Vector2D m_padding; + Vector2D m_arrowPos; etkFloat_t m_offset; markPosition_te m_arrawBorder; ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER]; public: void SubWidgetSet(ewol::Widget* newWidget); void SubWidgetRemove(void); - void SetPositionMark(markPosition_te position, coord2D_ts arrowPos); + void SetPositionMark(markPosition_te position, Vector2D arrowPos); protected: virtual void OnDraw(void); public: @@ -87,7 +87,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); + virtual ewol::Widget * GetWidgetAtPos(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 ...) @@ -97,7 +97,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); /** * @brief Event generated to inform a flip-flop has occured on the current widget * @param --- diff --git a/Sources/libewol/ewol/widget/Entry.cpp b/Sources/libewol/ewol/widget/Entry.cpp index 15732208..7ae2b7eb 100644 --- a/Sources/libewol/ewol/widget/Entry.cpp +++ b/Sources/libewol/ewol/widget/Entry.cpp @@ -177,7 +177,7 @@ void ewol::Entry::OnRegenerateDisplay(void) ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg); - coord2D_ts textPos; + Vector2D textPos; textPos.x = tmpTextOriginX + m_displayStartPosition; textPos.y = tmpTextOriginY; clipping_ts drawClipping; @@ -216,7 +216,7 @@ void ewol::Entry::OnRegenerateDisplay(void) * @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, coord2D_ts pos) +bool ewol::Entry::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { //EWOL_DEBUG("Event on Entry ..."); if (1 == IdInput) { diff --git a/Sources/libewol/ewol/widget/Entry.h b/Sources/libewol/ewol/widget/Entry.h index e75f9516..1a21bda4 100644 --- a/Sources/libewol/ewol/widget/Entry.h +++ b/Sources/libewol/ewol/widget/Entry.h @@ -86,7 +86,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, 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) diff --git a/Sources/libewol/ewol/widget/Image.cpp b/Sources/libewol/ewol/widget/Image.cpp index 5237da40..503a1aa1 100644 --- a/Sources/libewol/ewol/widget/Image.cpp +++ b/Sources/libewol/ewol/widget/Image.cpp @@ -118,7 +118,7 @@ const char * const ewol::Image::GetObjectType(void) } -void ewol::Image::SetPadding(coord2D_ts newPadding) +void ewol::Image::SetPadding(Vector2D newPadding) { m_padding = newPadding; } @@ -191,7 +191,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, coord2D_ts pos) +bool ewol::Image::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, 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 b0966951..4ac854e5 100644 --- a/Sources/libewol/ewol/widget/Image.h +++ b/Sources/libewol/ewol/widget/Image.h @@ -55,10 +55,10 @@ namespace ewol { virtual ~Image(void); virtual bool CalculateMinSize(void); void SetFile(etk::UString newFile); - void SetPadding(coord2D_ts newPadding); + void SetPadding(Vector2D newPadding); private: etk::UString m_imageSelected; - coord2D_ts m_padding; + Vector2D m_padding; color_ts m_textColorBg; //!< Background color int32_t m_imageSize; public: @@ -73,7 +73,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); }; /** diff --git a/Sources/libewol/ewol/widget/Joystick.cpp b/Sources/libewol/ewol/widget/Joystick.cpp index 0f56a94f..4d36cf4b 100644 --- a/Sources/libewol/ewol/widget/Joystick.cpp +++ b/Sources/libewol/ewol/widget/Joystick.cpp @@ -243,13 +243,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, coord2D_ts pos) +bool ewol::Joystick::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { if (1 == IdInput) { if( ewol::EVENT_INPUT_TYPE_DOWN == typeEvent || ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { // get local relative position - coord2D_ts relativePos = RelativePosition(pos); + Vector2D relativePos = RelativePosition(pos); etkFloat_t 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 6ae74cf6..f9b0aa84 100644 --- a/Sources/libewol/ewol/widget/Joystick.h +++ b/Sources/libewol/ewol/widget/Joystick.h @@ -43,7 +43,7 @@ namespace ewol { private: color_ts m_colorFg; //!< Forground color color_ts m_colorBg; //!< Background color - coord2D_ts m_displayPos; //!< direction of the cursor ... + Vector2D m_displayPos; //!< direction of the cursor ... etkFloat_t m_distance; //!< dintance from the center etkFloat_t 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 @@ -90,7 +90,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, 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 8a318c84..a9509429 100644 --- a/Sources/libewol/ewol/widget/Label.cpp +++ b/Sources/libewol/ewol/widget/Label.cpp @@ -141,7 +141,7 @@ void ewol::Label::OnRegenerateDisplay(void) ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg); - coord2D_ts textPos; + Vector2D textPos; textPos.x = tmpOriginX; textPos.y = tmpOriginY; clipping_ts drawClipping; @@ -164,7 +164,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, coord2D_ts pos) +bool ewol::Label::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, 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 0bab3573..4852d156 100644 --- a/Sources/libewol/ewol/widget/Label.h +++ b/Sources/libewol/ewol/widget/Label.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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); }; extern const char * const TYPE_EOBJECT_WIDGET_LABEL; diff --git a/Sources/libewol/ewol/widget/Layer.cpp b/Sources/libewol/ewol/widget/Layer.cpp index 0001fbbb..2111288c 100644 --- a/Sources/libewol/ewol/widget/Layer.cpp +++ b/Sources/libewol/ewol/widget/Layer.cpp @@ -113,7 +113,7 @@ bool ewol::Layer::CalculateMinSize(void) if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { m_userExpendY = true; } - coord2D_ts tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); m_minSize.x = etk_max(tmpSize.x, m_minSize.x); m_minSize.y = etk_max(tmpSize.y, m_minSize.y); } @@ -236,13 +236,13 @@ void ewol::Layer::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::Layer::GetWidgetAtPos(coord2D_ts pos) +ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D pos) { // for all element in the sizer ... for (int32_t iii=0; iiiGetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); + Vector2D tmpOrigin = m_subWidget[m_currentCreateId][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 0974cdd7..23b4e212 100644 --- a/Sources/libewol/ewol/widget/Layer.h +++ b/Sources/libewol/ewol/widget/Layer.h @@ -78,7 +78,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); + virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); /** * @brief Event generated to inform a flip-flop has occured on the current widget * @param --- diff --git a/Sources/libewol/ewol/widget/List.cpp b/Sources/libewol/ewol/widget/List.cpp index 5b3ac4e1..6b9284e8 100644 --- a/Sources/libewol/ewol/widget/List.cpp +++ b/Sources/libewol/ewol/widget/List.cpp @@ -221,7 +221,7 @@ void ewol::List::OnRegenerateDisplay(void) ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, fg); - coord2D_ts textPos; + Vector2D textPos; textPos.x = tmpOriginX; textPos.y = tmpOriginY + m_paddingSizeY; tmpText->Text(textPos, drawClipping, myTextToWrite); @@ -246,9 +246,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, coord2D_ts pos) +bool ewol::List::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { - coord2D_ts relativePos = RelativePosition(pos); + Vector2D relativePos = RelativePosition(pos); if (true == WidgetScrooled::OnEventInput(type, IdInput, typeEvent, pos)) { ewol::widgetManager::FocusKeep(this); // nothing to do ... done on upper widet ... diff --git a/Sources/libewol/ewol/widget/List.h b/Sources/libewol/ewol/widget/List.h index 70343309..2ea56e8c 100644 --- a/Sources/libewol/ewol/widget/List.h +++ b/Sources/libewol/ewol/widget/List.h @@ -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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); protected: // function call to display the list : virtual color_ts GetBasicBG(void) { diff --git a/Sources/libewol/ewol/widget/Menu.cpp b/Sources/libewol/ewol/widget/Menu.cpp index 07488468..55facb61 100644 --- a/Sources/libewol/ewol/widget/Menu.cpp +++ b/Sources/libewol/ewol/widget/Menu.cpp @@ -209,11 +209,11 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve return; } // Get the button widget : - coord2D_ts newPosition; + Vector2D newPosition; ewol::Widget * eventFromWidget = EWOL_CAST_WIDGET(CallerObject); if (NULL != eventFromWidget) { - coord2D_ts tmpOri = eventFromWidget->GetOrigin(); - coord2D_ts tmpSize = eventFromWidget->GetSize(); + Vector2D tmpOri = eventFromWidget->GetOrigin(); + Vector2D tmpSize = eventFromWidget->GetSize(); // calculate the correct position newPosition.x = tmpOri.x + tmpSize.x/2; newPosition.y = tmpOri.y + tmpSize.y; diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index 5efe2115..86ae572f 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -101,8 +101,8 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) m_size.y = availlableY; if (NULL != m_subWidget[m_currentCreateId]) { - coord2D_ts subWidgetSize; - coord2D_ts subWidgetOrigin; + Vector2D subWidgetSize; + Vector2D subWidgetOrigin; subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize(); if (true == m_subWidget[m_currentCreateId]->CanExpentX()) { subWidgetSize.x = m_size.x; @@ -138,7 +138,7 @@ bool ewol::PopUp::CalculateMinSize(void) m_minSize.y = 50.0; if (NULL != m_subWidget[m_currentCreateId]) { m_subWidget[m_currentCreateId]->CalculateMinSize(); - coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId]->GetMinSize(); m_minSize.x = tmpSize.x; m_minSize.y = tmpSize.y; } @@ -208,8 +208,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[m_currentCreateId]) { - coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); + Vector2D tmpSize = m_subWidget[m_currentCreateId]->GetSize(); + Vector2D tmpOrigin = m_subWidget[m_currentCreateId]->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); @@ -227,14 +227,14 @@ void ewol::PopUp::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::PopUp::GetWidgetAtPos(coord2D_ts pos) +ewol::Widget * ewol::PopUp::GetWidgetAtPos(Vector2D pos) { // calculate relative position - coord2D_ts relativePos = RelativePosition(pos); + Vector2D relativePos = RelativePosition(pos); // for the element in the pop-up ... if (NULL != m_subWidget[m_currentCreateId]) { - coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); + Vector2D tmpSize = m_subWidget[m_currentCreateId]->GetSize(); + Vector2D tmpOrigin = m_subWidget[m_currentCreateId]->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 0a3bf23a..70c14478 100644 --- a/Sources/libewol/ewol/widget/PopUp.h +++ b/Sources/libewol/ewol/widget/PopUp.h @@ -78,7 +78,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); + virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); /** * @brief Event generated to inform a flip-flop has occured on the current widget * @param --- diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index 068180bc..c59e7b84 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -92,7 +92,7 @@ bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl int32_t nbWidgetNotFixedSize=0; for (int32_t iii=0; iiiGetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); unexpendableSize += tmpSize.x; if (false == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { nbWidgetFixedSize++; @@ -109,12 +109,12 @@ bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl sizeToAddAtEveryOne=0; } } - coord2D_ts tmpOrigin; + Vector2D tmpOrigin; tmpOrigin.x = m_origin.x; tmpOrigin.y = m_origin.y; for (int32_t iii=0; iiiGetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); // Set the origin : //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); m_subWidget[m_currentCreateId][iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); @@ -149,7 +149,7 @@ bool ewol::SizerHori::CalculateMinSize(void) if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { m_userExpendY = true; } - coord2D_ts tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); m_minSize.x += tmpSize.x; if (tmpSize.y>m_minSize.y) { m_minSize.y = tmpSize.y; @@ -278,13 +278,13 @@ void ewol::SizerHori::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::SizerHori::GetWidgetAtPos(coord2D_ts pos) +ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D pos) { // for all element in the sizer ... for (int32_t iii=0; iiiGetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); + Vector2D tmpOrigin = m_subWidget[m_currentCreateId][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 5bc200e1..1120cea3 100644 --- a/Sources/libewol/ewol/widget/SizerHori.h +++ b/Sources/libewol/ewol/widget/SizerHori.h @@ -77,7 +77,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); + virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); /** * @brief Event generated to inform a flip-flop has occured on the current widget * @param --- diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index 2cf68e96..f73610c8 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -93,7 +93,7 @@ bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl int32_t nbWidgetNotFixedSize=0; for (int32_t iii=0; iiiGetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); unexpendableSize += tmpSize.y; if (false == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { nbWidgetFixedSize++; @@ -111,12 +111,12 @@ bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl sizeToAddAtEveryOne=0; } } - coord2D_ts tmpOrigin; + Vector2D tmpOrigin; tmpOrigin.x = m_origin.x; tmpOrigin.y = m_origin.y; for (int32_t iii=0; iiiGetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); // Set the origin : //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); m_subWidget[m_currentCreateId][iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); @@ -151,7 +151,7 @@ bool ewol::SizerVert::CalculateMinSize(void) if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { m_userExpendY = true; } - coord2D_ts tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); //EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")"); m_minSize.y += tmpSize.y; if (tmpSize.x>m_minSize.x) { @@ -278,13 +278,13 @@ void ewol::SizerVert::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::SizerVert::GetWidgetAtPos(coord2D_ts pos) +ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D pos) { // for all element in the sizer ... for (int32_t iii=0; iiiGetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); + Vector2D tmpOrigin = m_subWidget[m_currentCreateId][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 37455040..a7367840 100644 --- a/Sources/libewol/ewol/widget/SizerVert.h +++ b/Sources/libewol/ewol/widget/SizerVert.h @@ -78,7 +78,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); + virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); /** * @brief Event generated to inform a flip-flop has occured on the current widget * @param --- diff --git a/Sources/libewol/ewol/widget/Slider.cpp b/Sources/libewol/ewol/widget/Slider.cpp index 528eae65..f985e25c 100644 --- a/Sources/libewol/ewol/widget/Slider.cpp +++ b/Sources/libewol/ewol/widget/Slider.cpp @@ -171,9 +171,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, coord2D_ts pos) +bool ewol::Slider::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos) { - coord2D_ts relativePos = RelativePosition(pos); + 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 a493a9a7..be6c1927 100644 --- a/Sources/libewol/ewol/widget/Slider.h +++ b/Sources/libewol/ewol/widget/Slider.h @@ -76,7 +76,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, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); }; extern const char * const TYPE_EOBJECT_WIDGET_SLIDER; diff --git a/Sources/libewol/ewol/widget/Spacer.h b/Sources/libewol/ewol/widget/Spacer.h index d53998e9..aba3e13c 100644 --- a/Sources/libewol/ewol/widget/Spacer.h +++ b/Sources/libewol/ewol/widget/Spacer.h @@ -59,7 +59,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos) { return NULL; }; + virtual ewol::Widget * GetWidgetAtPos(Vector2D pos) { return NULL; }; private: etkFloat_t m_size; }; diff --git a/Sources/libewol/ewol/widget/WSlider.cpp b/Sources/libewol/ewol/widget/WSlider.cpp index 87322126..fd8bc1b9 100644 --- a/Sources/libewol/ewol/widget/WSlider.cpp +++ b/Sources/libewol/ewol/widget/WSlider.cpp @@ -129,7 +129,7 @@ bool ewol::WSlider::CalculateMinSize(void) if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { m_userExpendY = true; } - coord2D_ts tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); m_minSize.x = etk_max(tmpSize.x, m_minSize.x); m_minSize.y = etk_max(tmpSize.y, m_minSize.y); } @@ -323,7 +323,7 @@ void ewol::WSlider::OnRegenerateDisplay(void) * @return NULL No widget found * @return pointer on the widget found */ -ewol::Widget * ewol::WSlider::GetWidgetAtPos(coord2D_ts pos) +ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D pos) { // TODO : Review this ... if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentCreateId].Size()) { @@ -333,8 +333,8 @@ ewol::Widget * ewol::WSlider::GetWidgetAtPos(coord2D_ts pos) int32_t iii = m_windowsDestination; if (NULL != m_subWidget[m_currentCreateId][iii]) { - coord2D_ts tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); - coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); + Vector2D tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); + Vector2D tmpOrigin = m_subWidget[m_currentCreateId][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 abf654bf..4bc84213 100644 --- a/Sources/libewol/ewol/widget/WSlider.h +++ b/Sources/libewol/ewol/widget/WSlider.h @@ -84,7 +84,7 @@ namespace ewol { * @return NULL No widget found * @return pointer on the widget found */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); + virtual ewol::Widget * GetWidgetAtPos(Vector2D pos); /** * @brief Event generated to inform a flip-flop has occured on the current widget * @param --- diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.cpp b/Sources/libewol/ewol/widget/WidgetScrolled.cpp index 080a027c..307d5915 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.cpp +++ b/Sources/libewol/ewol/widget/WidgetScrolled.cpp @@ -133,9 +133,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, coord2D_ts pos) +bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D pos) { - coord2D_ts relativePos = RelativePosition(pos); + Vector2D relativePos = RelativePosition(pos); if (SCROLL_MODE_NORMAL == m_scroollingMode) { if (ewol::INPUT_TYPE_MOUSE==type && ( ewol::INPUT_TYPE_UNKNOW==m_highSpeedType || ewol::INPUT_TYPE_MOUSE==m_highSpeedType )) { if (1 == IdInput && ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { @@ -407,7 +407,7 @@ void ewol::WidgetScrooled::GenDraw(void) * @param[in] center True if the position might be at the center of the widget * @return --- */ -void ewol::WidgetScrooled::SetScrollingPositionDynamic(coord2D_ts borderWidth, coord2D_ts currentPosition, bool center) +void ewol::WidgetScrooled::SetScrollingPositionDynamic(Vector2D borderWidth, 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 5763e09f..31b35034 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.h +++ b/Sources/libewol/ewol/widget/WidgetScrolled.h @@ -50,13 +50,13 @@ namespace ewol { void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); protected: - coord2D_ts m_originScrooled; - coord2D_ts m_maxSize; + Vector2D m_originScrooled; + Vector2D m_maxSize; etkFloat_t m_zoom; //!< current zoom on the display private: scrollingMode_te m_scroollingMode; //!< mode of management of the scrooling etkFloat_t m_pixelScrolling; - coord2D_ts m_highSpeedStartPos; + Vector2D m_highSpeedStartPos; highSpeedMode_te m_highSpeedMode; int32_t m_highSpeedButton; ewol::inputType_te m_highSpeedType; @@ -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, ewol::eventInputType_te typeEvent, coord2D_ts pos); + virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, 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 @@ -116,7 +116,7 @@ namespace ewol { * @param[in] localSize new Maximum size * @return --- */ - void SetMaxSize(coord2D_ts localSize) { m_maxSize = localSize; }; + void SetMaxSize(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 @@ -124,7 +124,7 @@ namespace ewol { * @param[in] center True if the position might be at the center of the widget * @return --- */ - void SetScrollingPositionDynamic(coord2D_ts borderWidth, coord2D_ts currentPosition, bool center = false); + void SetScrollingPositionDynamic(Vector2D borderWidth, Vector2D currentPosition, bool center = false); }; extern const char * const TYPE_EOBJECT_WIDGET_SCROOLED; diff --git a/Sources/libparsersvg/parserSVG/Base.cpp b/Sources/libparsersvg/parserSVG/Base.cpp index c418a8f3..c7bbda6a 100644 --- a/Sources/libparsersvg/parserSVG/Base.cpp +++ b/Sources/libparsersvg/parserSVG/Base.cpp @@ -109,7 +109,7 @@ void svg::Base::ParseTransform(TiXmlNode *node) * @param[out] size parsed dimention * @return --- */ -void svg::Base::ParsePosition(const TiXmlNode *node, coord2D_ts &pos, coord2D_ts &size) +void svg::Base::ParsePosition(const TiXmlNode *node, Vector2D &pos, Vector2D &size) { pos.x = 0; pos.y = 0; @@ -435,7 +435,7 @@ color_ts svg::Base::ParseColor(const char *inputData) * @param[in] node standart XML node * @return true if no problem arrived */ -bool svg::Base::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Base::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { SVG_ERROR("NOT IMPLEMENTED"); sizeMax.x = 0; diff --git a/Sources/libparsersvg/parserSVG/Base.h b/Sources/libparsersvg/parserSVG/Base.h index 8fa14240..61aa8f05 100644 --- a/Sources/libparsersvg/parserSVG/Base.h +++ b/Sources/libparsersvg/parserSVG/Base.h @@ -54,13 +54,13 @@ namespace svg Base(void) {}; Base(PaintState parentPaintState); ~Base(void) { }; - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); //specific drawing for AAG librairy ... virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans) { }; virtual void Display(int32_t spacing) { }; void ParseTransform(TiXmlNode *node); - void ParsePosition(const TiXmlNode *node, coord2D_ts &pos, coord2D_ts &size); + void ParsePosition(const TiXmlNode *node, Vector2D &pos, Vector2D &size); etkFloat_t ParseLength(const char *dataInput); void ParsePaintAttr(const TiXmlNode *node); color_ts ParseColor(const char *inputData); diff --git a/Sources/libparsersvg/parserSVG/Circle.cpp b/Sources/libparsersvg/parserSVG/Circle.cpp index 9fac00b1..e47dd34b 100644 --- a/Sources/libparsersvg/parserSVG/Circle.cpp +++ b/Sources/libparsersvg/parserSVG/Circle.cpp @@ -38,7 +38,7 @@ svg::Circle::~Circle(void) } -bool svg::Circle::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Circle::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { m_radius = 0.0; m_position.x = 0.0; diff --git a/Sources/libparsersvg/parserSVG/Circle.h b/Sources/libparsersvg/parserSVG/Circle.h index 9dc590da..64703202 100644 --- a/Sources/libparsersvg/parserSVG/Circle.h +++ b/Sources/libparsersvg/parserSVG/Circle.h @@ -32,12 +32,12 @@ namespace svg class Circle : public svg::Base { private: - coord2D_ts m_position; //!< Position of the Circle - etkFloat_t m_radius; //!< Radius of the Circle + Vector2D m_position; //!< Position of the Circle + float m_radius; //!< Radius of the Circle public: Circle(PaintState parentPaintState); ~Circle(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); }; diff --git a/Sources/libparsersvg/parserSVG/Ellipse.cpp b/Sources/libparsersvg/parserSVG/Ellipse.cpp index 50bdd171..f5cad5cc 100644 --- a/Sources/libparsersvg/parserSVG/Ellipse.cpp +++ b/Sources/libparsersvg/parserSVG/Ellipse.cpp @@ -37,7 +37,7 @@ svg::Ellipse::~Ellipse(void) } -bool svg::Ellipse::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Ellipse::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { ParseTransform(node); ParsePaintAttr(node); diff --git a/Sources/libparsersvg/parserSVG/Ellipse.h b/Sources/libparsersvg/parserSVG/Ellipse.h index 0a6f6780..7c49bb00 100644 --- a/Sources/libparsersvg/parserSVG/Ellipse.h +++ b/Sources/libparsersvg/parserSVG/Ellipse.h @@ -32,12 +32,12 @@ namespace svg class Ellipse : public svg::Base { private: - coord2D_ts m_c; //!< Center property of the ellipse - coord2D_ts m_r; //!< Radius property of the ellipse + Vector2D m_c; //!< Center property of the ellipse + Vector2D m_r; //!< Radius property of the ellipse public: Ellipse(PaintState parentPaintState); ~Ellipse(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); }; diff --git a/Sources/libparsersvg/parserSVG/Group.cpp b/Sources/libparsersvg/parserSVG/Group.cpp index b6832b43..f6f06055 100644 --- a/Sources/libparsersvg/parserSVG/Group.cpp +++ b/Sources/libparsersvg/parserSVG/Group.cpp @@ -46,11 +46,11 @@ svg::Group::~Group(void) } -bool svg::Group::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Group::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { // parse ... - coord2D_ts pos; - coord2D_ts size; + Vector2D pos; + Vector2D size; ParseTransform(node); ParsePosition(node, pos, size); ParsePaintAttr(node); @@ -63,7 +63,7 @@ bool svg::Group::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D sizeMax.x = 0; sizeMax.y = 0; - coord2D_ts tmpPos; + Vector2D tmpPos; // parse all sub node : for(TiXmlNode * child = node->FirstChild(); NULL != child; child = child->NextSibling() ) { svg::Base *elementParser = NULL; diff --git a/Sources/libparsersvg/parserSVG/Group.h b/Sources/libparsersvg/parserSVG/Group.h index a976f396..e7c619c8 100644 --- a/Sources/libparsersvg/parserSVG/Group.h +++ b/Sources/libparsersvg/parserSVG/Group.h @@ -37,7 +37,7 @@ namespace svg public: Group(PaintState parentPaintState); ~Group(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); }; diff --git a/Sources/libparsersvg/parserSVG/Line.cpp b/Sources/libparsersvg/parserSVG/Line.cpp index f37e49cf..c1ba27ff 100644 --- a/Sources/libparsersvg/parserSVG/Line.cpp +++ b/Sources/libparsersvg/parserSVG/Line.cpp @@ -40,7 +40,7 @@ svg::Line::~Line(void) } -bool svg::Line::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Line::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { // line must have a minimum size... m_paint.strokeWidth = 1; diff --git a/Sources/libparsersvg/parserSVG/Line.h b/Sources/libparsersvg/parserSVG/Line.h index f8bf376a..2d5e4532 100644 --- a/Sources/libparsersvg/parserSVG/Line.h +++ b/Sources/libparsersvg/parserSVG/Line.h @@ -32,12 +32,12 @@ namespace svg class Line : public svg::Base { private: - coord2D_ts m_startPos; //!< Start line position - coord2D_ts m_stopPos; //!< Stop line position + Vector2D m_startPos; //!< Start line position + Vector2D m_stopPos; //!< Stop line position public: Line(PaintState parentPaintState); ~Line(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); }; diff --git a/Sources/libparsersvg/parserSVG/Path.cpp b/Sources/libparsersvg/parserSVG/Path.cpp index a348f4e4..7c1a94b7 100644 --- a/Sources/libparsersvg/parserSVG/Path.cpp +++ b/Sources/libparsersvg/parserSVG/Path.cpp @@ -78,7 +78,7 @@ const char * extractCmd(const char * input, char& cmd, etk::VectorType& o return outputPointer; } -bool svg::Path::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Path::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { ParseTransform(node); ParsePaintAttr(node); diff --git a/Sources/libparsersvg/parserSVG/Path.h b/Sources/libparsersvg/parserSVG/Path.h index 6f88adf3..7e8d978e 100644 --- a/Sources/libparsersvg/parserSVG/Path.h +++ b/Sources/libparsersvg/parserSVG/Path.h @@ -46,7 +46,7 @@ namespace svg typedef struct { pathEnum_te cmd; bool relative; - etkFloat_t element[7]; + float element[7]; }pathBasic_ts; class Path : public svg::Base @@ -56,7 +56,7 @@ namespace svg public: Path(PaintState parentPaintState); ~Path(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); private: diff --git a/Sources/libparsersvg/parserSVG/Polygon.cpp b/Sources/libparsersvg/parserSVG/Polygon.cpp index 78f2a94c..f82038f6 100644 --- a/Sources/libparsersvg/parserSVG/Polygon.cpp +++ b/Sources/libparsersvg/parserSVG/Polygon.cpp @@ -37,7 +37,7 @@ svg::Polygon::~Polygon(void) } -bool svg::Polygon::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Polygon::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { ParseTransform(node); ParsePaintAttr(node); @@ -58,7 +58,7 @@ bool svg::Polygon::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord sizeMax.y = 0; SVG_VERBOSE("Parse polygon : \"" << sss << "\""); while ('\0' != sss[0]) { - coord2D_ts pos; + Vector2D pos; int32_t n; if (sscanf(sss, "%f,%f%n", &pos.x, &pos.y, &n) == 2) { m_listPoint.PushBack(pos); diff --git a/Sources/libparsersvg/parserSVG/Polygon.h b/Sources/libparsersvg/parserSVG/Polygon.h index 49ec4318..bac6dec9 100644 --- a/Sources/libparsersvg/parserSVG/Polygon.h +++ b/Sources/libparsersvg/parserSVG/Polygon.h @@ -37,12 +37,12 @@ namespace svg class Polygon : public svg::Base { private: - etk::VectorType m_listPoint; //!< list of all point of the polygone - PolygonMode_te m_diplayMode; //!< polygone specific display mode + etk::VectorType > m_listPoint; //!< list of all point of the polygone + PolygonMode_te m_diplayMode; //!< polygone specific display mode public: Polygon(PaintState parentPaintState); ~Polygon(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); }; diff --git a/Sources/libparsersvg/parserSVG/Polyline.cpp b/Sources/libparsersvg/parserSVG/Polyline.cpp index b978a682..c46af181 100644 --- a/Sources/libparsersvg/parserSVG/Polyline.cpp +++ b/Sources/libparsersvg/parserSVG/Polyline.cpp @@ -37,7 +37,7 @@ svg::Polyline::~Polyline(void) } -bool svg::Polyline::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Polyline::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { // line must have a minimum size... m_paint.strokeWidth = 1; @@ -56,7 +56,7 @@ bool svg::Polyline::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coor sizeMax.y = 0; SVG_VERBOSE("Parse polyline : \"" << sss << "\""); while ('\0' != sss[0]) { - coord2D_ts pos; + Vector2D pos; int32_t n; if (sscanf(sss, "%f,%f %n", &pos.x, &pos.y, &n) == 2) { m_listPoint.PushBack(pos); diff --git a/Sources/libparsersvg/parserSVG/Polyline.h b/Sources/libparsersvg/parserSVG/Polyline.h index 322168ce..772c7b2c 100644 --- a/Sources/libparsersvg/parserSVG/Polyline.h +++ b/Sources/libparsersvg/parserSVG/Polyline.h @@ -33,11 +33,11 @@ namespace svg class Polyline : public svg::Base { private: - etk::VectorType m_listPoint; //!< list of all point of the polyline + etk::VectorType > m_listPoint; //!< list of all point of the polyline public: Polyline(PaintState parentPaintState); ~Polyline(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); }; diff --git a/Sources/libparsersvg/parserSVG/Rectangle.cpp b/Sources/libparsersvg/parserSVG/Rectangle.cpp index 373b0d6c..568ca2fb 100644 --- a/Sources/libparsersvg/parserSVG/Rectangle.cpp +++ b/Sources/libparsersvg/parserSVG/Rectangle.cpp @@ -42,7 +42,7 @@ svg::Rectangle::~Rectangle(void) } -bool svg::Rectangle::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Rectangle::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { m_position.x = 0.0; m_position.y = 0.0; diff --git a/Sources/libparsersvg/parserSVG/Rectangle.h b/Sources/libparsersvg/parserSVG/Rectangle.h index ffcfa3f9..5d0f8bb0 100644 --- a/Sources/libparsersvg/parserSVG/Rectangle.h +++ b/Sources/libparsersvg/parserSVG/Rectangle.h @@ -32,13 +32,13 @@ namespace svg class Rectangle : public svg::Base { private: - coord2D_ts m_position; //!< position of the rectangle - coord2D_ts m_size; //!< size of the rectangle - coord2D_ts m_roundedCorner; //!< property of the rounded corner + Vector2D m_position; //!< position of the rectangle + Vector2D m_size; //!< size of the rectangle + Vector2D m_roundedCorner; //!< property of the rounded corner public: Rectangle(PaintState parentPaintState); ~Rectangle(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); }; diff --git a/Sources/libparsersvg/parserSVG/Renderer.h b/Sources/libparsersvg/parserSVG/Renderer.h index 1de6358e..d27cf3bb 100644 --- a/Sources/libparsersvg/parserSVG/Renderer.h +++ b/Sources/libparsersvg/parserSVG/Renderer.h @@ -55,11 +55,11 @@ namespace svg public: color_ts fill; color_ts stroke; - etkFloat_t strokeWidth; + float strokeWidth; bool flagEvenOdd; lineCap_te lineCap; lineJoin_te lineJoin; - coord2D_ts viewPort; + Vector2D viewPort; }; // basic definition type for the renderer @@ -74,7 +74,7 @@ namespace svg Renderer(uint32_t width, uint32_t height); ~Renderer(void); void WritePpm(etk::UString fileName); - coord2D_ts m_size; + Vector2D m_size; agg::rendering_buffer * m_renderingBuffer; agg::pixfmt_rgba32 * m_pixFrame; rendererBase_t * m_renderBase; diff --git a/Sources/libparsersvg/parserSVG/Text.cpp b/Sources/libparsersvg/parserSVG/Text.cpp index 6f0c01be..696e88cf 100644 --- a/Sources/libparsersvg/parserSVG/Text.cpp +++ b/Sources/libparsersvg/parserSVG/Text.cpp @@ -35,7 +35,7 @@ svg::Text::~Text(void) } -bool svg::Text::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax) +bool svg::Text::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { sizeMax.x = 0; sizeMax.y = 0; diff --git a/Sources/libparsersvg/parserSVG/Text.h b/Sources/libparsersvg/parserSVG/Text.h index 2c5f0fcd..4b774244 100644 --- a/Sources/libparsersvg/parserSVG/Text.h +++ b/Sources/libparsersvg/parserSVG/Text.h @@ -36,7 +36,7 @@ namespace svg public: Text(PaintState parentPaintState); ~Text(void); - virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ts& sizeMax); + virtual bool Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax); virtual void Display(int32_t spacing); }; }; diff --git a/Sources/libparsersvg/parserSVG/parserSVG.cpp b/Sources/libparsersvg/parserSVG/parserSVG.cpp index 3987ec42..5be9c799 100644 --- a/Sources/libparsersvg/parserSVG/parserSVG.cpp +++ b/Sources/libparsersvg/parserSVG/parserSVG.cpp @@ -118,18 +118,18 @@ svg::Parser::Parser(etk::File fileName) : m_renderedElement(NULL) m_version = version; } // parse ... - coord2D_ts pos; + Vector2D pos; ParseTransform(root); ParsePosition(root, pos, m_size); ParsePaintAttr(root); SVG_VERBOSE("parsed .ROOT trans : (" << m_transformMatrix.sx << "," << m_transformMatrix.shy << "," << m_transformMatrix.shx << "," << m_transformMatrix.sy << "," << m_transformMatrix.tx << "," << m_transformMatrix.ty << ")"); - coord2D_ts maxSize; + Vector2D maxSize; maxSize.x = 0.0; maxSize.y = 0.0; - coord2D_ts size; + Vector2D size; // parse all sub node : for(TiXmlNode * child = root->FirstChild(); NULL != child; child = child->NextSibling() ) { svg::Base *elementParser = NULL; diff --git a/Sources/libparsersvg/parserSVG/parserSVG.h b/Sources/libparsersvg/parserSVG/parserSVG.h index 0fa50ce0..bf07a53a 100644 --- a/Sources/libparsersvg/parserSVG/parserSVG.h +++ b/Sources/libparsersvg/parserSVG/parserSVG.h @@ -39,7 +39,7 @@ namespace svg etk::UString m_version; etk::UString m_title; etk::VectorType m_subElementList; - coord2D_ts m_size; + Vector2D m_size; svg::Renderer* m_renderedElement; public: @@ -52,7 +52,7 @@ namespace svg virtual void AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans); uint8_t* GetPointerOnData(void); uint32_t GetSizeOnData(void); - coord2D_ts GetDefinedSize(void) { return m_size;}; + Vector2D GetDefinedSize(void) { return m_size;}; }; };