Change double and float in etkFloat_t to abstarct the precision of the display

This commit is contained in:
Edouard Dupin 2011-11-10 18:23:19 +01:00
parent 1cabc7310b
commit 1aa8310c45
24 changed files with 182 additions and 174 deletions

View File

@ -356,17 +356,17 @@ namespace guiAbstraction {
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); 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); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glTranslatef(0, 0, -5); glTranslatef(0, 0, -5);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glColor3f(1., 0., 0.); glVertex3f( .25*(float)m_width, .25*(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*(float)m_width, .25*(float)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*(float)m_width, .75*(float)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*(float)m_width, .75*(float)m_height, 0.); glColor3f(1., 1., 0.); glVertex3f( .25*(etkFloat_t)m_width, .75*(etkFloat_t)m_height, 0.);
glEnd(); glEnd();
} else { } else {
m_uniqueWindows->SysDraw(); m_uniqueWindows->SysDraw();
@ -416,7 +416,7 @@ namespace guiAbstraction {
{ {
m_uniqueWindows = newWindows; m_uniqueWindows = newWindows;
if (NULL != m_uniqueWindows) { 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: case ConfigureNotify:
EWOL_DEBUG("X11 event : " << event.type << " = \"ConfigureNotify\" Origin(" << event.xconfigure.x << "," << event.xconfigure.y << ") Size(" << event.xconfigure.width << "," << event.xconfigure.height << ")"); 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); m_uniqueWindows->SetOrigin(event.xconfigure.x, event.xconfigure.y);
break; break;
case Expose: case Expose:
@ -492,9 +492,9 @@ namespace guiAbstraction {
m_moveMode = false; m_moveMode = false;
m_resizeMode = false; m_resizeMode = false;
int32_t btId = event.xbutton.button; 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 // 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 ... // Check double or triple click event ...
m_previousDown_x = event.xbutton.x; m_previousDown_x = event.xbutton.x;
m_previousDown_y = event.xbutton.y; m_previousDown_y = event.xbutton.y;
@ -523,9 +523,9 @@ namespace guiAbstraction {
m_moveMode = false; m_moveMode = false;
m_resizeMode = false; m_resizeMode = false;
int32_t btId = event.xbutton.button; 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 ... // 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) { if (m_previousBouttonId != btId) {
m_previousDown_x = -1; m_previousDown_x = -1;
@ -544,8 +544,8 @@ namespace guiAbstraction {
&& abs(m_previousDown_y - event.xbutton.y) < 5 ) && abs(m_previousDown_y - event.xbutton.y) < 5 )
{ {
// might generate an sigle event : // might generate an sigle event :
//EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedSingle\" (" << (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, (double)event.xbutton.x, (double)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_x = m_previousDown_x;
m_previous_y = m_previousDown_y; m_previous_y = m_previousDown_y;
m_previousTime = currentTime; m_previousTime = currentTime;
@ -566,13 +566,13 @@ namespace guiAbstraction {
{ {
// might generate an sigle event : // might generate an sigle event :
if (false == m_previousDouble) { if (false == m_previousDouble) {
//EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedDouble\" (" << (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, (double)event.xbutton.x, (double)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_previousTime = currentTime;
m_previousDouble = true; m_previousDouble = true;
} else { } else {
//EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonClockedTriple\" (" << (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, (double)event.xbutton.x, (double)event.xbutton.y); m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)event.xbutton.x, (etkFloat_t)event.xbutton.y);
// reset values ... // reset values ...
m_previousDown_x = -1; m_previousDown_x = -1;
m_previousDown_y = -1; m_previousDown_y = -1;
@ -601,8 +601,8 @@ namespace guiAbstraction {
case EnterNotify: case EnterNotify:
m_resizeMode = false; m_resizeMode = false;
m_moveMode = false; m_moveMode = false;
//EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (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, (double)event.xcrossing.x, (double)event.xcrossing.y); m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
break; break;
case MotionNotify: case MotionNotify:
if (true == m_resizeMode) { if (true == m_resizeMode) {
@ -618,15 +618,15 @@ namespace guiAbstraction {
//EWOL_DEBUG("Change POS : (" << (m_startY - m_screenOffsetX) << "," << (m_startY - m_screenOffsetY) << ") ==> (" << newPosX << "," << newPosY << ")"); //EWOL_DEBUG("Change POS : (" << (m_startY - m_screenOffsetX) << "," << (m_startY - m_screenOffsetY) << ") ==> (" << newPosX << "," << newPosY << ")");
this->ChangePos(newPosX, newPosY); this->ChangePos(newPosX, newPosY);
} else { } else {
//EWOL_DEBUG("X11 event : " << event.type << " = \"MotionNotify\" (" << (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, (double)event.xmotion.x, (double)event.xmotion.y); m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)event.xmotion.x, (etkFloat_t)event.xmotion.y);
} }
break; break;
case LeaveNotify: case LeaveNotify:
m_resizeMode = false; m_resizeMode = false;
m_moveMode = false; m_moveMode = false;
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (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, (double)event.xcrossing.x, (double)event.xcrossing.y); m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_LEAVE, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
break; break;
case FocusIn: case FocusIn:
m_resizeMode = false; m_resizeMode = false;

View File

@ -64,9 +64,17 @@ typedef int32_t uniChar_t;
extern "C" 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{ struct etkPointAndPositionDouble{
double x; etkFloat_t x;
double y; etkFloat_t y;
}; };
struct etkPointAndPositionInt{ struct etkPointAndPositionInt{
@ -80,23 +88,23 @@ extern "C"
typedef etkPointAndPositionInt intSize_ts; typedef etkPointAndPositionInt intSize_ts;
typedef struct { typedef struct {
float x; etkFloat_t x;
float y; etkFloat_t y;
float z; etkFloat_t z;
}coord3D_ts; }coord3D_ts;
typedef struct { typedef struct {
float x; etkFloat_t x;
float y; etkFloat_t y;
}coord2D_ts; }coord2D_ts;
typedef struct { typedef struct {
float u; etkFloat_t u;
float v; etkFloat_t v;
}texCoord_ts; }texCoord_ts;
typedef struct { typedef struct {
float red; etkFloat_t red;
float green; etkFloat_t green;
float blue; etkFloat_t blue;
float alpha; etkFloat_t alpha;
}color_ts; }color_ts;
} }

View File

@ -64,7 +64,7 @@ namespace ewol
etk::VectorType<texCoord_ts> & coordTex); etk::VectorType<texCoord_ts> & coordTex);
int32_t LoadFont(etk::File fontFileName); 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 #endif

View File

@ -48,7 +48,7 @@ extern "C"
typedef struct { typedef struct {
texCoord_ts posStart; texCoord_ts posStart;
texCoord_ts posStop; texCoord_ts posStop;
float ratio; etkFloat_t ratio;
}UTF8Element_ts; }UTF8Element_ts;
} }
@ -152,22 +152,22 @@ namespace ewol
{ {
//EWOL_DEBUG("Find default font glyph : (" << x << "," << y << ") (" << w << "," << h << ") "); //EWOL_DEBUG("Find default font glyph : (" << x << "," << y << ") (" << w << "," << h << ") ");
for (int32_t iii=0; iii< 0x80; iii++) { for (int32_t iii=0; iii< 0x80; iii++) {
m_listOfElement[iii].posStart.u = (double)x / 512.0; m_listOfElement[iii].posStart.u = (etkFloat_t)x / 512.0;
m_listOfElement[iii].posStart.v = (double)y / 512.0; m_listOfElement[iii].posStart.v = (etkFloat_t)y / 512.0;
m_listOfElement[iii].posStop.u = (double)(x+w) / 512.0; m_listOfElement[iii].posStop.u = (etkFloat_t)(x+w) / 512.0;
m_listOfElement[iii].posStop.v = (double)(y+h) / 512.0; m_listOfElement[iii].posStop.v = (etkFloat_t)(y+h) / 512.0;
m_listOfElement[iii].ratio = (float)w/(float)h; 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) 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 << ") "); //EWOL_DEBUG("Add font glyph : "<< utf8Value << " (" << x << "," << y << ") (" << w << "," << h << ") ");
if (utf8Value < 0x80) { if (utf8Value < 0x80) {
m_listOfElement[utf8Value].posStart.u = (double)x / 512.0; m_listOfElement[utf8Value].posStart.u = (etkFloat_t)x / 512.0;
m_listOfElement[utf8Value].posStart.v = (double)y / 512.0; m_listOfElement[utf8Value].posStart.v = (etkFloat_t)y / 512.0;
m_listOfElement[utf8Value].posStop.u = (double)(x+w) / 512.0; m_listOfElement[utf8Value].posStop.u = (etkFloat_t)(x+w) / 512.0;
m_listOfElement[utf8Value].posStop.v = (double)(y+h) / 512.0; m_listOfElement[utf8Value].posStop.v = (etkFloat_t)(y+h) / 512.0;
m_listOfElement[utf8Value].ratio = (float)w/(float)h; m_listOfElement[utf8Value].ratio = (etkFloat_t)w/(etkFloat_t)h;
} else { } else {
EWOL_ERROR("not manage glyph with ID > 0x7F line : " << lineID); EWOL_ERROR("not manage glyph with ID > 0x7F line : " << lineID);
} }
@ -351,17 +351,17 @@ void ewol::DrawText(int32_t fontID,
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, listLoadedFonts[fontID]->GetOglId(displayMode)); glBindTexture(GL_TEXTURE_2D, listLoadedFonts[fontID]->GetOglId(displayMode));
float posDrawX = drawPosition.x; etkFloat_t posDrawX = drawPosition.x;
while(*tmpVal != '\0') { while(*tmpVal != '\0') {
int32_t tmpChar = (int32_t)*tmpVal; int32_t tmpChar = (int32_t)*tmpVal;
if (tmpChar >= 0x80) { if (tmpChar >= 0x80) {
tmpChar = 0; tmpChar = 0;
} }
float sizeWidth = size * listOfElement[tmpChar].ratio; etkFloat_t sizeWidth = size * listOfElement[tmpChar].ratio;
if (tmpChar != 0x20) { if (tmpChar != 0x20) {
// TODO : this is really not availlable in the OpenGL ES ==> make with vertex system ... // TODO : this is really not availlable in the OpenGL ES ==> make with vertex system ...
glBegin(GL_QUADS); 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].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].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); 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... // 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); fontTextureId = listLoadedFonts[fontID]->GetOglId(displayMode);
float posDrawX = drawPosition.x; etkFloat_t posDrawX = drawPosition.x;
while(*tmpVal != '\0') { while(*tmpVal != '\0') {
int32_t tmpChar = (int32_t)*tmpVal; int32_t tmpChar = (int32_t)*tmpVal;
if (tmpChar >= 0x80) { if (tmpChar >= 0x80) {
tmpChar = 0; tmpChar = 0;
} }
float sizeWidth = size * listOfElement[tmpChar].ratio; etkFloat_t sizeWidth = size * listOfElement[tmpChar].ratio;
if (tmpChar != 0x20) { if (tmpChar != 0x20) {
coordTex.PushBack(listOfElement[tmpChar].posStart); coordTex.PushBack(listOfElement[tmpChar].posStart);
texCoord_ts tmpTex; texCoord_ts tmpTex;

View File

@ -54,7 +54,7 @@ extern "C"
int32_t width; int32_t width;
texCoord_ts posStart; texCoord_ts posStart;
texCoord_ts posStop; texCoord_ts posStop;
float ratio; etkFloat_t ratio;
}freeTypeFontElement_ts; }freeTypeFontElement_ts;
}; };
@ -296,10 +296,10 @@ class FTFontInternal
} }
} }
listElement[iii].width = glyphMaxWidth; listElement[iii].width = glyphMaxWidth;
listElement[iii].posStart.u = (double)(tmpRowId *glyphMaxWidth) / (double)textureWidth; listElement[iii].posStart.u = (etkFloat_t)(tmpRowId *glyphMaxWidth) / (etkFloat_t)textureWidth;
listElement[iii].posStart.v = (double)(tmpLineId*glyphMaxHeight) / (double)textureHeight; listElement[iii].posStart.v = (etkFloat_t)(tmpLineId*glyphMaxHeight) / (etkFloat_t)textureHeight;
listElement[iii].posStop.u = (double)(tmpRowId *glyphMaxWidth + glyphMaxWidth) / (double)textureWidth;; listElement[iii].posStop.u = (etkFloat_t)(tmpRowId *glyphMaxWidth + glyphMaxWidth) / (etkFloat_t)textureWidth;;
listElement[iii].posStop.v = (double)(tmpLineId*glyphMaxHeight + glyphMaxHeight) / (double)textureHeight; listElement[iii].posStop.v = (etkFloat_t)(tmpLineId*glyphMaxHeight + glyphMaxHeight) / (etkFloat_t)textureHeight;
} }
// Now We Just Setup Some Texture Parameters. // Now We Just Setup Some Texture Parameters.
glBindTexture( GL_TEXTURE_2D, textureId); glBindTexture( GL_TEXTURE_2D, textureId);
@ -495,13 +495,13 @@ void ewol::DrawText(int32_t fontID,
fontTextureId = m_listLoadedFont[fontID]->GetOglId(); fontTextureId = m_listLoadedFont[fontID]->GetOglId();
int32_t size = m_listLoadedFont[fontID]->GetSize(); int32_t size = m_listLoadedFont[fontID]->GetSize();
float posDrawX = drawPosition.x; etkFloat_t posDrawX = drawPosition.x;
while(*unicodeString != 0) { while(*unicodeString != 0) {
int32_t tmpChar = *unicodeString++; int32_t tmpChar = *unicodeString++;
if (tmpChar >= 0x80) { if (tmpChar >= 0x80) {
tmpChar = 0; tmpChar = 0;
} }
float sizeWidth = listOfElement[tmpChar].width; etkFloat_t sizeWidth = listOfElement[tmpChar].width;
if (tmpChar != 0x20) { if (tmpChar != 0x20) {
// set texture coordonates : // set texture coordonates :
coordTex.PushBack(listOfElement[tmpChar].posStart); coordTex.PushBack(listOfElement[tmpChar].posStart);
@ -563,7 +563,7 @@ void ewol::DrawText(int32_t fontID,
fontTextureId = m_listLoadedFont[fontID]->GetOglId(); fontTextureId = m_listLoadedFont[fontID]->GetOglId();
int32_t size = m_listLoadedFont[fontID]->GetSize(); int32_t size = m_listLoadedFont[fontID]->GetSize();
float posDrawX = drawPosition.x; etkFloat_t posDrawX = drawPosition.x;
while(*tmpVal != 0) { while(*tmpVal != 0) {
int32_t tmpChar = *tmpVal++; int32_t tmpChar = *tmpVal++;
int32_t charIndex; int32_t charIndex;
@ -583,7 +583,7 @@ void ewol::DrawText(int32_t fontID,
// TODO : Update if possible the mapping // TODO : Update if possible the mapping
charIndex = 0; charIndex = 0;
} }
float sizeWidth = listOfElement[charIndex].width; etkFloat_t sizeWidth = listOfElement[charIndex].width;
// 0x01 == 0x20 == ' '; // 0x01 == 0x20 == ' ';
if (tmpChar != 0x01) { if (tmpChar != 0x01) {
// set texture coordonates : // set texture coordonates :
@ -623,7 +623,7 @@ int32_t ewol::GetWidth(int32_t fontID, const char * utf8String)
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
char * tmpVal = (char*)utf8String; char * tmpVal = (char*)utf8String;
float posDrawX = 0.0; etkFloat_t posDrawX = 0.0;
while(*tmpVal != 0) { while(*tmpVal != 0) {
int32_t tmpChar = *tmpVal++; int32_t tmpChar = *tmpVal++;
int32_t charIndex; int32_t charIndex;

View File

@ -52,9 +52,9 @@ namespace ewol {
etk::String GetName(void); etk::String GetName(void);
public: public:
// use to crop element outside the display // 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 // Move to the correct position display
virtual void UpdateOrigin(float x, float y) { }; virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y) { };
private: private:
etk::String m_name; etk::String m_name;
}; };

View File

@ -56,8 +56,8 @@ void ewol::OObject2DColored::Draw(void)
// Set the vertex pointer to our vertex data // Set the vertex pointer to our vertex data
glVertexPointer(2, GL_FLOAT, 0, &m_coord[0] ); glVertexPointer(2, oglTypeFloat_t, 0, &m_coord[0] );
glColorPointer(4, GL_FLOAT, 0, &m_coordColor[0] ); glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] );
// Render : draw all of the triangles at once // Render : draw all of the triangles at once
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
//glDrawElements( 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<m_coord.Size(); iii++) { for (int32_t iii=0; iii<m_coord.Size(); iii++) {
m_coord[iii].x += x; m_coord[iii].x += x;
@ -92,7 +92,7 @@ void generatePolyGone(etk::VectorType<coord2D_ts> & input, etk::VectorType<coord
//EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() ); //EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() );
} }
void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coord2D_ts> & output, float sx, float sy, float ex, float ey) void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coord2D_ts> & output, etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey)
{ {
// with Sutherland-Hodgman-Algorithm // with Sutherland-Hodgman-Algorithm
if (input.Size() <0) { if (input.Size() <0) {
@ -113,8 +113,8 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
//EWOL_DEBUG("element IN ==> OUT "); //EWOL_DEBUG("element IN ==> OUT ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); etkFloat_t aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x); etkFloat_t bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*sx + bbb; destPoint.y = aaa*sx + bbb;
destPoint.x = sx; destPoint.x = sx;
output.PushBack(destPoint); output.PushBack(destPoint);
@ -130,8 +130,8 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
//EWOL_DEBUG("element OUT ==> IN "); //EWOL_DEBUG("element OUT ==> IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); etkFloat_t aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x); etkFloat_t bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*sx + bbb; destPoint.y = aaa*sx + bbb;
destPoint.x = sx; destPoint.x = sx;
output.PushBack(destPoint); output.PushBack(destPoint);
@ -158,8 +158,8 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
//EWOL_DEBUG("element IN ==> OUT "); //EWOL_DEBUG("element IN ==> OUT ");
//new point intersection ... //new point intersection ...
//x=aaay+bbb //x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); etkFloat_t aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y); etkFloat_t bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = sy; destPoint.y = sy;
destPoint.x = sy*aaa + bbb; destPoint.x = sy*aaa + bbb;
output.PushBack(destPoint); output.PushBack(destPoint);
@ -175,8 +175,8 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
//EWOL_DEBUG("element OUT ==> IN "); //EWOL_DEBUG("element OUT ==> IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); etkFloat_t aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y); etkFloat_t bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = sy; destPoint.y = sy;
destPoint.x = sy*aaa + bbb; destPoint.x = sy*aaa + bbb;
output.PushBack(destPoint); output.PushBack(destPoint);
@ -203,8 +203,8 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
//EWOL_DEBUG("element IN ==> OUT "); //EWOL_DEBUG("element IN ==> OUT ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); etkFloat_t aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x); etkFloat_t bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*ex + bbb; destPoint.y = aaa*ex + bbb;
destPoint.x = ex; destPoint.x = ex;
output.PushBack(destPoint); output.PushBack(destPoint);
@ -220,8 +220,8 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
//EWOL_DEBUG("element OUT ==> IN "); //EWOL_DEBUG("element OUT ==> IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); etkFloat_t aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x); etkFloat_t bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*ex + bbb; destPoint.y = aaa*ex + bbb;
destPoint.x = ex; destPoint.x = ex;
output.PushBack(destPoint); output.PushBack(destPoint);
@ -247,8 +247,8 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
//EWOL_DEBUG("element IN ==> OUT "); //EWOL_DEBUG("element IN ==> OUT ");
//new point intersection ... //new point intersection ...
//x=aaay+bbb //x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); etkFloat_t aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y); etkFloat_t bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = ey; destPoint.y = ey;
destPoint.x = ey*aaa + bbb; destPoint.x = ey*aaa + bbb;
output.PushBack(destPoint); output.PushBack(destPoint);
@ -264,8 +264,8 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
//EWOL_DEBUG("element OUT ==> IN "); //EWOL_DEBUG("element OUT ==> IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); etkFloat_t aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y); etkFloat_t bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = ey; destPoint.y = ey;
destPoint.x = ey*aaa + bbb; destPoint.x = ey*aaa + bbb;
output.PushBack(destPoint); output.PushBack(destPoint);
@ -283,7 +283,7 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
} }
void ewol::OObject2DColored::UpdateSize(float sizeX, float sizeY) void ewol::OObject2DColored::UpdateSize(etkFloat_t sizeX, etkFloat_t sizeY)
{ {
// copy the data // copy the data
etk::VectorType<coord2D_ts> coord = m_coord; etk::VectorType<coord2D_ts> 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) { if (m_triElement < 1) {
m_color[0].red = red; 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].x = x;
m_triangle[m_triElement].y = y; m_triangle[m_triElement].y = y;
@ -403,7 +403,7 @@ void ewol::OObject2DColored::ResetCount(void)
m_color[2] = m_color[0]; 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(); ResetCount();
if (sx == ex && sy == ey) { if (sx == ex && sy == ey) {
@ -411,7 +411,7 @@ void ewol::OObject2DColored::Line(float sx, float sy, float ex, float ey, float
return; return;
} }
//teta = tan-1(oposer/adjacent) //teta = tan-1(oposer/adjacent)
double teta = 0; etkFloat_t teta = 0;
if (sx <= ex) { if (sx <= ex) {
teta = atan((ey-sy)/(ex-sx)); teta = atan((ey-sy)/(ex-sx));
} else { } else {
@ -423,8 +423,8 @@ void ewol::OObject2DColored::Line(float sx, float sy, float ex, float ey, float
teta -= 2*M_PI; teta -= 2*M_PI;
} }
//EWOL_DEBUG("teta = " << (teta*180/(M_PI)) << " deg." ); //EWOL_DEBUG("teta = " << (teta*180/(M_PI)) << " deg." );
double offsety = sin(teta-M_PI/2) * (thickness/2); etkFloat_t offsety = sin(teta-M_PI/2) * (thickness/2);
double offsetx = cos(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);
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(); 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(); ResetCount();
if (radius<0) { 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<nbOcurence; iii++) { for (int32_t iii=0; iii<nbOcurence; iii++) {
double angleOne = 2*M_PI* iii / nbOcurence ; etkFloat_t angleOne = 2*M_PI* iii / nbOcurence ;
double offsetExty = sin(angleOne) * (radius+thickness/2); etkFloat_t offsetExty = sin(angleOne) * (radius+thickness/2);
double offsetExtx = cos(angleOne) * (radius+thickness/2); etkFloat_t offsetExtx = cos(angleOne) * (radius+thickness/2);
double offsetInty = sin(angleOne) * (radius-thickness/2); etkFloat_t offsetInty = sin(angleOne) * (radius-thickness/2);
double offsetIntx = cos(angleOne) * (radius-thickness/2); etkFloat_t offsetIntx = cos(angleOne) * (radius-thickness/2);
double angleTwo = 2*M_PI* (iii+1) / nbOcurence ; etkFloat_t angleTwo = 2*M_PI* (iii+1) / nbOcurence ;
double offsetExt2y = sin(angleTwo) * (radius+thickness/2); etkFloat_t offsetExt2y = sin(angleTwo) * (radius+thickness/2);
double offsetExt2x = cos(angleTwo) * (radius+thickness/2); etkFloat_t offsetExt2x = cos(angleTwo) * (radius+thickness/2);
double offsetInt2y = sin(angleTwo) * (radius-thickness/2); etkFloat_t offsetInt2y = sin(angleTwo) * (radius-thickness/2);
double offsetInt2x = cos(angleTwo) * (radius-thickness/2); etkFloat_t offsetInt2x = cos(angleTwo) * (radius-thickness/2);
SetPoint(x + offsetIntx, y + offsetInty); SetPoint(x + offsetIntx, y + offsetInty);
SetPoint(x + offsetExtx, y + offsetExty); SetPoint(x + offsetExtx, y + offsetExty);
@ -488,7 +488,7 @@ void ewol::OObject2DColored::Circle(float x, float y, float radius, float thickn
} }
} }
void ewol::OObject2DColored::Disc(float x, float y, float radius) void ewol::OObject2DColored::Disc(etkFloat_t x, etkFloat_t y, etkFloat_t radius)
{ {
ResetCount(); ResetCount();
if (radius<0) { if (radius<0) {
@ -503,13 +503,13 @@ void ewol::OObject2DColored::Disc(float x, float y, float radius)
for (int32_t iii=0; iii<nbOcurence; iii++) { for (int32_t iii=0; iii<nbOcurence; iii++) {
SetPoint(x, y); SetPoint(x, y);
double angleOne = 2*M_PI* iii / nbOcurence ; etkFloat_t angleOne = 2*M_PI* iii / nbOcurence ;
double offsety = sin(angleOne) * radius; etkFloat_t offsety = sin(angleOne) * radius;
double offsetx = cos(angleOne) * radius; etkFloat_t offsetx = cos(angleOne) * radius;
SetPoint(x + offsetx, y + offsety); SetPoint(x + offsetx, y + offsety);
double angleTwo = 2*M_PI* (iii+1) / nbOcurence ; etkFloat_t angleTwo = 2*M_PI* (iii+1) / nbOcurence ;
offsety = sin(angleTwo) * radius; offsety = sin(angleTwo) * radius;
offsetx = cos(angleTwo) * radius; offsetx = cos(angleTwo) * radius;

View File

@ -45,23 +45,23 @@ namespace ewol {
void GenerateTriangle(void); void GenerateTriangle(void);
void ResetCount(void); void ResetCount(void);
public: public:
void SetColor(float red, float green, float blue, float alpha = 1.0); void SetColor(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha = 1.0);
void SetColor(color_ts color); void SetColor(color_ts color);
void SetPoint(coord2D_ts point); void SetPoint(coord2D_ts point);
void SetPoint(float x, float y); void SetPoint(etkFloat_t x, etkFloat_t y);
void Line(float sx, float sy, float ex, float ey, float thickness); void Line(etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey, etkFloat_t thickness);
void Rectangle(float x, float y, float w, float h); void Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h);
//void RectangleAngle(float x, float y, float w, float h, float angle); //void RectangleAngle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t angle);
//void RectangleBorder(float x, float y, float w, float h, float thickness); //void RectangleBorder(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t thickness);
//void RectangleBorder(float x, float y, float w, float h, float thickness, float angle); //void RectangleBorder(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t thickness, etkFloat_t angle);
void Circle(float x, float y, float radius, float thickness); void Circle(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t thickness);
//void CirclePart(float x, float y, float radius, float thickness, float angleStart, float angleStop); //void CirclePart(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t thickness, etkFloat_t angleStart, etkFloat_t angleStop);
void Disc(float x, float y, float radius); void Disc(etkFloat_t x, etkFloat_t y, etkFloat_t radius);
//void DiscPart(float x, float y, float radius, float angleStart, float angleStop); //void DiscPart(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t angleStart, etkFloat_t angleStop);
public: public:
// Ewol internal ... : done to update at the origin of the widget ... // Ewol internal ... : done to update at the origin of the widget ...
virtual void UpdateSize(float sizeX, float sizeY); virtual void UpdateSize(etkFloat_t sizeX, etkFloat_t sizeY);
virtual void UpdateOrigin(float x, float y); virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y);
}; };
}; };

View File

@ -67,8 +67,8 @@ void ewol::OObject2DText::Draw(void)
glBindTexture(GL_TEXTURE_2D, m_FontTextureId); glBindTexture(GL_TEXTURE_2D, m_FontTextureId);
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] ); glVertexPointer( 2, oglTypeFloat_t, 0, &m_coord[0] );
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] ); glTexCoordPointer( 2, oglTypeFloat_t, 0, &m_coordTex[0] );
glDrawArrays( GL_QUADS, 0, m_coord.Size()); glDrawArrays( GL_QUADS, 0, m_coord.Size());
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements"); //EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
@ -76,7 +76,7 @@ void ewol::OObject2DText::Draw(void)
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
void ewol::OObject2DText::Text(float x, float y, const char* utf8String) void ewol::OObject2DText::Text(etkFloat_t x, etkFloat_t y, const char* utf8String)
{ {
m_FontTextureId = 0; m_FontTextureId = 0;
m_coord.Clear(); m_coord.Clear();
@ -90,7 +90,7 @@ void ewol::OObject2DText::Text(float x, float y, const char* utf8String)
ewol::DrawText(m_FontId, drawPosition, utf8String, m_FontTextureId, m_coord, m_coordTex); ewol::DrawText(m_FontId, drawPosition, utf8String, m_FontTextureId, m_coord, m_coordTex);
} }
void ewol::OObject2DText::UpdateOrigin(float x, float y) void ewol::OObject2DText::UpdateOrigin(etkFloat_t x, etkFloat_t y)
{ {
for (int32_t iii=0; iii<m_coord.Size(); iii++) { for (int32_t iii=0; iii<m_coord.Size(); iii++) {
m_coord[iii].x += x; m_coord[iii].x += x;

View File

@ -37,7 +37,7 @@ namespace ewol {
public: public:
virtual void Draw(void); virtual void Draw(void);
// set a specific text // set a specific text
void Text(float x, float y, const char* utf8String); void Text(etkFloat_t x, etkFloat_t y, const char* utf8String);
protected: protected:
int32_t m_FontId; //!< font internal ID int32_t m_FontId; //!< font internal ID
color_ts m_textColorFg; //!< text color ... color_ts m_textColorFg; //!< text color ...
@ -45,7 +45,7 @@ namespace ewol {
etk::VectorType<coord2D_ts> m_coord; //!< internal coord of the object etk::VectorType<coord2D_ts> m_coord; //!< internal coord of the object
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
public: public:
virtual void UpdateOrigin(float x, float y); virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y);
}; };
}; };

View File

@ -54,8 +54,8 @@ void ewol::OObject2DTextured::Draw(void)
glBindTexture(GL_TEXTURE_2D, m_textureId); glBindTexture(GL_TEXTURE_2D, m_textureId);
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] ); glVertexPointer( 2, oglTypeFloat_t, 0, &m_coord[0] );
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] ); glTexCoordPointer( 2, oglTypeFloat_t, 0, &m_coordTex[0] );
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements"); //EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
@ -63,7 +63,7 @@ void ewol::OObject2DTextured::Draw(void)
glDisable(GL_TEXTURE_2D); 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 : ..."); //EWOL_DEBUG("Add rectangle : ...");
coord2D_ts point; coord2D_ts point;
@ -110,7 +110,7 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
m_coordTex.PushBack(tex); 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.Size(); iii++) { for (int32_t iii=0; iii<m_coord.Size(); iii++) {
m_coord[iii].x += x; m_coord[iii].x += x;

View File

@ -35,13 +35,13 @@ namespace ewol {
virtual ~OObject2DTextured(void); virtual ~OObject2DTextured(void);
public: public:
virtual void Draw(void); virtual void Draw(void);
void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0); void Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t texX=0.0, etkFloat_t texY=0.0, etkFloat_t texSX=1.0, etkFloat_t texSY=1.0);
protected: protected:
uint32_t m_textureId; //!< texture internal ID uint32_t m_textureId; //!< texture internal ID
etk::VectorType<coord2D_ts> m_coord; //!< internal coord of the object etk::VectorType<coord2D_ts> m_coord; //!< internal coord of the object
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
public: public:
virtual void UpdateOrigin(float x, float y); virtual void UpdateOrigin(etkFloat_t x, etkFloat_t y);
}; };
}; };

View File

@ -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.x = availlableX;
m_size.y = availlableY; 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; bool ended = false;
for(int32_t iii=m_inputEvent.Size()-1; iii>=0; iii--) { for(int32_t iii=m_inputEvent.Size()-1; iii>=0; iii--) {

View File

@ -33,8 +33,8 @@
namespace ewol { namespace ewol {
extern "C" { extern "C" {
typedef struct { typedef struct {
double x; etkFloat_t x;
double y; etkFloat_t y;
} coord; } coord;
} }
typedef enum { typedef enum {
@ -155,14 +155,14 @@ namespace ewol {
bool m_userExpendX; bool m_userExpendX;
bool m_userExpendY; bool m_userExpendY;
public: 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; }; 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 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 GetMinSize(void) { return m_minSize; };
coord GetSize(void) { return m_size; }; 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; }; coord GetCurrentSize(void) { return m_size; };
virtual void SetExpendX(bool newExpend=false) { m_userExpendX = newExpend; }; virtual void SetExpendX(bool newExpend=false) { m_userExpendX = newExpend; };
bool CanExpentX(void) { return m_userExpendX; }; bool CanExpentX(void) { return m_userExpendX; };
@ -215,7 +215,7 @@ namespace ewol {
etk::VectorType<event_ts> m_inputEvent; //!< generic area and short-cut event etk::VectorType<event_ts> m_inputEvent; //!< generic area and short-cut event
public: public:
// external acces to set an input event on this widget. // 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]); bool GenEventShortCut(bool shift, bool control, bool alt, bool pomme, char UTF8_data[UTF8_MAX_SIZE]);
protected: protected:
void EventAreaRemoveAll(void) { m_inputEvent.Clear(); }; 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 : // 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); bool ExternLinkOnEvent(const char * eventName, int32_t widgetId);
protected: protected:
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, 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, double x, double 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: // 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 // -- Keboard event (when one is present or when a graphical is present

View File

@ -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.x = availlableX;
m_size.y = availlableY; 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 (true == m_hasDecoration) {
if( x >= 60 if( x >= 60
@ -189,7 +189,7 @@ bool ewol::Windows::OnDraw(void)
return true; 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; bool eventIsOK = false;
//EWOL_DEBUG("Receive event : \"" << generateEventId << "\""); //EWOL_DEBUG("Receive event : \"" << generateEventId << "\"");

View File

@ -51,11 +51,11 @@ namespace ewol {
virtual void OnReduce(void) { }; virtual void OnReduce(void) { };
virtual void On(void) { }; virtual void On(void) { };
// from Widget management : // from Widget management :
virtual bool CalculateSize(double availlableX, double availlableY); virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY);
virtual bool OnEventArea(const char * generateEventId, double x, double y); virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y);
// Widget overwrite function // Widget overwrite function
public: 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: private:
bool m_hasDecoration; bool m_hasDecoration;
public: public:

View File

@ -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 ..."); EWOL_DEBUG("Event on BT ...");
return true; 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; bool eventIsOK = false;
//EWOL_DEBUG("Receive event : \"" << generateEventId << "\""); //EWOL_DEBUG("Receive event : \"" << generateEventId << "\"");

View File

@ -49,8 +49,8 @@ namespace ewol {
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
public: 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);
virtual bool OnEventArea(const char * generateEventId, double x, double y); virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y);
}; };
}; };

View File

@ -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"); //EWOL_DEBUG("Update Size");
m_size.x = availlableX; m_size.x = availlableX;
m_size.y = availlableY; m_size.y = availlableY;
// calculate unExpendable Size : // calculate unExpendable Size :
double unexpendableSize=0.0; etkFloat_t unexpendableSize=0.0;
int32_t nbWidgetFixedSize=0; int32_t nbWidgetFixedSize=0;
int32_t nbWidgetNotFixedSize=0; int32_t nbWidgetNotFixedSize=0;
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
@ -61,7 +61,7 @@ bool ewol::SizerHori::CalculateSize(double availlableX, double availlableY)
} }
} }
} }
double sizeToAddAtEveryOne = 0; etkFloat_t sizeToAddAtEveryOne = 0;
// 2 cases : 1 or more can Expend, or all is done ... // 2 cases : 1 or more can Expend, or all is done ...
if (0 != nbWidgetNotFixedSize) { if (0 != nbWidgetNotFixedSize) {
sizeToAddAtEveryOne = (m_size.x - unexpendableSize) / nbWidgetNotFixedSize; sizeToAddAtEveryOne = (m_size.x - unexpendableSize) / nbWidgetNotFixedSize;
@ -120,7 +120,7 @@ bool ewol::SizerHori::CalculateMinSize(void)
return true; return true;
} }
void ewol::SizerHori::SetMinSise(double x, double y) void ewol::SizerHori::SetMinSise(etkFloat_t x, etkFloat_t y)
{ {
EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)"); EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)");
} }
@ -213,7 +213,7 @@ void ewol::SizerHori::OnRegenerateDisplay(void)
} }
bool ewol::SizerHori::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y) bool ewol::SizerHori::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
{ {
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[iii]) { if (NULL != m_subWidget[iii]) {

View File

@ -36,9 +36,9 @@ namespace ewol {
SizerHori(void); SizerHori(void);
virtual ~SizerHori(void); virtual ~SizerHori(void);
public: public:
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); //update the min Size ... and the expend parameters for the sizer virtual bool CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer
virtual void SetMinSise(double x=-1, double y=-1); virtual void SetMinSise(etkFloat_t x=-1, etkFloat_t y=-1);
virtual void SetExpendX(bool newExpend=false); virtual void SetExpendX(bool newExpend=false);
virtual void SetExpendY(bool newExpend=false); virtual void SetExpendY(bool newExpend=false);
private: private:
@ -53,7 +53,7 @@ namespace ewol {
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
public: 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);
}; };
}; };

