diff --git a/external/agg b/external/agg index 197525df..b166e92b 160000 --- a/external/agg +++ b/external/agg @@ -1 +1 @@ -Subproject commit 197525dfc6cbe138767392466ad4f450aa7b2bd6 +Subproject commit b166e92b447201ef12236cd498a06664c7aec52f diff --git a/external/etk b/external/etk index a8cafb59..6ceb992e 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit a8cafb5969640bd14ed9ba0dd3dfa718124e2101 +Subproject commit 6ceb992e455f2cd02e7fa3ff071e835cedaf436f diff --git a/external/parsersvg b/external/parsersvg index 2697e694..6ff447ea 160000 --- a/external/parsersvg +++ b/external/parsersvg @@ -1 +1 @@ -Subproject commit 2697e6940e2549e4c6725911d049ae3a92efe2f9 +Subproject commit 6ff447eadb51765b42574baf8d3dd2ed791af617 diff --git a/sources/Linux.mk b/sources/Linux.mk index d850f8fa..f94c80c7 100644 --- a/sources/Linux.mk +++ b/sources/Linux.mk @@ -34,6 +34,8 @@ include $(LOCAL_PATH)/file.mk LOCAL_SRC_FILES := \ $(FILE_LIST) \ + +QSDFQSDFQSDF = \ ewol/os/gui.X11.cpp \ ewol/audio/interfacePortAudio.cpp diff --git a/sources/ewol/clipBoard.cpp b/sources/ewol/clipBoard.cpp index 07d0ce6e..279a7c6a 100644 --- a/sources/ewol/clipBoard.cpp +++ b/sources/ewol/clipBoard.cpp @@ -27,7 +27,7 @@ note: la copy dans le : static etk::UString mesCopy[ewol::clipBoard::clipboardCount]; -static const char* clipboardDescriptionString[clipboardCount] = { +static const char* clipboardDescriptionString[ewol::clipBoard::clipboardCount+1] = { "clipboard0", "clipboard1", "clipboard2", @@ -45,7 +45,7 @@ static const char* clipboardDescriptionString[clipboardCount] = { etk::CCout& ewol::clipBoard::operator <<(etk::CCout &os, const ewol::clipBoard::clipboardListe_te obj) { - if (obj>=0 && obj =0 && obj +#include #include namespace ewol diff --git a/sources/ewol/compositing/Compositing.cpp b/sources/ewol/compositing/Compositing.cpp index f2b297da..b52390ac 100644 --- a/sources/ewol/compositing/Compositing.cpp +++ b/sources/ewol/compositing/Compositing.cpp @@ -6,7 +6,10 @@ * @license BSD v3 (see license file) */ -#include +#include +#include + +#include #include @@ -30,19 +33,19 @@ void ewol::Compositing::ResetMatrix(void) void ewol::Compositing::Translate(etk::Vector3D vect) { - m_matrixApply *= etk::matrix::Translate(vect); + m_matrixApply *= etk::Matrix4::Translate(vect); } void ewol::Compositing::Rotate(etk::Vector3D vect, float angle) { - m_matrixApply *= etk::matrix::Rotate(vect, angle); + m_matrixApply *= etk::Matrix4::Rotate(vect, angle); } void ewol::Compositing::Scale(etk::Vector3D vect) { - m_matrixApply *= etk::matrix::Scale(vect); + m_matrixApply *= etk::Matrix4::Scale(vect); } diff --git a/sources/ewol/compositing/Compositing.h b/sources/ewol/compositing/Compositing.h index 1cb7a5fb..8e26d46d 100644 --- a/sources/ewol/compositing/Compositing.h +++ b/sources/ewol/compositing/Compositing.h @@ -9,9 +9,9 @@ #ifndef __EWOL_COMPOSITING_H__ #define __EWOL_COMPOSITING_H__ -#include -#include +#include #include +#include namespace ewol { diff --git a/sources/ewol/compositing/Drawing.cpp b/sources/ewol/compositing/Drawing.cpp index c302d161..f4a38ecc 100644 --- a/sources/ewol/compositing/Drawing.cpp +++ b/sources/ewol/compositing/Drawing.cpp @@ -6,7 +6,7 @@ * @license BSD v3 (see license file) */ -#include +#include #include diff --git a/sources/ewol/compositing/Drawing.h b/sources/ewol/compositing/Drawing.h index e884a1c5..8656ffec 100644 --- a/sources/ewol/compositing/Drawing.h +++ b/sources/ewol/compositing/Drawing.h @@ -9,10 +9,11 @@ #ifndef __EWOL_DRAWING_H__ #define __EWOL_DRAWING_H__ -#include -#include #include -#include + +#include +#include +#include namespace ewol diff --git a/sources/ewol/compositing/Image.cpp b/sources/ewol/compositing/Image.cpp index e69de29b..67bf3a51 100644 --- a/sources/ewol/compositing/Image.cpp +++ b/sources/ewol/compositing/Image.cpp @@ -0,0 +1,255 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + +#include +#include +#include + +ewol::Image::Image(etk::UString imageName) : + m_position(0.0, 0.0, 0.0), + m_clippingPosStart(0.0, 0.0, 0.0), + m_clippingPosStop(0.0, 0.0, 0.0), + m_clippingEnable(false), + m_color(draw::color::black), + m_axes(0.0, 0.0, 0.0), + m_angle(0.0), + m_GLprogram(NULL), + m_GLPosition(-1), + m_GLMatrix(-1), + m_GLColor(-1), + m_GLtexture(-1), + m_GLtexID(-1), + m_resource(NULL) +{ + SetSource(imageName); + LoadProgram(); +} + +ewol::Image::~Image(void) +{ + if (NULL != m_resource) { + ewol::resource::Release(m_resource); + m_resource = NULL; + } + ewol::resource::Release(m_GLprogram); +} + +void ewol::Image::LoadProgram(void) +{ + etk::UString tmpString("DATA:textured3D.prog"); + // get the shader resource : + m_GLPosition = 0; + if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) { + m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); + m_GLColor = m_GLprogram->GetAttribute("EW_color"); + m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d"); + m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); + m_GLtexID = m_GLprogram->GetUniform("EW_texID"); + } +} + +void ewol::Image::Draw(void) +{ + if (m_coord.Size()<=0) { + //EWOL_WARNING("Nothink to draw..."); + return; + } + if (m_resource == NULL) { + EWOL_WARNING("no resources ..."); + return; + } + if (m_GLprogram==NULL) { + EWOL_ERROR("No shader ..."); + return; + } + // set Matrix : translation/positionMatrix + etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply; + m_GLprogram->Use(); + m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + // TextureID + m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId()); + // position : + m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &m_coord[0]); + // Texture : + m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]); + // color : + m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]); + // Request the draw od the elements : + glDrawArrays(GL_TRIANGLES, 0, m_coord.Size()); + m_GLprogram->UnUse(); +} + +void ewol::Image::Clear(void) +{ + // call upper class + ewol::Compositing::Clear(); + // Reset Buffer : + m_coord.Clear(); + m_coordTex.Clear(); + m_coordColor.Clear(); + // Reset temporal variables : + m_position = etk::Vector3D(0.0, 0.0, 0.0); + m_clippingPosStart = etk::Vector3D(0.0, 0.0, 0.0); + m_clippingPosStop = etk::Vector3D(0.0, 0.0, 0.0); + m_clippingEnable = false; + m_color = draw::color::black; + m_axes = etk::Vector3D(0.0, 0.0, 0.0); + m_angle = 0.0; +} + + +etk::Vector3D ewol::Image::GetPos(void) +{ + return m_position; +} + + +void ewol::Image::SetPos(etk::Vector3D pos) +{ + m_position = pos; +} + + +void ewol::Image::SetRelPos(etk::Vector3D pos) +{ + m_position += pos; +} + + +void ewol::Image::SetColor(draw::Color color) +{ + m_color = color; +} + + +void ewol::Image::SetClippingWidth(etk::Vector3D pos, etk::Vector3D width) +{ + SetClipping(pos, pos+width); +} + +void ewol::Image::SetClipping(etk::Vector3D pos, etk::Vector3D posEnd) +{ + // note the internal system all time request to have a bounding all time in the same order + if (pos.x <= posEnd.x) { + m_clippingPosStart.x = pos.x; + m_clippingPosStop.x = posEnd.x; + } else { + m_clippingPosStart.x = posEnd.x; + m_clippingPosStop.x = pos.x; + } + if (pos.y <= posEnd.y) { + m_clippingPosStart.y = pos.y; + m_clippingPosStop.y = posEnd.y; + } else { + m_clippingPosStart.y = posEnd.y; + m_clippingPosStop.y = pos.y; + } + if (pos.z <= posEnd.z) { + m_clippingPosStart.z = pos.z; + m_clippingPosStop.z = posEnd.z; + } else { + m_clippingPosStart.z = posEnd.z; + m_clippingPosStop.z = pos.z; + } + m_clippingEnable = true; +} + + +void ewol::Image::SetClippingMode(bool newMode) +{ + m_clippingEnable = newMode; +} + + +void ewol::Image::SetAngle(etk::Vector3D axes, float angle) +{ + m_axes = axes; + m_angle = angle; + if( m_axes.x == 0 + && m_axes.y == 0 + && m_axes.z == 0) { + m_angle = 0; + } +} + +void ewol::Image::Print(etk::Vector2D size) +{ + etk::Vector3D point; + etk::Vector2D tex; + point.z = 0; + + tex.x = 0; + tex.y = 1; + point.x = m_position.x; + point.y = m_position.y; + m_coord.PushBack(point); + m_coordTex.PushBack(tex); + m_coordColor.PushBack(m_color); + + + tex.x = 1; + tex.y = 1; + point.x = m_position.x + size.x; + point.y = m_position.y; + m_coord.PushBack(point); + m_coordTex.PushBack(tex); + m_coordColor.PushBack(m_color); + + + tex.x = 1; + tex.y = 0; + point.x = m_position.x + size.x; + point.y = m_position.y + size.y; + m_coord.PushBack(point); + m_coordTex.PushBack(tex); + m_coordColor.PushBack(m_color); + + m_coord.PushBack(point); + m_coordTex.PushBack(tex); + m_coordColor.PushBack(m_color); + + tex.x = 0; + tex.y = 0; + point.x = m_position.x; + point.y = m_position.y + size.y; + m_coord.PushBack(point); + m_coordTex.PushBack(tex); + m_coordColor.PushBack(m_color); + + tex.x = 0; + tex.y = 1; + point.x = m_position.x; + point.y = m_position.y; + m_coord.PushBack(point); + m_coordTex.PushBack(tex); + m_coordColor.PushBack(m_color); +} + +void ewol::Image::PrintPart(etk::Vector2D size, + etk::Vector2D sourcePosStart, + etk::Vector2D sourcePosStop) +{ + +} + +void ewol::Image::SetSource(etk::UString newFile) +{ + Clear(); + // remove old one + if (NULL != m_resource) { + ewol::resource::Release(m_resource); + m_resource = NULL; + } + etk::Vector2D size(-1,-1); + // link to new One + if (false == ewol::resource::Keep(newFile, m_resource, size)) { + EWOL_ERROR("Can not get Image resource"); + } +} diff --git a/sources/ewol/compositing/Image.h b/sources/ewol/compositing/Image.h index 496ef3ea..f9c685d2 100644 --- a/sources/ewol/compositing/Image.h +++ b/sources/ewol/compositing/Image.h @@ -9,23 +9,122 @@ #ifndef __EWOL_IMAGE_H__ #define __EWOL_IMAGE_H__ +#include +#include +#include + namespace ewol { class Image : public ewol::Compositing { - protected: - etk::Vector2D m_size; + private: + private: + etk::Vector3D m_position; //!< The current position to draw + etk::Vector3D m_clippingPosStart; //!< Clipping start position + etk::Vector3D m_clippingPosStop; //!< Clipping stop position + bool m_clippingEnable; //!< true if the clipping must be activated + private: + draw::Color m_color; //!< The text foreground color + etk::Vector3D m_axes; //!< Rotation axes (instant) + float m_angle; //!< Angle to set at the axes + private: + ewol::Program* m_GLprogram; //!< pointer on the opengl display program + int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) + int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) + int32_t m_GLColor; //!< openGL id on the element (color buffer) + int32_t m_GLtexture; //!< openGL id on the element (Texture position) + int32_t m_GLtexID; //!< openGL id on the element (texture ID) + private: + ewol::TextureFile* m_resource; //!< texture resources + etk::Vector > m_coord; //!< internal coord of the object + etk::Vector > m_coordTex; //!< internal texture coordinate for every point + etk::Vector m_coordColor; //!< internal color of the different point + private: + /** + * @brief Load the openGL program and get all the ID needed + */ + void LoadProgram(void); public: - Image(void); + /** + * @brief generic constructor + * @param[in] imageName Name of the file that might be loaded + */ + Image(etk::UString imageName); + /** + * @brief generic destructor + */ ~Image(void); + public: + /** + * @brief Draw All the refistered text in the current element on openGL + */ void Draw(void); + /** + * @brief Clear alll tre registered element in the current element + */ void Clear(void); + /** + * @brief Get the current display position (sometime needed in the gui control) + * @return the current position. + */ + etk::Vector3D GetPos(void); + /** + * @brief Set position for the next text writen + * @param[in] pos Position of the text (in 3D) + */ void SetPos(etk::Vector3D pos); + /** + * @brief Set relative position for the next text writen + * @param[in] pos ofset apply of the text (in 3D) + */ void SetRelPos(etk::Vector3D pos); - void SetAngle(etk::Vector3D angle); - void SetColor(etk::Color color); - void SetSize(etk::Vector2D size); - // TODO : ... + /** + * @brief Set the Color of the current foreground font + * @param[in] color Color to set on foreground (for next print) + */ + void SetColor(draw::Color color); + /** + * @brief Request a clipping area for the text (next draw only) + * @param[in] pos Start position of the clipping + * @param[in] width Width size of the clipping + */ + void SetClippingWidth(etk::Vector3D pos, etk::Vector3D width); + /** + * @brief Request a clipping area for the text (next draw only) + * @param[in] pos Start position of the clipping + * @param[in] posEnd End position of the clipping + */ + void SetClipping(etk::Vector3D pos, etk::Vector3D posEnd); + /** + * @brief Enable/Disable the clipping (without lose the current clipping position) + * @brief newMode The new status of the clipping + */ + void SetClippingMode(bool newMode); + /** + * @brief Set a unique rotation of this element (not set in the Rotate Generic system) + * @param[in] axes Rotation axes selection + * @param[in] angle Angle to set on this axes + */ + void SetAngle(etk::Vector3D axes, float angle); + /** + * @brief Add a compleate of the image to display with the requested size + * @param[in] size Size of the output image + */ + void Print(etk::Vector2D size); + /** + * @brief Add a part of the image to display with the requested size + * @param[in] size Size of the output image + * @param[in] sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image). + * @param[in] sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image). + */ + void PrintPart(etk::Vector2D size, + etk::Vector2D sourcePosStart, + etk::Vector2D sourcePosStop); + /** + * @brief Change the image Source ==> can not be done to display 2 images at the same time ... + * @param[in] newFile New file of the Image + */ + void SetSource(etk::UString newFile); }; }; diff --git a/sources/ewol/compositing/Mesh.h b/sources/ewol/compositing/Mesh.h index 183630e4..f6caa7be 100644 --- a/sources/ewol/compositing/Mesh.h +++ b/sources/ewol/compositing/Mesh.h @@ -9,6 +9,10 @@ #ifndef __EWOL_MESH_H__ #define __EWOL_MESH_H__ +#include +#include +#include + namespace ewol { class Mesh : public ewol::Compositing diff --git a/sources/ewol/compositing/Sprite.h b/sources/ewol/compositing/Sprite.h index add6a36e..207c7e51 100644 --- a/sources/ewol/compositing/Sprite.h +++ b/sources/ewol/compositing/Sprite.h @@ -9,6 +9,10 @@ #ifndef __EWOL_SPRITE_H__ #define __EWOL_SPRITE_H__ +#include +#include +#include + namespace ewol { class Sprite : public ewol::Compositing diff --git a/sources/ewol/compositing/Text.cpp b/sources/ewol/compositing/Text.cpp index 6d9e8bc3..bdffcac3 100644 --- a/sources/ewol/compositing/Text.cpp +++ b/sources/ewol/compositing/Text.cpp @@ -6,23 +6,11 @@ * @license BSD v3 (see license file) */ - -#include -#include -#include #include - -/* - // curent Drawing position - etk::Vector3D m_position; //!< the next position to draw the text - // clipping section - etk::Vector3D m_clippingPosition; - etk::Vector3D m_clippingSize; - bool m_clippingEnable; - // Basic color - etk::Color m_color; -*/ +#include +#include +#include ewol::Text::Text(void) : m_position(0.0, 0.0, 0.0), @@ -46,7 +34,7 @@ ewol::Text::Text(void) : m_GLtexID(-1), m_font(NULL) { - SetFont(ewol::font::GetDefaultFont(), ewol::font::GetDefaultSize()); + SetFont("", -1); LoadProgram(); } @@ -263,7 +251,7 @@ void ewol::Text::SetClippingMode(bool newMode) void ewol::Text::SetFontSize(int32_t fontSize) { // get old size - etk::UString fontName = ewol::font::GetDefaultFont(); + etk::UString fontName = ""; if (NULL != m_font) { fontName = m_font->GetName(); } @@ -274,7 +262,7 @@ void ewol::Text::SetFontSize(int32_t fontSize) void ewol::Text::SetFontName(etk::UString fontName) { // get old size - int32_t fontSize = ewol::font::GetDefaultSize(); + int32_t fontSize = -1; if (NULL != m_font) { fontSize = m_font->GetFontSize(); } @@ -284,16 +272,22 @@ void ewol::Text::SetFontName(etk::UString fontName) void ewol::Text::SetFont(etk::UString fontName, int32_t fontSize) { + Clear(); // remove old one if (NULL != m_font) { ewol::resource::Release(m_font); m_font = NULL; } - etk::UString tmpName = fontName; - tmpName += ":"; - tmpName += fontSize; + if (fontSize <= 0) { + fontSize = ewol::config::FontGetDefaultSize(); + } + if (fontName == "") { + fontName = ewol::config::FontGetDefaultName(); + } + fontName += ":"; + fontName += fontSize; // link to new One - if (false == ewol::resource::Keep(tmpName, m_font)) { + if (false == ewol::resource::Keep(fontName, m_font)) { EWOL_ERROR("Can not get font resource"); } } @@ -629,10 +623,10 @@ void ewol::Text::Print(const uniChar_t charcode) float dyC = m_position.y + myGlyph->m_bearing.y + fontHeigh - fontSize; float dyD = dyC - myGlyph->m_sizeTexture.y; - float tuA = myGlyph->m_texturePosStart.u; - float tuB = myGlyph->m_texturePosStop.u; - float tvC = myGlyph->m_texturePosStart.v; - float tvD = myGlyph->m_texturePosStop.v; + float tuA = myGlyph->m_texturePosStart.x; + float tuB = myGlyph->m_texturePosStop.x; + float tvC = myGlyph->m_texturePosStart.y; + float tvD = myGlyph->m_texturePosStop.y; // Clipping and drawing area @@ -710,16 +704,16 @@ void ewol::Text::Print(const uniChar_t charcode) * | | * 3------2 */ - texCoord_ts texturePos[4]; - texturePos[0].u = tuA+m_mode; - texturePos[1].u = tuB+m_mode; - texturePos[2].u = tuB+m_mode; - texturePos[3].u = tuA+m_mode; + etk::Vector2D texturePos[4]; + texturePos[0].x = tuA+m_mode; + texturePos[1].x = tuB+m_mode; + texturePos[2].x = tuB+m_mode; + texturePos[3].x = tuA+m_mode; - texturePos[0].v = tvC; - texturePos[1].v = tvC; - texturePos[2].v = tvD; - texturePos[3].v = tvD; + texturePos[0].y = tvC; + texturePos[1].y = tvC; + texturePos[2].y = tvD; + texturePos[3].y = tvD; // NOTE : Android does not support the Quads elements ... /* Step 1 : diff --git a/sources/ewol/compositing/Text.h b/sources/ewol/compositing/Text.h index 10bb061a..38b4fc42 100644 --- a/sources/ewol/compositing/Text.h +++ b/sources/ewol/compositing/Text.h @@ -9,11 +9,12 @@ #ifndef __EWOL_TEXT_H__ #define __EWOL_TEXT_H__ -#include +#include + +#include #include #include -#include -#include +#include namespace ewol { @@ -75,7 +76,7 @@ namespace ewol ewol::TexturedFont* m_font; //!< Font resources private: // Text etk::Vector > m_coord; //!< internal coord of the object - etk::Vector m_coordTex; //!< internal texture coordinate for every point + etk::Vector > m_coordTex; //!< internal texture coordinate for every point etk::Vector m_coordColor; //!< internal color of the different point private: /** diff --git a/sources/ewol/config.cpp b/sources/ewol/config.cpp index 03b9474d..68be17e8 100644 --- a/sources/ewol/config.cpp +++ b/sources/ewol/config.cpp @@ -7,6 +7,7 @@ */ #include +#include #undef __class__ #define __class__ "ewol::config" diff --git a/sources/ewol/config.h b/sources/ewol/config.h index 782c1393..f6e7c35e 100644 --- a/sources/ewol/config.h +++ b/sources/ewol/config.h @@ -9,6 +9,9 @@ #ifndef __EWOL_CONFIG_H__ #define __EWOL_CONFIG_H__ +#include +#include + namespace ewol { namespace config diff --git a/sources/ewol/debug.cpp b/sources/ewol/debug.cpp index 212f87bc..bc3516a2 100644 --- a/sources/ewol/debug.cpp +++ b/sources/ewol/debug.cpp @@ -6,6 +6,6 @@ * @license BSD v3 (see license file) */ -#include +#include const char * ewolLibName = "ewol "; diff --git a/sources/ewol/eObject/EObject.cpp b/sources/ewol/eObject/EObject.cpp index ce7c338f..8cdf6258 100644 --- a/sources/ewol/eObject/EObject.cpp +++ b/sources/ewol/eObject/EObject.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #undef __class__ diff --git a/sources/ewol/eObject/EObjectManager.cpp b/sources/ewol/eObject/EObjectManager.cpp index 908c232a..86f0e741 100644 --- a/sources/ewol/eObject/EObjectManager.cpp +++ b/sources/ewol/eObject/EObjectManager.cpp @@ -7,7 +7,8 @@ */ #include -#include +#include +#include #undef __class__ #define __class__ "EObjectManager" diff --git a/sources/ewol/ewol.cpp b/sources/ewol/ewol.cpp index da4a0ce1..aef2082e 100644 --- a/sources/ewol/ewol.cpp +++ b/sources/ewol/ewol.cpp @@ -16,11 +16,10 @@ #define __class__ "ewol" -int32_t ewol::Run(int32_t argc, const char* argv[]); +int32_t ewol::Run(int32_t argc, const char* argv[]) { - // call standard RUN ... - + return guiInterface::main(argc, argv); } @@ -49,12 +48,12 @@ void ewol::WindowsPopUpAdd(ewol::Widget * tmpWidget) } } -void ewol::ChangeSize(etkVector2D size) +void ewol::ChangeSize(etk::Vector2D size) { guiInterface::ChangeSize(size); } -void ewol::ChangePos(etkVector2D pos) +void ewol::ChangePos(etk::Vector2D pos) { guiInterface::ChangePos(pos); } diff --git a/sources/ewol/ewol.h b/sources/ewol/ewol.h index 16aedcdb..66030e1a 100644 --- a/sources/ewol/ewol.h +++ b/sources/ewol/ewol.h @@ -47,13 +47,13 @@ namespace ewol * @note work only on computer * @param[in] size The new windows size */ - void ChangeSize(etkVector2D size); + void ChangeSize(etk::Vector2D size); /** * @brief Change the windows curent position * @note work only on computer * @param[in] pos The new windows position */ - void ChangePos(etkVector2D pos); + void ChangePos(etk::Vector2D pos); /** * @brief Generate the action of redrawing all the display. */ diff --git a/sources/ewol/key.cpp b/sources/ewol/key.cpp index 820ce46d..aa946e43 100644 --- a/sources/ewol/key.cpp +++ b/sources/ewol/key.cpp @@ -8,7 +8,7 @@ #include -static const char* statusDescriptionString[statusCount] = { +static const char* statusDescriptionString[ewol::keyEvent::statusCount+1] = { "statusUnknow", "statusDown", "statusMove", @@ -21,13 +21,13 @@ static const char* statusDescriptionString[statusCount] = { "statusEnter", "statusLeave", "statusAbort", - "statusTransfer", + "statusTransfert", "statusCount" }; etk::CCout& ewol::keyEvent::operator <<(etk::CCout &os, const ewol::keyEvent::status_te obj) { - if (obj>=0 && obj =0 && obj =0 && obj =0 && obj =0 && obj < typeCount) { + if (obj>=0 && obj < ewol::keyEvent::typeCount) { os << typeDescriptionString[obj]; } else { os << "[ERROR]"; diff --git a/sources/ewol/key.h b/sources/ewol/key.h index a553df1f..dbad86bd 100644 --- a/sources/ewol/key.h +++ b/sources/ewol/key.h @@ -46,7 +46,7 @@ namespace ewol statusEnter, statusLeave, statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events) - statusTransfer, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event) + statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event) statusCount, // number max of imput possible } status_te; /** @@ -101,6 +101,19 @@ namespace ewol etk::CCout& operator <<(etk::CCout &os, const ewol::keyEvent::keyboard_te obj); }; + + class SpecialKey { + public: + unsigned capLock : 1; + unsigned shift : 1; + unsigned ctrl : 1; + unsigned meta : 1; + unsigned alt : 1; + unsigned altGr : 1; + unsigned verNum : 1; + unsigned insert : 1; + + }; }; diff --git a/sources/ewol/renderer/ResourceManager.cpp b/sources/ewol/renderer/ResourceManager.cpp index 495c58c7..60eed71b 100644 --- a/sources/ewol/renderer/ResourceManager.cpp +++ b/sources/ewol/renderer/ResourceManager.cpp @@ -6,10 +6,10 @@ * @license BSD v3 (see license file) */ -#include -#include -#include -#include +#include +#include +#include +#include // Specific for the resource : @@ -197,10 +197,10 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::TexturedFont*& object) } -bool ewol::resource::Keep(etk::UString& filename, ewol::Font*& object) +bool ewol::resource::Keep(etk::UString& filename, ewol::FontBase*& object) { EWOL_VERBOSE("KEEP : Font : file : \"" << filename << "\""); - object = static_cast(LocalKeep(filename)); + object = static_cast(LocalKeep(filename)); if (NULL != object) { return true; } @@ -233,7 +233,7 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Program*& object) bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object) { - EWOL_VERBOSE("KEEP : Shader : file : \"" << filename << "\""); + EWOL_VERBOSE("KEEP : ShSimpleader : file : \"" << filename << "\""); object = static_cast(LocalKeep(filename)); if (NULL != object) { return true; @@ -248,23 +248,6 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object) return true; } -bool ewol::resource::Keep(etk::UString& filename, ewol::DistantFieldFont*& object) -{ - EWOL_VERBOSE("KEEP : DistanceFieldFont : file : \"" << filename << "\""); - object = static_cast(LocalKeep(filename)); - if (NULL != object) { - return true; - } - // need to crate a new one ... - object = new ewol::DistantFieldFont(filename); - if (NULL == object) { - EWOL_ERROR("allocation error of a resource : " << filename); - return false; - } - LocalAdd(object); - return true; -} - bool ewol::resource::Keep(ewol::Texture*& object) { // this element create a new one every time .... @@ -345,15 +328,15 @@ bool ewol::resource::Keep(etk::UString& accesMode, ewol::VirtualBufferObject*& o return true; } -bool ewol::resource::Keep(etk::UString& filename, ewol::SimpleConfigFile*& object) +bool ewol::resource::Keep(etk::UString& filename, ewol::ConfigFile*& object) { EWOL_INFO("KEEP : SimpleConfig : file : \"" << filename << "\""); - object = static_cast(LocalKeep(filename)); + object = static_cast(LocalKeep(filename)); if (NULL != object) { return true; } // this element create a new one every time .... - object = new ewol::SimpleConfigFile(filename); + object = new ewol::ConfigFile(filename); if (NULL == object) { EWOL_ERROR("allocation error of a resource : ??Mesh.obj??"); return false; @@ -404,7 +387,7 @@ void ewol::resource::Release(ewol::TexturedFont*& object) Release(object2); object = NULL; } -void ewol::resource::Release(ewol::Font*& object) +void ewol::resource::Release(ewol::FontBase*& object) { ewol::Resource* object2 = static_cast(object); Release(object2); @@ -422,12 +405,6 @@ void ewol::resource::Release(ewol::Shader*& object) Release(object2); object = NULL; } -void ewol::resource::Release(ewol::DistantFieldFont*& object) -{ - ewol::Resource* object2 = static_cast(object); - Release(object2); - object = NULL; -} void ewol::resource::Release(ewol::Texture*& object) { ewol::Resource* object2 = static_cast(object); @@ -448,7 +425,7 @@ void ewol::resource::Release(ewol::MeshObj*& object) object = NULL; } -void ewol::resource::Release(ewol::SimpleConfigFile*& object) +void ewol::resource::Release(ewol::ConfigFile*& object) { ewol::Resource* object2 = static_cast(object); Release(object2); diff --git a/sources/ewol/renderer/ResourceManager.h b/sources/ewol/renderer/ResourceManager.h index de618dc8..2f7c2d9e 100644 --- a/sources/ewol/renderer/ResourceManager.h +++ b/sources/ewol/renderer/ResourceManager.h @@ -9,19 +9,17 @@ #ifndef __RESOURCES_MANAGER_H__ #define __RESOURCES_MANAGER_H__ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace ewol { @@ -40,27 +38,25 @@ namespace ewol // return the type of the resource ... bool Keep(etk::UString& filename, ewol::TexturedFont*& object); - bool Keep(etk::UString& filename, ewol::Font*& object); + bool Keep(etk::UString& filename, ewol::FontBase*& object); bool Keep(etk::UString& filename, ewol::Program*& object); bool Keep(etk::UString& filename, ewol::Shader*& object); - bool Keep(etk::UString& filename, ewol::DistantFieldFont*& object); bool Keep(ewol::Texture*& object); // no name needed here ... bool Keep(etk::UString& filename, ewol::TextureFile*& object, etk::Vector2D size); bool Keep(etk::UString& accesMode, ewol::VirtualBufferObject*& object); bool Keep(etk::UString& filename, ewol::MeshObj*& object); - bool Keep(etk::UString& filename, ewol::SimpleConfigFile*& object); + bool Keep(etk::UString& filename, ewol::ConfigFile*& object); void Release(ewol::Resource*& object); void Release(ewol::TexturedFont*& object); - void Release(ewol::Font*& object); + void Release(ewol::FontBase*& object); void Release(ewol::Program*& object); void Release(ewol::Shader*& object); - void Release(ewol::DistantFieldFont*& object); void Release(ewol::Texture*& object); void Release(ewol::TextureFile*& object); void Release(ewol::VirtualBufferObject*& object); void Release(ewol::MeshObj*& object); - void Release(ewol::SimpleConfigFile*& object); + void Release(ewol::ConfigFile*& object); } }; diff --git a/sources/ewol/renderer/openGL/openGL.cpp b/sources/ewol/renderer/openGL.cpp similarity index 96% rename from sources/ewol/renderer/openGL/openGL.cpp rename to sources/ewol/renderer/openGL.cpp index 00446c5c..c04f5eb6 100644 --- a/sources/ewol/renderer/openGL/openGL.cpp +++ b/sources/ewol/renderer/openGL.cpp @@ -6,9 +6,9 @@ * @license BSD v3 (see license file) */ -#include -#include #include +#include +#include etk::Vector l_matrixList; diff --git a/sources/ewol/renderer/openGL/openGL.h b/sources/ewol/renderer/openGL.h similarity index 99% rename from sources/ewol/renderer/openGL/openGL.h rename to sources/ewol/renderer/openGL.h index 826f3361..9ffe51a0 100644 --- a/sources/ewol/renderer/openGL/openGL.h +++ b/sources/ewol/renderer/openGL.h @@ -9,6 +9,7 @@ #ifndef __OPEN_GL_H__ #define __OPEN_GL_H__ +#include #include #ifdef __cplusplus diff --git a/sources/ewol/renderer/os/eSystem.cpp b/sources/ewol/renderer/os/eSystem.cpp index d9d11b6d..3ec1eaf1 100644 --- a/sources/ewol/renderer/os/eSystem.cpp +++ b/sources/ewol/renderer/os/eSystem.cpp @@ -7,25 +7,30 @@ */ -#include -#include -#include +#include #include -#include -#include -#include + +#include +#include + +#include + #include #include -#include -#include -#include -#include -#include -#include -static ewol::Windows* windowsCurrent = NULL; +#include +#include +#include +#include +#include +#include + +#include + + +static ewol::Windows* windowsCurrent = NULL; static etk::Vector2D windowsSize(320, 480); -static ewol::eSystemInput l_managementInput; +static ewol::eSystemInput l_managementInput; @@ -58,8 +63,9 @@ typedef struct { int w; int h; } eventResize_ts; + typedef struct { - ewol::inputType_te type; + ewol::keyEvent::type_te type; int pointerID; bool state; float x; @@ -81,7 +87,7 @@ typedef struct { static etk::MessageFifo l_msgSystem; -extern ewol::specialKey_ts specialCurrentKey; +extern ewol::SpecialKey specialCurrentKey; static bool requestEndProcessing = false; @@ -131,26 +137,27 @@ void ewolProcessEvents(void) //EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); { specialCurrentKey = data.keyboardKey.special; - // check main shortcut - if (false==ewol::shortCut::Process(data.keyboardKey.special, - data.keyboardKey.myChar, - ewol::EVENT_KB_MOVE_TYPE_NONE, - data.keyboardKey.isDown)) { - // Get the current Focused Widget : - ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet(); - if (NULL != tmpWidget) { - // check Widget shortcut - if (false==tmpWidget->OnEventShortCut(data.keyboardKey.special, - data.keyboardKey.myChar, - ewol::EVENT_KB_MOVE_TYPE_NONE, - data.keyboardKey.isDown)) { - // generate the direct event ... - if(true == data.keyboardKey.isDown) { - EWOL_VERBOSE("GUI PRESSED : \"" << data.keyboardKey.myChar << "\""); - tmpWidget->OnEventKb(ewol::EVENT_KB_TYPE_DOWN, data.keyboardKey.myChar); - } else { - EWOL_VERBOSE("GUI Release : \"" << data.keyboardKey.myChar << "\""); - tmpWidget->OnEventKb(ewol::EVENT_KB_TYPE_UP, data.keyboardKey.myChar); + if (NULL != windowsCurrent) { + if (false==windowsCurrent->OnEventShortCut(data.keyboardKey.special, + data.keyboardKey.myChar, + ewol::keyEvent::keyboardUnknow, + data.keyboardKey.isDown)) { + // Get the current Focused Widget : + ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet(); + if (NULL != tmpWidget) { + // check Widget shortcut + if (false==tmpWidget->OnEventShortCut(data.keyboardKey.special, + data.keyboardKey.myChar, + ewol::keyEvent::keyboardUnknow, + data.keyboardKey.isDown)) { + // generate the direct event ... + if(true == data.keyboardKey.isDown) { + EWOL_VERBOSE("GUI PRESSED : \"" << data.keyboardKey.myChar << "\""); + tmpWidget->OnEventKb(ewol::keyEvent::statusDown, data.keyboardKey.myChar); + } else { + EWOL_VERBOSE("GUI Release : \"" << data.keyboardKey.myChar << "\""); + tmpWidget->OnEventKb(ewol::keyEvent::statusUp, data.keyboardKey.myChar); + } } } } @@ -160,24 +167,26 @@ void ewolProcessEvents(void) case THREAD_KEYBORAD_MOVE: //EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_MOVE"); // check main shortcut - if (false==ewol::shortCut::Process(data.keyboardKey.special, - 0, - data.keyboardMove.move, - data.keyboardKey.isDown)) { - specialCurrentKey = data.keyboardMove.special; - // Get the current Focused Widget : - ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet(); - if (NULL != tmpWidget) { - // check Widget shortcut - if (false==tmpWidget->OnEventShortCut(data.keyboardKey.special, - data.keyboardKey.myChar, - ewol::EVENT_KB_MOVE_TYPE_NONE, - data.keyboardKey.isDown)) { - // generate the direct event ... - if(true == data.keyboardMove.isDown) { - tmpWidget->OnEventKbMove(ewol::EVENT_KB_TYPE_DOWN, data.keyboardMove.move); - } else { - tmpWidget->OnEventKbMove(ewol::EVENT_KB_TYPE_UP, data.keyboardMove.move); + if (NULL != windowsCurrent) { + if (false==windowsCurrent->OnEventShortCut(data.keyboardKey.special, + data.keyboardKey.myChar, + ewol::keyEvent::keyboardUnknow, + data.keyboardKey.isDown)) { + specialCurrentKey = data.keyboardMove.special; + // Get the current Focused Widget : + ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet(); + if (NULL != tmpWidget) { + // check Widget shortcut + if (false==tmpWidget->OnEventShortCut(data.keyboardKey.special, + data.keyboardKey.myChar, + ewol::keyEvent::keyboardUnknow, + data.keyboardKey.isDown)) { + // generate the direct event ... + if(true == data.keyboardMove.isDown) { + tmpWidget->OnEventKbMove(ewol::keyEvent::statusDown, data.keyboardMove.move); + } else { + tmpWidget->OnEventKbMove(ewol::keyEvent::statusUp, data.keyboardMove.move); + } } } } @@ -266,8 +275,7 @@ void eSystem::Init(void) l_managementInput.Reset(); ewol::resource::Init(); ewol::widgetManager::Init(); - ewol::font::Init(); - ewol::shortCut::Init(); + ewol::config::Init(); isGlobalSystemInit = true; // request the init of the application in the main context of openGL ... RequestInit(); @@ -291,12 +299,11 @@ void eSystem::UnInit(void) isGlobalSystemInit = false; requestEndProcessing = true; // unset all windows - ewol::DisplayWindows(NULL); + ewol::WindowsSet(NULL); // call application to uninit APP_UnInit(); - ewol::shortCut::UnInit(); ewol::widgetManager::UnInit(); - ewol::font::UnInit(); + ewol::config::UnInit(); ewol::EObjectMessageMultiCast::UnInit(); ewol::EObjectManager::UnInit(); ewol::resource::UnInit(); @@ -345,7 +352,7 @@ void eSystem::SetInputMotion(int pointerID, float x, float y ) if (true == isGlobalSystemInit) { eSystemMessage_ts data; data.TypeMessage = THREAD_INPUT_MOTION; - data.input.type = ewol::INPUT_TYPE_FINGER; + data.input.type = ewol::keyEvent::typeFinger; data.input.pointerID = pointerID; data.input.x = x; data.input.y = y; @@ -359,7 +366,7 @@ void eSystem::SetInputState(int pointerID, bool isUp, float x, float y ) if (true == isGlobalSystemInit) { eSystemMessage_ts data; data.TypeMessage = THREAD_INPUT_STATE; - data.input.type = ewol::INPUT_TYPE_FINGER; + data.input.type = ewol::keyEvent::typeFinger; data.input.pointerID = pointerID; data.input.state = isUp; data.input.x = x; @@ -374,7 +381,7 @@ void eSystem::SetMouseMotion(int pointerID, float x, float y ) if (true == isGlobalSystemInit) { eSystemMessage_ts data; data.TypeMessage = THREAD_INPUT_MOTION; - data.input.type = ewol::INPUT_TYPE_MOUSE; + data.input.type = ewol::keyEvent::typeMouse; data.input.pointerID = pointerID; data.input.x = x; data.input.y = y; @@ -388,7 +395,7 @@ void eSystem::SetMouseState(int pointerID, bool isUp, float x, float y ) if (true == isGlobalSystemInit) { eSystemMessage_ts data; data.TypeMessage = THREAD_INPUT_STATE; - data.input.type = ewol::INPUT_TYPE_MOUSE; + data.input.type = ewol::keyEvent::typeMouse; data.input.pointerID = pointerID; data.input.state = isUp; data.input.x = x; diff --git a/sources/ewol/renderer/os/eSystem.h b/sources/ewol/renderer/os/eSystem.h index 8853c6ca..46394cea 100644 --- a/sources/ewol/renderer/os/eSystem.h +++ b/sources/ewol/renderer/os/eSystem.h @@ -9,7 +9,10 @@ #ifndef __EWOL_SYSTEM_H__ #define __EWOL_SYSTEM_H__ -#include +#include +#include +#include +#include namespace eSystem { @@ -30,15 +33,15 @@ namespace eSystem void SetMouseState(int pointerID, bool isUp, float x, float y); typedef struct { - bool isDown; - uniChar_t myChar; - ewol::specialKey_ts special; + bool isDown; + uniChar_t myChar; + ewol::SpecialKey special; } keyboardKey_ts; typedef struct { - bool isDown; - ewol::eventKbMoveType_te move; - ewol::specialKey_ts special; + bool isDown; + ewol::keyEvent::keyboard_te move; + ewol::SpecialKey special; } keyboardMove_ts; void SetKeyboard(eSystem::keyboardKey_ts& keyInput); diff --git a/sources/ewol/renderer/os/eSystemInput.cpp b/sources/ewol/renderer/os/eSystemInput.cpp index c9712e06..74789e14 100644 --- a/sources/ewol/renderer/os/eSystemInput.cpp +++ b/sources/ewol/renderer/os/eSystemInput.cpp @@ -6,23 +6,25 @@ * @license BSD v3 (see license file) */ -#include -#include -#include -#include -#include -#include - -#include +#include #include + +#include + +#include + #include #include + +#include +#include +#include +#include + +#include +#include #include -#include -#include -#include -#include -#include + #define EVENT_DEBUG EWOL_VERBOSE @@ -63,10 +65,14 @@ void ewol::eSystemInput::CleanElement(InputPoperty_ts *eventTable, int32_t idInp } -bool ewol::eSystemInput::localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D pos) +bool ewol::eSystemInput::localEventInput(ewol::keyEvent::type_te type, + ewol::Widget* destWidget, + int32_t IdInput, + ewol::keyEvent::status_te typeEvent, + etk::Vector2D pos) { if (NULL != destWidget) { - if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) { + if (type == ewol::keyEvent::typeMouse || type == ewol::keyEvent::typeFinger) { return destWidget->OnEventInput(type, IdInput, typeEvent, pos); } else { return false; @@ -87,22 +93,22 @@ void ewol::eSystemInput::TransfertEvent(ewol::Widget* source, ewol::Widget* dest if (m_eventInputSaved[iii].curentWidgetEvent == source) { // inform the widget that it does not receive the event now EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent); - localEventInput(ewol::INPUT_TYPE_FINGER, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::EVENT_INPUT_TYPE_ABORT, m_eventInputSaved[iii].posEvent); + localEventInput(ewol::keyEvent::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::keyEvent::statusAbort, m_eventInputSaved[iii].posEvent); // set the new widget ... m_eventInputSaved[iii].curentWidgetEvent = destination; // inform the widget that he receive the event property now... EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventInputSaved[iii].posEvent); - localEventInput(ewol::INPUT_TYPE_FINGER, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::EVENT_INPUT_TYPE_TRANSFERT, m_eventInputSaved[iii].posEvent); + localEventInput(ewol::keyEvent::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::keyEvent::statusTransfert, m_eventInputSaved[iii].posEvent); } if (m_eventMouseSaved[iii].curentWidgetEvent == source) { // inform the widget that it does not receive the event now EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventMouseSaved[iii].posEvent); - localEventInput(ewol::INPUT_TYPE_MOUSE, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::EVENT_INPUT_TYPE_ABORT, m_eventMouseSaved[iii].posEvent); + localEventInput(ewol::keyEvent::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::keyEvent::statusAbort, m_eventMouseSaved[iii].posEvent); // set the new widget ... m_eventMouseSaved[iii].curentWidgetEvent = destination; // inform the widget that he receive the event property now... EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventMouseSaved[iii].posEvent); - localEventInput(ewol::INPUT_TYPE_MOUSE, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::EVENT_INPUT_TYPE_TRANSFERT, m_eventMouseSaved[iii].posEvent); + localEventInput(ewol::keyEvent::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::keyEvent::statusTransfert, m_eventMouseSaved[iii].posEvent); } } } @@ -153,9 +159,9 @@ ewol::eSystemInput::~eSystemInput(void) } -int32_t ewol::eSystemInput::localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId) +int32_t ewol::eSystemInput::localGetDestinationId(ewol::keyEvent::type_te type, ewol::Widget* destWidget, int32_t realInputId) { - if (type == ewol::INPUT_TYPE_FINGER) { + if (type == ewol::keyEvent::typeFinger) { int32_t lastMinimum = 0; for(int32_t iii=0; iii the it was finger event ... -void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vector2D pos) +void ewol::eSystemInput::Motion(ewol::keyEvent::type_te type, int pointerID, etk::Vector2D pos) { // convert position in Open-GL coordonates ... - pos.y = ewol::GetCurrentHeight() - pos.y; + pos.y = pos.y; InputPoperty_ts *eventTable = NULL; - if (type == ewol::INPUT_TYPE_MOUSE) { + if (type == ewol::keyEvent::typeMouse) { eventTable = m_eventMouseSaved; - } else if (type == ewol::INPUT_TYPE_FINGER) { + } else if (type == ewol::keyEvent::typeFinger) { eventTable = m_eventInputSaved; } else { EWOL_ERROR("Unknown type of event"); @@ -193,7 +199,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec } ewol::Windows* tmpWindows = eSystem::GetCurrentWindows(); // special case for the mouse event 0 that represent the hover event of the system : - if (type == ewol::INPUT_TYPE_MOUSE && pointerID == 0) { + if (type == ewol::keyEvent::typeMouse && pointerID == 0) { // this event is all time on the good widget ... and manage the enter and leave ... // NOTE : the "layer widget" force us to get the widget at the specific position all the time : ewol::Widget* tmpWidget = NULL; @@ -209,7 +215,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec eventTable[pointerID].isInside = false; EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos); } if (false == eventTable[pointerID].isInside) { // Set the element inside ... @@ -230,11 +236,11 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec eventTable[pointerID].destinationInputId = 0; EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, pos); } EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos); } else if (true == eventTable[pointerID].isUsed) { if (true == eventTable[pointerID].isInside) { if( eventTable[pointerID].origin.x > pos.x @@ -244,7 +250,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec eventTable[pointerID].isInside = false; EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos); } } else { if( ( eventTable[pointerID].origin.x <= pos.x @@ -254,25 +260,24 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec eventTable[pointerID].isInside = true; EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, pos); } } EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos); } } -void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDown, etk::Vector2D pos) +void ewol::eSystemInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDown, etk::Vector2D pos) { // convert position in Open-GL coordonates ... - pos.y = ewol::GetCurrentHeight() - pos.y; InputPoperty_ts *eventTable = NULL; inputLimit_ts localLimit; - if (type == ewol::INPUT_TYPE_MOUSE) { + if (type == ewol::keyEvent::typeMouse) { eventTable = m_eventMouseSaved; localLimit = m_eventMouseLimit; - } else if (type == ewol::INPUT_TYPE_FINGER) { + } else if (type == ewol::keyEvent::typeFinger) { eventTable = m_eventInputSaved; localLimit = m_eventInputLimit; } else { @@ -305,7 +310,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo // generate DOWN Event EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos); } else { // Mark it used : eventTable[pointerID].isUsed = true; @@ -331,7 +336,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo // generate DOWN Event EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos); } } else { EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos); @@ -346,7 +351,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo // generate UP Event EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos); eventTable[pointerID].posEvent = pos; - localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_UP, pos); + localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::keyEvent::statusUp, pos); // generate event (single) if( abs(eventTable[pointerID].downStart.x - pos.x) < localLimit.DpiOffset && abs(eventTable[pointerID].downStart.y - pos.y) < localLimit.DpiOffset ){ @@ -369,7 +374,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, - (ewol::eventInputType_te)(ewol::EVENT_INPUT_TYPE_SINGLE + eventTable[pointerID].nbClickEvent-1), + (ewol::keyEvent::status_te)(ewol::keyEvent::statusSingle + eventTable[pointerID].nbClickEvent-1), pos); if( eventTable[pointerID].nbClickEvent >= nbClickMax) { eventTable[pointerID].nbClickEvent = 0; @@ -379,7 +384,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo } } // specific for tuch event - if (type == ewol::INPUT_TYPE_FINGER) { + if (type == ewol::keyEvent::typeFinger) { CleanElement(eventTable, pointerID); } } diff --git a/sources/ewol/renderer/os/eSystemInput.h b/sources/ewol/renderer/os/eSystemInput.h index 13086175..1757e438 100644 --- a/sources/ewol/renderer/os/eSystemInput.h +++ b/sources/ewol/renderer/os/eSystemInput.h @@ -16,17 +16,17 @@ namespace ewol // internal structure typedef struct { - bool isUsed; - int32_t destinationInputId; - int64_t lastTimeEvent; - ewol::Widget* curentWidgetEvent; + bool isUsed; + int32_t destinationInputId; + int64_t lastTimeEvent; + ewol::Widget* curentWidgetEvent; etk::Vector2D origin; etk::Vector2D size; etk::Vector2D downStart; etk::Vector2D posEvent; - bool isDown; - bool isInside; - int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3 + bool isDown; + bool isInside; + int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3 } InputPoperty_ts; typedef struct { @@ -46,23 +46,30 @@ namespace ewol InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT]; void CleanElement(InputPoperty_ts *eventTable, int32_t idInput); /** - * @brief generate the event on the destinated widger - * @param[in] type Type of the event that might be sended + * @brief generate the event on the destinated widget. + * @param[in] type Type of the event that might be sended. * @param[in] destWidget Pointer on the requested widget that element might be sended * @param[in] IdInput Id of the event (PC : [0..9] and touch : [1..9]) * @param[in] typeEvent type of the eventg generated * @param[in] pos position of the event * @return true if event has been greped */ - bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D pos); + bool localEventInput(ewol::keyEvent::type_te type, + ewol::Widget* destWidget, + int32_t IdInput, + ewol::keyEvent::status_te typeEvent, + etk::Vector2D pos); /** * @brief Convert the system event id in the correct EWOL id depending of the system management mode - * This function find the next input id unused on the specifiic widget ==> on PC, the ID does not change (IHM is not the same + * This function find the next input id unused on the specifiic widget + * ==> on PC, the ID does not change (GUI is not the same) * @param[in] destWidget Pointer of the widget destination * @param[in] realInputId System Id * @return the ewol input id */ - int32_t localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId); + int32_t localGetDestinationId(ewol::keyEvent::type_te type, + ewol::Widget* destWidget, + int32_t realInputId); public: eSystemInput(void); ~eSystemInput(void); @@ -70,8 +77,8 @@ namespace ewol void SetDpi(int32_t newDPI); // note if id<0 ==> the it was finger event ... - void Motion(ewol::inputType_te type, int pointerID, etk::Vector2D pos ); - void State(ewol::inputType_te type, int pointerID, bool isDown, etk::Vector2D pos); + void Motion(ewol::keyEvent::type_te type, int pointerID, etk::Vector2D pos ); + void State(ewol::keyEvent::type_te type, int pointerID, bool isDown, etk::Vector2D pos); /** * @brief Inform object that an other object is removed ... diff --git a/sources/ewol/renderer/os/gui.Android.base.cpp b/sources/ewol/renderer/os/gui.Android.base.cpp index ce4e0f2e..2fe9fb34 100644 --- a/sources/ewol/renderer/os/gui.Android.base.cpp +++ b/sources/ewol/renderer/os/gui.Android.base.cpp @@ -27,6 +27,7 @@ static jmethodID javaClassActivityEntryPoint__CPP_OrientationChange = 0; // generic classes static jclass javaDefaultClassString = 0; // default string class +static int32_t m_currentHeight = 0; static JavaVM* g_JavaVM = NULL; @@ -369,22 +370,22 @@ extern "C" * ********************************************************************************************** */ void Java_org_ewol_interfaceJNI_IOInputEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y ) { - eSystem::SetInputMotion(pointerID+1, x, y); + eSystem::SetInputMotion(pointerID+1, x, m_currentHeight-y); } void Java_org_ewol_interfaceJNI_IOInputEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y ) { - eSystem::SetInputState(pointerID+1, isUp, x, y); + eSystem::SetInputState(pointerID+1, isUp, x, m_currentHeight-y); } void Java_org_ewol_interfaceJNI_IOMouseEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y ) { - eSystem::SetMouseMotion(pointerID+1, x, y); + eSystem::SetMouseMotion(pointerID+1, x, m_currentHeight-y); } void Java_org_ewol_interfaceJNI_IOMouseEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y ) { - eSystem::SetMouseState(pointerID+1, isUp, x, y); + eSystem::SetMouseState(pointerID+1, isUp, x, m_currentHeight-y); } void Java_org_ewol_interfaceJNI_IOUnknowEvent( JNIEnv* env, jobject thiz, jint pointerID) @@ -454,6 +455,7 @@ extern "C" void Java_org_ewol_interfaceJNI_RenderResize( JNIEnv* env, jobject thiz, jint w, jint h ) { + m_currentHeight = h; eSystem::Resize(w, h); } diff --git a/sources/ewol/renderer/os/gui.Windows.cpp b/sources/ewol/renderer/os/gui.Windows.cpp index 3062cf51..a5b00e86 100644 --- a/sources/ewol/renderer/os/gui.Windows.cpp +++ b/sources/ewol/renderer/os/gui.Windows.cpp @@ -23,6 +23,9 @@ #include +int32_t m_currentHeight = 0; + + int64_t guiInterface::GetTime(void) { struct timeval now; @@ -33,7 +36,7 @@ int64_t guiInterface::GetTime(void) bool inputIsPressed[20]; -static ewol::specialKey_ts guiKeyBoardMode; +static ewol::SpecialKey guiKeyBoardMode; void guiInterface::SetTitle(etk::UString& title) { @@ -72,7 +75,7 @@ void guiInterface::ChangeSize(etk::Vector2D size) int title_size = GetSystemMetrics(SM_CYCAPTION); size.x += border_thickness*2; size.y += border_thickness*2 + title_size; - + //m_currentHeight = size.y; // TODO : Later } @@ -247,7 +250,8 @@ int Windows_Run(void) NULL, NULL, hInstance, NULL ); int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int title_size = GetSystemMetrics(SM_CYCAPTION); - eSystem::Resize(800-2*border_thickness, 600-2*border_thickness -title_size); + m_currentHeight = 600-2*border_thickness -title_size; + eSystem::Resize(800-2*border_thickness, m_currentHeight); // enable OpenGL for the window EnableOpenGL( hWnd, &hDC, &hRC ); @@ -329,7 +333,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) // in windows system, we need to remove the size of the border elements : int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int title_size = GetSystemMetrics(SM_CYCAPTION); - eSystem::Resize(tmpVal->cx-2*border_thickness, tmpVal->cy - 2*border_thickness - title_size); + m_currentHeight = tmpVal->cy - 2*border_thickness - title_size; + eSystem::Resize(tmpVal->cx-2*border_thickness, m_currentHeight); } } return 0; @@ -463,7 +468,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_LBUTTONDOWN: mouseButtonId = 1; pos.x = GET_X_LPARAM(lParam); - pos.y = GET_Y_LPARAM(lParam); + pos.y = m_currentHeight-GET_Y_LPARAM(lParam); inputIsPressed[mouseButtonId] = buttonIsDown; eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); return 0; @@ -473,7 +478,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MBUTTONDOWN: mouseButtonId = 2; pos.x = GET_X_LPARAM(lParam); - pos.y = GET_Y_LPARAM(lParam); + pos.y = m_currentHeight-GET_Y_LPARAM(lParam); inputIsPressed[mouseButtonId] = buttonIsDown; eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); return 0; @@ -483,7 +488,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_RBUTTONDOWN: mouseButtonId = 3; pos.x = GET_X_LPARAM(lParam); - pos.y = GET_Y_LPARAM(lParam); + pos.y = m_currentHeight-GET_Y_LPARAM(lParam); inputIsPressed[mouseButtonId] = buttonIsDown; eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); return 0; @@ -497,7 +502,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) mouseButtonId = 5; } pos.x = GET_X_LPARAM(lParam); - pos.y = GET_Y_LPARAM(lParam); + pos.y = m_currentHeight-GET_Y_LPARAM(lParam); eSystem::SetMouseState(mouseButtonId, true, (float)pos.x, (float)pos.y); eSystem::SetMouseState(mouseButtonId, false, (float)pos.x, (float)pos.y); return 0; @@ -505,7 +510,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MOUSEHOVER: case WM_MOUSEMOVE: pos.x = GET_X_LPARAM(lParam); - pos.y = GET_Y_LPARAM(lParam); + pos.y = m_currentHeight-GET_Y_LPARAM(lParam); for (int32_t iii=0; iiiGenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (float)event.xcrossing.x, (float)event.xcrossing.y); break; @@ -714,7 +719,7 @@ void X11_Run(void) EWOL_INFO("X11 event LeaveNotify"); #endif m_cursorEventX = event.xcrossing.x; - m_cursorEventY = event.xcrossing.y; + m_cursorEventY = (m_currentHeight-event.xcrossing.y); //EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (float)event.xcrossing.x << "," << (float)event.xcrossing.y << ")"); break; case MotionNotify: @@ -722,20 +727,20 @@ void X11_Run(void) EWOL_INFO("X11 event MotionNotify"); #endif m_cursorEventX = event.xmotion.x; - m_cursorEventY = event.xmotion.y; + m_cursorEventY = (m_currentHeight-event.xmotion.y); { // For compatibility of the Android system : bool findOne = false; for (int32_t iii=0; iii size) #ifdef DEBUG_X11_EVENT EWOL_INFO("X11: ChangeSize"); #endif + m_currentHeight = size.y; XResizeWindow(m_display, WindowHandle, size.x, size.y); } @@ -1103,7 +1109,7 @@ void guiInterface::GetAbsPos(etk::Vector2D& pos) * @param std IO * @return std IO */ -int main(int argc, char *argv[]) +int guiInterface::main(int argc, const char *argv[]) { ewol::CmdLine::Clean(); for( int32_t i=1 ; i +#include #include #include #include -#include +#include #include namespace guiInterface { + int main(int argc, const char *argv[]); /** * @brief Get the curent time in micro-second * @param --- diff --git a/sources/ewol/renderer/resources/Config.h b/sources/ewol/renderer/resources/Config.h deleted file mode 100644 index 34eb7e35..00000000 --- a/sources/ewol/renderer/resources/Config.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __SIMPLE_CONFIG_FILE_H__ -#define __SIMPLE_CONFIG_FILE_H__ - #include - #include - #include - - namespace ewol - { - class SimpleConfigElement - { - public: - etk::UString m_paramName; - private: - etk::UString m_value; - int32_t m_valueInt; - float m_valuefloat; - public: - SimpleConfigElement(etk::UString name) : - m_paramName(name), - m_value(""), - m_valueInt(0), - m_valuefloat(0.0) { }; - ~SimpleConfigElement(void) { }; - void Parse(etk::UString value); - int32_t GetInteger(void) { return m_valueInt; }; - float GetFloat(void) { return m_valuefloat; }; - etk::UString& GetString(void) { return m_value; }; - }; - - class SimpleConfigFile : public ewol::Resource - { - private: - etk::Vector m_list; - public: - SimpleConfigFile(etk::UString& filename); - virtual ~SimpleConfigFile(void); - const char* GetType(void) { return "ewol::SimpleConfigFile"; }; - void Reload(void); - - int32_t Request(etk::UString paramName); - - int32_t GetInteger(int32_t id) { return m_list[id]->GetInteger(); }; - float GetFloat(int32_t id) { return m_list[id]->GetFloat(); }; - etk::UString& GetString(int32_t id) { return m_list[id]->GetString(); }; - }; - }; -#endif - diff --git a/sources/ewol/renderer/resources/Config.cpp b/sources/ewol/renderer/resources/ConfigFile.cpp similarity index 91% rename from sources/ewol/renderer/resources/Config.cpp rename to sources/ewol/renderer/resources/ConfigFile.cpp index 79975cbf..3b179feb 100644 --- a/sources/ewol/renderer/resources/Config.cpp +++ b/sources/ewol/renderer/resources/ConfigFile.cpp @@ -6,10 +6,9 @@ * @license BSD v3 (see license file) */ -#include #include -#include -#include +#include +#include void ewol::SimpleConfigElement::Parse(etk::UString value) @@ -23,7 +22,7 @@ void ewol::SimpleConfigElement::Parse(etk::UString value) -ewol::SimpleConfigFile::SimpleConfigFile(etk::UString& filename): +ewol::ConfigFile::ConfigFile(etk::UString& filename): ewol::Resource(filename) { EWOL_DEBUG("SFP : load \"" << filename << "\""); @@ -31,7 +30,7 @@ ewol::SimpleConfigFile::SimpleConfigFile(etk::UString& filename): } -ewol::SimpleConfigFile::~SimpleConfigFile(void) +ewol::ConfigFile::~ConfigFile(void) { // remove all element for (int32_t iii=0; iii +#include +#include + +namespace ewol +{ + class SimpleConfigElement + { + public: + etk::UString m_paramName; + private: + etk::UString m_value; + int32_t m_valueInt; + float m_valuefloat; + public: + SimpleConfigElement(etk::UString name) : + m_paramName(name), + m_value(""), + m_valueInt(0), + m_valuefloat(0.0) { }; + ~SimpleConfigElement(void) { }; + void Parse(etk::UString value); + int32_t GetInteger(void) { return m_valueInt; }; + float GetFloat(void) { return m_valuefloat; }; + etk::UString& GetString(void) { return m_value; }; + }; + + class ConfigFile : public ewol::Resource + { + private: + etk::Vector m_list; + public: + ConfigFile(etk::UString& filename); + virtual ~ConfigFile(void); + const char* GetType(void) { return "ewol::SimpleConfigFile"; }; + void Reload(void); + + int32_t Request(etk::UString paramName); + + int32_t GetInteger(int32_t id) { return m_list[id]->GetInteger(); }; + float GetFloat(int32_t id) { return m_list[id]->GetFloat(); }; + etk::UString& GetString(int32_t id) { return m_list[id]->GetString(); }; + }; +}; + +#endif + diff --git a/sources/ewol/renderer/resources/FontFreeType.cpp b/sources/ewol/renderer/resources/FontFreeType.cpp index 7277ec55..599883aa 100644 --- a/sources/ewol/renderer/resources/FontFreeType.cpp +++ b/sources/ewol/renderer/resources/FontFreeType.cpp @@ -6,18 +6,17 @@ * @license BSD v3 (see license file) */ -#include -#include #include #include -#include #include -#include -extern "C" { - #include -} -#include FT_FREETYPE_H + +#include + +#include +#include +#include + #undef __class__ #define __class__ "ewol::FontFreeType" @@ -49,7 +48,7 @@ void ewol::FreeTypeUnInit(void) ewol::FontFreeType::FontFreeType(etk::UString fontName) : - Font(fontName) + FontBase(fontName) { m_init = false; m_FileBuffer = NULL; diff --git a/sources/ewol/renderer/resources/FontFreeType.h b/sources/ewol/renderer/resources/FontFreeType.h index 39f811f5..bea3fb94 100644 --- a/sources/ewol/renderer/resources/FontFreeType.h +++ b/sources/ewol/renderer/resources/FontFreeType.h @@ -9,7 +9,8 @@ #ifndef __EWOL_FONT_FREE_TYPE_H__ #define __EWOL_FONT_FREE_TYPE_H__ -#include +#include +#include extern "C" { #include @@ -19,7 +20,7 @@ extern "C" { namespace ewol { // show : http://www.freetype.org/freetype2/docs/tutorial/step2.html - class FontFreeType : public ewol::Font + class FontFreeType : public ewol::FontBase { private: FT_Byte * m_FileBuffer; diff --git a/sources/ewol/renderer/resources/Image.cpp b/sources/ewol/renderer/resources/Image.cpp index c3084aeb..d6ac4668 100644 --- a/sources/ewol/renderer/resources/Image.cpp +++ b/sources/ewol/renderer/resources/Image.cpp @@ -6,15 +6,19 @@ * @license BSD v3 (see license file) */ -#include -#include -#include +#include #include -#include #include -#include + +#include +#include +#include + + +#include +#include ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, etk::Vector2D size) : diff --git a/sources/ewol/renderer/resources/Image.h b/sources/ewol/renderer/resources/Image.h index 627a71d8..d609d7dc 100644 --- a/sources/ewol/renderer/resources/Image.h +++ b/sources/ewol/renderer/resources/Image.h @@ -9,10 +9,11 @@ #ifndef __EWOL_TEXTURE_FILE_H__ #define __EWOL_TEXTURE_FILE_H__ +#include #include #include -#include -#include +#include +#include namespace ewol { diff --git a/sources/ewol/renderer/resources/Mesh.cpp b/sources/ewol/renderer/resources/Mesh.cpp index 565227d4..557020c6 100644 --- a/sources/ewol/renderer/resources/Mesh.cpp +++ b/sources/ewol/renderer/resources/Mesh.cpp @@ -6,9 +6,9 @@ * @license BSD v3 (see license file) */ -#include -#include -#include +#include +#include +#include ewol::Mesh::Mesh(etk::UString genName) : @@ -61,11 +61,11 @@ void ewol::Mesh::Draw(void) m_GLprogram->Use(); // set Matrix : translation/positionMatrix etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix(); - tmpMatrix = etk::matrix::Scale(100,100,100) - * etk::matrix::rotate(1,0,0,rotx) - * etk::matrix::rotate(0,1,0,roty)/* - * etk::matrix::Translate(0.01,0,0) - * etk::matrix::rotate(0,0,1,rotz)*/ + tmpMatrix = etk::Matrix4::Scale(etk::Vector3D(100,100,100) ) + * etk::Matrix4::Rotate(etk::Vector3D(1,0,0), rotx) + * etk::Matrix4::Rotate(etk::Vector3D(0,1,0), roty)/* + * etk::Matrix4::Translate(etk::Vector3D(0.01,0.0,0.0)) + * etk::Matrix4::Rotate(etk::Vector3D(0,0,1), rotz)*/ * tmpMatrix; m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); // TextureID diff --git a/sources/ewol/renderer/resources/Mesh.h b/sources/ewol/renderer/resources/Mesh.h index 447ff0d7..64a915ab 100644 --- a/sources/ewol/renderer/resources/Mesh.h +++ b/sources/ewol/renderer/resources/Mesh.h @@ -9,11 +9,11 @@ #ifndef __MESH_H__ #define __MESH_H__ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace ewol { diff --git a/sources/ewol/renderer/resources/MeshObj.cpp b/sources/ewol/renderer/resources/MeshObj.cpp index 68d716a0..40cf37a7 100644 --- a/sources/ewol/renderer/resources/MeshObj.cpp +++ b/sources/ewol/renderer/resources/MeshObj.cpp @@ -6,11 +6,13 @@ * @license BSD v3 (see license file) */ -#include +#include #include #include -#include -#include + +#include +#include +#include ewol::MeshObj::MeshObj(etk::UString _fileName) : diff --git a/sources/ewol/renderer/resources/MeshObj.h b/sources/ewol/renderer/resources/MeshObj.h index 3e9ee9ce..854edcdf 100644 --- a/sources/ewol/renderer/resources/MeshObj.h +++ b/sources/ewol/renderer/resources/MeshObj.h @@ -9,9 +9,9 @@ #ifndef __MESH_OBJ_H__ #define __MESH_OBJ_H__ -#include +#include #include -#include +#include namespace ewol { diff --git a/sources/ewol/renderer/resources/Program.cpp b/sources/ewol/renderer/resources/Program.cpp index 7bceb9d5..c7f5bbf4 100644 --- a/sources/ewol/renderer/resources/Program.cpp +++ b/sources/ewol/renderer/resources/Program.cpp @@ -6,10 +6,10 @@ * @license BSD v3 (see license file) */ -#include -#include -#include -#include +#include +#include +#include +#include #include //#define LOCAL_DEBUG EWOL_VERBOSE diff --git a/sources/ewol/renderer/resources/Program.h b/sources/ewol/renderer/resources/Program.h index 6958dbec..a9f5ffc3 100644 --- a/sources/ewol/renderer/resources/Program.h +++ b/sources/ewol/renderer/resources/Program.h @@ -8,11 +8,12 @@ #ifndef __OPEN_GL__PROGRAM_H__ #define __OPEN_GL__PROGRAM_H__ -#include -#include -#include -#include -#include + +#include +#include +#include +#include +#include namespace ewol { diff --git a/sources/ewol/renderer/resources/Resource.h b/sources/ewol/renderer/resources/Resource.h index 9b144fdf..dedc4565 100644 --- a/sources/ewol/renderer/resources/Resource.h +++ b/sources/ewol/renderer/resources/Resource.h @@ -6,13 +6,14 @@ * @license BSD v3 (see license file) */ -#include -#include -#include #ifndef __RESOURCES_H__ #define __RESOURCES_H__ +#include +#include +#include + #define MAX_RESOURCE_LEVEL (5) namespace ewol diff --git a/sources/ewol/renderer/resources/Shader.cpp b/sources/ewol/renderer/resources/Shader.cpp index 228e908b..ca6f934f 100644 --- a/sources/ewol/renderer/resources/Shader.cpp +++ b/sources/ewol/renderer/resources/Shader.cpp @@ -6,10 +6,10 @@ * @license BSD v3 (see license file) */ -#include +#include #include -#include -#include +#include +#include diff --git a/sources/ewol/renderer/resources/Shader.h b/sources/ewol/renderer/resources/Shader.h index 66e4b534..3d5c147d 100644 --- a/sources/ewol/renderer/resources/Shader.h +++ b/sources/ewol/renderer/resources/Shader.h @@ -8,10 +8,11 @@ #ifndef __OPEN_GL__SHADER_H__ #define __OPEN_GL__SHADER_H__ -#include -#include -#include -#include + +#include +#include +#include +#include namespace ewol { diff --git a/sources/ewol/renderer/resources/Texture.cpp b/sources/ewol/renderer/resources/Texture.cpp index 36a831ae..a9fed36b 100644 --- a/sources/ewol/renderer/resources/Texture.cpp +++ b/sources/ewol/renderer/resources/Texture.cpp @@ -6,10 +6,16 @@ * @license BSD v3 (see license file) */ -#include -#include +#include + #include +#include + +#include + +#include + /** * @brief get the next power 2 if the input diff --git a/sources/ewol/renderer/resources/Texture.h b/sources/ewol/renderer/resources/Texture.h index 1e8d284e..11e34296 100644 --- a/sources/ewol/renderer/resources/Texture.h +++ b/sources/ewol/renderer/resources/Texture.h @@ -9,11 +9,11 @@ #ifndef __EWOL_TEXTURE_H__ #define __EWOL_TEXTURE_H__ -#include -#include +#include +#include #include -#include -#include +#include +#include namespace ewol { class Texture : public ewol::Resource { diff --git a/sources/ewol/renderer/resources/Font.cpp b/sources/ewol/renderer/resources/TexturedFont.cpp similarity index 53% rename from sources/ewol/renderer/resources/Font.cpp rename to sources/ewol/renderer/resources/TexturedFont.cpp index 5619945d..df5ec7d5 100644 --- a/sources/ewol/renderer/resources/Font.cpp +++ b/sources/ewol/renderer/resources/TexturedFont.cpp @@ -6,12 +6,15 @@ * @license BSD v3 (see license file) */ -#include -#include -#include -#include +#include #include -#include + +#include + +#include + +#include +#include static int32_t nextP2(int32_t value) @@ -226,10 +229,10 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) : // draw the glyph m_font[iiiFontId]->DrawGlyph(m_data, m_size, glyphPosition, (m_listElement[iiiFontId])[iii], iiiFontId); // set video position - (m_listElement[iiiFontId])[iii].m_texturePosStart.u = (float)(glyphPosition.x) / (float)textureWidth; - (m_listElement[iiiFontId])[iii].m_texturePosStart.v = (float)(glyphPosition.y) / (float)textureHeight; - (m_listElement[iiiFontId])[iii].m_texturePosStop.u = (float)(glyphPosition.x + (m_listElement[iiiFontId])[iii].m_sizeTexture.x) / (float)textureWidth; - (m_listElement[iiiFontId])[iii].m_texturePosStop.v = (float)(glyphPosition.y + (m_listElement[iiiFontId])[iii].m_sizeTexture.y) / (float)textureHeight; + (m_listElement[iiiFontId])[iii].m_texturePosStart.x = (float)(glyphPosition.x) / (float)textureWidth; + (m_listElement[iiiFontId])[iii].m_texturePosStart.y = (float)(glyphPosition.y) / (float)textureHeight; + (m_listElement[iiiFontId])[iii].m_texturePosStop.x = (float)(glyphPosition.x + (m_listElement[iiiFontId])[iii].m_sizeTexture.x) / (float)textureWidth; + (m_listElement[iiiFontId])[iii].m_texturePosStop.y = (float)(glyphPosition.y + (m_listElement[iiiFontId])[iii].m_sizeTexture.y) / (float)textureHeight; // update the maximum of the line hight : if (CurrentLineHigh<(m_listElement[iiiFontId])[iii].m_sizeTexture.y) { @@ -285,246 +288,6 @@ bool ewol::TexturedFont::HasName(etk::UString& fileName) } - -int32_t ewol::TexturedFont::Draw(etk::Vector2D textPos, - const etk::UString& unicodeString, - etk::Vector > & coord, - etk::Vector & coordTex, - etk::Vector & vectDisplayMode, - bool hasClipping, - clipping_ts& clipping, - ewol::font::mode_te displayMode) -{ - float totalSize = 0; - etk::Vector2D tmpPos = textPos; - uniChar_t unicodeCharPrevious = 0; - for(int32_t iii=0; iii textPos, - const uniChar_t unicodeChar, - etk::Vector > & coord, - etk::Vector & coordTex, - etk::Vector & vectDisplayMode, - bool hasClipping, - clipping_ts& clipping, - ewol::font::mode_te displayMode, - const uniChar_t unicodeCharPrevious) -{ - float posDrawX = textPos.x; - int32_t charIndex; - if (unicodeChar < 0x20) { - charIndex = 0; - } else if (unicodeChar < 0x80) { - charIndex = unicodeChar - 0x1F; - } else { - charIndex = 0; - for (int32_t iii=0x80-0x20; iii < m_listElement[0].Size(); iii++) { - if ((m_listElement[displayMode])[iii].m_UVal == unicodeChar) { - charIndex = iii; - break; - } - } - } - float kerningOffset = (m_listElement[displayMode])[charIndex].KerningGet(unicodeCharPrevious); - /* - if (kerningOffset != 0) { - EWOL_DEBUG("Kerning between : '" << (char)unicodeCharPrevious << "'&'" << (char)(m_listElement[displayMode])[charIndex].m_UVal << "' value : " << kerningOffset); - } - */ - // 0x01 == 0x20 == ' '; - if (unicodeChar != 0x01) { - /* Bitmap position - * xA xB - * yC *------* - * | | - * | | - * yD *------* - */ - float dxA = posDrawX + (m_listElement[displayMode])[charIndex].m_bearing.x + kerningOffset; - float dxB = dxA + (m_listElement[displayMode])[charIndex].m_sizeTexture.x; - float dyC = textPos.y + (m_listElement[displayMode])[charIndex].m_bearing.y + m_height[displayMode] - m_size; - float dyD = dyC - (m_listElement[displayMode])[charIndex].m_sizeTexture.y; - - float tuA = (m_listElement[displayMode])[charIndex].m_texturePosStart.u; - float tuB = (m_listElement[displayMode])[charIndex].m_texturePosStop.u; - float tvC = (m_listElement[displayMode])[charIndex].m_texturePosStart.v; - float tvD = (m_listElement[displayMode])[charIndex].m_texturePosStop.v; - - - // Clipping and drawing area - if( true == hasClipping - && ( dxB < clipping.x - || dxA > clipping.x + clipping.w) ) { - // Nothing to diplay ... - } else { - if (true == hasClipping) { - // generata positions... - float TexSizeX = tuB - tuA; - if (dxA < clipping.x) { - // clip display - float drawSize = clipping.x - dxA; - // Update element start display - dxA = clipping.x; - float addElement = TexSizeX * drawSize / (float)(m_listElement[displayMode])[charIndex].m_sizeTexture.x; - // update texture start X Pos - tuA += addElement; - } - if (dxB > clipping.x + clipping.w) { - // clip display - float drawSize = dxB - (clipping.x + clipping.w); - // Update element start display - dxB = clipping.x + clipping.w; - float addElement = TexSizeX * drawSize / (float)(m_listElement[displayMode])[charIndex].m_sizeTexture.x; - // update texture start X Pos - tuB -= addElement; - } - float TexSizeY = tvD - tvC; - if (dyC < clipping.y) { - // clip display - float drawSize = clipping.y - dyC; - // Update element start display - dyC = clipping.y; - float addElement = TexSizeY * drawSize / (float)(m_listElement[displayMode])[charIndex].m_sizeTexture.x; - // update texture start X Pos - tvC += addElement; - } - if (dyD > clipping.y + clipping.h) { - // clip display - float drawSize = dyD - (clipping.y + clipping.h); - // Update element start display - dyD = clipping.y + clipping.h; - float addElement = TexSizeX * drawSize / (float)(m_listElement[displayMode])[charIndex].m_sizeTexture.x; - // update texture start X Pos - tvD -= addElement; - } - } - if( dxB <= dxA - || dyD >= dyC) { - // nothing to do ... - } else { - /* Bitmap position - * 0------1 - * | | - * | | - * 3------2 - */ - etk::Vector2D bitmapDrawPos[4]; - bitmapDrawPos[0].x = (int32_t)dxA; - bitmapDrawPos[1].x = (int32_t)dxB; - bitmapDrawPos[2].x = (int32_t)dxB; - bitmapDrawPos[3].x = (int32_t)dxA; - - bitmapDrawPos[0].y = (int32_t)dyC; - bitmapDrawPos[1].y = (int32_t)dyC; - bitmapDrawPos[2].y = (int32_t)dyD; - bitmapDrawPos[3].y = (int32_t)dyD; - /* texture Position : - * 0------1 - * | | - * | | - * 3------2 - */ - texCoord_ts texturePos[4]; - texturePos[0].u = tuA+displayMode; - texturePos[1].u = tuB+displayMode; - texturePos[2].u = tuB+displayMode; - texturePos[3].u = tuA+displayMode; - - texturePos[0].v = tvC; - texturePos[1].v = tvC; - texturePos[2].v = tvD; - texturePos[3].v = tvD; - - // NOTE : Android does not support the Quads elements ... - /* Step 1 : - * ******** - * ****** - * **** - * ** - * - */ - // set texture coordonates : - coordTex.PushBack(texturePos[0]); - coordTex.PushBack(texturePos[1]); - coordTex.PushBack(texturePos[2]); - // set display positions : - coord.PushBack(bitmapDrawPos[0]); - coord.PushBack(bitmapDrawPos[1]); - coord.PushBack(bitmapDrawPos[2]); - - /* Step 2 : - * - * ** - * **** - * ****** - * ******** - */ - // set texture coordonates : - coordTex.PushBack(texturePos[0]); - coordTex.PushBack(texturePos[2]); - coordTex.PushBack(texturePos[3]); - // set display positions : - coord.PushBack(bitmapDrawPos[0]); - coord.PushBack(bitmapDrawPos[2]); - coord.PushBack(bitmapDrawPos[3]); - } - } - } - posDrawX += (m_listElement[displayMode])[charIndex].m_advance.x + kerningOffset; - int32_t sizeOut = posDrawX - textPos.x; - textPos.x = posDrawX; - return sizeOut; -} - -etk::Vector2D ewol::TexturedFont::GetSize(const etk::UString & unicodeString, const ewol::font::mode_te displayMode) -{ - etk::Vector2D outputSize(0,m_height[0]); - uniChar_t unicodeCharPrevious = 0; - for(int32_t iii=0; iii tmpp = GetSize(unicodeString[iii], unicodeCharPrevious, displayMode); - unicodeCharPrevious = unicodeString[iii]; - outputSize.x += tmpp.x; - } - return outputSize; -} - - -etk::Vector2D ewol::TexturedFont::GetSize(const uniChar_t unicodeChar, - const uniChar_t unicodeCharPrevious, - const ewol::font::mode_te displayMode) -{ - etk::Vector2D outputSize(0,m_height[0]); - int32_t charIndex; - if (unicodeChar >= 0x80) { - charIndex = 0; - } else if (unicodeChar < 0x20) { - charIndex = 0; - } else if (unicodeChar < 0x80) { - charIndex = unicodeChar - 0x1F; - } else { - for (int32_t iii=0x80-0x20; iii < m_listElement[0].Size(); iii++) { - if ((m_listElement[0])[iii].m_UVal == unicodeChar) { - charIndex = iii; - break; - } - } - // TODO : Update if possible the mapping - charIndex = 0; - } - float kerningOffset = (m_listElement[displayMode])[charIndex].KerningGet(unicodeCharPrevious); - outputSize.x = (m_listElement[0])[charIndex].m_advance.x + kerningOffset; - return outputSize; -} - - int32_t ewol::TexturedFont::GetIndex(const uniChar_t charcode, const ewol::font::mode_te displayMode) const { if (charcode < 0x20) { diff --git a/sources/ewol/renderer/resources/Font.h b/sources/ewol/renderer/resources/TexturedFont.h similarity index 54% rename from sources/ewol/renderer/resources/Font.h rename to sources/ewol/renderer/resources/TexturedFont.h index 98fb80cb..a9ce42b5 100644 --- a/sources/ewol/renderer/resources/Font.h +++ b/sources/ewol/renderer/resources/TexturedFont.h @@ -9,9 +9,9 @@ #ifndef __EWOL_TEXTURED_FONT_H__ #define __EWOL_TEXTURED_FONT_H__ -#include -#include -#include +#include +#include +#include namespace ewol { @@ -33,7 +33,7 @@ namespace ewol // specific element to have the the know if the specify element is known... // ==> otherwise I can just generate italic ... // ==> Bold is a little more complicated (maybe with the bordersize) - ewol::Font* m_font[4]; + ewol::FontBase* m_font[4]; ewol::font::mode_te m_modeWraping[4]; //!< This is a wrapping mode to prevent the fact that no font is define for a specific mode public: etk::Vector m_listElement[4]; @@ -47,49 +47,6 @@ namespace ewol virtual bool HasName(etk::UString& fileName); const char* GetType(void) { return "ewol::TexturedFont"; }; int32_t getFontSize(void) { return m_size; }; - // TODO : Remove : DEPRECATED ... - int32_t Draw(etk::Vector2D textPos, - const etk::UString& unicodeString, - etk::Vector > & coord, - etk::Vector & coordTex, - etk::Vector & vectDisplayMode, - bool hasClipping, - clipping_ts& clipping, - ewol::font::mode_te displayMode); - - // TODO : Remove : DEPRECATED ... - int32_t Draw(etk::Vector2D textPos, - const uniChar_t unicodeChar, - etk::Vector > & coord, - etk::Vector & coordTex, - etk::Vector & vectDisplayMode, - bool hasClipping, - clipping_ts& clipping, - ewol::font::mode_te displayMode, - const uniChar_t unicodeCharPrevious = 0); - - // TODO : Remove : DEPRECATED ... - /** - * @brief Get the size of the specified String - * @param[in] unicodeString The string that we might calculate the display size - * @param[in] displayMode Mode to display the currrent font - * @return Dimention of the string use - */ - etk::Vector2D GetSize(const etk::UString & unicodeString, - const ewol::font::mode_te displayMode = ewol::font::Regular); - - // TODO : Remove : DEPRECATED ... - /** - * @brief Get the size of the specified unicode value - * @param[in] unicodeChar the char that might be displayed - * @param[in] unicodeCharPrevious Previous char of this One ==> 0 no previous char - * @param[in] displayMode Mode to display the currrent font - * @return Dimention of the font use - */ - etk::Vector2D GetSize(const uniChar_t unicodeChar, - const uniChar_t unicodeCharPrevious = 0, - const ewol::font::mode_te displayMode = ewol::font::Regular); - /** * @brief Get the display height of this font * @param[in] displayMode Mode to display the currrent font diff --git a/sources/ewol/renderer/resources/VirtualBufferObject.cpp b/sources/ewol/renderer/resources/VirtualBufferObject.cpp index 5c2b57d4..274c288f 100644 --- a/sources/ewol/renderer/resources/VirtualBufferObject.cpp +++ b/sources/ewol/renderer/resources/VirtualBufferObject.cpp @@ -6,9 +6,9 @@ * @license BSD v3 (see license file) */ -#include -#include -#include +#include +#include +#include diff --git a/sources/ewol/renderer/resources/VirtualBufferObject.h b/sources/ewol/renderer/resources/VirtualBufferObject.h index c83c0d07..b5c3cab1 100644 --- a/sources/ewol/renderer/resources/VirtualBufferObject.h +++ b/sources/ewol/renderer/resources/VirtualBufferObject.h @@ -8,10 +8,11 @@ #ifndef __OPEN_GL__VIRTUAL_BUFFER_OBJECT_H__ #define __OPEN_GL__VIRTUAL_BUFFER_OBJECT_H__ -#include -#include -#include -#include + +#include +#include +#include +#include namespace ewol { diff --git a/sources/ewol/renderer/resources/font/Font.h b/sources/ewol/renderer/resources/font/FontBase.h similarity index 76% rename from sources/ewol/renderer/resources/font/Font.h rename to sources/ewol/renderer/resources/font/FontBase.h index 0899e03e..65d21fb5 100644 --- a/sources/ewol/renderer/resources/font/Font.h +++ b/sources/ewol/renderer/resources/font/FontBase.h @@ -9,23 +9,23 @@ #ifndef __EWOL_FONT_H__ #define __EWOL_FONT_H__ -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include namespace ewol { - class Font : public ewol::Resource + class FontBase : public ewol::Resource { protected: public: - Font(etk::UString fontName) : ewol::Resource(fontName) {}; + FontBase(etk::UString fontName) : ewol::Resource(fontName) {}; - virtual ~Font(void) { }; + virtual ~FontBase(void) { }; const char* GetType(void) { return "ewol::Font"; }; diff --git a/sources/ewol/renderer/resources/font/GlyphProperty.h b/sources/ewol/renderer/resources/font/GlyphProperty.h index 72dc6792..912bb0c9 100644 --- a/sources/ewol/renderer/resources/font/GlyphProperty.h +++ b/sources/ewol/renderer/resources/font/GlyphProperty.h @@ -9,7 +9,7 @@ #ifndef __EWOL_FONT_GLYPH_PROPERTY_H__ #define __EWOL_FONT_GLYPH_PROPERTY_H__ -#include +#include namespace ewol @@ -57,8 +57,8 @@ namespace ewol etk::Vector2D m_sizeTexture; //!< size of the element to display etk::Vector2D m_bearing; //!< offset to display the data (can be negatif id the texture sise is bigger than the theoric places in the string) etk::Vector2D m_advance; //!< space use in the display for this specific char - texCoord_ts m_texturePosStart; //!< Texture normalised position (START) - texCoord_ts m_texturePosStop; //!< Texture normalised position (STOP) + etk::Vector2D m_texturePosStart; //!< Texture normalised position (START) + etk::Vector2D m_texturePosStop; //!< Texture normalised position (STOP) private: etk::Vector m_kerning; //!< kerning values of link of all elements public: diff --git a/sources/ewol/renderer/resources/image/ImageBMP.cpp b/sources/ewol/renderer/resources/image/ImageBMP.cpp index 1f77bd33..5bef20cb 100644 --- a/sources/ewol/renderer/resources/image/ImageBMP.cpp +++ b/sources/ewol/renderer/resources/image/ImageBMP.cpp @@ -6,9 +6,9 @@ * @license BSD v3 (see license file) */ -#include +#include #include -#include +#include #include #pragma pack(push,1) diff --git a/sources/ewol/renderer/resources/image/ImageBMP.h b/sources/ewol/renderer/resources/image/ImageBMP.h index 4793cb44..b231fc04 100644 --- a/sources/ewol/renderer/resources/image/ImageBMP.h +++ b/sources/ewol/renderer/resources/image/ImageBMP.h @@ -9,8 +9,8 @@ #ifndef __EWOL_TEXTURE_BITMAP_H__ #define __EWOL_TEXTURE_BITMAP_H__ -#include -#include +#include +#include #include #include diff --git a/sources/ewol/renderer/resources/image/ImagePNG.cpp b/sources/ewol/renderer/resources/image/ImagePNG.cpp index 51d038b9..9142f3b6 100644 --- a/sources/ewol/renderer/resources/image/ImagePNG.cpp +++ b/sources/ewol/renderer/resources/image/ImagePNG.cpp @@ -6,9 +6,9 @@ * @license BSD v3 (see license file) */ -#include +#include #include -#include +#include #include #include diff --git a/sources/ewol/renderer/resources/image/ImagePNG.h b/sources/ewol/renderer/resources/image/ImagePNG.h index b4547026..99eedded 100644 --- a/sources/ewol/renderer/resources/image/ImagePNG.h +++ b/sources/ewol/renderer/resources/image/ImagePNG.h @@ -9,8 +9,8 @@ #ifndef __EWOL_TEXTURE_PNG_H__ #define __EWOL_TEXTURE_PNG_H__ -#include -#include +#include +#include #include #include diff --git a/sources/ewol/renderer/resources/image/ImageSVG.cpp b/sources/ewol/renderer/resources/image/ImageSVG.cpp deleted file mode 100644 index 66111443..00000000 --- a/sources/ewol/renderer/resources/image/ImageSVG.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#include -#include - - -#undef __class__ -#define __class__ "texture::TextureSVG" - - -ewol::texture::TextureSVG::TextureSVG(etk::UString & fileName, int32_t width, int32_t height) : - m_elementParsed(fileName) -{ - m_loadOK = false; - if (false == m_elementParsed.IsLoadOk()) { - EWOL_ERROR("Error To load SVG file " << fileName ); - } else { - m_elementParsed.GenerateAnImage(width, height); - m_loadOK = true; - } - if (width == -1) { - etk::Vector2D elementSize = m_elementParsed.GetDefinedSize(); - m_width = elementSize.x; - m_height = elementSize.y; - } else { - m_width = width; - m_height = height; - } -} - -ewol::texture::TextureSVG::~TextureSVG(void) -{ - -} - -bool ewol::texture::TextureSVG::LoadOK(void) -{ - return m_loadOK; -} - -int32_t ewol::texture::TextureSVG::Width(void) -{ - return m_width; -} - -int32_t ewol::texture::TextureSVG::Height(void) -{ - return m_height; -} - -uint8_t * ewol::texture::TextureSVG::Data(void) -{ - return m_elementParsed.GetPointerOnData(); -} - -uint32_t ewol::texture::TextureSVG::DataSize(void) -{ - return m_elementParsed.GetSizeOnData(); -} - -void ewol::texture::TextureSVG::Display(void) -{ - EWOL_DEBUG("SVG Texture : (" << m_width << "," << m_height << ") loadedOK=" << m_loadOK); -} diff --git a/sources/ewol/renderer/resources/image/ImageSVG.h b/sources/ewol/renderer/resources/image/ImageSVG.h deleted file mode 100644 index 08a9c03a..00000000 --- a/sources/ewol/renderer/resources/image/ImageSVG.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_TEXTURE_SVG_H__ -#define __EWOL_TEXTURE_SVG_H__ - -#include -#include -#include - -namespace ewol -{ - namespace texture { - class TextureSVG - { - private: - svg::Parser m_elementParsed; - int32_t m_width; - int32_t m_height; - int32_t m_size; - uint8_t * m_data; - bool m_loadOK; - public: - TextureSVG(etk::UString & fileName, int32_t width, int32_t height); - ~TextureSVG(void); - bool LoadOK(void); - int32_t Width(void); - int32_t Height(void); - uint8_t * Data(void); - uint32_t DataSize(void); - void Display(void); - }; - }; -}; - -#endif - diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index 263c7cc2..378097e6 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -304,7 +304,7 @@ void ewol::Widget::ShortCutClean(void) } -bool ewol::Widget::OnEventShortCut(ewol::specialKey_ts& special, uniChar_t unicodeValue, ewol::eventKbMoveType_te kbMove, bool isDown) +bool ewol::Widget::OnEventShortCut(ewol::SpecialKey& special, uniChar_t unicodeValue, ewol::eventKbMoveType_te kbMove, bool isDown) { if (unicodeValue >= 'A' && unicodeValue <='Z') { unicodeValue += 'a' - 'A'; diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index 763c6542..b4e695c8 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -29,23 +29,13 @@ namespace ewol { etk::Vector2D m_size; }; - typedef struct { - bool capLock; - bool shift; - bool ctrl; - bool meta; - bool alt; - bool altGr; - bool verNum; - bool insert; - } specialKey_ts; class EventShortCut { public: bool broadcastEvent; // if it is true, then the message is sent to all the system const char * generateEventId; // Local generated event etk::UString eventData; // data link with the event - ewol::specialKey_ts specialKey; // special board key + ewol::SpecialKey specialKey; // special board key uniChar_t unicodeValue; // 0 if not used ewol::keyEvent::keyboard_te keyboardMoveValue; // ewol::EVENT_KB_MOVE_TYPE_NONE if not used EventShortCut(void) { @@ -404,7 +394,7 @@ namespace ewol { * @return false if the event has not been used * @note To prevent some error when you get an event get it if it is down and Up ... ==> like this it could not generate some ununderstanding error */ - virtual bool OnEventShortCut(ewol::specialKey_ts& special, uniChar_t unicodeValue, ewol::keyEvent::keyboard_te kbMove, bool isDown); + virtual bool OnEventShortCut(ewol::SpecialKey& special, uniChar_t unicodeValue, ewol::keyEvent::keyboard_te kbMove, bool isDown); // ---------------------------------------------------------------------------------------------------------------- // -- Drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working... // ---------------------------------------------------------------------------------------------------------------- diff --git a/sources/file.mk b/sources/file.mk index 63293a87..69688274 100644 --- a/sources/file.mk +++ b/sources/file.mk @@ -7,60 +7,40 @@ FILE_LIST:= ewol/ewol.cpp \ ewol/commandLine.cpp \ ewol/key.cpp - -#PLOPPPPP = \ - ewol/renderer/ResourceManager.cpp \ - ewol/renderer/resources/SimpleConfigFile.cpp - -#FILE_LIST+= ewol/openGL/openGL.cpp \ - ewol/openGL/Shader.cpp \ - ewol/openGL/Program.cpp \ - ewol/openGL/VirtualBufferObject.cpp - - -# Gui interface -#FILE_LIST+= ewol/os/eSystem.cpp \ - ewol/os/eSystemInput.cpp - # Basic Eobject of EWOL -#FILE_LIST+= ewol/eObject/EObject.cpp \ +FILE_LIST+= ewol/eObject/EObject.cpp \ ewol/eObject/EObjectManager.cpp -# Game elements -#FILE_LIST+= ewol/game/GameElement.cpp \ - ewol/game/GameElementLua.cpp \ - ewol/game/SceneElement.cpp +#openGl Basic access abstraction (for the model matrix and include +FILE_LIST+= ewol/renderer/openGL.cpp + +# Operating System interface +FILE_LIST+= ewol/renderer/os/eSystem.cpp \ + ewol/renderer/os/eSystemInput.cpp + +# renderer : +FILE_LIST+= ewol/renderer/resources/Shader.cpp \ + ewol/renderer/resources/Program.cpp \ + ewol/renderer/resources/VirtualBufferObject.cpp \ + ewol/renderer/resources/ConfigFile.cpp \ + ewol/renderer/resources/FontFreeType.cpp \ + ewol/renderer/resources/TexturedFont.cpp \ + ewol/renderer/resources/Mesh.cpp \ + ewol/renderer/resources/MeshObj.cpp \ + ewol/renderer/resources/Texture.cpp \ + ewol/renderer/resources/Image.cpp \ + ewol/renderer/resources/image/ImageBMP.cpp \ + ewol/renderer/resources/image/ImagePNG.cpp \ + ewol/renderer/ResourceManager.cpp + # Compositing -#FILE_LIST+= ewol/compositing/Compositing.cpp \ +FILE_LIST+= ewol/compositing/Compositing.cpp \ ewol/compositing/Text.cpp \ - ewol/compositing/Drawing.cpp - -# Object abstraction for OpenGl -#FILE_LIST+= ewol/oObject/OObject.cpp \ - ewol/oObject/2DTextColored.cpp \ - ewol/oObject/2DTextShader.cpp \ - ewol/oObject/2DColored.cpp \ - ewol/oObject/2DTextured.cpp \ - ewol/oObject/3DTextured.cpp \ - ewol/oObject/Sprite.cpp - -# texture management -#FILE_LIST+= ewol/texture/Texture.cpp \ - ewol/texture/TextureFile.cpp \ - ewol/texture/TextureBMP.cpp \ - ewol/texture/TexturePNG.cpp \ - ewol/texture/TextureSVG.cpp - -# fonst system -#FILE_LIST+= ewol/font/FontManager.cpp \ - ewol/font/FontFreeType.cpp \ - ewol/font/TexturedFont.cpp \ - ewol/font/DistantFieldFont.cpp - -# Mesh management -#FILE_LIST+= ewol/Mesh/Mesh.cpp \ - ewol/Mesh/MeshObj.cpp + ewol/compositing/Drawing.cpp \ + ewol/compositing/Image.cpp \ + ewol/compositing/Sprite.cpp \ + ewol/compositing/Mesh.cpp # all widgets