[DEV] correction of andoid port and remove some log

This commit is contained in:
Edouard DUPIN 2013-10-10 21:56:48 +02:00
parent aee421c216
commit a05707e55a
20 changed files with 142 additions and 110 deletions

2
external/egami vendored

@ -1 +1 @@
Subproject commit 11956be90c71c30c77b7c487ff16b077db22a49d
Subproject commit 3bb75e9d2b835e65f2b39fca0cb887ae8e90b22a

2
external/ege vendored

@ -1 +1 @@
Subproject commit cc9f514fb31e8400ee9d5d2b244ce2cafdbdacae
Subproject commit a65abb55e7b88eba13fbf0ecb46997ae5f86cce5

2
external/etk vendored

@ -1 +1 @@
Subproject commit 15f270da8a23ecf629d171e688579f497be6acd3
Subproject commit 21c190edeec50092bf76b7c5841b63082c107c40

View File

@ -35,6 +35,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.util.DisplayMetrics;
import android.util.Log;
import java.io.IOException;
@ -173,6 +174,7 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
}
public void keyboardUpdate(boolean show) {
Log.e("EwolActivity", "keyboardUpdate(" + show + ")");
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if(show) {
//EWOL.touchEvent();

View File

@ -16,7 +16,7 @@ bool ewol::PhysicsBox::parse(const char* _line) {
}
if(0 == strncmp(_line, "half-extents : ", 15) ) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EWOL_DEBUG(" halfSize=" << m_size);
EWOL_VERBOSE(" halfSize=" << m_size);
return true;
}
return false;

View File

@ -16,12 +16,12 @@ bool ewol::PhysicsCapsule::parse(const char* _line) {
}
if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius);
EWOL_VERBOSE(" radius=" << m_radius);
return true;
}
if(0 == strncmp(_line, "height : ", 9) ) {
sscanf(&_line[9], "%f", &m_height );
EWOL_DEBUG(" height=" << m_height);
EWOL_VERBOSE(" height=" << m_height);
return true;
}
return false;

View File

@ -16,12 +16,12 @@ bool ewol::PhysicsCone::parse(const char* _line) {
}
if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius);
EWOL_VERBOSE(" radius=" << m_radius);
return true;
}
if(0 == strncmp(_line, "height : ", 9) ) {
sscanf(&_line[9], "%f", &m_height );
EWOL_DEBUG(" height=" << m_height);
EWOL_VERBOSE(" height=" << m_height);
return true;
}
return false;

View File

@ -30,14 +30,14 @@ bool ewol::PhysicsConvexHull::parse(const char* _line) {
m_points.pushBack(pos);
/*
for (int32_t iii=0; iii<m_points.size(); iii++) {
EWOL_DEBUG(" parsed " << m_points[iii]);
EWOL_VERBOSE(" parsed " << m_points[iii]);
}
*/
return true;
}
if(0 == strncmp(_line, "scale : ", 8) ) {
sscanf(&_line[8], "%f %f %f", &m_scale.m_floats[0], &m_scale.m_floats[1], &m_scale.m_floats[2] );
EWOL_DEBUG(" scale=" << m_scale);
EWOL_VERBOSE(" scale=" << m_scale);
return true;
}
return false;

View File

@ -15,7 +15,7 @@ bool ewol::PhysicsCylinder::parse(const char* _line) {
}
if(0 == strncmp(_line, "half-extents : ", 15) ) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EWOL_DEBUG(" halfSize=" << m_size);
EWOL_VERBOSE(" halfSize=" << m_size);
return true;
}
return false;

View File