View File

@ -42,13 +42,13 @@ ewol::SizerVert::~SizerVert(void)
} }
bool ewol::SizerVert::CalculateSize(double availlableX, double availlableY) bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
{ {
//EWOL_DEBUG("Update Size"); //EWOL_DEBUG("Update Size");
m_size.x = availlableX; m_size.x = availlableX;
m_size.y = availlableY; m_size.y = availlableY;
// calculate unExpendable Size : // calculate unExpendable Size :
double unexpendableSize=0.0; etkFloat_t unexpendableSize=0.0;
int32_t nbWidgetFixedSize=0; int32_t nbWidgetFixedSize=0;
int32_t nbWidgetNotFixedSize=0; int32_t nbWidgetNotFixedSize=0;
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
@ -63,7 +63,7 @@ bool ewol::SizerVert::CalculateSize(double availlableX, double availlableY)
} }
} }
// 2 cases : 1 or more can Expend, or all is done ... // 2 cases : 1 or more can Expend, or all is done ...
double sizeToAddAtEveryOne = 0; etkFloat_t sizeToAddAtEveryOne = 0;
// 2 cases : 1 or more can Expend, or all is done ... // 2 cases : 1 or more can Expend, or all is done ...
if (0 != nbWidgetNotFixedSize) { if (0 != nbWidgetNotFixedSize) {
sizeToAddAtEveryOne = (m_size.y - unexpendableSize) / nbWidgetNotFixedSize; sizeToAddAtEveryOne = (m_size.y - unexpendableSize) / nbWidgetNotFixedSize;
@ -122,7 +122,7 @@ bool ewol::SizerVert::CalculateMinSize(void)
return true; return true;
} }
void ewol::SizerVert::SetMinSise(double x, double y) void ewol::SizerVert::SetMinSise(etkFloat_t x, etkFloat_t y)
{ {
EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)"); EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)");
} }
@ -212,7 +212,7 @@ void ewol::SizerVert::OnRegenerateDisplay(void)
} }
bool ewol::SizerVert::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y) bool ewol::SizerVert::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
{ {
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) { for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[iii]) { if (NULL != m_subWidget[iii]) {

View File

@ -36,9 +36,9 @@ namespace ewol {
SizerVert(void); SizerVert(void);
virtual ~SizerVert(void); virtual ~SizerVert(void);
public: public:
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); //update the min Size ... and the expend parameters for the sizer virtual bool CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer
virtual void SetMinSise(double x=-1, double y=-1); virtual void SetMinSise(etkFloat_t x=-1, etkFloat_t y=-1);
virtual void SetExpendX(bool newExpend=false); virtual void SetExpendX(bool newExpend=false);
virtual void SetExpendY(bool newExpend=false); virtual void SetExpendY(bool newExpend=false);
private: private:
@ -53,7 +53,7 @@ namespace ewol {
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
public: 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);
}; };
}; };

View File

@ -164,7 +164,7 @@ void ewol::Test::OnRegenerateDisplay(void)
} }
bool ewol::Test::OnEventArea(const char * generateEventId, double x, double y) bool ewol::Test::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y)
{ {
bool eventIsOK = false; bool eventIsOK = false;
//EWOL_DEBUG("Receive event : \"" << generateEventId << "\""); //EWOL_DEBUG("Receive event : \"" << generateEventId << "\"");

View File

@ -39,7 +39,7 @@ namespace ewol {
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
public: public:
virtual bool OnEventArea(const char * generateEventId, double x, double y); virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y);
private: private:
int32_t m_elementID; int32_t m_elementID;
}; };