diff --git a/Sources/base/guiX11.cpp b/Sources/base/guiX11.cpp index 497eab7a..fe2b86c6 100644 --- a/Sources/base/guiX11.cpp +++ b/Sources/base/guiX11.cpp @@ -356,17 +356,17 @@ namespace guiAbstraction { glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0., (float)m_width, 0., (float)m_height, 1., 20.); + glOrtho(0., (etkFloat_t)m_width, 0., (etkFloat_t)m_height, 1., 20.); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -5); glBegin(GL_QUADS); - glColor3f(1., 0., 0.); glVertex3f( .25*(float)m_width, .25*(float)m_height, 0.); - glColor3f(0., 1., 0.); glVertex3f( .75*(float)m_width, .25*(float)m_height, 0.); - glColor3f(0., 0., 1.); glVertex3f( .75*(float)m_width, .75*(float)m_height, 0.); - glColor3f(1., 1., 0.); glVertex3f( .25*(float)m_width, .75*(float)m_height, 0.); + glColor3f(1., 0., 0.); glVertex3f( .25*(etkFloat_t)m_width, .25*(etkFloat_t)m_height, 0.); + glColor3f(0., 1., 0.); glVertex3f( .75*(etkFloat_t)m_width, .25*(etkFloat_t)m_height, 0.); + glColor3f(0., 0., 1.); glVertex3f( .75*(etkFloat_t)m_width, .75*(etkFloat_t)m_height, 0.); + glColor3f(1., 1., 0.); glVertex3f( .25*(etkFloat_t)m_width, .75*(etkFloat_t)m_height, 0.); glEnd(); } else { m_uniqueWindows->SysDraw(); @@ -416,7 +416,7 @@ namespace guiAbstraction { { m_uniqueWindows = newWindows; if (NULL != m_uniqueWindows) { - m_uniqueWindows->CalculateSize((double)m_width, (double)m_height); + m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height); } } @@ -480,7 +480,7 @@ namespace guiAbstraction { { case ConfigureNotify: EWOL_DEBUG("X11 event : " << event.type << " = \"ConfigureNotify\" Origin(" << event.xconfigure.x << "," << event.xconfigure.y << ") Size(" << event.xconfigure.width << "," << event.xconfigure.height << ")"); - m_uniqueWindows->CalculateSize((double)event.xconfigure.width, (double)event.xconfigure.height); + m_uniqueWindows->CalculateSize((etkFloat_t)event.xconfigure.width, (etkFloat_t)event.xconfigure.height); m_uniqueWindows->SetOrigin(event.xconfigure.x, event.xconfigure.y); break; case Expose: @@ -492,9 +492,9 @@ namespace guiAbstraction { m_moveMode = false; m_resizeMode = false; int32_t btId = event.xbutton.button; - //EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonPress\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")"); + //EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonPress\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")"); // Send Down message - m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_DOWN, (double)event.xbutton.x, (double)event.xbutton.y); + m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)event.xbutton.x, (etkFloat_t)event.xbutton.y); // Check double or triple click event ... m_previousDown_x = event.xbutton.x; m_previousDown_y = event.xbutton.y; @@ -523,9 +523,9 @@ namespace guiAbstraction { m_moveMode = false; m_resizeMode = false; int32_t btId = event.xbutton.button; - //EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonRelease\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")"); + //EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonRelease\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")"); // send Up event ... - m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_UP, (double)event.xbutton.x, (double)event.xbutton.y); + m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)event.xbutton.x, (etkFloat_t)event.xbutton.y); if (m_previousBouttonId != btId) { m_previousDown_x = -1; @@ -544,8 +544,8 @@ namespace guiAbstraction { && abs(m_previousDown_y - event.xbutton.y) < 5 ) { // might generate an sigle event : - //EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedSingle\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")"); - m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_SINGLE, (double)event.xbutton.x, (double)event.xbutton.y); + //EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedSingle\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")"); + m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)event.xbutton.x, (etkFloat_t)event.xbutton.y); m_previous_x = m_previousDown_x; m_previous_y = m_previousDown_y; m_previousTime = currentTime; @@ -566,13 +566,13 @@ namespace guiAbstraction { { // might generate an sigle event : if (false == m_previousDouble) { - //EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedDouble\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")"); - m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_DOUBLE, (double)event.xbutton.x, (double)event.xbutton.y); + //EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedDouble\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")"); + m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_DOUBLE, (etkFloat_t)event.xbutton.x, (etkFloat_t)event.xbutton.y); m_previousTime = currentTime; m_previousDouble = true; } else { - //EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedTriple\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")"); - m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_TRIPLE, (double)event.xbutton.x, (double)event.xbutton.y); + //EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedTriple\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")"); + m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)event.xbutton.x, (etkFloat_t)event.xbutton.y); // reset values ... m_previousDown_x = -1; m_previousDown_y = -1; @@ -601,8 +601,8 @@ namespace guiAbstraction { case EnterNotify: m_resizeMode = false; m_moveMode = false; - //EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (double)event.xcrossing.x << "," << (double)event.xcrossing.y << ")"); - m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (double)event.xcrossing.x, (double)event.xcrossing.y); + //EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")"); + m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y); break; case MotionNotify: if (true == m_resizeMode) { @@ -618,15 +618,15 @@ namespace guiAbstraction { //EWOL_DEBUG("Change POS : (" << (m_startY - m_screenOffsetX) << "," << (m_startY - m_screenOffsetY) << ") ==> (" << newPosX << "," << newPosY << ")"); this->ChangePos(newPosX, newPosY); } else { - //EWOL_DEBUG("X11 event : " << event.type << " = \"MotionNotify\" (" << (double)event.xmotion.x << "," << (double)event.xmotion.y << ")"); - m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_MOVE, (double)event.xmotion.x, (double)event.xmotion.y); + //EWOL_DEBUG("X11 event : " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")"); + m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)event.xmotion.x, (etkFloat_t)event.xmotion.y); } break; case LeaveNotify: m_resizeMode = false; m_moveMode = false; - //EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (double)event.xcrossing.x << "," << (double)event.xcrossing.y << ")"); - m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_LEAVE, (double)event.xcrossing.x, (double)event.xcrossing.y); + //EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")"); + m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_LEAVE, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y); break; case FocusIn: m_resizeMode = false; diff --git a/Sources/etk/etkTypes.h b/Sources/etk/etkTypes.h index 1750d70b..685874db 100644 --- a/Sources/etk/etkTypes.h +++ b/Sources/etk/etkTypes.h @@ -64,9 +64,17 @@ typedef int32_t uniChar_t; extern "C" { + #ifdef EWOL_PECISION_DOUBLE + typedef double etkFloat_t; + #define oglTypeFloat_t GL_DOUBLE + #else + typedef float etkFloat_t; + #define oglTypeFloat_t GL_FLOAT + #endif + struct etkPointAndPositionDouble{ - double x; - double y; + etkFloat_t x; + etkFloat_t y; }; struct etkPointAndPositionInt{ @@ -80,23 +88,23 @@ extern "C" typedef etkPointAndPositionInt intSize_ts; typedef struct { - float x; - float y; - float z; + etkFloat_t x; + etkFloat_t y; + etkFloat_t z; }coord3D_ts; typedef struct { - float x; - float y; + etkFloat_t x; + etkFloat_t y; }coord2D_ts; typedef struct { - float u; - float v; + etkFloat_t u; + etkFloat_t v; }texCoord_ts; typedef struct { - float red; - float green; - float blue; - float alpha; + etkFloat_t red; + etkFloat_t green; + etkFloat_t blue; + etkFloat_t alpha; }color_ts; } diff --git a/Sources/ewolFont.h b/Sources/ewolFont.h index 03089202..ac6c391a 100644 --- a/Sources/ewolFont.h +++ b/Sources/ewolFont.h @@ -64,7 +64,7 @@ namespace ewol etk::VectorType & coordTex); int32_t LoadFont(etk::File fontFileName); - void DrawText(double x, double y, const char * myString); + void DrawText(etkFloat_t x, etkFloat_t y, const char * myString); }; #endif diff --git a/Sources/ewolFontBitmap.cpp b/Sources/ewolFontBitmap.cpp index 02d2ba99..a3e4c988 100644 --- a/Sources/ewolFontBitmap.cpp +++ b/Sources/ewolFontBitmap.cpp @@ -48,7 +48,7 @@ extern "C" typedef struct { texCoord_ts posStart; texCoord_ts posStop; - float ratio; + etkFloat_t ratio; }UTF8Element_ts; } @@ -152,22 +152,22 @@ namespace ewol { //EWOL_DEBUG("Find default font glyph : (" << x << "," << y << ") (" << w << "," << h << ") "); for (int32_t iii=0; iii< 0x80; iii++) { - m_listOfElement[iii].posStart.u = (double)x / 512.0; - m_listOfElement[iii].posStart.v = (double)y / 512.0; - m_listOfElement[iii].posStop.u = (double)(x+w) / 512.0; - m_listOfElement[iii].posStop.v = (double)(y+h) / 512.0; - m_listOfElement[iii].ratio = (float)w/(float)h; + m_listOfElement[iii].posStart.u = (etkFloat_t)x / 512.0; + m_listOfElement[iii].posStart.v = (etkFloat_t)y / 512.0; + m_listOfElement[iii].posStop.u = (etkFloat_t)(x+w) / 512.0; + m_listOfElement[iii].posStop.v = (etkFloat_t)(y+h) / 512.0; + m_listOfElement[iii].ratio = (etkFloat_t)w/(etkFloat_t)h; } }; void SetGlyphID(int32_t utf8Value, int32_t lineID, int32_t x, int32_t y, int32_t w, int32_t h) { //EWOL_DEBUG("Add font glyph : "<< utf8Value << " (" << x << "," << y << ") (" << w << "," << h << ") "); if (utf8Value < 0x80) { - m_listOfElement[utf8Value].posStart.u = (double)x / 512.0; - m_listOfElement[utf8Value].posStart.v = (double)y / 512.0; - m_listOfElement[utf8Value].posStop.u = (double)(x+w) / 512.0; - m_listOfElement[utf8Value].posStop.v = (double)(y+h) / 512.0; - m_listOfElement[utf8Value].ratio = (float)w/(float)h; + m_listOfElement[utf8Value].posStart.u = (etkFloat_t)x / 512.0; + m_listOfElement[utf8Value].posStart.v = (etkFloat_t)y / 512.0; + m_listOfElement[utf8Value].posStop.u = (etkFloat_t)(x+w) / 512.0; + m_listOfElement[utf8Value].posStop.v = (etkFloat_t)(y+h) / 512.0; + m_listOfElement[utf8Value].ratio = (etkFloat_t)w/(etkFloat_t)h; } else { EWOL_ERROR("not manage glyph with ID > 0x7F line : " << lineID); } @@ -351,17 +351,17 @@ void ewol::DrawText(int32_t fontID, glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, listLoadedFonts[fontID]->GetOglId(displayMode)); - float posDrawX = drawPosition.x; + etkFloat_t posDrawX = drawPosition.x; while(*tmpVal != '\0') { int32_t tmpChar = (int32_t)*tmpVal; if (tmpChar >= 0x80) { tmpChar = 0; } - float sizeWidth = size * listOfElement[tmpChar].ratio; + etkFloat_t sizeWidth = size * listOfElement[tmpChar].ratio; if (tmpChar != 0x20) { // TODO : this is really not availlable in the OpenGL ES ==> make with vertex system ... glBegin(GL_QUADS); - //m_listOfElement[utf8Value].ratio = (float)w/(float)h; + //m_listOfElement[utf8Value].ratio = (etkFloat_t)w/(etkFloat_t)h; glTexCoord2f(listOfElement[tmpChar].posStart.u, listOfElement[tmpChar].posStart.v); glVertex3f(posDrawX, drawPosition.y, 0.0); glTexCoord2f(listOfElement[tmpChar].posStop.u, listOfElement[tmpChar].posStart.v); glVertex3f(posDrawX + sizeWidth, drawPosition.y, 0.0); glTexCoord2f(listOfElement[tmpChar].posStop.u, listOfElement[tmpChar].posStop.v); glVertex3f(posDrawX + sizeWidth, drawPosition.y + size, 0.0); @@ -403,13 +403,13 @@ void ewol::DrawText(int32_t fontID, // set id of texture ... (i kwnow it was a little dangerous, but this ID is never remove while the program is running... fontTextureId = listLoadedFonts[fontID]->GetOglId(displayMode); - float posDrawX = drawPosition.x; + etkFloat_t posDrawX = drawPosition.x; while(*tmpVal != '\0') { int32_t tmpChar = (int32_t)*tmpVal; if (tmpChar >= 0x80) { tmpChar = 0; } - float sizeWidth = size * listOfElement[tmpChar].ratio; + etkFloat_t sizeWidth = size * listOfElement[tmpChar].ratio; if (tmpChar != 0x20) { coordTex.PushBack(listOfElement[tmpChar].posStart); texCoord_ts tmpTex; diff --git a/Sources/ewolFontFreeType.cpp b/Sources/ewolFontFreeType.cpp index d5432766..9d668ee7 100644 --- a/Sources/ewolFontFreeType.cpp +++ b/Sources/ewolFontFreeType.cpp @@ -54,7 +54,7 @@ extern "C" int32_t width; texCoord_ts posStart; texCoord_ts posStop; - float ratio; + etkFloat_t ratio; }freeTypeFontElement_ts; }; @@ -296,10 +296,10 @@ class FTFontInternal } } listElement[iii].width = glyphMaxWidth; - listElement[iii].posStart.u = (double)(tmpRowId *glyphMaxWidth) / (double)textureWidth; - listElement[iii].posStart.v = (double)(tmpLineId*glyphMaxHeight) / (double)textureHeight; - listElement[iii].posStop.u = (double)(tmpRowId *glyphMaxWidth + glyphMaxWidth) / (double)textureWidth;; - listElement[iii].posStop.v = (double)(tmpLineId*glyphMaxHeight + glyphMaxHeight) / (double)textureHeight; + listElement[iii].posStart.u = (etkFloat_t)(tmpRowId *glyphMaxWidth) / (etkFloat_t)textureWidth; + listElement[iii].posStart.v = (etkFloat_t)(tmpLineId*glyphMaxHeight) / (etkFloat_t)textureHeight; + listElement[iii].posStop.u = (etkFloat_t)(tmpRowId *glyphMaxWidth + glyphMaxWidth) / (etkFloat_t)textureWidth;; + listElement[iii].posStop.v = (etkFloat_t)(tmpLineId*glyphMaxHeight + glyphMaxHeight) / (etkFloat_t)textureHeight; } // Now We Just Setup Some Texture Parameters. glBindTexture( GL_TEXTURE_2D, textureId); @@ -495,13 +495,13 @@ void ewol::DrawText(int32_t fontID, fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t size = m_listLoadedFont[fontID]->GetSize(); - float posDrawX = drawPosition.x; + etkFloat_t posDrawX = drawPosition.x; while(*unicodeString != 0) { int32_t tmpChar = *unicodeString++; if (tmpChar >= 0x80) { tmpChar = 0; } - float sizeWidth = listOfElement[tmpChar].width; + etkFloat_t sizeWidth = listOfElement[tmpChar].width; if (tmpChar != 0x20) { // set texture coordonates : coordTex.PushBack(listOfElement[tmpChar].posStart); @@ -563,7 +563,7 @@ void ewol::DrawText(int32_t fontID, fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t size = m_listLoadedFont[fontID]->GetSize(); - float posDrawX = drawPosition.x; + etkFloat_t posDrawX = drawPosition.x; while(*tmpVal != 0) { int32_t tmpChar = *tmpVal++; int32_t charIndex; @@ -583,7 +583,7 @@ void ewol::DrawText(int32_t fontID, // TODO : Update if possible the mapping charIndex = 0; } - float sizeWidth = listOfElement[charIndex].width; + etkFloat_t sizeWidth = listOfElement[charIndex].width; // 0x01 == 0x20 == ' '; if (tmpChar != 0x01) { // set texture coordonates : @@ -623,7 +623,7 @@ int32_t ewol::GetWidth(int32_t fontID, const char * utf8String) etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); char * tmpVal = (char*)utf8String; - float posDrawX = 0.0; + etkFloat_t posDrawX = 0.0; while(*tmpVal != 0) { int32_t tmpChar = *tmpVal++; int32_t charIndex; diff --git a/Sources/ewolOObject.h b/Sources/ewolOObject.h index 605192ad..d3fbd91f 100644 --- a/Sources/ewolOObject.h +++ b/Sources/ewolOObject.h @@ -52,9 +52,9 @@ namespace ewol { etk::String GetName(void); public: // use to crop element outside the display - virtual void UpdateSize(float sizeX, float sizeY) { }; + virtual void UpdateSize(etkFloat_t sizeX, etkFloat_t sizeY) { }; // Move to the correct position display - virtual void UpdateOrigin(float x, float y) { }; + virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y) { }; private: etk::String m_name; }; diff --git a/Sources/ewolOObject2DColored.cpp b/Sources/ewolOObject2DColored.cpp index b898ba50..010f5590 100644 --- a/Sources/ewolOObject2DColored.cpp +++ b/Sources/ewolOObject2DColored.cpp @@ -56,8 +56,8 @@ void ewol::OObject2DColored::Draw(void) // Set the vertex pointer to our vertex data - glVertexPointer(2, GL_FLOAT, 0, &m_coord[0] ); - glColorPointer(4, GL_FLOAT, 0, &m_coordColor[0] ); + glVertexPointer(2, oglTypeFloat_t, 0, &m_coord[0] ); + glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] ); // Render : draw all of the triangles at once glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); //glDrawElements( GL_TRIANGLES, 0, m_coord.Size()); @@ -70,7 +70,7 @@ void ewol::OObject2DColored::Draw(void) } -void ewol::OObject2DColored::UpdateOrigin(float x, float y) +void ewol::OObject2DColored::UpdateOrigin(etkFloat_t x, etkFloat_t y) { for (int32_t iii=0; iii & input, etk::VectorType " << output.Size() ); } -void SutherlandHodgman(etk::VectorType & input, etk::VectorType & output, float sx, float sy, float ex, float ey) +void SutherlandHodgman(etk::VectorType & input, etk::VectorType & output, etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey) { // with Sutherland-Hodgman-Algorithm if (input.Size() <0) { @@ -113,8 +113,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType OUT "); //new point intersection ... //y=aaax+bbb - float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); - float bbb = lastElement.y - (aaa*lastElement.x); + etkFloat_t aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); + etkFloat_t bbb = lastElement.y - (aaa*lastElement.x); destPoint.y = aaa*sx + bbb; destPoint.x = sx; output.PushBack(destPoint); @@ -130,8 +130,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType IN "); //new point intersection ... //y=aaax+bbb - float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); - float bbb = lastElement.y - (aaa*lastElement.x); + etkFloat_t aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); + etkFloat_t bbb = lastElement.y - (aaa*lastElement.x); destPoint.y = aaa*sx + bbb; destPoint.x = sx; output.PushBack(destPoint); @@ -158,8 +158,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType OUT "); //new point intersection ... //x=aaay+bbb - float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); - float bbb = lastElement.x - (aaa*lastElement.y); + etkFloat_t aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); + etkFloat_t bbb = lastElement.x - (aaa*lastElement.y); destPoint.y = sy; destPoint.x = sy*aaa + bbb; output.PushBack(destPoint); @@ -175,8 +175,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType IN "); //new point intersection ... //y=aaax+bbb - float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); - float bbb = lastElement.x - (aaa*lastElement.y); + etkFloat_t aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); + etkFloat_t bbb = lastElement.x - (aaa*lastElement.y); destPoint.y = sy; destPoint.x = sy*aaa + bbb; output.PushBack(destPoint); @@ -203,8 +203,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType OUT "); //new point intersection ... //y=aaax+bbb - float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); - float bbb = lastElement.y - (aaa*lastElement.x); + etkFloat_t aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); + etkFloat_t bbb = lastElement.y - (aaa*lastElement.x); destPoint.y = aaa*ex + bbb; destPoint.x = ex; output.PushBack(destPoint); @@ -220,8 +220,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType IN "); //new point intersection ... //y=aaax+bbb - float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); - float bbb = lastElement.y - (aaa*lastElement.x); + etkFloat_t aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); + etkFloat_t bbb = lastElement.y - (aaa*lastElement.x); destPoint.y = aaa*ex + bbb; destPoint.x = ex; output.PushBack(destPoint); @@ -247,8 +247,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType OUT "); //new point intersection ... //x=aaay+bbb - float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); - float bbb = lastElement.x - (aaa*lastElement.y); + etkFloat_t aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); + etkFloat_t bbb = lastElement.x - (aaa*lastElement.y); destPoint.y = ey; destPoint.x = ey*aaa + bbb; output.PushBack(destPoint); @@ -264,8 +264,8 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType IN "); //new point intersection ... //y=aaax+bbb - float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); - float bbb = lastElement.x - (aaa*lastElement.y); + etkFloat_t aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); + etkFloat_t bbb = lastElement.x - (aaa*lastElement.y); destPoint.y = ey; destPoint.x = ey*aaa + bbb; output.PushBack(destPoint); @@ -283,7 +283,7 @@ void SutherlandHodgman(etk::VectorType & input, etk::VectorType coord = m_coord; @@ -353,7 +353,7 @@ void ewol::OObject2DColored::SetColor(color_ts color) } -void ewol::OObject2DColored::SetColor(float red, float green, float blue, float alpha) +void ewol::OObject2DColored::SetColor(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha) { if (m_triElement < 1) { m_color[0].red = red; @@ -385,7 +385,7 @@ void ewol::OObject2DColored::SetPoint(coord2D_ts point) } } -void ewol::OObject2DColored::SetPoint(float x, float y) +void ewol::OObject2DColored::SetPoint(etkFloat_t x, etkFloat_t y) { m_triangle[m_triElement].x = x; m_triangle[m_triElement].y = y; @@ -403,7 +403,7 @@ void ewol::OObject2DColored::ResetCount(void) m_color[2] = m_color[0]; } -void ewol::OObject2DColored::Line(float sx, float sy, float ex, float ey, float thickness) +void ewol::OObject2DColored::Line(etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey, etkFloat_t thickness) { ResetCount(); if (sx == ex && sy == ey) { @@ -411,7 +411,7 @@ void ewol::OObject2DColored::Line(float sx, float sy, float ex, float ey, float return; } //teta = tan-1(oposer/adjacent) - double teta = 0; + etkFloat_t teta = 0; if (sx <= ex) { teta = atan((ey-sy)/(ex-sx)); } else { @@ -423,8 +423,8 @@ void ewol::OObject2DColored::Line(float sx, float sy, float ex, float ey, float teta -= 2*M_PI; } //EWOL_DEBUG("teta = " << (teta*180/(M_PI)) << " deg." ); - double offsety = sin(teta-M_PI/2) * (thickness/2); - double offsetx = cos(teta-M_PI/2) * (thickness/2); + etkFloat_t offsety = sin(teta-M_PI/2) * (thickness/2); + etkFloat_t offsetx = cos(teta-M_PI/2) * (thickness/2); SetPoint(sx - offsetx, sy - offsety); SetPoint(sx + offsetx, sy + offsety); @@ -436,7 +436,7 @@ void ewol::OObject2DColored::Line(float sx, float sy, float ex, float ey, float } -void ewol::OObject2DColored::Rectangle(float x, float y, float w, float h) +void ewol::OObject2DColored::Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h) { ResetCount(); @@ -450,7 +450,7 @@ void ewol::OObject2DColored::Rectangle(float x, float y, float w, float h) } -void ewol::OObject2DColored::Circle(float x, float y, float radius, float thickness) +void ewol::OObject2DColored::Circle(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t thickness) { ResetCount(); if (radius<0) { @@ -466,17 +466,17 @@ void ewol::OObject2DColored::Circle(float x, float y, float radius, float thickn } for (int32_t iii=0; iii m_coord; //!< internal coord of the object etk::VectorType m_coordTex; //!< internal texture coordinate for every point public: - virtual void UpdateOrigin(float x, float y); + virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y); }; }; diff --git a/Sources/ewolOObject2DTextured.cpp b/Sources/ewolOObject2DTextured.cpp index de0d421d..ec3a0fbd 100644 --- a/Sources/ewolOObject2DTextured.cpp +++ b/Sources/ewolOObject2DTextured.cpp @@ -54,8 +54,8 @@ void ewol::OObject2DTextured::Draw(void) glBindTexture(GL_TEXTURE_2D, m_textureId); glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays - glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] ); - glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] ); + glVertexPointer( 2, oglTypeFloat_t, 0, &m_coord[0] ); + glTexCoordPointer( 2, oglTypeFloat_t, 0, &m_coordTex[0] ); glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); //EWOL_DEBUG("request draw of " << m_coord.Size() << " elements"); glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays @@ -63,7 +63,7 @@ void ewol::OObject2DTextured::Draw(void) glDisable(GL_TEXTURE_2D); } -void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY) +void ewol::OObject2DTextured::Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t texX, etkFloat_t texY, etkFloat_t texSX, etkFloat_t texSY) { //EWOL_DEBUG("Add rectangle : ..."); coord2D_ts point; @@ -110,7 +110,7 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa m_coordTex.PushBack(tex); } -void ewol::OObject2DTextured::UpdateOrigin(float x, float y) +void ewol::OObject2DTextured::UpdateOrigin(etkFloat_t x, etkFloat_t y) { for (int32_t iii=0; iii m_coord; //!< internal coord of the object etk::VectorType m_coordTex; //!< internal texture coordinate for every point public: - virtual void UpdateOrigin(float x, float y); + virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y); }; }; diff --git a/Sources/ewolWidget.cpp b/Sources/ewolWidget.cpp index 457bd10f..dffb8c41 100644 --- a/Sources/ewolWidget.cpp +++ b/Sources/ewolWidget.cpp @@ -51,7 +51,7 @@ ewol::Widget::~Widget(void) -bool ewol::Widget::CalculateSize(double availlableX, double availlableY) +bool ewol::Widget::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) { m_size.x = availlableX; m_size.y = availlableY; @@ -59,7 +59,7 @@ bool ewol::Widget::CalculateSize(double availlableX, double availlableY) } -bool ewol::Widget::GenEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y) +bool ewol::Widget::GenEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { bool ended = false; for(int32_t iii=m_inputEvent.Size()-1; iii>=0; iii--) { diff --git a/Sources/ewolWidget.h b/Sources/ewolWidget.h index f374d8b1..5dc74211 100644 --- a/Sources/ewolWidget.h +++ b/Sources/ewolWidget.h @@ -33,8 +33,8 @@ namespace ewol { extern "C" { typedef struct { - double x; - double y; + etkFloat_t x; + etkFloat_t y; } coord; } typedef enum { @@ -155,14 +155,14 @@ namespace ewol { bool m_userExpendX; bool m_userExpendY; public: - void SetOrigin(double x, double y) { m_origin.x=x; m_origin.y=y; }; + void SetOrigin(etkFloat_t x, etkFloat_t y) { m_origin.x=x; m_origin.y=y; }; coord GetOrigin(void) { return m_origin; }; - virtual bool CalculateSize(double availlableX, double availlableY); // this generate the current size ... + virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY); // this generate the current size ... virtual bool CalculateMinSize(void) {m_minSize.x = m_userMinSize.x; m_minSize.y = m_userMinSize.y; return true; }; //update the min Size ... and the expend parameters for the sizer - virtual void SetMinSise(double x=-1, double y=-1) { m_userMinSize.x = x; m_userMinSize.y = y; }; + virtual void SetMinSise(etkFloat_t x=-1, etkFloat_t y=-1) { m_userMinSize.x = x; m_userMinSize.y = y; }; coord GetMinSize(void) { return m_minSize; }; coord GetSize(void) { return m_size; }; - void SetCurrentSise(double x=-1, double y=-1) { m_size.x = x; m_size.y = y; }; + void SetCurrentSise(etkFloat_t x=-1, etkFloat_t y=-1) { m_size.x = x; m_size.y = y; }; coord GetCurrentSize(void) { return m_size; }; virtual void SetExpendX(bool newExpend=false) { m_userExpendX = newExpend; }; bool CanExpentX(void) { return m_userExpendX; }; @@ -215,7 +215,7 @@ namespace ewol { etk::VectorType m_inputEvent; //!< generic area and short-cut event public: // external acces to set an input event on this widget. - bool GenEventInput(int32_t IdInput, eventInputType_te typeEvent, double X, double Y); // call when input event arrive and call OnEventInput, if no event detected + bool GenEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t X, etkFloat_t Y); // call when input event arrive and call OnEventInput, if no event detected bool GenEventShortCut(bool shift, bool control, bool alt, bool pomme, char UTF8_data[UTF8_MAX_SIZE]); protected: void EventAreaRemoveAll(void) { m_inputEvent.Clear(); }; @@ -226,10 +226,10 @@ namespace ewol { // to link an extern widget at the internal event of this one it will access by here : bool ExternLinkOnEvent(const char * eventName, int32_t widgetId); protected: - virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double X, double Y) { return false; }; - virtual bool OnEventArea(const char * generateEventId, double x, double y) { return false; }; + virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t X, etkFloat_t Y) { return false; }; + virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y) { return false; }; // when an event arrive from an other widget, it will arrive here: - virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, double x, double y) { return false; }; + virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, etkFloat_t x, etkFloat_t y) { return false; }; // ---------------------------------------------------------------------------------------------------------------- // -- Keboard event (when one is present or when a graphical is present diff --git a/Sources/ewolWindows.cpp b/Sources/ewolWindows.cpp index 5c658226..e8ed84e5 100644 --- a/Sources/ewolWindows.cpp +++ b/Sources/ewolWindows.cpp @@ -90,7 +90,7 @@ ewol::Windows::~Windows(void) } } -bool ewol::Windows::CalculateSize(double availlableX, double availlableY) +bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) { m_size.x = availlableX; m_size.y = availlableY; @@ -106,7 +106,7 @@ bool ewol::Windows::CalculateSize(double availlableX, double availlableY) } -bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y) +bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { if (true == m_hasDecoration) { if( x >= 60 @@ -189,7 +189,7 @@ bool ewol::Windows::OnDraw(void) return true; } -bool ewol::Windows::OnEventArea(const char * generateEventId, double x, double y) +bool ewol::Windows::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y) { bool eventIsOK = false; //EWOL_DEBUG("Receive event : \"" << generateEventId << "\""); diff --git a/Sources/ewolWindows.h b/Sources/ewolWindows.h index ab8d91b5..d2269b11 100644 --- a/Sources/ewolWindows.h +++ b/Sources/ewolWindows.h @@ -51,11 +51,11 @@ namespace ewol { virtual void OnReduce(void) { }; virtual void On(void) { }; // from Widget management : - virtual bool CalculateSize(double availlableX, double availlableY); - virtual bool OnEventArea(const char * generateEventId, double x, double y); + virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY); + virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y); // Widget overwrite function public: - virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y); + virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); private: bool m_hasDecoration; public: diff --git a/Sources/widget/ewolButton.cpp b/Sources/widget/ewolButton.cpp index 0b2eaa93..bcc2a19c 100644 --- a/Sources/widget/ewolButton.cpp +++ b/Sources/widget/ewolButton.cpp @@ -121,14 +121,14 @@ void ewol::Button::OnRegenerateDisplay(void) } /* -bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y) +bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { EWOL_DEBUG("Event on BT ..."); return true; } */ -bool ewol::Button::OnEventArea(const char * generateEventId, double x, double y) +bool ewol::Button::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y) { bool eventIsOK = false; //EWOL_DEBUG("Receive event : \"" << generateEventId << "\""); diff --git a/Sources/widget/ewolButton.h b/Sources/widget/ewolButton.h index c88addfe..62e521ff 100644 --- a/Sources/widget/ewolButton.h +++ b/Sources/widget/ewolButton.h @@ -49,8 +49,8 @@ namespace ewol { public: virtual void OnRegenerateDisplay(void); public: - //virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y); - virtual bool OnEventArea(const char * generateEventId, double x, double y); + //virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); + virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y); }; }; diff --git a/Sources/widget/ewolSizerHori.cpp b/Sources/widget/ewolSizerHori.cpp index 88adf40d..4dcda48a 100644 --- a/Sources/widget/ewolSizerHori.cpp +++ b/Sources/widget/ewolSizerHori.cpp @@ -41,13 +41,13 @@ ewol::SizerHori::~SizerHori(void) } -bool ewol::SizerHori::CalculateSize(double availlableX, double availlableY) +bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) { //EWOL_DEBUG("Update Size"); m_size.x = availlableX; m_size.y = availlableY; // calculate unExpendable Size : - double unexpendableSize=0.0; + etkFloat_t unexpendableSize=0.0; int32_t nbWidgetFixedSize=0; int32_t nbWidgetNotFixedSize=0; for (int32_t iii=0; iii