Abstraction thread nearly ended ==> work on android, but texture are not correct
This commit is contained in:
parent
37098ebad7
commit
ebac712147
@ -20,6 +20,7 @@ import android.view.WindowManager;
|
||||
|
||||
import java.io.File;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
// For the getting apk name :
|
||||
import android.content.pm.ActivityInfo;
|
||||
@ -34,6 +35,14 @@ import android.content.res.AssetManager;
|
||||
*
|
||||
*/
|
||||
public class __PROJECT_NAME__ extends Activity {
|
||||
private static native void ActivityOnCreate();
|
||||
private static native void ActivityOnStart();
|
||||
private static native void ActivityOnReStart();
|
||||
private static native void ActivityOnResume();
|
||||
private static native void ActivityOnPause();
|
||||
private static native void ActivityOnStop();
|
||||
private static native void ActivityOnDestroy();
|
||||
private static native void ActivityParamSetArchiveDir(int mode, String myString);
|
||||
|
||||
private GLSurfaceView mGLView;
|
||||
|
||||
@ -43,6 +52,30 @@ public class __PROJECT_NAME__ extends Activity {
|
||||
|
||||
@Override protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Load the application directory
|
||||
ActivityParamSetArchiveDir(1, getFilesDir().toString());
|
||||
ActivityParamSetArchiveDir(2, getCacheDir().toString());
|
||||
// to enable extarnal storage: add in the manifest the restriction needed ...
|
||||
//ActivityParamSetArchiveDir(3, getExternalCacheDir().toString());
|
||||
|
||||
// return apk file path (or null on error)
|
||||
String apkFilePath = null;
|
||||
ApplicationInfo appInfo = null;
|
||||
PackageManager packMgmr = getPackageManager();
|
||||
try {
|
||||
appInfo = packMgmr.getApplicationInfo("com.__PROJECT_VENDOR__.__PROJECT_PACKAGE__", 0);
|
||||
} catch (NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Unable to locate assets, aborting...");
|
||||
}
|
||||
apkFilePath = appInfo.sourceDir;
|
||||
ActivityParamSetArchiveDir(0, apkFilePath);
|
||||
|
||||
|
||||
// call C init ...
|
||||
ActivityOnCreate();
|
||||
|
||||
// Remove the title of the current display :
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
// set full screen Mode :
|
||||
@ -54,14 +87,44 @@ public class __PROJECT_NAME__ extends Activity {
|
||||
setContentView(mGLView);
|
||||
}
|
||||
|
||||
@Override protected void onPause() {
|
||||
super.onPause();
|
||||
mGLView.onPause();
|
||||
@Override protected void onStart() {
|
||||
super.onStart();
|
||||
// call C
|
||||
ActivityOnStart();
|
||||
}
|
||||
|
||||
|
||||
@Override protected void onRestart() {
|
||||
super.onRestart();
|
||||
// call C
|
||||
ActivityOnReStart();
|
||||
}
|
||||
|
||||
@Override protected void onResume() {
|
||||
super.onResume();
|
||||
mGLView.onResume();
|
||||
// call C
|
||||
ActivityOnResume();
|
||||
}
|
||||
|
||||
@Override protected void onPause() {
|
||||
super.onPause();
|
||||
mGLView.onPause();
|
||||
// call C
|
||||
ActivityOnPause();
|
||||
}
|
||||
|
||||
@Override protected void onStop() {
|
||||
super.onStop();
|
||||
// call C
|
||||
ActivityOnStop();
|
||||
}
|
||||
@Override protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
// call C
|
||||
ActivityOnDestroy();
|
||||
}
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,29 +139,10 @@ class EwolGLSurfaceView extends GLSurfaceView {
|
||||
private static native void nativeEventInputMotion(int pointerID, float x, float y);
|
||||
private static native void nativeEventInputState(int pointerID, boolean isDown, float x, float y);
|
||||
private static native void nativeEventUnknow(int eventID);
|
||||
private static native void nativeParamSetArchiveDir(int mode, String myString);
|
||||
|
||||
public EwolGLSurfaceView(Context context) {
|
||||
// super must be first statement in constructor
|
||||
super(context);
|
||||
// Load the application directory
|
||||
nativeParamSetArchiveDir(1, context.getFilesDir().toString());
|
||||
nativeParamSetArchiveDir(2, context.getCacheDir().toString());
|
||||
// to enable extarnal storage: add in the manifest the restriction needed ...
|
||||
//nativeParamSetArchiveDir(3, context.getExternalCacheDir().toString());
|
||||
|
||||
// return apk file path (or null on error)
|
||||
String apkFilePath = null;
|
||||
ApplicationInfo appInfo = null;
|
||||
PackageManager packMgmr = context.getPackageManager();
|
||||
try {
|
||||
appInfo = packMgmr.getApplicationInfo("com.__PROJECT_VENDOR__.__PROJECT_PACKAGE__", 0);
|
||||
} catch (NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Unable to locate assets, aborting...");
|
||||
}
|
||||
apkFilePath = appInfo.sourceDir;
|
||||
nativeParamSetArchiveDir(0, apkFilePath);
|
||||
|
||||
// je n'ai pas compris ...
|
||||
mRenderer = new EwolRenderer();
|
||||
@ -121,32 +165,32 @@ class EwolGLSurfaceView extends GLSurfaceView {
|
||||
}
|
||||
} else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
|
||||
|| tmpActionType == MotionEvent.ACTION_DOWN) {
|
||||
nativeEventInputState(0, true, (float)event.getX(0), (float)event.getY(0));
|
||||
nativeEventInputState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
|
||||
InputDown1 = true;
|
||||
} else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
|
||||
nativeEventInputState(0, false, (float)event.getX(0), (float)event.getY(0));
|
||||
nativeEventInputState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
|
||||
InputDown1 = false;
|
||||
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) {
|
||||
nativeEventInputState(1, true, (float)event.getX(1), (float)event.getY(1));
|
||||
nativeEventInputState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
|
||||
InputDown2 = true;
|
||||
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) {
|
||||
nativeEventInputState(1, false, (float)event.getX(1), (float)event.getY(1));
|
||||
nativeEventInputState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
|
||||
InputDown2 = false;
|
||||
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) {
|
||||
nativeEventInputState(2, true, (float)event.getX(2), (float)event.getY(2));
|
||||
nativeEventInputState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
|
||||
InputDown3 = true;
|
||||
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) {
|
||||
nativeEventInputState(2, false, (float)event.getX(2), (float)event.getY(2));
|
||||
nativeEventInputState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
|
||||
InputDown3 = false;
|
||||
} else if(tmpActionType == MotionEvent.ACTION_UP){
|
||||
if (InputDown1) {
|
||||
nativeEventInputState(0, false, (float)event.getX(0), (float)event.getY(0));
|
||||
nativeEventInputState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
|
||||
InputDown1 = false;
|
||||
} else if (InputDown2) {
|
||||
nativeEventInputState(1, false, (float)event.getX(1), (float)event.getY(1));
|
||||
nativeEventInputState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
|
||||
InputDown2 = false;
|
||||
} else {
|
||||
nativeEventInputState(2, false, (float)event.getX(2), (float)event.getY(2));
|
||||
nativeEventInputState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
|
||||
InputDown3 = false;
|
||||
}
|
||||
} else {
|
||||
@ -173,7 +217,6 @@ class EwolRenderer implements GLSurfaceView.Renderer {
|
||||
private static native void nativeInit();
|
||||
private static native void nativeResize(int w, int h);
|
||||
private static native void nativeRender();
|
||||
private static native void nativeDone();
|
||||
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
nativeInit();
|
||||
|
@ -50,6 +50,7 @@ static pthread_attr_t androidJniThreadAttr;
|
||||
enum {
|
||||
JNI_NONE,
|
||||
JNI_INIT,
|
||||
JNI_UN_INIT,
|
||||
JNI_DONE,
|
||||
JNI_RESIZE,
|
||||
JNI_INPUT_MOTION,
|
||||
@ -64,49 +65,85 @@ enum {
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
typedef struct {
|
||||
int w;
|
||||
int h;
|
||||
} eventResize_ts;
|
||||
|
||||
typedef struct {
|
||||
int pointerID;
|
||||
float x;
|
||||
float y;
|
||||
} eventInputMotion_ts;
|
||||
|
||||
typedef struct {
|
||||
int pointerID;
|
||||
bool state;
|
||||
float x;
|
||||
float y;
|
||||
} eventInputState_ts;
|
||||
|
||||
|
||||
|
||||
static void* BaseAppEntry(void* param)
|
||||
{
|
||||
bool requestEndProcessing = false;
|
||||
EDN_DEBUG("start Ewol Basic thread ...");
|
||||
ewol::threadMsg::tmppp5656("start Ewol Basic thread ...");
|
||||
while(1) {
|
||||
while(false == requestEndProcessing) {
|
||||
ewol::threadMsg::threadMsgContent_ts data;
|
||||
ewol::threadMsg::tmppp5656("start waiting");
|
||||
ewol::threadMsg::WaitMessage(androidJniMsg, data);
|
||||
ewol::threadMsg::tmppp5656("end waiting");
|
||||
switch (data.type) {
|
||||
case JNI_NONE:
|
||||
ewol::threadMsg::tmppp5656("JNI_NONE");
|
||||
EDN_DEBUG("Receive MSG : JNI_NONE");
|
||||
break;
|
||||
case JNI_INIT:
|
||||
ewol::threadMsg::tmppp5656("JNI_INIT");
|
||||
EDN_DEBUG("Receive MSG : JNI_INIT");
|
||||
EWOL_NativeApplicationInit();
|
||||
break;
|
||||
case JNI_UN_INIT:
|
||||
EDN_DEBUG("Receive MSG : JNI_UN_INIT");
|
||||
EWOL_NativeApplicationUnInit();
|
||||
requestEndProcessing = true;
|
||||
break;
|
||||
case JNI_DONE:
|
||||
ewol::threadMsg::tmppp5656("JNI_DONE");
|
||||
EDN_DEBUG("Receive MSG : JNI_DONE");
|
||||
break;
|
||||
case JNI_RESIZE:
|
||||
ewol::threadMsg::tmppp5656("JNI_RESIZE");
|
||||
EDN_DEBUG("Receive MSG : JNI_RESIZE");
|
||||
{
|
||||
eventResize_ts * tmpData = (eventResize_ts*)data.data;
|
||||
EWOL_NativeResize(tmpData->w, tmpData->h);
|
||||
EWOL_NativeInit();
|
||||
}
|
||||
break;
|
||||
case JNI_INPUT_MOTION:
|
||||
ewol::threadMsg::tmppp5656("JNI_INPUT_MOTION");
|
||||
EDN_DEBUG("Receive MSG : JNI_INPUT_MOTION");
|
||||
{
|
||||
eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data;
|
||||
EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y);
|
||||
}
|
||||
break;
|
||||
case JNI_INPUT_STATE:
|
||||
ewol::threadMsg::tmppp5656("JNI_INPUT_STATE");
|
||||
EDN_DEBUG("Receive MSG : JNI_INPUT_STATE");
|
||||
{
|
||||
eventInputState_ts * tmpData = (eventInputState_ts*)data.data;
|
||||
EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y);
|
||||
}
|
||||
break;
|
||||
case JNI_DATA_ARCHIVE_DIR:
|
||||
ewol::threadMsg::tmppp5656("JNI_DATA_ARCHIVE_DIR");
|
||||
EDN_DEBUG("Receive MSG : JNI_DATA_ARCHIVE_DIR");
|
||||
break;
|
||||
case JNI_APP_INIT:
|
||||
ewol::threadMsg::tmppp5656("JNI_APP_INIT");
|
||||
EDN_DEBUG("Receive MSG : JNI_APP_INIT");
|
||||
break;
|
||||
case JNI_APP_UN_INIT:
|
||||
ewol::threadMsg::tmppp5656("JNI_APP_UN_INIT");
|
||||
EDN_DEBUG("Receive MSG : JNI_APP_UN_INIT");
|
||||
break;
|
||||
case JNI_APP_RENDERER:
|
||||
ewol::threadMsg::tmppp5656("JNI_APP_RENDERER");
|
||||
EDN_DEBUG("Receive MSG : JNI_APP_RENDERER");
|
||||
break;
|
||||
default:
|
||||
ewol::threadMsg::tmppp5656("UNKNOW");
|
||||
EDN_DEBUG("Receive MSG : UNKNOW");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -114,72 +151,117 @@ static void* BaseAppEntry(void* param)
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
|
||||
bool isGlobalSystemInit = false;
|
||||
|
||||
void BaseInit(void)
|
||||
{
|
||||
static bool isInit = false;
|
||||
if (false == isInit) {
|
||||
if (false == isGlobalSystemInit) {
|
||||
// create interface mutex :
|
||||
ewol::threadMsg::Init(androidJniMsg);
|
||||
// init the thread :
|
||||
//pthread_attr_init(&androidJniThreadAttr);
|
||||
//pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_DETACHED);
|
||||
//pthread_create(&androidJniThread, &androidJniThreadAttr, BaseAppEntry, NULL);
|
||||
pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
||||
isInit = true;
|
||||
isGlobalSystemInit = true;
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseUnInit(void)
|
||||
{
|
||||
if (true == isGlobalSystemInit) {
|
||||
isGlobalSystemInit = false;
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_UN_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
||||
|
||||
EDN_DEBUG("Wait end of the thread ...");
|
||||
// Wait end of the thread
|
||||
pthread_join(androidJniThread, NULL);
|
||||
ewol::threadMsg::UnInit(androidJniMsg);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
/* Call to initialize the graphics state */
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityParamSetArchiveDir( JNIEnv* env, jobject thiz, jint mode, jstring myString)
|
||||
{
|
||||
// direct setting of the date in the string system ...
|
||||
const char* str = env->GetStringUTFChars(myString,0);
|
||||
EWOL_NativeParamSetArchiveDir(mode, str);
|
||||
//env->ReleaseStringUTFChars(str,myString,0);
|
||||
}
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnCreate( JNIEnv* env )
|
||||
{
|
||||
EDN_DEBUG("Activity On Create");
|
||||
BaseInit();
|
||||
}
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStart( JNIEnv* env )
|
||||
{
|
||||
EDN_DEBUG("Activity On Start");
|
||||
}
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnReStart( JNIEnv* env )
|
||||
{
|
||||
EDN_DEBUG("Activity On Re-Start");
|
||||
}
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnResume( JNIEnv* env )
|
||||
{
|
||||
EDN_DEBUG("Activity On Resume");
|
||||
}
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnPause( JNIEnv* env )
|
||||
{
|
||||
EDN_DEBUG("Activity On Pause");
|
||||
}
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStop( JNIEnv* env )
|
||||
{
|
||||
EDN_DEBUG("Activity On Stop");
|
||||
}
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnDestroy( JNIEnv* env )
|
||||
{
|
||||
EDN_DEBUG("Activity On Destroy");
|
||||
BaseUnInit();
|
||||
}
|
||||
|
||||
|
||||
/* Call to initialize the graphics state */
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolRenderer_nativeInit( JNIEnv* env )
|
||||
{
|
||||
BaseInit();
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INIT);
|
||||
//EWOL_NativeInit();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolRenderer_nativeResize( JNIEnv* env, jobject thiz, jint w, jint h )
|
||||
{
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_RESIZE);
|
||||
//EWOL_NativeResize(w, h);
|
||||
}
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolRenderer_nativeDone( JNIEnv* env )
|
||||
{
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_DONE);
|
||||
//EWOL_NativeDone();
|
||||
eventResize_ts tmpData;
|
||||
tmpData.w = w;
|
||||
tmpData.h = h;
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_RESIZE, ewol::threadMsg::MSG_PRIO_MEDIUM, &tmpData, sizeof(eventResize_ts) );
|
||||
}
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventInputMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
|
||||
{
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_MOTION);
|
||||
//EWOL_NativeEventInputMotion(pointerID, x, y);
|
||||
eventInputMotion_ts tmpData;
|
||||
tmpData.pointerID = pointerID;
|
||||
tmpData.x = x;
|
||||
tmpData.y = y;
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
|
||||
}
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventInputState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
|
||||
{
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_STATE);
|
||||
//EWOL_NativeEventInputState(pointerID, isUp, x, y);
|
||||
eventInputState_ts tmpData;
|
||||
tmpData.pointerID = pointerID;
|
||||
tmpData.state = isUp;
|
||||
tmpData.x = x;
|
||||
tmpData.y = y;
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
|
||||
}
|
||||
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventUnknow( JNIEnv* env, jobject thiz, jint ID)
|
||||
{
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_DATA_ARCHIVE_DIR);
|
||||
//EWOL_NativeEventUnknow(ID);
|
||||
}
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeParamSetArchiveDir( JNIEnv* env, jobject thiz, jint mode, jstring myString)
|
||||
{
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, 0);
|
||||
const char* str = env->GetStringUTFChars(myString,0);
|
||||
//EWOL_NativeParamSetArchiveDir(mode, str);
|
||||
//env->ReleaseStringUTFChars(str,myString,0);
|
||||
}
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeApplicationInit( JNIEnv* env)
|
||||
{
|
||||
@ -195,11 +277,7 @@ extern "C"
|
||||
|
||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolRenderer_nativeRender( JNIEnv* env )
|
||||
{
|
||||
//pthread_mutex_lock(&androidJniMutex);
|
||||
//EWOL_NativeRender();
|
||||
//messageID = JNI_APP_RENDERER;
|
||||
//pthread_cond_signal(&androidJniCond);
|
||||
//pthread_mutex_unlock(&androidJniMutex);
|
||||
EWOL_NativeRender();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -505,7 +505,6 @@ void ewol::SetDefaultFont(etk::String fontName, int32_t size)
|
||||
// save the default font parameters ...
|
||||
s_currentDefaultFontName = fontName;
|
||||
s_currentDefaultFontId = tmpId;
|
||||
EWOL_DEBUG("MEGAPLOP 2");
|
||||
}
|
||||
|
||||
int32_t ewol::GetDefaultFontId(void)
|
||||
|
@ -435,7 +435,7 @@ int32_t ewol::LoadTexture(int32_t target,
|
||||
memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes);
|
||||
|
||||
if (true == OGLContextLoaded) {
|
||||
uint32_t textureid = -1;
|
||||
uint32_t textureid = 0;
|
||||
glGenTextures(1, &textureid);
|
||||
glBindTexture(tmpTex->m_target, textureid);
|
||||
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <sys/times.h>
|
||||
|
||||
|
||||
static int64_t GetCurrentTime(void)
|
||||
int64_t GetCurrentTime(void)
|
||||
{
|
||||
return times(NULL);
|
||||
}
|
||||
|
@ -70,7 +70,15 @@ bool ewol::threadMsg::WaitMessage(ewol::threadMsg::threadMsg_ts& messageData, ew
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_lock(&messageData.mutex);
|
||||
pthread_cond_wait(&messageData.condition, &messageData.mutex);
|
||||
bool findAnOtherMessageInStack = false;
|
||||
for (int32_t iii=0; MSG_PRIO_NUMBER>iii; iii++) {
|
||||
if (0 < messageData.nbMessages[iii]) {
|
||||
findAnOtherMessageInStack = true;
|
||||
}
|
||||
}
|
||||
if (false == findAnOtherMessageInStack) {
|
||||
pthread_cond_wait(&messageData.condition, &messageData.mutex);
|
||||
}
|
||||
// find the message :
|
||||
for (int32_t iii=0; MSG_PRIO_NUMBER>iii; iii++) {
|
||||
if (0 < messageData.nbMessages[iii]) {
|
||||
@ -96,7 +104,7 @@ bool ewol::threadMsg::WaitMessage(ewol::threadMsg::threadMsg_ts& messageData, ew
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ewol::threadMsg::SendMessage(ewol::threadMsg::threadMsg_ts& messageData, uint32_t type, char * data, uint32_t size, ewol::threadMsg::msgPriority_te prio)
|
||||
bool ewol::threadMsg::SendMessage(ewol::threadMsg::threadMsg_ts& messageData, uint32_t type, ewol::threadMsg::msgPriority_te prio, void * data, uint32_t size)
|
||||
{
|
||||
if (false == messageData.isInit) {
|
||||
return false;
|
||||
@ -107,8 +115,9 @@ bool ewol::threadMsg::SendMessage(ewol::threadMsg::threadMsg_ts& messageData, ui
|
||||
}
|
||||
if (size > MAX_MSG_DATA_SIZE) {
|
||||
EWOL_ERROR("Send message with an biger size than predictible " << size << " > " << MAX_MSG_DATA_SIZE);
|
||||
return false;
|
||||
}
|
||||
EWOL_DEBUG("Try to send Message");
|
||||
pthread_mutex_lock(&messageData.mutex);
|
||||
int32_t lastNbMessage = messageData.nbMessages[prio];
|
||||
for (int32_t jjj=0; NUMBER_OF_ELEMENT_IN_THE_FIFO>jjj; jjj++) {
|
||||
if (messageData.listOfMessages[prio][jjj].isActive == false) {
|
||||
@ -119,21 +128,27 @@ bool ewol::threadMsg::SendMessage(ewol::threadMsg::threadMsg_ts& messageData, ui
|
||||
if (data!=NULL) {
|
||||
memcpy(messageData.listOfMessages[prio][jjj].data, data, size);
|
||||
}
|
||||
//EWOL_DEBUG("Find Slot : (" << prio << "," << jjj << ")");
|
||||
messageData.nbMessages[prio]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pthread_cond_broadcast(&messageData.condition);
|
||||
/*
|
||||
EWOL_DEBUG("send message (" << messageData.nbMessages[MSG_PRIO_REAL_TIME] << ","
|
||||
<< messageData.nbMessages[MSG_PRIO_HIGH] << ","
|
||||
<< messageData.nbMessages[MSG_PRIO_MEDIUM] << ","
|
||||
<< messageData.nbMessages[MSG_PRIO_LOW] << ","
|
||||
<< messageData.nbMessages[MSG_PRIO_NONE] << ")");
|
||||
*/
|
||||
bool returnValue = false;
|
||||
if (lastNbMessage != messageData.nbMessages[prio]) {
|
||||
return true;
|
||||
returnValue = true;
|
||||
} else {
|
||||
EWOL_ERROR("Send message Add error");
|
||||
return false;
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ewol::threadMsg::tmppp5656(const char * plop)
|
||||
{
|
||||
EWOL_CRITICAL(plop);
|
||||
pthread_cond_broadcast(&messageData.condition);
|
||||
pthread_mutex_unlock(&messageData.mutex);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
@ -60,10 +60,7 @@ namespace ewol {
|
||||
void Init(threadMsg_ts& messageData);
|
||||
void UnInit(threadMsg_ts& messageData);
|
||||
bool WaitMessage(threadMsg_ts& messageData, threadMsgContent_ts &data);
|
||||
bool SendMessage(threadMsg_ts& messageData, uint32_t type, char * data = NULL, uint32_t size = 0, msgPriority_te prio = MSG_PRIO_NONE);
|
||||
|
||||
|
||||
void tmppp5656(const char * plop);
|
||||
bool SendMessage(threadMsg_ts& messageData, uint32_t type, msgPriority_te prio = MSG_PRIO_NONE, void * data = NULL, uint32_t size = 0);
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user