@ -44,12 +44,12 @@ ewol::PhysicsShape* ewol::PhysicsShape::create(const etk::UString& _name) {
bool ewol::PhysicsShape::parse(const char* _line) {
if(0 == strncmp(_line, "origin : ", 9) ) {
sscanf(&_line[9], "%f %f %f", &m_origin.m_floats[0], &m_origin.m_floats[1], &m_origin.m_floats[2] );
EWOL_DEBUG(" Origin=" << m_origin);
EWOL_VERBOSE(" Origin=" << m_origin);
return true;
}
if(0 == strncmp(_line, "rotate : ", 9) ) {
sscanf(&_line[9], "%f %f %f %f", &m_quaternion.m_floats[0], &m_quaternion.m_floats[1], &m_quaternion.m_floats[2], &m_quaternion.m_floats[3] );
EWOL_DEBUG(" rotate=" << m_quaternion);
EWOL_VERBOSE(" rotate=" << m_quaternion);
return true;
}
return false;

View File

@ -16,7 +16,7 @@ bool ewol::PhysicsSphere::parse(const char* _line) {
}
if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius);
EWOL_VERBOSE(" radius=" << m_radius);
return true;
}
return false;

View File

@ -64,8 +64,8 @@ class AndroidContext : public ewol::eContext {
ewol::SpecialKey m_guiKeyBoardSpecialKeyMode;//!< special key of the android system :
bool m_clipBoardOwnerStd;
private:
bool SafeInitMethodID(jmethodID& _mid, jclass& _cls, char* _name, char* _sign) {
_mid = m_JavaVirtualMachinePointer->getMethodID(_cls, _name, _sign);
bool safeInitMethodID(jmethodID& _mid, jclass& _cls, char* _name, char* _sign) {
_mid = m_JavaVirtualMachinePointer->GetMethodID(_cls, _name, _sign);
if(_mid == NULL) {
EWOL_ERROR("C->java : Can't find the method " << _name);
/* remove access on the virtual machine : */
@ -100,7 +100,7 @@ class AndroidContext : public ewol::eContext {
// get default needed all time elements :
if (NULL != m_JavaVirtualMachinePointer) {
EWOL_DEBUG("C->java : try load org/ewol/Ewol class");
m_javaClassEwol = m_JavaVirtualMachinePointer->findClass("org/ewol/Ewol" );
m_javaClassEwol = m_JavaVirtualMachinePointer->FindClass("org/ewol/Ewol" );
if (m_javaClassEwol == 0) {
EWOL_ERROR("C->java : Can't find org/ewol/Ewol class");
// remove access on the virtual machine :
@ -108,7 +108,7 @@ class AndroidContext : public ewol::eContext {
return;
}
/* The object field extends Activity and implement EwolCallback */
m_javaClassEwolCallback = m_JavaVirtualMachinePointer->getObjectClass(_objCallback);
m_javaClassEwolCallback = m_JavaVirtualMachinePointer->GetObjectClass(_objCallback);
if(m_javaClassEwolCallback == NULL) {
EWOL_ERROR("C->java : Can't find org/ewol/EwolCallback class");
// remove access on the virtual machine :
@ -116,45 +116,45 @@ class AndroidContext : public ewol::eContext {
return;
}
bool ret= false;
ret=SafeInitMethodID(m_javaMethodEwolActivitySetTitle,
m_javaClassEwolCallback,
"titleSet",
"(Ljava/lang/String;)V");
ret = safeInitMethodID(m_javaMethodEwolActivitySetTitle,
m_javaClassEwolCallback,
"titleSet",
"(Ljava/lang/String;)V");
if (ret == false) {
java_check_exception(_env);
return;
}
ret=SafeInitMethodID(m_javaMethodEwolCallbackStop,
m_javaClassEwolCallback,
"stop",
"()V");
ret = safeInitMethodID(m_javaMethodEwolCallbackStop,
m_javaClassEwolCallback,
"stop",
"()V");
if (ret == false) {
java_check_exception(_env);
return;
}
ret=SafeInitMethodID(m_javaMethodEwolCallbackEventNotifier,
m_javaClassEwolCallback,
"eventNotifier",
"([Ljava/lang/String;)V");
ret = safeInitMethodID(m_javaMethodEwolCallbackEventNotifier,
m_javaClassEwolCallback,
"eventNotifier",
"([Ljava/lang/String;)V");
if (ret == false) {
java_check_exception(_env);
return;
}
ret=SafeInitMethodID(m_javaMethodEwolCallbackKeyboardUpdate,
m_javaClassEwolCallback,
"keyboardUpdate",
"(Z)V");
ret = safeInitMethodID(m_javaMethodEwolCallbackKeyboardUpdate,
m_javaClassEwolCallback,
"keyboardUpdate",
"(Z)V");
if (ret == false) {
java_check_exception(_env);
return;
}
ret=SafeInitMethodID(m_javaMethodEwolCallbackOrientationUpdate,
m_javaClassEwolCallback,
"orientationUpdate",
"(I)V");
ret = safeInitMethodID(m_javaMethodEwolCallbackOrientationUpdate,
m_javaClassEwolCallback,
"orientationUpdate",
"(I)V");
if (ret == false) {
java_check_exception(_env);
return;
@ -163,7 +163,7 @@ class AndroidContext : public ewol::eContext {
m_javaObjectEwolCallback = _env->NewGlobalRef(_objCallback);
//javaObjectEwolCallbackAndActivity = objCallback;
m_javaDefaultClassString = m_JavaVirtualMachinePointer->findClass("java/lang/String" );
m_javaDefaultClassString = m_JavaVirtualMachinePointer->FindClass("java/lang/String" );
if (m_javaDefaultClassString == 0) {
EWOL_ERROR("C->java : Can't find java/lang/String" );
// remove access on the virtual machine :
@ -177,17 +177,17 @@ class AndroidContext : public ewol::eContext {
// TODO ...
}
void UnInit(JNIEnv* _env) {
void unInit(JNIEnv* _env) {
_env->DeleteGlobalRef(m_javaObjectEwolCallback);
m_javaObjectEwolCallback = NULL;
}
int32_t Run(void) {
int32_t run(void) {
// might never be called !!!
return -1;
}
void Stop(void) {
void stop(void) {
EWOL_DEBUG("C->java : send message to the java : STOP REQUESTED");
int status;
if(!java_attach_current_thread(&status)) {
@ -200,7 +200,7 @@ class AndroidContext : public ewol::eContext {
java_detach_current_thread(status);
}
void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) {
void clipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) {
// this is to force the local system to think we have the buffer
// TODO : remove this 2 line when code will be writen
m_clipBoardOwnerStd = true;
@ -225,7 +225,7 @@ class AndroidContext : public ewol::eContext {
}
}
void ClipBoardSet(ewol::clipBoard::clipboardListe_te _clipboardID) {
void clipBoardSet(ewol::clipBoard::clipboardListe_te _clipboardID) {
switch (_clipboardID) {
case ewol::clipBoard::clipboardSelection:
// NOTE : nothing to do : Windows deas ot supported Middle button
@ -250,7 +250,7 @@ class AndroidContext : public ewol::eContext {
return false;
}
JNIEnv *JavaVirtualMachinePointer_tmp;
*_rstatus = g_JavaVM->getEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
*_rstatus = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
if (*_rstatus == JNI_EDETACHED) {
JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
@ -273,7 +273,7 @@ class AndroidContext : public ewol::eContext {
}
void SendJavaKeyboardUpdate(jboolean _showIt) {
void sendJavaKeyboardUpdate(jboolean _showIt) {
int status;
if(!java_attach_current_thread(&status)) {
return;
@ -285,11 +285,11 @@ class AndroidContext : public ewol::eContext {
java_check_exception(m_JavaVirtualMachinePointer);
java_detach_current_thread(status);
}
void KeyboardShow(void) {
SendJavaKeyboardUpdate(JNI_TRUE);
void keyboardShow(void) {
sendJavaKeyboardUpdate(JNI_TRUE);
};
void KeyboardHide(void) {
SendJavaKeyboardUpdate(JNI_FALSE);
void keyboardHide(void) {
sendJavaKeyboardUpdate(JNI_FALSE);
};
// mode 0 : auto; 1 landscape, 2 portrait
@ -335,7 +335,7 @@ class AndroidContext : public ewol::eContext {
void SendSystemMessage(const char* _dataString) {
void sendSystemMessage(const char* _dataString) {
EWOL_DEBUG("C->java : send message to the java : \"" << _dataString << "\"");
int status;
if(!java_attach_current_thread(&status)) {
@ -428,11 +428,11 @@ extern "C"
//EWOL_CRITICAL(" call with ID : " << _id);
// direct setting of the date in the string system ...
jboolean isCopy;
const char* str = _env->getStringUTFChars(_myString, &isCopy);
const char* str = _env->GetStringUTFChars(_myString, &isCopy);
s_listInstance[_id]->setArchiveDir(_mode, str);
if (isCopy == JNI_TRUE) {
// from here str is reset ...
_env->releaseStringUTFChars(_myString, str);
_env->ReleaseStringUTFChars(_myString, str);
str = NULL;
}
}
@ -476,7 +476,7 @@ extern "C"
EWOL_ERROR("the requested instance _id=" << (int32_t)_id << " is already removed ...");
return;
}
s_listInstance[_id]->UnInit(_env);
s_listInstance[_id]->unInit(_env);
delete(s_listInstance[_id]);
s_listInstance[_id]=NULL;
}
@ -556,7 +556,7 @@ extern "C"
return;
}
// All the openGl has been destroyed ...
s_listInstance[_id]->getResourcesManager().ContextHasBeenDestroyed();
s_listInstance[_id]->getResourcesManager().contextHasBeenDestroyed();
s_listInstance[_id]->OS_Suspend();
}
void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id) {
@ -817,7 +817,7 @@ extern "C"
}
// get the short* pointer from the Java array
jboolean isCopy;
jshort* dst = _env->getShortArrayElements(_location, &isCopy);
jshort* dst = _env->GetShortArrayElements(_location, &isCopy);
if (NULL != dst) {
ewol::audio::getData(dst, _frameRate, _nbChannels);
}
@ -825,12 +825,13 @@ extern "C"
// TODO : Understand why it did not work corectly ...
//if (isCopy == JNI_TRUE) {
// release the short* pointer
_env->releaseShortArrayElements(_location, dst, 0);
_env->ReleaseShortArrayElements(_location, dst, 0);
//}
}
};
int ewol::Run(int _argc, const char *_argv[]) {
int ewol::run(int _argc, const char *_argv[]) {
// Never call but needed ...
return -1;
}

View File

@ -214,7 +214,11 @@ void ewol::eContext::setArchiveDir(int _mode, const char* _str) {
ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
m_previousDisplayTime(0),
m_input(*this),
#if defined(__TARGET_OS__Android)
m_displayFps(true),
#else
m_displayFps(false),
#endif
m_FpsSystemEvent( "Event ", false),
m_FpsSystemContext("Context ", false),
m_FpsSystem( "Draw ", true),
@ -549,21 +553,30 @@ void ewol::eContext::stop(void) {
}
void ewol::eContext::setSize(const vec2& _size) {
EWOL_INFO("NOT implemented ...");
EWOL_INFO("setSize: NOT implemented ...");
};
void ewol::eContext::setPos(const vec2& _pos) {
EWOL_INFO("NOT implemented ...");
EWOL_INFO("setPos: NOT implemented ...");
}
void ewol::eContext::hide(void) {
EWOL_INFO("NOT implemented ...");
EWOL_INFO("hide: NOT implemented ...");
};
void ewol::eContext::show(void) {
EWOL_INFO("NOT implemented ...");
EWOL_INFO("show: NOT implemented ...");
}
void ewol::eContext::setTitle(const etk::UString& _title) {
EWOL_INFO("NOT implemented ...");
EWOL_INFO("setTitle: NOT implemented ...");
}
void ewol::eContext::keyboardShow(void) {
EWOL_INFO("keyboardShow: NOT implemented ...");
}
void ewol::eContext::keyboardHide(void) {
EWOL_INFO("keyboardHide: NOT implemented ...");
}

View File

@ -272,11 +272,11 @@ namespace ewol {
/**
* @brief display the virtal keyboard (for touch system only)
*/
void keyboardShow(void) {};
virtual void keyboardShow(void);
/**
* @brief Hide the virtal keyboard (for touch system only)
*/
void keyboardHide(void) {};
virtual void keyboardHide(void);
/**
* @brief Inform the Gui that we want to have a copy of the clipboard

View File

@ -56,7 +56,7 @@ static int32_t nextP2(int32_t _value) {
ewol::TextureFile* ewol::TextureFile::keep(const etk::UString& _filename, ivec2 _size) {
EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size);
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size);
if (_filename == "") {
ewol::TextureFile* object = new ewol::TextureFile("");
if (NULL == object) {
@ -93,12 +93,12 @@ ewol::TextureFile* ewol::TextureFile::keep(const etk::UString& _filename, ivec2
TmpFilename += _size.y();
}
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size);
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size);
ewol::TextureFile* object = static_cast<ewol::TextureFile*>(getManager().localKeep(TmpFilename));
if (NULL != object) {
return object;
}
EWOL_INFO(" == > create new one...");
EWOL_INFO("CREATE: TextureFile: '" << TmpFilename << "' size=" << _size);
// need to crate a new one ...
object = new ewol::TextureFile(TmpFilename, _filename, _size);
if (NULL == object) {

View File

@ -20,7 +20,7 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName)
m_checkNormal(false),
m_pointerShape(NULL),
m_functionFreeShape(NULL) {
EWOL_DEBUG("Load a new mesh : '" << _fileName << "'");
EWOL_VERBOSE("Load a new mesh : '" << _fileName << "'");
// get the shader resource :
m_GLPosition = 0;
@ -652,7 +652,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
return false;
}
emfModuleMode_te currentMode = EMFModuleNone;
EWOL_DEBUG("Start parsing Mesh file : " << fileName);
EWOL_VERBOSE("Start parsing Mesh file : " << fileName);
// mesh global param :
etk::UString currentMeshName = "";
int32_t meshFaceMaterialID = -1;
@ -671,10 +671,10 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
}
if(0 == strncmp(inputDataLine, "Mesh :", 6) ) {
currentMode = EMFModuleMesh;
EWOL_DEBUG("Parse Mesh :");
EWOL_VERBOSE("Parse Mesh :");
} else if(0 == strncmp(inputDataLine, "Materials : ", 11) ) {
currentMode = EMFModuleMaterial;
EWOL_DEBUG("Parse Material :");
EWOL_VERBOSE("Parse Material :");
} else {
currentMode = EMFModuleNone;
}
@ -689,7 +689,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
removeEndLine(inputDataLine);
currentMeshName = inputDataLine;
currentMode = EMFModuleMeshNamed;
EWOL_DEBUG(" "<< currentMeshName);
EWOL_VERBOSE(" "<< currentMeshName);
continue;
}
if (level == 2) {
@ -701,22 +701,22 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
removeEndLine(inputDataLine);
if(0 == strncmp(inputDataLine, "Vertex", 6) ) {
currentMode = EMFModuleMeshVertex;
EWOL_DEBUG(" Vertex ...");
EWOL_VERBOSE(" Vertex ...");
} else if(0 == strncmp(inputDataLine, "UV-mapping", 10) ) {
currentMode = EMFModuleMeshUVMapping;
EWOL_DEBUG(" UV-mapping ...");
EWOL_VERBOSE(" UV-mapping ...");
} else if(0 == strncmp(inputDataLine, "Normal(vertex)", 14) ) {
currentMode = EMFModuleMeshNormalVertex;
EWOL_DEBUG(" Normal(vertex) ...");
EWOL_VERBOSE(" Normal(vertex) ...");
} else if(0 == strncmp(inputDataLine, "Normal(face)", 12) ) {
currentMode = EMFModuleMeshNormalFace;
EWOL_DEBUG(" Normal(face) ...");
EWOL_VERBOSE(" Normal(face) ...");
} else if(0 == strncmp(inputDataLine, "Face", 4) ) {
currentMode = EMFModuleMeshFace;
EWOL_DEBUG(" Face ...");
EWOL_VERBOSE(" Face ...");
} else if(0 == strncmp(inputDataLine, "Physics", 7) ) {
currentMode = EMFModuleMeshPhysics;
EWOL_DEBUG(" Physics ...");
EWOL_VERBOSE(" Physics ...");
} else {
EWOL_ERROR(" Unknow mesh property '"<<inputDataLine<<"'");
currentMode = EMFModuleMeshNamed;
@ -743,7 +743,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
break;
}
}
EWOL_DEBUG(" " << m_listVertex.size() << " vertex");
EWOL_VERBOSE(" " << m_listVertex.size() << " vertex");
break;
}
case EMFModuleMeshUVMapping: {
@ -760,7 +760,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
break;
}
}
EWOL_DEBUG(" " << m_listUV.size() << " coord");
EWOL_VERBOSE(" " << m_listUV.size() << " coord");
break;
}
case EMFModuleMeshNormalVertex: {
@ -779,7 +779,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
break;
}
}
EWOL_DEBUG(" " << m_listVertexNormal.size() << " Normals");
EWOL_VERBOSE(" " << m_listVertexNormal.size() << " Normals");
break;
}
case EMFModuleMeshNormalFace: {
@ -798,7 +798,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
break;
}
}
EWOL_DEBUG(" " << m_listFacesNormal.size() << " Normals");
EWOL_VERBOSE(" " << m_listFacesNormal.size() << " Normals");
break;
}
case EMFModuleMeshFace:
@ -815,7 +815,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
FaceIndexing empty;
m_listFaces.add(inputDataLine, empty);
meshFaceMaterialID = m_listFaces.getId(inputDataLine);
EWOL_DEBUG(" " << inputDataLine);
EWOL_VERBOSE(" " << inputDataLine);
} else if (currentMode == EMFModuleMeshFaceMaterial) {
while (NULL != loadNextData(inputDataLine, 2048, fileName, true, true) ) {
if (inputDataLine[0] == '\0') {
@ -854,7 +854,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
break;
}
}
EWOL_DEBUG(" " << m_listFaces.getValue(meshFaceMaterialID).m_faces.size() << " faces");
EWOL_VERBOSE(" " << m_listFaces.getValue(meshFaceMaterialID).m_faces.size() << " faces");
} else {
// insert element without material ...
EWOL_ERROR(" try to add face without material selection ...");
@ -875,7 +875,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
continue;
}
m_physics.pushBack(physics);
EWOL_DEBUG(" " << m_physics.size() << " " << inputDataLine);
EWOL_VERBOSE(" " << m_physics.size() << " " << inputDataLine);
currentMode = EMFModuleMeshPhysicsNamed;
} else if (currentMode == EMFModuleMeshPhysicsNamed) {
if (physics == NULL) {
@ -907,7 +907,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
material = new ewol::Material();
materialName = inputDataLine;
currentMode = EMFModuleMaterialNamed;
EWOL_DEBUG(" "<< materialName);
EWOL_VERBOSE(" "<< materialName);
continue;
}
// level >1
@ -925,7 +925,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
float tmpVal=0;
sscanf(&inputDataLine[3], "%f", &tmpVal);
material->setShininess(tmpVal);
EWOL_WARNING(" Shininess " << tmpVal);
EWOL_VERBOSE(" Shininess " << tmpVal);
} else if(0 == strncmp(inputDataLine,"Ka ",3)) {
float tmpVal1=0;
float tmpVal2=0;
@ -933,7 +933,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
sscanf(&inputDataLine[3], "%f %f %f", &tmpVal1, &tmpVal2, &tmpVal3);
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
material->setAmbientFactor(tmp);
EWOL_WARNING(" AmbientFactor " << tmp);
EWOL_VERBOSE(" AmbientFactor " << tmp);
} else if(0 == strncmp(inputDataLine,"Kd ",3)) {
float tmpVal1=0;
float tmpVal2=0;
@ -941,7 +941,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
sscanf(&inputDataLine[3], "%f %f %f", &tmpVal1, &tmpVal2, &tmpVal3);
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
material->setDiffuseFactor(tmp);
EWOL_WARNING(" DiffuseFactor " << tmp);
EWOL_VERBOSE(" DiffuseFactor " << tmp);
} else if(0 == strncmp(inputDataLine,"Ks ",3)) {
float tmpVal1=0;
float tmpVal2=0;
@ -949,25 +949,25 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
sscanf(&inputDataLine[3], "%f %f %f", &tmpVal1, &tmpVal2, &tmpVal3);
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
material->setSpecularFactor(tmp);
EWOL_WARNING(" SpecularFactor " << tmp);
EWOL_VERBOSE(" SpecularFactor " << tmp);
} else if(0 == strncmp(inputDataLine,"Ni ",3)) {
float tmpVal=0;
sscanf(&inputDataLine[3], "%f", &tmpVal);
// TODO : ...
EWOL_WARNING(" Ni " << tmpVal);
EWOL_VERBOSE(" Ni " << tmpVal);
} else if(0 == strncmp(inputDataLine,"d ",2)) {
float tmpVal=0;
sscanf(&inputDataLine[2], "%f", &tmpVal);
// TODO : ...
EWOL_WARNING(" d " << tmpVal);
EWOL_VERBOSE(" d " << tmpVal);
} else if(0 == strncmp(inputDataLine,"illum ",6)) {
int tmpVal=0;
sscanf(&inputDataLine[6], "%d", &tmpVal);
// TODO : ...
EWOL_WARNING(" illum " << tmpVal);
EWOL_VERBOSE(" illum " << tmpVal);
} else if(0 == strncmp(inputDataLine,"map_Kd ",7)) {
material->setTexture0(fileName.getRelativeFolder() + &inputDataLine[7]);
EWOL_WARNING(" Texture " << &inputDataLine[7]);
EWOL_VERBOSE(" Texture " << &inputDataLine[7]);
} else {
EWOL_ERROR("unknow material property ... : '" << inputDataLine << "'");
}
@ -985,7 +985,7 @@ bool ewol::Mesh::loadEMF(const etk::UString& _fileName) {
materialName = "";
material = NULL;
}
EWOL_DEBUG("Stop parsing Mesh file");
EWOL_VERBOSE("Stop parsing Mesh file");
fileName.fileClose();
generateVBO();
@ -1018,6 +1018,7 @@ ewol::Mesh* ewol::Mesh::keep(const etk::UString& _meshName) {
if (NULL != object) {
return object;
}
EWOL_DEBUG("CREATE: Mesh: '" << _meshName << "'");
object = new ewol::Mesh(_meshName);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName);

View File

@ -176,10 +176,10 @@ void ewol::ResourceManager::localAdd(ewol::Resource* _object) {
m_resourceList.pushBack(_object);
}
void ewol::ResourceManager::release(ewol::Resource*& _object) {
bool ewol::ResourceManager::release(ewol::Resource*& _object) {
if (NULL == _object) {
EWOL_ERROR("Try to remove a resource that have null pointer ...");
return;
return false;
}
for (int32_t iii=0; iii<m_resourceListToUpdate.size(); iii++) {
if (m_resourceListToUpdate[iii] == _object) {
@ -199,11 +199,12 @@ void ewol::ResourceManager::release(ewol::Resource*& _object) {
}
// insidiously remove the pointer for the caller ...
_object = NULL;
return;
return true;
}
}
}
EWOL_ERROR("Can not find the resources in the list : " << (int64_t)_object);
// insidiously remove the pointer for the caller ...
_object = NULL;
return false;
}

View File

@ -72,8 +72,9 @@ namespace ewol {
/**
* @brief release a resources and free it if the Last release is call.
* @param[in,out] _object element to realease == > is return at NULL value.
* @return true, if element is removed, and false for just decreasing counter
*/
void release(ewol::Resource*& _object);
bool release(ewol::Resource*& _object);
};
};

View File

@ -81,7 +81,7 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
return;
}
}
m_name = fontName.extract(0, (tmpPos - tmpData));
etk::UString localName = fontName.extract(0, (tmpPos - tmpData));
m_size = tmpSize;
etk::Vector<etk::UString> folderList;
@ -98,8 +98,8 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
// find the real Font name :
etk::Vector<etk::UString> output;
myFolder.folderGetRecursiveFiles(output);
etk::Vector<etk::UString> split = m_name.split(';');
EWOL_INFO("try to find font named : '" << split << "' in : '" << myFolder <<"'");
etk::Vector<etk::UString> split = localName.split(';');
EWOL_INFO("try to find font named : " << split << " in: " << myFolder);
//EWOL_CRITICAL("parse string : " << split);
bool hasFindAFont = false;
for (int32_t jjj=0; jjj<split.size(); jjj++) {
@ -292,7 +292,7 @@ bool ewol::TexturedFont::addGlyph(const etk::UniChar& _val) {
}
if (hasChange == true) {
flush();
egami::store(m_data, "fileFont.bmp");
//egami::store(m_data, "fileFont.bmp"); // ==> for debug test only ...
}
return hasChange;
}
@ -352,12 +352,13 @@ ewol::GlyphProperty* ewol::TexturedFont::getGlyphPointer(const uniChar_t& _charc
}
ewol::TexturedFont* ewol::TexturedFont::keep(const etk::UString& _filename) {
EWOL_VERBOSE("KEEP : TexturedFont : file : \"" << _filename << "\"");
EWOL_DEBUG("KEEP : TexturedFont : file : '" << _filename << "'");
ewol::TexturedFont* object = static_cast<ewol::TexturedFont*>(getManager().localKeep(_filename));
if (NULL != object) {
return object;
}
// need to crate a new one ...
EWOL_DEBUG("CREATE: TexturedFont : file : '" << _filename << "'");
object = new ewol::TexturedFont(_filename);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : " << _filename);
@ -371,7 +372,11 @@ void ewol::TexturedFont::release(ewol::TexturedFont*& _object) {
if (NULL == _object) {
return;
}
etk::UString name = _object->getName();
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
getManager().release(object2);
if (getManager().release(object2) == true) {
EWOL_DEBUG("REMOVE: TexturedFont : file : '" << name << "'");
etk::displayBacktrace(false);
}
_object = NULL;
}

View File

@ -45,18 +45,24 @@ namespace ewol {
~TexturedFont(void);
public:
virtual bool hasName(const etk::UString& _fileName);
const char* getType(void) { return "ewol::TexturedFont"; };
const char* getType(void) {
return "ewol::TexturedFont";
};
/**
* @brief get the display height of this font
* @param[in] _displayMode Mode to display the currrent font
* @return Dimention of the font need between 2 lines
*/
int32_t getHeight(const ewol::font::mode_te _displayMode = ewol::font::Regular) { return m_height[_displayMode]; };
int32_t getHeight(const ewol::font::mode_te _displayMode = ewol::font::Regular) {
return m_height[_displayMode];
};
/**
* @brief get the font height (user friendly)
* @return Dimention of the font the user requested
*/
int32_t getFontSize(void) { return m_size; };
int32_t getFontSize(void) {
return m_size;
};
/**
* @brief get the ID of a unicode charcode
* @param[in] _charcode The unicodeValue
@ -77,7 +83,9 @@ namespace ewol {
* @param[in] _source The requested mode.
* @return the best mode we have in stock.
*/
ewol::font::mode_te getWrappingMode(ewol::font::mode_te _source) { return m_modeWraping[_source]; };
ewol::font::mode_te getWrappingMode(ewol::font::mode_te _source) {
return m_modeWraping[_source];
};
public:
/**
* @brief keep the resource pointer.