diff --git a/sources/ewol/compositing/Shaper.cpp b/sources/ewol/compositing/Shaper.cpp index 4d0a1b1b..82b5e03f 100644 --- a/sources/ewol/compositing/Shaper.cpp +++ b/sources/ewol/compositing/Shaper.cpp @@ -35,6 +35,10 @@ ewol::Shaper::Shaper(etk::UString shaperName) : m_resourceTexture(NULL), m_nextStatusRequested(-1), m_time(-1), + m_propertyOrigin(0,0), + m_propertySize(0,0), + m_propertyInsidePosition(0,0), + m_propertyInsideSize(0,0), m_stateOld(0), m_stateNew(0), m_stateTransition(1.0) @@ -250,7 +254,7 @@ void ewol::Shaper::SetInsidePos(vec2 newInsidePos) vec2 ewol::Shaper::GetPadding(void) { - vec2 padding; + vec2 padding(0,0); if (m_config!=NULL) { padding.setValue(m_config->GetFloat(m_confIdPaddingX), m_config->GetFloat(m_confIdPaddingY)); diff --git a/sources/ewol/compositing/Shaper.h b/sources/ewol/compositing/Shaper.h index fda3ce9a..c520ed18 100644 --- a/sources/ewol/compositing/Shaper.h +++ b/sources/ewol/compositing/Shaper.h @@ -46,16 +46,16 @@ namespace ewol // For the Image : ewol::TextureFile* m_resourceTexture; //!< texture resources (for the image) // internal needed data : - int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it - int64_t m_time; //!< The last time of the dispaly (-1 if nothing progressing) - vec2 m_propertyOrigin; //!< widget origin - vec2 m_propertySize; //!< widget size - vec2 m_propertyInsidePosition; //!< internal subwidget position - vec2 m_propertyInsideSize; //!< internal subwidget size - int32_t m_stateOld; //!< previous state - int32_t m_stateNew; //!< destination state - float m_stateTransition; //!< working state between 2 states - vec2 m_coord[6]; //!< the double triangle coordonates + int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it + int64_t m_time; //!< The last time of the dispaly (-1 if nothing progressing) + vec2 m_propertyOrigin; //!< widget origin + vec2 m_propertySize; //!< widget size + vec2 m_propertyInsidePosition; //!< internal subwidget position + vec2 m_propertyInsideSize; //!< internal subwidget size + int32_t m_stateOld; //!< previous state + int32_t m_stateNew; //!< destination state + float m_stateTransition; //!< working state between 2 states + vec2 m_coord[6]; //!< the double triangle coordonates private: /** * @brief Load the openGL program and get all the ID needed diff --git a/sources/ewol/compositing/Text.h b/sources/ewol/compositing/Text.h index 550b86ba..4ace36f9 100644 --- a/sources/ewol/compositing/Text.h +++ b/sources/ewol/compositing/Text.h @@ -82,11 +82,11 @@ namespace ewol int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection) int32_t m_cursorPos; //!< Cursor position (default no cursor ==> -100) private: - ewol::TexturedFont* m_font; //!< Font resources + 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_coordColor; //!< internal color of the different point + 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 diff --git a/sources/ewol/renderer/os/gui.Windows.cpp b/sources/ewol/renderer/os/gui.Windows.cpp index 6d66a3e5..fe777a0a 100644 --- a/sources/ewol/renderer/os/gui.Windows.cpp +++ b/sources/ewol/renderer/os/gui.Windows.cpp @@ -74,8 +74,8 @@ void guiInterface::ChangeSize(ivec2 size) { int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int title_size = GetSystemMetrics(SM_CYCAPTION); - size.x += border_thickness*2; - size.y += border_thickness*2 + title_size; + size.setValue(size.x() + border_thickness*2, + size.y() + border_thickness*2 + title_size); //m_currentHeight = size.y; // TODO : Later } @@ -88,8 +88,7 @@ void guiInterface::ChangePos(ivec2 pos) void guiInterface::GetAbsPos(ivec2& size) { // TODO : Later - size.x = 0; - size.y = 0; + size.setValue(0,0); } @@ -433,30 +432,30 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) buttonIsDown = false; case WM_LBUTTONDOWN: mouseButtonId = 1; - pos.x = GET_X_LPARAM(lParam); - pos.y = m_currentHeight-GET_Y_LPARAM(lParam); + pos.setValue(GET_X_LPARAM(lParam), + m_currentHeight-GET_Y_LPARAM(lParam)); inputIsPressed[mouseButtonId] = buttonIsDown; - eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); + eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); return 0; case WM_MBUTTONUP: buttonIsDown = false; case WM_MBUTTONDOWN: mouseButtonId = 2; - pos.x = GET_X_LPARAM(lParam); - pos.y = m_currentHeight-GET_Y_LPARAM(lParam); + pos.setValue(GET_X_LPARAM(lParam), + m_currentHeight-GET_Y_LPARAM(lParam)); inputIsPressed[mouseButtonId] = buttonIsDown; - eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); + eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); return 0; case WM_RBUTTONUP: buttonIsDown = false; case WM_RBUTTONDOWN: mouseButtonId = 3; - pos.x = GET_X_LPARAM(lParam); - pos.y = m_currentHeight-GET_Y_LPARAM(lParam); + pos.setValue(GET_X_LPARAM(lParam), + m_currentHeight-GET_Y_LPARAM(lParam)); inputIsPressed[mouseButtonId] = buttonIsDown; - eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); + eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); return 0; case WM_MOUSEWHEEL: @@ -467,25 +466,25 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) EWOL_DEBUG("event SCROOL DOWN"); mouseButtonId = 5; } - pos.x = GET_X_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); + pos.setValue(GET_X_LPARAM(lParam), + 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; case WM_MOUSEHOVER: case WM_MOUSEMOVE: - pos.x = GET_X_LPARAM(lParam); - pos.y = m_currentHeight-GET_Y_LPARAM(lParam); + pos.setValue(GET_X_LPARAM(lParam), + m_currentHeight-GET_Y_LPARAM(lParam)); for (int32_t iii=0; iii& list) -{ - for (int32_t iii=0; iii& list) +int32_t CreateOrGetNewPointId(vertex_te type, const vec3& point, etk::Vector& list) { for (int32_t iii=0; iiiGetPos() == point) { @@ -324,193 +313,91 @@ int32_t CreateOrGetNewTexId(const vec2& point, etk::Vector& list) void ewol::Mesh::InternalSubdivide(bool smooth) { - if (false==smooth) { - //Copy the mesh for modify this one and not his parrent (that one is needed for smoothing) - etk::Vector listVertex(m_listVertex); - etk::Vector listUV(m_listUV); - etk::Vector listFaces; // no face here ... - etk::Vector listElementHalfPoint(16);// preallocate at 16.. - etk::Vector listElementHalfUV(16);// preallocate at 16.. - - for (int32_t iii=0; iii o.. ..o - / \ / ''o'' \ - / \ / | \ - / \ / | \ - / \ / | \ - o-------------------o o---------o---------o - - */ - } else { - // create the center point: - centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]] - + m_listVertex[m_listFaces[iii].m_vertex[1]] - + m_listVertex[m_listFaces[iii].m_vertex[2]] - + m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4); - // create the center Texture coord: - centerTex = ( listUV[m_listFaces[iii].m_uv[0]] - + listUV[m_listFaces[iii].m_uv[1]] - + listUV[m_listFaces[iii].m_uv[2]] - + listUV[m_listFaces[iii].m_uv[3]] ) / vec2(4,4); - /* - - o---------------------o o----------o----------o - | | | | | - | | | | | - | | | | | - | | | | | - | | | | | - | | ==> o----------o----------o - | | | | | - | | | | | - | | | | | - | | | | | - | | | | | - o---------------------o o----------o----------o - - */ - } - - int32_t newCenterVertexID = CreateOrGetNewPointId(centerPoint, listVertex); - int32_t newCenterTexID = CreateOrGetNewTexId(centerTex, listUV); - - listElementHalfPoint.Clear(); - listElementHalfUV.Clear(); - // generate list f the forder elements - for (int32_t jjj=0; jjj listVertex; + for(int32_t iii=0; iii listUV(m_listUV); + etk::Vector listFaces; // no face here ... + etk::Vector listElementHalfPoint(16);// preallocate at 16.. + etk::Vector listElementHalfUV(16);// preallocate at 16.. + + for (int32_t iii=0; iii o.. ..o + / \ / ''o'' \ + / \ / | \ + / \ / | \ + / \ / | \ + o-------------------o o---------o---------o + + */ + } else { + // create the center point: + centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]] + + m_listVertex[m_listFaces[iii].m_vertex[1]] + + m_listVertex[m_listFaces[iii].m_vertex[2]] + + m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4); + // create the center Texture coord: + centerTex = ( listUV[m_listFaces[iii].m_uv[0]] + + listUV[m_listFaces[iii].m_uv[1]] + + listUV[m_listFaces[iii].m_uv[2]] + + listUV[m_listFaces[iii].m_uv[3]] ) / vec2(4,4); + /* + + o---------------------o o----------o----------o + | | | | | + | | | | | + | | | | | + | | | | | + | | | | | + | | ==> o----------o----------o + | | | | | + | | | | | + | | | | | + | | | | | + | | | | | + o---------------------o o----------o----------o + + */ } - // copy all the element in the internal structure : - m_listVertex = listVertex; - m_listUV = listUV; - m_listFaces = listFaces; - } else { - // smooth mode - //Copy the mesh for modify this one and not his parrent (that one is needed for smoothing) - etk::Vector listVertex; - for(int32_t iii=0; iii listUV(m_listUV); - etk::Vector listFaces; // no face here ... - etk::Vector listElementHalfPoint(16);// preallocate at 16.. - etk::Vector listElementHalfUV(16);// preallocate at 16.. - for (int32_t iii=0; iii o.. ..o - / \ / ''o'' \ - / \ / | \ - / \ / | \ - / \ / | \ - o-------------------o o---------o---------o - - */ - } else { - // create the center point: - centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]] - + m_listVertex[m_listFaces[iii].m_vertex[1]] - + m_listVertex[m_listFaces[iii].m_vertex[2]] - + m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4); - // create the center Texture coord: - centerTex = ( listUV[m_listFaces[iii].m_uv[0]] - + listUV[m_listFaces[iii].m_uv[1]] - + listUV[m_listFaces[iii].m_uv[2]] - + listUV[m_listFaces[iii].m_uv[3]] ) / vec2(4,4); - /* - - o---------------------o o----------o----------o - | | | | | - | | | | | - | | | | | - | | | | | - | | | | | - | | ==> o----------o----------o - | | | | | - | | | | | - | | | | | - | | | | | - | | | | | - o---------------------o o----------o----------o - - */ - } + int32_t newCenterVertexID = CreateOrGetNewPointId(VERTEX_CENTER_FACE, centerPoint, listVertex); + int32_t newCenterTexID = CreateOrGetNewTexId(centerTex, listUV); + + listElementHalfPoint.Clear(); + listElementHalfUV.Clear(); + // generate list f the forder elements + for (int32_t jjj=0; jjjAddLink(newCenterVertexID); // add center of edge end face at the old element point : @@ -518,24 +405,26 @@ void ewol::Mesh::InternalSubdivide(bool smooth) listVertex[m_listFaces[iii].m_vertex[jjj]]->AddLink(newMiddleVertexID); listVertex[m_listFaces[iii].m_vertex[cyclicID]]->AddLink(newCenterVertexID); listVertex[m_listFaces[iii].m_vertex[cyclicID]]->AddLink(newMiddleVertexID); - // list of all middle point to recontitute the faces - listElementHalfPoint.PushBack(newMiddleVertexID); - // create the center Texture coord: - vec2 middleTex = ( listUV[m_listFaces[iii].m_uv[jjj]] - + listUV[m_listFaces[iii].m_uv[cyclicID]]) / 2.0f; - int32_t newMiddleTexID = CreateOrGetNewTexId(middleTex, listUV); - listElementHalfUV.PushBack(newMiddleTexID); - } - // generate faces: - //EWOL_DEBUG(" ==> Generatedd faces"); - for (int32_t jjj=0; jjj Generatedd faces"); + for (int32_t jjj=0; jjj Update middle edge points position"); // reposition the Middle point of the edge for(int32_t iii=0; iii Back to the normal list of element:"); - // copy all the element in the internal structure : - m_listUV = listUV; - m_listFaces = listFaces; - m_listVertex.Clear(); - for(int32_t iii=0; iiiGetPos()); - delete(listVertex[iii]); - listVertex[iii] = NULL; - } - } - listVertex.Clear(); } + //EWOL_DEBUG(" ==> Back to the normal list of element:"); + // copy all the element in the internal structure : + m_listUV = listUV; + m_listFaces = listFaces; + m_listVertex.Clear(); + for(int32_t iii=0; iiiGetPos()); + delete(listVertex[iii]); + listVertex[iii] = NULL; + } + } + listVertex.Clear(); } diff --git a/sources/ewol/widget/SizerHori.cpp b/sources/ewol/widget/SizerHori.cpp index 9c8820b9..eace1c8d 100644 --- a/sources/ewol/widget/SizerHori.cpp +++ b/sources/ewol/widget/SizerHori.cpp @@ -88,14 +88,14 @@ bool widget::SizerHori::CalculateMinSize(void) m_userExpend.setY(true); } vec2 tmpSize = m_subWidget[iii]->GetMinSize(); + //EWOL_DEBUG("HORI : NewMinSize=" << tmpSize); m_minSize.setX(m_minSize.x() + tmpSize.x()); if (tmpSize.y()>m_minSize.y()) { m_minSize.setY(tmpSize.y()); } } } - //EWOL_DEBUG("Result : expend X="<< m_userExpend.x << " Y=" << m_userExpend.y); - //EWOL_DEBUG(" minSize ("<< m_minSize.x << "," << m_minSize.y << ")"); + //EWOL_DEBUG("Hori Result : expend="<< m_userExpend << " minSize="<< m_minSize); return true; } diff --git a/sources/ewol/widget/SizerVert.cpp b/sources/ewol/widget/SizerVert.cpp index e316338b..cf9b52e9 100644 --- a/sources/ewol/widget/SizerVert.cpp +++ b/sources/ewol/widget/SizerVert.cpp @@ -91,6 +91,7 @@ bool widget::SizerVert::CalculateMinSize(void) m_userExpend.setY(true); } vec2 tmpSize = m_subWidget[iii]->GetMinSize(); + //EWOL_DEBUG("VERT : NewMinSize=" << tmpSize); //EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")"); m_minSize.setY(m_minSize.y() + tmpSize.y()); if (tmpSize.x()>m_minSize.x()) { @@ -98,8 +99,7 @@ bool widget::SizerVert::CalculateMinSize(void) } } } - //EWOL_DEBUG("Result : expend X="<< m_userExpend.x << " Y=" << m_userExpend.y); - //EWOL_DEBUG(" minSize ("<< m_minSize.x << "," << m_minSize.y << ")"); + //EWOL_DEBUG("Vert Result : expend="<< m_userExpend << " minSize="<< m_minSize); return true; } diff --git a/sources/ewol/widget/SizerVert.h b/sources/ewol/widget/SizerVert.h index afa97497..9af275f5 100644 --- a/sources/ewol/widget/SizerVert.h +++ b/sources/ewol/widget/SizerVert.h @@ -21,7 +21,7 @@ namespace widget { virtual ~SizerVert(void); void LockExpendContamination(bool lockExpend=false); private: - bool m_lockExpendContamination; + bool m_lockExpendContamination; etk::Vector m_subWidget; public: virtual void SubWidgetRemoveAll(void);