Update Makefile suite AND add text clipping in X at end (first step)
This commit is contained in:
parent
61932a171f
commit
4d06072529
@ -3,17 +3,20 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_MODULE := etk
|
LOCAL_MODULE := etk
|
||||||
LOCAL_STATIC_LIBRARIES :=
|
LOCAL_STATIC_LIBRARIES := libzip
|
||||||
|
|
||||||
LOCAL_C_INCLUDES :=
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
|
|
||||||
LOCAL_CFLAGS := -D__PLATFORM__Android \
|
LOCAL_CFLAGS := -D__PLATFORM__Android \
|
||||||
-Wno-write-strings \
|
-Wno-write-strings \
|
||||||
|
-DDATA_IN_APK \
|
||||||
-DETK_DEBUG_LEVEL=3
|
-DETK_DEBUG_LEVEL=3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_MODULE := etk
|
LOCAL_MODULE := etk
|
||||||
LOCAL_STATIC_LIBRARIES :=
|
LOCAL_STATIC_LIBRARIES := libzip
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ void TOOLS_DisplayTime(void);
|
|||||||
#define ETK_DBG_COMMON(libName, color, info, data) do { \
|
#define ETK_DBG_COMMON(libName, color, info, data) do { \
|
||||||
etk::cout << color; \
|
etk::cout << color; \
|
||||||
/*TOOLS_DisplayTime();*/ \
|
/*TOOLS_DisplayTime();*/ \
|
||||||
/*TOOLS_DisplayFuncName(__LINE__, __class__, __func__, libName);*/ \
|
TOOLS_DisplayFuncName(__LINE__, __class__, __func__, libName); \
|
||||||
etk::cout << "[" << info << "] " << data; \
|
etk::cout << "[" << info << "] " << data; \
|
||||||
etk::cout << ETK_BASH_COLOR_NORMAL <<etk::endl; \
|
etk::cout << ETK_BASH_COLOR_NORMAL <<etk::endl; \
|
||||||
}while(0)
|
}while(0)
|
||||||
|
@ -295,6 +295,8 @@ void etk::File::SetCompleateName(etk::String &newFilename, etk::FileType_te type
|
|||||||
}
|
}
|
||||||
if (-1 == m_idZipFile) {
|
if (-1 == m_idZipFile) {
|
||||||
TK_ERROR("File Does not existed ... in APK : \"" << tmpFilename << "\"");
|
TK_ERROR("File Does not existed ... in APK : \"" << tmpFilename << "\"");
|
||||||
|
} else {
|
||||||
|
TK_INFO("File existed ... in APK : \"" << tmpFilename << "\" ==> id=" << m_idZipFile);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
//etk::String tmpFilename = destFilename;
|
//etk::String tmpFilename = destFilename;
|
||||||
|
@ -5,7 +5,7 @@ include $(CLEAR_VARS)
|
|||||||
LOCAL_MODULE := ewol
|
LOCAL_MODULE := ewol
|
||||||
LOCAL_STATIC_LIBRARIES := libetk libtinyxml libzip libpng
|
LOCAL_STATIC_LIBRARIES := libetk libtinyxml libzip libpng
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/../libzip/ $(LOCAL_PATH)/../libpng/ $(LOCAL_PATH)/../libtinyxml/ $(LOCAL_PATH)/../libetk/
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
LOCAL_EXPORT_LDLIBS := -lGLESv1_CM -ldl -llog -lz
|
LOCAL_EXPORT_LDLIBS := -lGLESv1_CM -ldl -llog -lz
|
||||||
|
@ -5,7 +5,7 @@ include $(CLEAR_VARS)
|
|||||||
LOCAL_MODULE := ewol
|
LOCAL_MODULE := ewol
|
||||||
LOCAL_STATIC_LIBRARIES := etk tinyxml libzip libpng
|
LOCAL_STATIC_LIBRARIES := etk tinyxml libzip libpng
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := -I$(LOCAL_PATH) -I$(LOCAL_PATH)/../libzip/ -I$(LOCAL_PATH)/../libpng/ -I$(LOCAL_PATH)/../libtinyxml/ -I$(LOCAL_PATH)/../libetk/
|
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
||||||
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
LOCAL_EXPORT_LDLIBS := -lGL -lGLU -lz -lX11 -lXxf86vm `pkg-config --libs freetype2`
|
LOCAL_EXPORT_LDLIBS := -lGL -lGLU -lz -lX11 -lXxf86vm `pkg-config --libs freetype2`
|
||||||
|
@ -89,18 +89,19 @@ namespace ewol
|
|||||||
|
|
||||||
void DrawText(int32_t fontID,
|
void DrawText(int32_t fontID,
|
||||||
coord2D_ts & drawPosition,
|
coord2D_ts & drawPosition,
|
||||||
|
coord2D_ts & clipSize,
|
||||||
const char * utf8String,
|
const char * utf8String,
|
||||||
uint32_t & fontTextureId,
|
uint32_t & fontTextureId,
|
||||||
etk::VectorType<coord2D_ts> & coord,
|
etk::VectorType<coord2D_ts> & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex);
|
etk::VectorType<texCoord_ts> & coordTex);
|
||||||
|
/*
|
||||||
void DrawText(int32_t fontID,
|
void DrawText(int32_t fontID,
|
||||||
coord2D_ts & drawPosition,
|
coord2D_ts & drawPosition,
|
||||||
const uniChar_t * unicodeString,
|
const uniChar_t * unicodeString,
|
||||||
uint32_t & fontTextureId,
|
uint32_t & fontTextureId,
|
||||||
etk::VectorType<coord2D_ts> & coord,
|
etk::VectorType<coord2D_ts> & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex);
|
etk::VectorType<texCoord_ts> & coordTex);
|
||||||
|
*/
|
||||||
int32_t LoadFont(etk::File fontFileName);
|
int32_t LoadFont(etk::File fontFileName);
|
||||||
void DrawText(etkFloat_t x, etkFloat_t y, const char * myString);
|
void DrawText(etkFloat_t x, etkFloat_t y, const char * myString);
|
||||||
};
|
};
|
||||||
|
@ -296,7 +296,7 @@ void ewol::UnloadFont(int32_t id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
void ewol::DrawText(int32_t fontID,
|
void ewol::DrawText(int32_t fontID,
|
||||||
coord2D_ts & drawPosition,
|
coord2D_ts & drawPosition,
|
||||||
const uniChar_t * unicodeString,
|
const uniChar_t * unicodeString,
|
||||||
@ -304,6 +304,8 @@ void ewol::DrawText(int32_t fontID,
|
|||||||
etk::VectorType<coord2D_ts> & coord,
|
etk::VectorType<coord2D_ts> & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex)
|
etk::VectorType<texCoord_ts> & coordTex)
|
||||||
{
|
{
|
||||||
|
EWOL_TODO("previous code does not work at all");
|
||||||
|
|
||||||
if(fontID>=s_listLoadedFonts.Size() || fontID < 0) {
|
if(fontID>=s_listLoadedFonts.Size() || fontID < 0) {
|
||||||
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
||||||
return;
|
return;
|
||||||
@ -348,14 +350,15 @@ void ewol::DrawText(int32_t fontID,
|
|||||||
}
|
}
|
||||||
drawPosition.x = posDrawX;
|
drawPosition.x = posDrawX;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void ewol::DrawText(int32_t fontID, // Id of the desire font
|
||||||
void ewol::DrawText(int32_t fontID,
|
coord2D_ts & drawPosition, // position to start the writing (can be < 0) ==> no check
|
||||||
coord2D_ts & drawPosition,
|
coord2D_ts & clipSize, // clipping size
|
||||||
const char * utf8String,
|
const char * utf8String, // my UTF8 string
|
||||||
uint32_t & fontTextureId,
|
uint32_t & fontTextureId, // return the fontID needed to display this string
|
||||||
etk::VectorType<coord2D_ts> & coord,
|
etk::VectorType<coord2D_ts> & coord, // return the coordonates
|
||||||
etk::VectorType<texCoord_ts> & coordTex)
|
etk::VectorType<texCoord_ts> & coordTex) // return the texture coordonates
|
||||||
{
|
{
|
||||||
// TODO : This code des not work, why ????
|
// TODO : This code des not work, why ????
|
||||||
/*
|
/*
|
||||||
@ -403,83 +406,62 @@ void ewol::DrawText(int32_t fontID,
|
|||||||
charIndex = 0;
|
charIndex = 0;
|
||||||
}
|
}
|
||||||
etkFloat_t sizeWidth = listOfElement[charIndex].width;
|
etkFloat_t sizeWidth = listOfElement[charIndex].width;
|
||||||
|
// check the clipping
|
||||||
|
if (clipSize.x>0 && posDrawX+sizeWidth > clipSize.x) {
|
||||||
|
// TODO : Create a better clipping methode ...
|
||||||
|
break;
|
||||||
|
}
|
||||||
// 0x01 == 0x20 == ' ';
|
// 0x01 == 0x20 == ' ';
|
||||||
if (tmpChar != 0x01) {
|
if (tmpChar != 0x01) {
|
||||||
#if !defined(__PLATFORM__Android)
|
// NOTE : Android does not support the Quads elements ...
|
||||||
// set texture coordonates :
|
/* Step 1 :
|
||||||
coordTex.PushBack(listOfElement[charIndex].posStart);
|
* ********
|
||||||
texCoord_ts tmpTex;
|
* ******
|
||||||
tmpTex.u = listOfElement[charIndex].posStop.u;
|
* ****
|
||||||
tmpTex.v = listOfElement[charIndex].posStart.v;
|
* **
|
||||||
coordTex.PushBack(tmpTex);
|
*
|
||||||
coordTex.PushBack(listOfElement[charIndex].posStop);
|
*/
|
||||||
tmpTex.u = listOfElement[charIndex].posStart.u;
|
// set texture coordonates :
|
||||||
tmpTex.v = listOfElement[charIndex].posStop.v;
|
coordTex.PushBack(listOfElement[charIndex].posStart);
|
||||||
coordTex.PushBack(tmpTex);
|
texCoord_ts tmpTex;
|
||||||
// set display positions :
|
tmpTex.u = listOfElement[charIndex].posStop.u;
|
||||||
/*int32_t xxxx = posDrawX;
|
tmpTex.v = listOfElement[charIndex].posStart.v;
|
||||||
int32_t yyyy = drawPosition.y;*/
|
coordTex.PushBack(tmpTex);
|
||||||
coord2D_ts tmpCoord;
|
coordTex.PushBack(listOfElement[charIndex].posStop);
|
||||||
tmpCoord.x = posDrawX;
|
// set display positions :
|
||||||
tmpCoord.y = drawPosition.y;
|
coord2D_ts tmpCoord;
|
||||||
coord.PushBack(tmpCoord);
|
tmpCoord.x = posDrawX;
|
||||||
tmpCoord.x = posDrawX + sizeWidth;
|
tmpCoord.y = drawPosition.y;
|
||||||
coord.PushBack(tmpCoord);
|
coord.PushBack(tmpCoord);
|
||||||
tmpCoord.y = drawPosition.y + size;
|
tmpCoord.x = posDrawX + sizeWidth;
|
||||||
coord.PushBack(tmpCoord);
|
coord.PushBack(tmpCoord);
|
||||||
tmpCoord.x = posDrawX;
|
tmpCoord.y = drawPosition.y + size;
|
||||||
coord.PushBack(tmpCoord);
|
coord.PushBack(tmpCoord);
|
||||||
#else
|
|
||||||
// NOTE : Android does not support the Quads elements ...
|
/* Step 2 :
|
||||||
/* Step 1 :
|
*
|
||||||
* ********
|
* **
|
||||||
* ******
|
* ****
|
||||||
* ****
|
* ******
|
||||||
* **
|
* ********
|
||||||
*
|
*/
|
||||||
*/
|
|
||||||
// set texture coordonates :
|
// set texture coordonates :
|
||||||
coordTex.PushBack(listOfElement[charIndex].posStart);
|
coordTex.PushBack(listOfElement[charIndex].posStart);
|
||||||
texCoord_ts tmpTex;
|
coordTex.PushBack(listOfElement[charIndex].posStop);
|
||||||
tmpTex.u = listOfElement[charIndex].posStop.u;
|
tmpTex.u = listOfElement[charIndex].posStart.u;
|
||||||
tmpTex.v = listOfElement[charIndex].posStart.v;
|
tmpTex.v = listOfElement[charIndex].posStop.v;
|
||||||
coordTex.PushBack(tmpTex);
|
coordTex.PushBack(tmpTex);
|
||||||
coordTex.PushBack(listOfElement[charIndex].posStop);
|
|
||||||
// set display positions :
|
// set display positions :
|
||||||
coord2D_ts tmpCoord;
|
tmpCoord.x = posDrawX;
|
||||||
tmpCoord.x = posDrawX;
|
tmpCoord.y = drawPosition.y;
|
||||||
tmpCoord.y = drawPosition.y;
|
coord.PushBack(tmpCoord);
|
||||||
coord.PushBack(tmpCoord);
|
tmpCoord.x = posDrawX + sizeWidth;
|
||||||
tmpCoord.x = posDrawX + sizeWidth;
|
tmpCoord.y = drawPosition.y + size;
|
||||||
coord.PushBack(tmpCoord);
|
coord.PushBack(tmpCoord);
|
||||||
tmpCoord.y = drawPosition.y + size;
|
tmpCoord.x = posDrawX;
|
||||||
coord.PushBack(tmpCoord);
|
coord.PushBack(tmpCoord);
|
||||||
|
|
||||||
/* Step 2 :
|
|
||||||
*
|
|
||||||
* **
|
|
||||||
* ****
|
|
||||||
* ******
|
|
||||||
* ********
|
|
||||||
*/
|
|
||||||
|
|
||||||
// set texture coordonates :
|
|
||||||
coordTex.PushBack(listOfElement[charIndex].posStart);
|
|
||||||
coordTex.PushBack(listOfElement[charIndex].posStop);
|
|
||||||
tmpTex.u = listOfElement[charIndex].posStart.u;
|
|
||||||
tmpTex.v = listOfElement[charIndex].posStop.v;
|
|
||||||
coordTex.PushBack(tmpTex);
|
|
||||||
|
|
||||||
// set display positions :
|
|
||||||
tmpCoord.x = posDrawX;
|
|
||||||
tmpCoord.y = drawPosition.y;
|
|
||||||
coord.PushBack(tmpCoord);
|
|
||||||
tmpCoord.x = posDrawX + sizeWidth;
|
|
||||||
tmpCoord.y = drawPosition.y + size;
|
|
||||||
coord.PushBack(tmpCoord);
|
|
||||||
tmpCoord.x = posDrawX;
|
|
||||||
coord.PushBack(tmpCoord);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
posDrawX += sizeWidth;
|
posDrawX += sizeWidth;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ void ewol::UnloadFont(int32_t id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
void ewol::DrawText(int32_t fontID,
|
void ewol::DrawText(int32_t fontID,
|
||||||
coord2D_ts & drawPosition,
|
coord2D_ts & drawPosition,
|
||||||
const uniChar_t * unicodeString,
|
const uniChar_t * unicodeString,
|
||||||
@ -570,10 +570,11 @@ void ewol::DrawText(int32_t fontID,
|
|||||||
}
|
}
|
||||||
drawPosition.x = posDrawX;
|
drawPosition.x = posDrawX;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void ewol::DrawText(int32_t fontID,
|
void ewol::DrawText(int32_t fontID,
|
||||||
coord2D_ts & drawPosition,
|
coord2D_ts & drawPosition,
|
||||||
|
coord2D_ts & clipSize,
|
||||||
const char * utf8String,
|
const char * utf8String,
|
||||||
uint32_t & fontTextureId,
|
uint32_t & fontTextureId,
|
||||||
etk::VectorType<coord2D_ts> & coord,
|
etk::VectorType<coord2D_ts> & coord,
|
||||||
@ -624,8 +625,22 @@ void ewol::DrawText(int32_t fontID,
|
|||||||
charIndex = 0;
|
charIndex = 0;
|
||||||
}
|
}
|
||||||
etkFloat_t sizeWidth = listOfElement[charIndex].width;
|
etkFloat_t sizeWidth = listOfElement[charIndex].width;
|
||||||
|
// check the clipping
|
||||||
|
if (clipSize.x>0 && posDrawX+sizeWidth > clipSize.x) {
|
||||||
|
// TODO : Create a better clipping methode ...
|
||||||
|
break;
|
||||||
|
}
|
||||||
// 0x01 == 0x20 == ' ';
|
// 0x01 == 0x20 == ' ';
|
||||||
if (tmpChar != 0x01) {
|
if (tmpChar != 0x01) {
|
||||||
|
|
||||||
|
// NOTE : Android does not support the Quads elements ...
|
||||||
|
/* Step 1 :
|
||||||
|
* ********
|
||||||
|
* ******
|
||||||
|
* ****
|
||||||
|
* **
|
||||||
|
*
|
||||||
|
*/
|
||||||
// set texture coordonates :
|
// set texture coordonates :
|
||||||
coordTex.PushBack(listOfElement[charIndex].posStart);
|
coordTex.PushBack(listOfElement[charIndex].posStart);
|
||||||
texCoord_ts tmpTex;
|
texCoord_ts tmpTex;
|
||||||
@ -633,12 +648,7 @@ void ewol::DrawText(int32_t fontID,
|
|||||||
tmpTex.v = listOfElement[charIndex].posStart.v;
|
tmpTex.v = listOfElement[charIndex].posStart.v;
|
||||||
coordTex.PushBack(tmpTex);
|
coordTex.PushBack(tmpTex);
|
||||||
coordTex.PushBack(listOfElement[charIndex].posStop);
|
coordTex.PushBack(listOfElement[charIndex].posStop);
|
||||||
tmpTex.u = listOfElement[charIndex].posStart.u;
|
|
||||||
tmpTex.v = listOfElement[charIndex].posStop.v;
|
|
||||||
coordTex.PushBack(tmpTex);
|
|
||||||
// set display positions :
|
// set display positions :
|
||||||
/*int32_t xxxx = posDrawX;
|
|
||||||
int32_t yyyy = drawPosition.y;*/
|
|
||||||
coord2D_ts tmpCoord;
|
coord2D_ts tmpCoord;
|
||||||
tmpCoord.x = posDrawX;
|
tmpCoord.x = posDrawX;
|
||||||
tmpCoord.y = drawPosition.y;
|
tmpCoord.y = drawPosition.y;
|
||||||
@ -647,6 +657,29 @@ void ewol::DrawText(int32_t fontID,
|
|||||||
coord.PushBack(tmpCoord);
|
coord.PushBack(tmpCoord);
|
||||||
tmpCoord.y = drawPosition.y + size;
|
tmpCoord.y = drawPosition.y + size;
|
||||||
coord.PushBack(tmpCoord);
|
coord.PushBack(tmpCoord);
|
||||||
|
|
||||||
|
/* Step 2 :
|
||||||
|
*
|
||||||
|
* **
|
||||||
|
* ****
|
||||||
|
* ******
|
||||||
|
* ********
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set texture coordonates :
|
||||||
|
coordTex.PushBack(listOfElement[charIndex].posStart);
|
||||||
|
coordTex.PushBack(listOfElement[charIndex].posStop);
|
||||||
|
tmpTex.u = listOfElement[charIndex].posStart.u;
|
||||||
|
tmpTex.v = listOfElement[charIndex].posStop.v;
|
||||||
|
coordTex.PushBack(tmpTex);
|
||||||
|
|
||||||
|
// set display positions :
|
||||||
|
tmpCoord.x = posDrawX;
|
||||||
|
tmpCoord.y = drawPosition.y;
|
||||||
|
coord.PushBack(tmpCoord);
|
||||||
|
tmpCoord.x = posDrawX + sizeWidth;
|
||||||
|
tmpCoord.y = drawPosition.y + size;
|
||||||
|
coord.PushBack(tmpCoord);
|
||||||
tmpCoord.x = posDrawX;
|
tmpCoord.x = posDrawX;
|
||||||
coord.PushBack(tmpCoord);
|
coord.PushBack(tmpCoord);
|
||||||
}
|
}
|
||||||
|
@ -69,19 +69,14 @@ void ewol::OObject2DText::Draw(void)
|
|||||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
||||||
glVertexPointer( 2, oglTypeFloat_t, 0, &m_coord[0] );
|
glVertexPointer( 2, oglTypeFloat_t, 0, &m_coord[0] );
|
||||||
glTexCoordPointer( 2, oglTypeFloat_t, 0, &m_coordTex[0] );
|
glTexCoordPointer( 2, oglTypeFloat_t, 0, &m_coordTex[0] );
|
||||||
#if !defined(__PLATFORM__Android)
|
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||||
glDrawArrays( GL_QUADS, 0, m_coord.Size());
|
|
||||||
#else
|
|
||||||
// NOTE : Android does not support the Quads elements ...
|
|
||||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
|
||||||
#endif
|
|
||||||
//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
|
||||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::OObject2DText::Text(etkFloat_t x, etkFloat_t y, const char* utf8String)
|
void ewol::OObject2DText::Text(etkFloat_t x, etkFloat_t y, const char* utf8String, int32_t clippingPositionX)
|
||||||
{
|
{
|
||||||
m_FontTextureId = 0;
|
m_FontTextureId = 0;
|
||||||
m_coord.Clear();
|
m_coord.Clear();
|
||||||
@ -92,7 +87,10 @@ void ewol::OObject2DText::Text(etkFloat_t x, etkFloat_t y, const char* utf8Strin
|
|||||||
coord2D_ts drawPosition;
|
coord2D_ts drawPosition;
|
||||||
drawPosition.x = x;
|
drawPosition.x = x;
|
||||||
drawPosition.y = y;
|
drawPosition.y = y;
|
||||||
ewol::DrawText(m_FontId, drawPosition, utf8String, m_FontTextureId, m_coord, m_coordTex);
|
coord2D_ts clipSize;
|
||||||
|
clipSize.x = clippingPositionX;
|
||||||
|
clipSize.y = -1;
|
||||||
|
ewol::DrawText(m_FontId, drawPosition, clipSize, utf8String, m_FontTextureId, m_coord, m_coordTex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::OObject2DText::UpdateOrigin(etkFloat_t x, etkFloat_t y)
|
void ewol::OObject2DText::UpdateOrigin(etkFloat_t x, etkFloat_t y)
|
||||||
|
@ -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(etkFloat_t x, etkFloat_t y, const char* utf8String);
|
void Text(etkFloat_t x, etkFloat_t y, const char* utf8String, int32_t clippingPositionX);
|
||||||
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 ...
|
||||||
|
@ -82,7 +82,7 @@ ewol::Windows::Windows(void)
|
|||||||
AddOObject(myOObject, "leftBoutton");
|
AddOObject(myOObject, "leftBoutton");
|
||||||
|
|
||||||
ewol::OObject2DText * myOObjectText = new ewol::OObject2DText();
|
ewol::OObject2DText * myOObjectText = new ewol::OObject2DText();
|
||||||
myOObjectText->Text(62, 2, "My Title ...");
|
myOObjectText->Text(62, 2, "My Title ...", m_size.x-2);
|
||||||
AddOObject(myOObjectText, "Title");
|
AddOObject(myOObjectText, "Title");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,12 @@ static etkFloat_t m_width = 320;
|
|||||||
static etkFloat_t m_height = 480;
|
static etkFloat_t m_height = 480;
|
||||||
|
|
||||||
ewol::Windows* m_uniqueWindows = NULL;
|
ewol::Windows* m_uniqueWindows = NULL;
|
||||||
|
static int64_t GetCurrentTime(void)
|
||||||
static int32_t times(char* tmpVar)
|
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
return (long)(now.tv_sec*1000 + now.tv_usec/1000);
|
//EWOL_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us");
|
||||||
|
return (int64_t)((int64_t)now.tv_sec*(int64_t)1000 + (int64_t)now.tv_usec/(int64_t)1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,12 +123,13 @@ void EWOL_NativeEventInputMotion(int pointerID, float x, float y )
|
|||||||
|
|
||||||
void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
||||||
{
|
{
|
||||||
|
//EWOL_INFO("Event : Input ID=" << pointerID << " [" << isUp << "] x=" << x << " y=" << y);
|
||||||
if (isUp) {
|
if (isUp) {
|
||||||
//EWOL_INFO("Event : Input ID=" << pointerID << " [DOWN] x=" << x << " y=" << y);
|
//EWOL_INFO("Event : Input ID=" << pointerID << " [DOWN] x=" << x << " y=" << y);
|
||||||
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
||||||
// Send Down message
|
// Send Down message
|
||||||
if (NULL != m_uniqueWindows) {
|
if (NULL != m_uniqueWindows) {
|
||||||
//EWOL_DEBUG("ANDROID bt=" << pointerID+1 << " event : **=\"ButtonPress\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("ANDROID bt=" << pointerID+1 << " event : **=\"ButtonPress\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)x, (etkFloat_t)y);
|
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
}
|
}
|
||||||
// Check double or triple click event ...
|
// Check double or triple click event ...
|
||||||
@ -158,7 +159,7 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
|||||||
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
||||||
// Send Down message
|
// Send Down message
|
||||||
if (NULL != m_uniqueWindows) {
|
if (NULL != m_uniqueWindows) {
|
||||||
//EWOL_DEBUG("ANDROID bt=" << pointerID+1 << " event : **=\"ButtonRelease\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("ANDROID bt=" << pointerID+1 << " event : **=\"ButtonRelease\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)x, (etkFloat_t)y);
|
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
}
|
}
|
||||||
if (m_previousBouttonId != pointerID+1) {
|
if (m_previousBouttonId != pointerID+1) {
|
||||||
@ -170,15 +171,15 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
|||||||
m_previousTime = 0;
|
m_previousTime = 0;
|
||||||
m_previousDouble = false;
|
m_previousDouble = false;
|
||||||
} else {
|
} else {
|
||||||
int64_t currentTime = times(NULL); // return the tic in 10ms
|
int64_t currentTime = GetCurrentTime(); // return the tic in 10ms
|
||||||
//EWOL_DEBUG("time is : " << currentTime << " "<< currentTime/100 <<"s " << (currentTime%100)*10 << "ms");
|
//EWOL_DEBUG("time is : " << (int)currentTime << " "<< (int)(currentTime/100) <<"s " << (int)((currentTime%100)*10) << "ms");
|
||||||
if (currentTime - m_previousTime >= SEPARATED_CLICK_TIME) {
|
if (currentTime - m_previousTime >= SEPARATED_CLICK_TIME) {
|
||||||
//check if the same area click :
|
//check if the same area click :
|
||||||
if( abs(m_previousDown_x - x) < OFFSET_MOVE_CLICKED
|
if( abs(m_previousDown_x - x) < OFFSET_MOVE_CLICKED
|
||||||
&& abs(m_previousDown_y - y) < OFFSET_MOVE_CLICKED )
|
&& abs(m_previousDown_y - y) < OFFSET_MOVE_CLICKED )
|
||||||
{
|
{
|
||||||
// might generate an sigle event :
|
// might generate an sigle event :
|
||||||
//EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedSingle\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedSingle\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)x, (etkFloat_t)y);
|
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)x, (etkFloat_t)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;
|
||||||
@ -201,12 +202,12 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
|||||||
{
|
{
|
||||||
// might generate an sigle event :
|
// might generate an sigle event :
|
||||||
if (false == m_previousDouble) {
|
if (false == m_previousDouble) {
|
||||||
//EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedDouble\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedDouble\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_DOUBLE, (etkFloat_t)x, (etkFloat_t)y);
|
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_DOUBLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
m_previousTime = currentTime;
|
m_previousTime = currentTime;
|
||||||
m_previousDouble = true;
|
m_previousDouble = true;
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedTriple\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedTriple\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)x, (etkFloat_t)y);
|
m_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
// reset values ...
|
// reset values ...
|
||||||
m_previousDown_x = -1;
|
m_previousDown_x = -1;
|
||||||
@ -299,7 +300,7 @@ void EWOL_NativeRender(void)
|
|||||||
if (sDemoStopped) {
|
if (sDemoStopped) {
|
||||||
curTime = sTimeStopped + sTimeOffset;
|
curTime = sTimeStopped + sTimeOffset;
|
||||||
} else {
|
} else {
|
||||||
curTime =times(NULL) + sTimeOffset;
|
curTime =GetCurrentTime() + sTimeOffset;
|
||||||
if (sTimeOffsetInit == 0) {
|
if (sTimeOffsetInit == 0) {
|
||||||
sTimeOffsetInit = 1;
|
sTimeOffsetInit = 1;
|
||||||
sTimeOffset = -curTime;
|
sTimeOffset = -curTime;
|
||||||
|
@ -50,6 +50,11 @@
|
|||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
|
|
||||||
|
|
||||||
|
static int64_t GetCurrentTime(void)
|
||||||
|
{
|
||||||
|
return times(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "guiAbstraction"
|
#define __class__ "guiAbstraction"
|
||||||
|
|
||||||
@ -543,7 +548,7 @@ namespace guiAbstraction {
|
|||||||
m_previousTime = 0;
|
m_previousTime = 0;
|
||||||
m_previousDouble = false;
|
m_previousDouble = false;
|
||||||
} else {
|
} else {
|
||||||
int64_t currentTime = times(NULL); // return the tic in 10ms
|
int64_t currentTime = GetCurrentTime(); // return the tic in 10ms
|
||||||
//EWOL_DEBUG("time is : " << currentTime << " "<< currentTime/100 <<"s " << (currentTime%100)*10 << "ms");
|
//EWOL_DEBUG("time is : " << currentTime << " "<< currentTime/100 <<"s " << (currentTime%100)*10 << "ms");
|
||||||
if (currentTime - m_previousTime >= SEPARATED_CLICK_TIME) {
|
if (currentTime - m_previousTime >= SEPARATED_CLICK_TIME) {
|
||||||
//check if the same area click :
|
//check if the same area click :
|
||||||
|
@ -137,7 +137,7 @@ void ewol::Button::OnRegenerateDisplay(void)
|
|||||||
int32_t fontHeight = ewol::GetHeight(fontId);
|
int32_t fontHeight = ewol::GetHeight(fontId);
|
||||||
int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||||
*/
|
*/
|
||||||
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_label.c_str());
|
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_label.c_str(), m_size.x - borderSize - 2*paddingSize);
|
||||||
|
|
||||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||||
tmpOObjects->SetColor(m_textColorBg);
|
tmpOObjects->SetColor(m_textColorBg);
|
||||||
|
@ -116,7 +116,7 @@ void ewol::CheckBox::OnRegenerateDisplay(void)
|
|||||||
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||||
int32_t posy = (m_size.y - fontHeight - 6)/2 + 3;
|
int32_t posy = (m_size.y - fontHeight - 6)/2 + 3;
|
||||||
//int32_t posx = (m_size.x - fontWidth - 6)/2 + 25;
|
//int32_t posx = (m_size.x - fontWidth - 6)/2 + 25;
|
||||||
tmpText->Text(boxSize+5, posy, m_label.c_str());
|
tmpText->Text(boxSize+5, posy, m_label.c_str(), m_size.x - (boxSize+5));
|
||||||
|
|
||||||
|
|
||||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||||
|
@ -135,7 +135,7 @@ void ewol::Entry::OnRegenerateDisplay(void)
|
|||||||
tmpSizeY -= 2*m_paddingSize;
|
tmpSizeY -= 2*m_paddingSize;
|
||||||
|
|
||||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||||
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_data.c_str() + m_displayStartPosition);
|
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_data.c_str() + m_displayStartPosition, m_size.x - (m_borderSize + 2*m_paddingSize));
|
||||||
|
|
||||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||||
tmpOObjects->SetColor(m_textColorBg);
|
tmpOObjects->SetColor(m_textColorBg);
|
||||||
|
@ -101,7 +101,7 @@ void ewol::Label::OnRegenerateDisplay(void)
|
|||||||
tmpOriginY += paddingSize;
|
tmpOriginY += paddingSize;
|
||||||
|
|
||||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||||
tmpText->Text(tmpOriginX, tmpOriginY, m_label.c_str());
|
tmpText->Text(tmpOriginX, tmpOriginY, m_label.c_str(), m_size.x - 2*paddingSize);
|
||||||
|
|
||||||
AddOObject(tmpText, "LabelText");
|
AddOObject(tmpText, "LabelText");
|
||||||
|
|
||||||
|
@ -95,8 +95,10 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
BGOObjects->SetColor(basicBG);
|
BGOObjects->SetColor(basicBG);
|
||||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||||
|
|
||||||
|
uint32_t displayableRaw = m_size.y / (minHeight + 2*m_paddingSize);
|
||||||
|
|
||||||
for(uint32_t iii=0; iii<nbRaw; iii++) {
|
// We display only compleate lines ...
|
||||||
|
for(uint32_t iii=0; iii<nbRaw && iii<displayableRaw; iii++) {
|
||||||
etk::String myTextToWrite;
|
etk::String myTextToWrite;
|
||||||
color_ts fg;
|
color_ts fg;
|
||||||
color_ts bg;
|
color_ts bg;
|
||||||
@ -106,7 +108,7 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
tmpOriginYBG += minHeight+2*m_paddingSize;
|
tmpOriginYBG += minHeight+2*m_paddingSize;
|
||||||
|
|
||||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, fg);
|
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, fg);
|
||||||
tmpText->Text(tmpOriginX, tmpOriginY, myTextToWrite.c_str());
|
tmpText->Text(tmpOriginX, tmpOriginY, myTextToWrite.c_str(), m_size.x - (2*m_paddingSize));
|
||||||
AddOObject(tmpText);
|
AddOObject(tmpText);
|
||||||
tmpOriginY += minHeight + 2* m_paddingSize;
|
tmpOriginY += minHeight + 2* m_paddingSize;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,9 @@ LOCAL_MODULE := libpng
|
|||||||
|
|
||||||
LOCAL_CFLAGS := -DPNG_NO_LIMITS_H
|
LOCAL_CFLAGS := -DPNG_NO_LIMITS_H
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
@ -22,6 +22,8 @@ LOCAL_MODULE := libpng
|
|||||||
|
|
||||||
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
||||||
|
|
||||||
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ include $(CLEAR_VARS)
|
|||||||
LOCAL_MODULE := tinyxml
|
LOCAL_MODULE := tinyxml
|
||||||
LOCAL_STATIC_LIBRARIES :=
|
LOCAL_STATIC_LIBRARIES :=
|
||||||
|
|
||||||
LOCAL_C_INCLUDES :=
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@ include $(CLEAR_VARS)
|
|||||||
|
|
||||||
LOCAL_MODULE := libzip
|
LOCAL_MODULE := libzip
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
@ -20,6 +20,8 @@ LOCAL_MODULE := libzip
|
|||||||
|
|
||||||
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
LOCAL_C_INCLUDES := -I$(LOCAL_PATH)
|
||||||
|
|
||||||
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user