android: link with the jni is now ok

This commit is contained in:
Edouard Dupin 2011-12-04 10:36:37 +01:00
parent 0a479ca7ff
commit aa3e79f8d1
3 changed files with 104 additions and 96 deletions

View File

@ -65,7 +65,7 @@ else
$(error you must specify a corect platform : make PLATFORM=$(SUPPORTED_PLATFORM)) $(error you must specify a corect platform : make PLATFORM=$(SUPPORTED_PLATFORM))
endif endif
$(info Build for $(PLATFORM)) $(info Build for PLATFORM=$(PLATFORM))
############################################################################### ###############################################################################
### Compilateur base system ### ### Compilateur base system ###
@ -305,10 +305,14 @@ $(OUTPUT_NAME_DEBUG): $(OBJ) $(MAKE_DEPENDENCE)
@cp $@ $(PROG_NAME) @cp $@ $(PROG_NAME)
endif endif
clean: clean:
@echo $(CADRE_HAUT_BAS) @echo $(CADRE_HAUT_BAS)
@echo ' CLEANING : $(F_VIOLET)$(OUTPUT_NAME)$(F_NORMALE)'$(CADRE_COTERS) @echo ' CLEANING : $(F_VIOLET)$(OUTPUT_NAME)$(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS) @echo $(CADRE_HAUT_BAS)
ifeq ($(PLATFORM), Android)
rm -r bin libs gen obj
else
@echo Remove Folder : $(OBJECT_DIR) @echo Remove Folder : $(OBJECT_DIR)
@rm -rf $(OBJECT_DIR) @rm -rf $(OBJECT_DIR)
@echo Remove File : $(PROG_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE) @echo Remove File : $(PROG_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)
@ -322,10 +326,15 @@ clean:
@rm -f doxygen.log @rm -f doxygen.log
@echo Remove temporary files *.bck @echo Remove temporary files *.bck
@rm -f `find . -name "*.bck"` @rm -f `find . -name "*.bck"`
endif
count: count:
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"` wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
ifeq ($(PLATFORM), Android)
install:
sudo $(PROJECT_SDK)/platform-tools/adb install -r ./bin/EwolActivity-debug.apk
else
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE) install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
@echo $(CADRE_HAUT_BAS) @echo $(CADRE_HAUT_BAS)
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS) @echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
@ -342,7 +351,7 @@ install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
@mkdir -p /usr/share/edn/images/ @mkdir -p /usr/share/edn/images/
@cp -vf data/imagesSources/icone.png /usr/share/edn/images/ @cp -vf data/imagesSources/icone.png /usr/share/edn/images/
@cp -vf data/imagesSources/delete-24px.png /usr/share/edn/images/ @cp -vf data/imagesSources/delete-24px.png /usr/share/edn/images/
endif
# http://alp.developpez.com/tutoriels/debian/creer-paquet/ # http://alp.developpez.com/tutoriels/debian/creer-paquet/
package: .encadrer package: .encadrer

View File

@ -24,6 +24,11 @@
#include <jni.h>
#include <sys/time.h>
#include <time.h>
#include <android/log.h>
#include <stdint.h>
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <etk/String.h> #include <etk/String.h>
@ -31,11 +36,6 @@
#include <base/guiAndroid.h> #include <base/guiAndroid.h>
#include <jni.h>
#include <sys/time.h>
#include <time.h>
#include <android/log.h>
#include <stdint.h>
#include <app.h> #include <app.h>
@ -61,99 +61,98 @@ static long _getTime(void)
return (long)(now.tv_sec*1000 + now.tv_usec/1000); return (long)(now.tv_sec*1000 + now.tv_usec/1000);
} }
/* Call to initialize the graphics state */ extern "C"
void Java_com_example_ewolAbstraction_EwolRenderer_nativeInit( JNIEnv* env )
{ {
EWOL_INFO("Init : Start All Application");
appInit(); /* Call to initialize the graphics state */
gAppAlive = 1; void Java_com_example_ewolAbstraction_EwolRenderer_nativeInit( JNIEnv* env )
sDemoStopped = 0; {
sTimeOffsetInit = 0; EWOL_INFO("Init : Start All Application");
} appInit();
gAppAlive = 1;
sDemoStopped = 0;
void Java_com_example_ewolAbstraction_EwolRenderer_nativeResize( JNIEnv* env, jobject thiz, jint w, jint h ) sTimeOffsetInit = 0;
{
currentWidth = w;
currentHeight = h;
EWOL_INFO("Resize w=" << w << " h=" << h);
}
/* Call to finalize the graphics state */
void Java_com_example_ewolAbstraction_EwolRenderer_nativeDone( JNIEnv* env )
{
EWOL_INFO("Renderer : Close All Application");
appDeinit();
}
/* This is called to indicate to the render loop that it should
* stop as soon as possible.
*/
void Java_com_example_ewolAbstraction_EwolGLSurfaceView_nativePause( JNIEnv* env )
{
sDemoStopped = !sDemoStopped;
if (sDemoStopped) {
/* we paused the animation, so store the current
* time in sTimeStopped for future nativeRender calls */
sTimeStopped = _getTime();
} else {
/* we resumed the animation, so adjust the time offset
* to take care of the pause interval. */
sTimeOffset -= _getTime() - sTimeStopped;
} }
}
void Java_com_example_ewolAbstraction_EwolRenderer_nativeResize( JNIEnv* env, jobject thiz, jint w, jint h )
void Java_com_example_ewolAbstraction_EwolGLSurfaceView_nativeEventInputMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y ) {
{ currentWidth = w;
EWOL_INFO("Event : Input Motion ID=" << pointerID << " x=" << x << " y=" << y); currentHeight = h;
if (0 == pointerID) { EWOL_INFO("Resize w=" << w << " h=" << h);
appMove(x,y);
} }
}
/* Call to finalize the graphics state */
void Java_com_example_ewolAbstraction_EwolGLSurfaceView_nativeEventInputState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp) void Java_com_example_ewolAbstraction_EwolRenderer_nativeDone( JNIEnv* env )
{ {
if (isUp) { EWOL_INFO("Renderer : Close All Application");
__android_log_print(ANDROID_LOG_INFO, "EWOL", "Event : Input ID=%d [DOWN]", pointerID); appDeinit();
EWOL_INFO("Event : Input ID=" << pointerID << " [DOWN]");
} else {
__android_log_print(ANDROID_LOG_INFO, "EWOL", "Event : Input ID=%d [UP]", pointerID);
EWOL_INFO("Event : Input ID=" << pointerID << " [UP]");
} }
/* This is called to indicate to the render loop that it should
* stop as soon as possible.
*/
void Java_com_example_ewolAbstraction_EwolGLSurfaceView_nativePause( JNIEnv* env )
{
sDemoStopped = !sDemoStopped;
if (sDemoStopped) {
/* we paused the animation, so store the current
* time in sTimeStopped for future nativeRender calls */
sTimeStopped = _getTime();
} else {
/* we resumed the animation, so adjust the time offset
* to take care of the pause interval. */
sTimeOffset -= _getTime() - sTimeStopped;
}
}
void Java_com_example_ewolAbstraction_EwolGLSurfaceView_nativeEventInputMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{
EWOL_INFO("Event : Input Motion ID=" << pointerID << " x=" << x << " y=" << y);
if (0 == pointerID) {
appMove(x,y);
}
}
void Java_com_example_ewolAbstraction_EwolGLSurfaceView_nativeEventInputState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp)
{
if (isUp) {
EWOL_INFO("Event : Input ID=" << pointerID << " [DOWN]");
} else {
EWOL_INFO("Event : Input ID=" << pointerID << " [UP]");
}
}
void Java_com_example_ewolAbstraction_EwolGLSurfaceView_nativeEventUnknow( JNIEnv* env, jobject thiz, jint eventID)
{
EWOL_WARNING("Event : Unknow ID=" << eventID);
}
/* Call to render the next GL frame */
void Java_com_example_ewolAbstraction_EwolRenderer_nativeRender( JNIEnv* env )
{
long curTime;
/* NOTE: if sDemoStopped is TRUE, then we re-render the same frame
* on each iteration.
*/
if (sDemoStopped) {
curTime = sTimeStopped + sTimeOffset;
} else {
curTime = _getTime() + sTimeOffset;
if (sTimeOffsetInit == 0) {
sTimeOffsetInit = 1;
sTimeOffset = -curTime;
curTime = 0;
}
}
appRender(curTime, currentWidth, currentHeight);
}
} }
void Java_com_example_ewolAbstraction_EwolGLSurfaceView_nativeEventUnknow( JNIEnv* env, jobject thiz, jint eventID)
{
EWOL_WARNING("Event : Unknow ID=" << eventID);
}
/* Call to render the next GL frame */
void Java_com_example_ewolAbstraction_EwolRenderer_nativeRender( JNIEnv* env )
{
long curTime;
/* NOTE: if sDemoStopped is TRUE, then we re-render the same frame
* on each iteration.
*/
if (sDemoStopped) {
curTime = sTimeStopped + sTimeOffset;
} else {
curTime = _getTime() + sTimeOffset;
if (sTimeOffsetInit == 0) {
sTimeOffsetInit = 1;
sTimeOffset = -curTime;
curTime = 0;
}
}
//__android_log_print(ANDROID_LOG_INFO, "EWOL", "curTime=%ld", curTime);
appRender(curTime, currentWidth, currentHeight);
}

View File

@ -179,9 +179,9 @@ class FTFontInternal
} }
EWOL_INFO(" unit per EM = " << m_fftFace->units_per_EM); EWOL_INFO(" unit per EM = " << m_fftFace->units_per_EM);
EWOL_INFO(" num of fixed sizes = " << m_fftFace->num_fixed_sizes); EWOL_INFO(" num of fixed sizes = " << m_fftFace->num_fixed_sizes);
EWOL_INFO(" Availlable sizes = " << (int)m_fftFace->available_sizes); //EWOL_INFO(" Availlable sizes = " << (int)m_fftFace->available_sizes);
EWOL_INFO(" Current size = " << (int)m_fftFace->size); //EWOL_INFO(" Current size = " << (int)m_fftFace->size);
} }
public: public:
FTFontInternal(etk::File fontFileName, etk::String fontName) FTFontInternal(etk::File fontFileName, etk::String fontName)