Android: add making system
Etk : remove the dependency with std::ostream and std::cout that are not present on Android OS
This commit is contained in:
parent
2ea7bc27d2
commit
0a479ca7ff
17
AndroidManifest.xml
Normal file
17
AndroidManifest.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.ewolAbstraction"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<application android:label="@string/app_name">
|
||||
<activity android:name=".EwolActivity"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@drawable/ic_luncher_ewoltest">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="4" />
|
||||
</manifest>
|
28
Makefile
28
Makefile
@ -91,12 +91,12 @@ else
|
||||
endif
|
||||
DEFINE+= -DVERSION_BUILD_TIME="\"$(VERSION_BUILD_TIME)\""
|
||||
|
||||
X11FLAGS= -lX11 -lGL -lGLU
|
||||
X11FLAGS= -lGL -lGLU
|
||||
# some X11 mode availlable :
|
||||
# install package : libxxf86vm-dev
|
||||
X11FLAGS+= -DEWOL_X11_MODE__XF86V -lXxf86vm
|
||||
X11FLAGS+= -lX11 -DEWOL_X11_MODE__XF86V -lXxf86vm
|
||||
# install package : libxrender-dev
|
||||
#X11FLAGS+= -DEWOL_X11_MODE__XRENDER -lXrandr
|
||||
#X11FLAGS+= -lX11 -DEWOL_X11_MODE__XRENDER -lXrandr
|
||||
|
||||
|
||||
ifeq ($(shell if `pkg-config --exists freetype2` ; then echo "yes"; else echo "no"; fi), yes)
|
||||
@ -108,12 +108,22 @@ else
|
||||
$(Info libFreeType-dev is not installed)
|
||||
endif
|
||||
|
||||
|
||||
###############################################################################
|
||||
### Android Area ###
|
||||
###############################################################################
|
||||
ifeq ($(PLATFORM), Android)
|
||||
PROJECT_NDK=$(realpath ../android/ndk-r7/)
|
||||
PROJECT_SDK=$(realpath ../android/sdk-r15/)
|
||||
endif
|
||||
|
||||
|
||||
###############################################################################
|
||||
### Basic C flags ###
|
||||
###############################################################################
|
||||
|
||||
# basic X11 librairy ==> show if we can une under lib ...
|
||||
CXXFLAGS= $(X11FLAGS) $(FREETYPE_CFLAGS) -D__PLATFORM__=$(PLATFORM)
|
||||
CXXFLAGS= $(X11FLAGS) $(FREETYPE_CFLAGS) -D__PLATFORM__$(PLATFORM)
|
||||
|
||||
ifeq ("$(DEBUG)", "0")
|
||||
CXXFLAGS+= -O2
|
||||
@ -127,6 +137,8 @@ CXXFLAGS+= -Wall
|
||||
CXXFLAGS+= -D_REENTRANT
|
||||
# internal defines
|
||||
CXXFLAGS+= $(DEFINE)
|
||||
# remove warning from the convertion char*
|
||||
CXXFLAGS+= -Wno-write-strings
|
||||
|
||||
CFLAGS= $(CXXFLAGS) -std=c99
|
||||
|
||||
@ -179,6 +191,7 @@ CXXFILES += etk/Debug.cpp \
|
||||
etk/DebugInternal.cpp \
|
||||
etk/Memory.cpp \
|
||||
etk/String.cpp \
|
||||
etk/Stream.cpp \
|
||||
etk/File.cpp \
|
||||
etk/RegExp.cpp
|
||||
|
||||
@ -280,10 +293,17 @@ $(OUTPUT_NAME_RELEASE): $(OBJ) $(MAKE_DEPENDENCE)
|
||||
@cp $@ $(PROG_NAME)
|
||||
|
||||
# build binary Debug Mode
|
||||
ifeq ($(PLATFORM), Android)
|
||||
$(OUTPUT_NAME_DEBUG): $(MAKE_DEPENDENCE)
|
||||
cd $(PROJECT_NDK) ; NDK_PROJECT_PATH=$(shell pwd) ./ndk-build
|
||||
# V=1
|
||||
PATH=$(PROJECT_SDK)/tools/:$(PROJECT_SDK)/platform-tools/:$(PATH) ant -Dsdk.dir=$(PROJECT_SDK) debug
|
||||
else
|
||||
$(OUTPUT_NAME_DEBUG): $(OBJ) $(MAKE_DEPENDENCE)
|
||||
@echo $(F_ROUGE)"
(bin) $@ "$(F_NORMALE)
|
||||
@$(CXX) $(OBJ) $(LDFLAGS) -o $@
|
||||
@cp $@ $(PROG_NAME)
|
||||
endif
|
||||
|
||||
clean:
|
||||
@echo $(CADRE_HAUT_BAS)
|
||||
|
33
Sources/app.h
Normal file
33
Sources/app.h
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef APP_H_INCLUDED
|
||||
#define APP_H_INCLUDED
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define WINDOW_DEFAULT_WIDTH 640
|
||||
#define WINDOW_DEFAULT_HEIGHT 480
|
||||
|
||||
#define WINDOW_BPP 16
|
||||
|
||||
|
||||
// The simple framework expects the application code to define these functions.
|
||||
extern void appInit();
|
||||
extern void appDeinit();
|
||||
extern void appRender(long tick, int width, int height);
|
||||
extern void appMove(double x, double y);
|
||||
/* Value is non-zero when application is alive, and 0 when it is closing.
|
||||
* Defined by the application framework.
|
||||
*/
|
||||
extern int gAppAlive;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@ -26,23 +26,255 @@
|
||||
|
||||
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/String.h>
|
||||
#include <ewol/WidgetManager.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>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "AndroidJNI"
|
||||
|
||||
|
||||
int gAppAlive = 1;
|
||||
|
||||
static int sDemoStopped = 0;
|
||||
static long sTimeOffset = 0;
|
||||
static int sTimeOffsetInit = 0;
|
||||
static long sTimeStopped = 0;
|
||||
|
||||
static int32_t currentWidth = 320;
|
||||
static int32_t currentHeight = 480;
|
||||
|
||||
|
||||
static long _getTime(void)
|
||||
{
|
||||
struct timeval now;
|
||||
gettimeofday(&now, NULL);
|
||||
return (long)(now.tv_sec*1000 + now.tv_usec/1000);
|
||||
}
|
||||
|
||||
/* Call to initialize the graphics state */
|
||||
void Java_com_example_ewolAbstraction_EwolRenderer_nativeInit( JNIEnv* env )
|
||||
{
|
||||
EWOL_INFO("Init : Start All Application");
|
||||
appInit();
|
||||
gAppAlive = 1;
|
||||
sDemoStopped = 0;
|
||||
sTimeOffsetInit = 0;
|
||||
}
|
||||
|
||||
|
||||
void Java_com_example_ewolAbstraction_EwolRenderer_nativeResize( JNIEnv* env, jobject thiz, jint w, jint h )
|
||||
{
|
||||
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_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) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "EWOL", "Event : Input ID=%d [DOWN]", pointerID);
|
||||
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]");
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "guiAbstraction"
|
||||
|
||||
static bool guiAbstractionIsInit = false;
|
||||
//static guiAbstraction::X11systemInterface * myX11Access = NULL;
|
||||
|
||||
|
||||
void guiAbstraction::Init(int32_t argc, char *argv[])
|
||||
{
|
||||
EWOL_INFO("INIT for Android environement");
|
||||
if (false == guiAbstractionIsInit) {
|
||||
// set the gui is init :
|
||||
guiAbstractionIsInit = true;
|
||||
EWOL_INFO("INIT for X11 environement");
|
||||
//myX11Access = new guiAbstraction::X11systemInterface();
|
||||
} else {
|
||||
EWOL_CRITICAL("Can not INIT X11 ==> already init before");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void guiAbstraction::Run(void)
|
||||
{
|
||||
EWOL_INFO("Start Running");
|
||||
EWOL_INFO("Stop Running");
|
||||
if (true == guiAbstractionIsInit) {
|
||||
EWOL_INFO("Start Running");
|
||||
//myX11Access->Run();
|
||||
EWOL_INFO("Stop Running");
|
||||
} else {
|
||||
EWOL_CRITICAL("Can not Run X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::Stop(void)
|
||||
{
|
||||
if (true == guiAbstractionIsInit) {
|
||||
//myX11Access->Stop();
|
||||
} else {
|
||||
EWOL_CRITICAL("Can not Stop X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::SetDisplayOnWindows(ewol::Windows * newOne)
|
||||
{
|
||||
if (true == guiAbstractionIsInit) {
|
||||
//myX11Access->Setwindow(newOne);
|
||||
} else {
|
||||
EWOL_CRITICAL("Can not set Windows X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::UnInit(void)
|
||||
{
|
||||
EWOL_INFO("UN-INIT for Android environement");
|
||||
if (true == guiAbstractionIsInit) {
|
||||
EWOL_INFO("UN-INIT for X11 environement");
|
||||
//if (NULL != myX11Access) {
|
||||
// delete(myX11Access);
|
||||
//}
|
||||
guiAbstractionIsInit = false;
|
||||
} else {
|
||||
EWOL_CRITICAL("Can not Un-Init X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void guiAbstraction::ChangeSize(int32_t w, int32_t h)
|
||||
{
|
||||
if (true == guiAbstractionIsInit) {
|
||||
//myX11Access->ChangeSize(w, h);
|
||||
} else {
|
||||
EWOL_CRITICAL("X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::ChangePos(int32_t x, int32_t y)
|
||||
{
|
||||
if (true == guiAbstractionIsInit) {
|
||||
//myX11Access->ChangePos(x, y);
|
||||
} else {
|
||||
EWOL_CRITICAL("X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
|
||||
{
|
||||
if (true == guiAbstractionIsInit) {
|
||||
//myX11Access->GetAbsPos(x, y);
|
||||
} else {
|
||||
EWOL_CRITICAL("X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::StartResizeSystem(void)
|
||||
{
|
||||
if (true == guiAbstractionIsInit) {
|
||||
//myX11Access->StartResizeSystem();
|
||||
} else {
|
||||
EWOL_CRITICAL("X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::StartMoveSystem(void)
|
||||
{
|
||||
if (true == guiAbstractionIsInit) {
|
||||
//myX11Access->StartMoveSystem();
|
||||
} else {
|
||||
EWOL_CRITICAL("X11 ==> not init ... ");
|
||||
}
|
||||
}
|
||||
|
||||
bool guiAbstraction::IsPressedInput(int32_t inputID)
|
||||
{
|
||||
//if (true == guiAbstractionIsInit) {
|
||||
// return myX11Access->IsPressedInput(inputID);
|
||||
//} else {
|
||||
// EWOL_CRITICAL("X11 ==> not init ... ");
|
||||
return false;
|
||||
//}
|
||||
}
|
||||
|
@ -27,12 +27,21 @@
|
||||
#define __GUI_ABSTRACTION_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Windows.h>
|
||||
|
||||
namespace guiAbstraction
|
||||
{
|
||||
void Init(int32_t argc, char *argv[]);
|
||||
void Run(void);
|
||||
void Stop(void);
|
||||
void UnInit(void);
|
||||
void SetDisplayOnWindows(ewol::Windows * newOne);
|
||||
void ChangeSize(int32_t w, int32_t h);
|
||||
void ChangePos(int32_t x, int32_t y);
|
||||
void GetAbsPos(int32_t & x, int32_t & y);
|
||||
void StartResizeSystem(void);
|
||||
void StartMoveSystem(void);
|
||||
bool IsPressedInput(int32_t inputID);
|
||||
};
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <base/guiX11.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
198
Sources/demo.cpp
Normal file
198
Sources/demo.cpp
Normal file
@ -0,0 +1,198 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "importgl.h"
|
||||
|
||||
#include "app.h"
|
||||
|
||||
|
||||
// Called from the app framework.
|
||||
void appInit()
|
||||
{
|
||||
// initialisation of the application :
|
||||
// glEnable(GL_NORMALIZE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
//glEnableClientState(GL_VERTEX_ARRAY);
|
||||
//glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Called from the app framework.
|
||||
void appDeinit()
|
||||
{
|
||||
// close the application ...
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "====> EWOL", __VA_ARGS__))
|
||||
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "====> EWOL", __VA_ARGS__))
|
||||
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "====> EWOL", __VA_ARGS__))
|
||||
|
||||
void glOrtho(GLfloat left,
|
||||
GLfloat right,
|
||||
GLfloat bottom,
|
||||
GLfloat top,
|
||||
GLfloat nearVal,
|
||||
GLfloat farVal)
|
||||
{
|
||||
GLfloat myMatrix[4*4];
|
||||
int iii;
|
||||
for(iii=0; iii<4*4 ; iii++) {
|
||||
myMatrix[iii] = 0;
|
||||
}
|
||||
myMatrix[0] = 2.0 / (right - left);
|
||||
myMatrix[5] = 2.0 / (top - bottom);
|
||||
myMatrix[10] = -2.0 / (farVal - nearVal);
|
||||
#if 1
|
||||
myMatrix[3] = -1*(right + left) / (right - left);
|
||||
myMatrix[7] = -1*(top + bottom) / (top - bottom);
|
||||
myMatrix[11] = -1*(farVal + nearVal) / (farVal - nearVal);
|
||||
#else
|
||||
// test if matrix is not corectly instanciate ...
|
||||
myMatrix[12] = -1*(right + left) / (right - left);
|
||||
myMatrix[13] = -1*(top + bottom) / (top - bottom);
|
||||
myMatrix[14] = -1*(farVal + nearVal) / (farVal - nearVal);
|
||||
#endif
|
||||
myMatrix[15] = 1;
|
||||
|
||||
glLoadMatrixf(myMatrix);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
GLfloat gTriangleVertices[] = { 0.0f, 0.0f, 200.0f, 0.0f, 0.0f, 200.0f };
|
||||
GLfloat gTriangleVertices5[] = { 200.0f, 200.0f, 100.0f, 200.0f, 200.0f, 100.0f,
|
||||
200.0f, 200.0f, 300.0f, 200.0f, 200.0f, 300.0f };
|
||||
|
||||
void appMove(double x, double y)
|
||||
{
|
||||
gTriangleVertices5[0] = x;
|
||||
gTriangleVertices5[1] = y;
|
||||
gTriangleVertices5[2] = x - 100.0f;
|
||||
gTriangleVertices5[3] = y;
|
||||
gTriangleVertices5[4] = x;
|
||||
gTriangleVertices5[5] = y - 100.0f;
|
||||
gTriangleVertices5[6] = x;
|
||||
gTriangleVertices5[7] = y;
|
||||
gTriangleVertices5[8] = x + 100.0f;
|
||||
gTriangleVertices5[9] = y;
|
||||
gTriangleVertices5[10] = x;
|
||||
gTriangleVertices5[11] = y + 100.0f;
|
||||
//LOGI("move To ... (%f,%f)",x,y);
|
||||
}
|
||||
|
||||
|
||||
void appRender(long timestamp, int width, int height)
|
||||
{
|
||||
|
||||
if (!gAppAlive) {
|
||||
return;
|
||||
}
|
||||
// to terminate application :
|
||||
// set : gAppAlive = true; and return ...
|
||||
|
||||
//EWOL_DEBUG("Drow on (" << m_size.x << "," << m_size.y << ")");
|
||||
// set the size of the open GL system
|
||||
glViewport(0,0,width,height);
|
||||
|
||||
// Clear the screen with transparency ...
|
||||
glClearColor(0.0,0.0,0.0, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
//glOrtho(0., width, 0., -height, 1., 20.);
|
||||
glOrtho(-width/2, width/2, height/2, -height/2, -1, 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
//glTranslatef(0, -height/2, -5);
|
||||
glTranslatef(-width/2, -height/2, -1.0);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR);
|
||||
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
|
||||
//LOGI("engine_draw_frame (%d,%d)",width,height);
|
||||
|
||||
glColor4f(0.0, 1.0, 1.0, 1.0);
|
||||
glVertexPointer(2, GL_FLOAT, 0, gTriangleVertices5 );
|
||||
glDrawArrays( GL_TRIANGLES, 0, 6);
|
||||
static int vallllll = 0;
|
||||
static float transparency = 0.0;
|
||||
if (vallllll <= 1) {
|
||||
transparency +=0.025;
|
||||
if (transparency >= 1.0) {
|
||||
vallllll++;
|
||||
transparency = 0.0;
|
||||
glColor4f(1.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
glColor4f(1.0, 0.0, 0.0, transparency);
|
||||
}
|
||||
} else if (vallllll <= 2) {
|
||||
transparency +=0.025;
|
||||
if (transparency >= 1.0) {
|
||||
vallllll++;
|
||||
transparency = 0.0;
|
||||
glColor4f(1.0, 1.0, 0.0, 1.0);
|
||||
} else {
|
||||
glColor4f(1.0, 1.0, 0.0, transparency);
|
||||
}
|
||||
} else if (vallllll <= 3) {
|
||||
transparency +=0.025;
|
||||
if (transparency >= 1.0) {
|
||||
vallllll++;
|
||||
transparency = 0.0;
|
||||
glColor4f(0.0, 1.0, 0.0, 1.0);
|
||||
} else {
|
||||
glColor4f(0.0, 1.0, 0.0, transparency);
|
||||
}
|
||||
} else if (vallllll <= 4) {
|
||||
transparency +=0.025;
|
||||
if (transparency >= 1.0) {
|
||||
vallllll++;
|
||||
transparency = 0.0;
|
||||
glColor4f(0.0, 1.0, 1.0, 1.0);
|
||||
} else {
|
||||
glColor4f(0.0, 1.0, 1.0, transparency);
|
||||
}
|
||||
} else if (vallllll <= 5) {
|
||||
transparency +=0.025;
|
||||
if (transparency >= 1.0) {
|
||||
vallllll++;
|
||||
transparency = 0.0;
|
||||
glColor4f(0.0, 0.0, 1.0, 1.0);
|
||||
} else {
|
||||
glColor4f(0.0, 0.0, 1.0, transparency);
|
||||
}
|
||||
} else {
|
||||
transparency +=0.025;
|
||||
if (transparency >= 1.0) {
|
||||
vallllll = 0;
|
||||
transparency = 0.0;
|
||||
glColor4f(1.0, 0.0, 1.0, 1.0);
|
||||
} else {
|
||||
glColor4f(1.0, 0.0, 1.0, transparency);
|
||||
}
|
||||
}
|
||||
glVertexPointer(2, GL_FLOAT, 0, gTriangleVertices );
|
||||
glDrawArrays( GL_TRIANGLES, 0, 3);
|
||||
|
||||
glDisableClientState( GL_VERTEX_ARRAY );
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glFlush();
|
||||
}
|
@ -53,7 +53,7 @@ void TOOLS_DisplayFuncName(int32_t ligne, const char* className, const char* fun
|
||||
tmpName[FUNCTION_NAME_SIZE-3] = '|';
|
||||
tmpName[FUNCTION_NAME_SIZE-2] = ' ';
|
||||
tmpName[FUNCTION_NAME_SIZE-1] = '\0';
|
||||
std::cout << tmpName;
|
||||
etk::cout << tmpName;
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +66,6 @@ void TOOLS_DisplayTime(void)
|
||||
time(&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
sprintf(tmpdata, " %2dh %2dmin %2ds | ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
||||
std::cout << tmpdata ;
|
||||
etk::cout << tmpdata ;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifndef __ETK_DEBUG_H__
|
||||
#define __ETK_DEBUG_H__
|
||||
|
||||
#include <iostream>
|
||||
#include <etk/Stream.h>
|
||||
#include <etk/Types.h>
|
||||
|
||||
// Log Message System For EDN
|
||||
@ -68,11 +68,11 @@ void TOOLS_DisplayTime(void);
|
||||
#define __class__ (NULL)
|
||||
|
||||
#define ETK_DBG_COMMON(libName, color, info, data) do { \
|
||||
std::cout << color; \
|
||||
etk::cout << color; \
|
||||
TOOLS_DisplayTime(); \
|
||||
TOOLS_DisplayFuncName(__LINE__, __class__, __func__, libName); \
|
||||
std::cout << "[" << info << "] " << data; \
|
||||
std::cout << ETK_BASH_COLOR_NORMAL <<std::endl; \
|
||||
etk::cout << "[" << info << "] " << data; \
|
||||
etk::cout << ETK_BASH_COLOR_NORMAL <<etk::endl; \
|
||||
}while(0)
|
||||
#define ETK_CRITICAL(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_BOLD_RED, 'C', data)
|
||||
#define ETK_WARNING(libName, data) ETK_DBG_COMMON(libName, ETK_BASH_COLOR_MAGENTA, 'W', data)
|
||||
|
@ -32,7 +32,7 @@
|
||||
#define __class__ "etk::File"
|
||||
|
||||
|
||||
std::ostream& etk::operator <<(std::ostream &os, const etk::File &obj)
|
||||
etk::CCout& etk::operator <<(etk::CCout &os, const etk::File &obj)
|
||||
{
|
||||
os << obj.m_folder;
|
||||
os << "/";
|
||||
@ -156,9 +156,13 @@ void etk::File::SetCompleateName(etk::String &newFilename)
|
||||
if ('/' != *destFilename.c_str()) {
|
||||
// Get the command came from the running of the program :
|
||||
char cCurrentPath[FILENAME_MAX];
|
||||
#if __PLATFORM__ == Android
|
||||
strcpy(cCurrentPath, "./");
|
||||
#else
|
||||
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
||||
etk::String tmpFilename = destFilename;
|
||||
destFilename = cCurrentPath;
|
||||
|
@ -53,7 +53,7 @@ namespace etk
|
||||
const etk::File& operator= (const etk::File &etkF );
|
||||
bool operator== (const etk::File &etkF ) const;
|
||||
bool operator!= (const etk::File &etkF ) const;
|
||||
friend std::ostream& operator <<( std::ostream &os,const etk::File &obj);
|
||||
friend etk::CCout& operator <<( etk::CCout &os,const etk::File &obj);
|
||||
|
||||
private :
|
||||
etk::String m_folder;
|
||||
@ -61,7 +61,7 @@ namespace etk
|
||||
int32_t m_lineNumberOpen;
|
||||
};
|
||||
|
||||
std::ostream& operator <<(std::ostream &os, const etk::File &obj);
|
||||
etk::CCout& operator <<(etk::CCout &os, const etk::File &obj);
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ void etk::DisplayData(etk::VectorType<char> &data)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<(int32_t)data.Size() ; i++) {
|
||||
std::cout<< (char)(data[i]&0x00FF );
|
||||
etk::cout<< (char)(data[i]&0x00FF );
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,36 +109,36 @@ void etk::DisplayData(etk::VectorType<char> &data)
|
||||
void etk::DisplayElem(etk::VectorType<int16_t> &data, int32_t start, int32_t stop)
|
||||
{
|
||||
int32_t i;
|
||||
std::cout<< ETK_BASH_COLOR_NORMAL;
|
||||
etk::cout<< ETK_BASH_COLOR_NORMAL;
|
||||
for (i=start; i<(int32_t)data.Size() && i<stop ; i++) {
|
||||
switch(data[i])
|
||||
{
|
||||
case REGEXP_OPCODE_PTHESE_IN: std::cout<<ETK_BASH_COLOR_RED << (char*)"(" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_PTHESE_OUT: std::cout<<ETK_BASH_COLOR_RED << (char*)")" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_BRACKET_IN: std::cout<<ETK_BASH_COLOR_YELLOW << (char*)"[" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_BRACKET_OUT: std::cout<<ETK_BASH_COLOR_YELLOW << (char*)"]" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_TO: std::cout<<ETK_BASH_COLOR_YELLOW << (char*)"-" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_BRACE_IN: std::cout<<ETK_BASH_COLOR_GREEN << (char*)"{" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_BRACE_OUT: std::cout<<ETK_BASH_COLOR_GREEN << (char*)"}" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_STAR: std::cout<<ETK_BASH_COLOR_BLUE << (char*)"*" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_DOT: std::cout<<ETK_BASH_COLOR_BLUE << (char*)"." << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_QUESTION: std::cout<<ETK_BASH_COLOR_BLUE << (char*)"?" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_PLUS: std::cout<<ETK_BASH_COLOR_BLUE << (char*)"+" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_PIPE: std::cout<<ETK_BASH_COLOR_BLUE << (char*)"|" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_NO_CHAR: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"@" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_START_OF_LINE: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"^" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_END_OF_LINE: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"$" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_DIGIT: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\d" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_DIGIT_NOT: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\D" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_LETTER: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\l" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_LETTER_NOT: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\L" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_SPACE: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\s" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_SPACE_NOT: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\S" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_WORD: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\w" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_WORD_NOT: std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\W" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case '\n': std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\n" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case '\t': std::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\t" << ETK_BASH_COLOR_NORMAL; break;
|
||||
default: std::cout<< (char)(data[i]&0x00FF ); break;
|
||||
case REGEXP_OPCODE_PTHESE_IN: etk::cout<<ETK_BASH_COLOR_RED << (char*)"(" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_PTHESE_OUT: etk::cout<<ETK_BASH_COLOR_RED << (char*)")" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_BRACKET_IN: etk::cout<<ETK_BASH_COLOR_YELLOW << (char*)"[" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_BRACKET_OUT: etk::cout<<ETK_BASH_COLOR_YELLOW << (char*)"]" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_TO: etk::cout<<ETK_BASH_COLOR_YELLOW << (char*)"-" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_BRACE_IN: etk::cout<<ETK_BASH_COLOR_GREEN << (char*)"{" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_BRACE_OUT: etk::cout<<ETK_BASH_COLOR_GREEN << (char*)"}" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_STAR: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"*" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_DOT: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"." << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_QUESTION: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"?" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_PLUS: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"+" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_PIPE: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"|" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_NO_CHAR: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"@" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_START_OF_LINE: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"^" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_END_OF_LINE: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"$" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_DIGIT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\d" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_DIGIT_NOT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\D" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_LETTER: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\l" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_LETTER_NOT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\L" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_SPACE: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\s" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_SPACE_NOT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\S" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_WORD: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\w" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case REGEXP_OPCODE_WORD_NOT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\W" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case '\n': etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\n" << ETK_BASH_COLOR_NORMAL; break;
|
||||
case '\t': etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\t" << ETK_BASH_COLOR_NORMAL; break;
|
||||
default: etk::cout<< (char)(data[i]&0x00FF ); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ template<class CLASS_TYPE> class RegExpNodeValue : public RegExpNode<CLASS_TYPE>
|
||||
*/
|
||||
void Display(int32_t level)
|
||||
{
|
||||
TK_INFO("Find NODE : " << levelSpace(level) << "@Value@ {" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} subdata="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData); std::cout<< " data: "; DisplayData(m_data); );
|
||||
TK_INFO("Find NODE : " << levelSpace(level) << "@Value@ {" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} subdata="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData); etk::cout<< " data: "; DisplayData(m_data); );
|
||||
};
|
||||
protected :
|
||||
// SubNodes :
|
||||
@ -417,7 +417,7 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public RegExpNode<CLASS_TYP
|
||||
*/
|
||||
void Display(int32_t level)
|
||||
{
|
||||
TK_INFO("Find NODE : " << levelSpace(level) << "@[...]@ {" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} subdata="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData); std::cout<< " data: "; DisplayData(m_data); );
|
||||
TK_INFO("Find NODE : " << levelSpace(level) << "@[...]@ {" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} subdata="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData); etk::cout<< " data: "; DisplayData(m_data); );
|
||||
};
|
||||
protected :
|
||||
// SubNodes :
|
||||
|
31
Sources/etk/Stream.cpp
Normal file
31
Sources/etk/Stream.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Stream.cpp
|
||||
* @brief Ewol Tool Kit : Basic etk::Stream for Log system ... (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 02/12/2011
|
||||
* @par Project
|
||||
* Ewol TK
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include <etk/Stream.h>
|
||||
|
||||
etk::CCout etk::cout;
|
||||
etk::CEndl etk::endl;
|
||||
etk::CHex etk::hex;
|
||||
|
87
Sources/etk/Stream.h
Normal file
87
Sources/etk/Stream.h
Normal file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Stream.h
|
||||
* @brief Ewol Tool Kit : Basic etk::Stream for Log system ... (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 02/12/2011
|
||||
* @par Project
|
||||
* Ewol TK
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ETK_STREAM_H__
|
||||
#define __ETK_STREAM_H__
|
||||
|
||||
#include <cstdio>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace etk{
|
||||
class CEndl{};
|
||||
class CHex{};
|
||||
class CCout{
|
||||
private:
|
||||
bool hex;
|
||||
public:
|
||||
CCout(){
|
||||
hex=false;
|
||||
};
|
||||
|
||||
~CCout() { };
|
||||
|
||||
CCout& operator << (int t) {
|
||||
printf("%d", t);
|
||||
return *this;
|
||||
}
|
||||
CCout& operator << (unsigned int t) {
|
||||
printf("%d", t);
|
||||
return *this;
|
||||
}
|
||||
CCout& operator << (long t) {
|
||||
printf("%ld", t);
|
||||
return *this;
|
||||
}
|
||||
CCout& operator << (double t) {
|
||||
printf("%f", t);
|
||||
return *this;
|
||||
}
|
||||
CCout& operator << (float t) {
|
||||
printf("%f", t);
|
||||
return *this;
|
||||
}
|
||||
CCout& operator << (char * t) {
|
||||
printf("%s", t);
|
||||
return *this;
|
||||
}
|
||||
CCout& operator << (const char * t) {
|
||||
printf("%s", t);
|
||||
return *this;
|
||||
}
|
||||
CCout& operator << (char t) {
|
||||
printf("%c", t);
|
||||
return *this;
|
||||
}
|
||||
CCout& operator << (etk::CEndl t) {
|
||||
printf("\n");
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
extern etk::CCout cout;
|
||||
extern etk::CEndl endl;
|
||||
extern etk::CHex hex;
|
||||
}
|
||||
#endif
|
||||
|
@ -29,7 +29,7 @@
|
||||
#undef __class__
|
||||
#define __class__ "etk::String"
|
||||
|
||||
std::ostream& etk::operator <<(std::ostream &os, const etk::String &obj)
|
||||
etk::CCout& etk::operator <<(etk::CCout &os, const etk::String &obj)
|
||||
{
|
||||
os << (char*)&obj.m_data[0];
|
||||
return os;
|
||||
@ -608,30 +608,30 @@ void etk::TestUntaire_String(void)
|
||||
|
||||
int32_t iddd = 0;
|
||||
etk::String * monString = new etk::String();
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << *monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
monString = new etk::String("test de direct data");
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << *monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
monString = new etk::String("test de direct data", 7);
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << *monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
int32_t testId = -6789;
|
||||
monString = new etk::String(testId);
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << *monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
uint32_t testId2 = 12345;
|
||||
monString = new etk::String((unsigned int)testId2);
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << *monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
etk::String plop = "otherString";
|
||||
monString = new etk::String(plop);
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
TK_INFO("phase : " << iddd++ << " : \"" << *monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifndef __ETK_STRING_H__
|
||||
#define __ETK_STRING_H__
|
||||
|
||||
#include <iostream>
|
||||
#include <etk/Stream.h>
|
||||
#include <etk/VectorType.h>
|
||||
|
||||
namespace etk
|
||||
@ -58,7 +58,7 @@ namespace etk
|
||||
etk::String operator+ (const etk::String &etkS); // + operator
|
||||
etk::String operator+ (const char * inputData);
|
||||
//operator const char *()
|
||||
friend std::ostream& operator <<( std::ostream &os,const etk::String &obj);
|
||||
friend etk::CCout& operator <<( etk::CCout &os,const etk::String &obj);
|
||||
|
||||
bool IsEmpty(void) const;
|
||||
int32_t Size(void) const;
|
||||
@ -81,7 +81,7 @@ namespace etk
|
||||
|
||||
void TestUntaire_String(void);
|
||||
|
||||
std::ostream& operator <<(std::ostream &os, const etk::String &obj);
|
||||
etk::CCout& operator <<(etk::CCout &os, const etk::String &obj);
|
||||
|
||||
}
|
||||
|
||||
|
@ -26,22 +26,12 @@
|
||||
#include <ewol/Font.h>
|
||||
#include <ewol/Texture.h>
|
||||
#include <etk/VectorType.h>
|
||||
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glut.h>
|
||||
#if defined(EWOL_X11_MODE__XF86V)
|
||||
# include <X11/extensions/xf86vmode.h>
|
||||
#elif defined(EWOL_X11_MODE__XRENDER)
|
||||
# include <X11/extensions/Xrender.h>
|
||||
#endif
|
||||
#include <importgl.h>
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::FontBitmap"
|
||||
|
||||
#if 0
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -436,7 +426,95 @@ void ewol::DrawText(int32_t fontID,
|
||||
}
|
||||
drawPosition.x = posDrawX;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// set default folder name of the font :
|
||||
void ewol::SetFontFolder(etk::String folderName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ewol::SetDefaultFont(etk::String fontName, int32_t size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// unload all font loaded
|
||||
void ewol::InitFont(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ewol::UnInitFont(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// load the fonts...
|
||||
int32_t ewol::LoadFont(etk::String fontName, int32_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t ewol::GetDefaultFontId(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ewol::UnloadFont(int32_t id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// get the size of a long string in UTF8 (note that \n and \r represent unknown char...)
|
||||
int32_t ewol::GetWidth(int32_t fontID, const uniChar_t * unicodeString)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
||||
int32_t ewol::GetWidth(int32_t fontID, const char * utf8String)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
int32_t ewol::GetHeight(int32_t fontID)
|
||||
{
|
||||
return 25;
|
||||
}
|
||||
|
||||
|
||||
void ewol::DrawText(int32_t fontID,
|
||||
coord2D_ts & drawPosition,
|
||||
const char * utf8String,
|
||||
uint32_t & fontTextureId,
|
||||
etk::VectorType<coord2D_ts> & coord,
|
||||
etk::VectorType<texCoord_ts> & coordTex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ewol::DrawText(int32_t fontID,
|
||||
coord2D_ts & drawPosition,
|
||||
const uniChar_t * unicodeString,
|
||||
uint32_t & fontTextureId,
|
||||
etk::VectorType<coord2D_ts> & coord,
|
||||
etk::VectorType<texCoord_ts> & coordTex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int32_t ewol::LoadFont(etk::File fontFileName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ewol::DrawText(etkFloat_t x, etkFloat_t y, const char * myString)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -27,9 +27,7 @@
|
||||
#include <ewol/Texture.h>
|
||||
#include <etk/VectorType.h>
|
||||
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
/*
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glut.h>
|
||||
#if defined(EWOL_X11_MODE__XF86V)
|
||||
@ -37,9 +35,14 @@
|
||||
#elif defined(EWOL_X11_MODE__XRENDER)
|
||||
# include <X11/extensions/Xrender.h>
|
||||
#endif
|
||||
*/
|
||||
#include <importgl.h>
|
||||
#if defined(__PLATFORM__X11)
|
||||
# include <ft2build.h>
|
||||
#else
|
||||
# include <freetype/ft2build.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#undef __class__
|
||||
@ -101,7 +104,7 @@ class FTFontInternal
|
||||
private:
|
||||
void Display(void)
|
||||
{
|
||||
EWOL_INFO(" nuber of glyph = " << m_fftFace->num_glyphs);
|
||||
EWOL_INFO(" nuber of glyph = " << (int)m_fftFace->num_glyphs);
|
||||
if ((FT_FACE_FLAG_SCALABLE & m_fftFace->face_flags) != 0) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_SCALABLE (enable)");
|
||||
} else {
|
||||
@ -176,9 +179,9 @@ class FTFontInternal
|
||||
}
|
||||
EWOL_INFO(" unit per EM = " << m_fftFace->units_per_EM);
|
||||
EWOL_INFO(" num of fixed sizes = " << m_fftFace->num_fixed_sizes);
|
||||
EWOL_INFO(" Availlable sizes = " << m_fftFace->available_sizes);
|
||||
EWOL_INFO(" Availlable sizes = " << (int)m_fftFace->available_sizes);
|
||||
|
||||
EWOL_INFO(" Current size = " << m_fftFace->size);
|
||||
EWOL_INFO(" Current size = " << (int)m_fftFace->size);
|
||||
}
|
||||
public:
|
||||
FTFontInternal(etk::File fontFileName, etk::String fontName)
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <etk/Types.h>
|
||||
#include <etk/String.h>
|
||||
#include <ewol/OObject.h>
|
||||
#include <GL/gl.h>
|
||||
#include <importgl.h>
|
||||
|
||||
|
||||
#undef __class__
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <ewol/OObject/2DColored.h>
|
||||
#include <GL/gl.h>
|
||||
#include <importgl.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <ewol/OObject/2DText.h>
|
||||
#include <GL/gl.h>
|
||||
#include <importgl.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::OObject2DText"
|
||||
@ -61,7 +61,8 @@ void ewol::OObject2DText::Draw(void)
|
||||
EWOL_WARNING("Nothink to draw...");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO : Android does not support GL_QUADS ...
|
||||
#if !defined(__PLATFORM__Android)
|
||||
glColor4f(m_textColorFg.red, m_textColorFg.green, m_textColorFg.blue, m_textColorFg.alpha);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, m_FontTextureId);
|
||||
@ -74,6 +75,7 @@ void ewol::OObject2DText::Draw(void)
|
||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ewol::OObject2DText::Text(etkFloat_t x, etkFloat_t y, const char* utf8String)
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <ewol/OObject/2DTextured.h>
|
||||
#include <ewol/Texture.h>
|
||||
#include <GL/gl.h>
|
||||
#include <importgl.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::OObject2DTextured"
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
|
||||
#include <ewol/Texture.h>
|
||||
#include <importgl.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -308,8 +309,7 @@ class Bitmap
|
||||
}
|
||||
};
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
|
||||
class LoadedTexture
|
||||
{
|
||||
@ -396,7 +396,7 @@ void ewol::UnLoadTexture(uint32_t textureID)
|
||||
return;
|
||||
}
|
||||
}
|
||||
EWOL_CRITICAL("Can not find TextureId=" << textureID << " in the list of texture loaded...==> to remove it ...");
|
||||
EWOL_CRITICAL("Can not find TextureId=" << (int)textureID << " in the list of texture loaded...==> to remove it ...");
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <ewol/Texture.h>
|
||||
#include <ewol/Font.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <GL/gl.h>
|
||||
#include <importgl.h>
|
||||
|
||||
|
||||
|
||||
@ -131,18 +131,6 @@ bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, e
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glut.h>
|
||||
#if defined(EWOL_X11_MODE__XF86V)
|
||||
# include <X11/extensions/xf86vmode.h>
|
||||
#elif defined(EWOL_X11_MODE__XRENDER)
|
||||
# include <X11/extensions/Xrender.h>
|
||||
#endif
|
||||
|
||||
void ewol::Windows::SysDraw(void)
|
||||
{
|
||||
|
||||
|
@ -28,17 +28,17 @@
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/themeManager.h>
|
||||
|
||||
#if __PLATFORM__ == X11
|
||||
#if defined(__PLATFORM__X11)
|
||||
#include <base/guiX11.h>
|
||||
#elif __PLATFORM__ == DoubleBuffer
|
||||
#elif defined(__PLATFORM__DoubleBuffer)
|
||||
#include <base/guiDoubleBuffer.h>
|
||||
#elif __PLATFORM__ == Android
|
||||
#elif defined(__PLATFORM__Android)
|
||||
#include <base/guiAndroid.h>
|
||||
#elif __PLATFORM__ == AndroidTablet
|
||||
#elif defined(__PLATFORM__AndroidTablet)
|
||||
#include <base/guiAndroidTablet.h>
|
||||
#elif __PLATFORM__ == IPhone
|
||||
#elif defined(__PLATFORM__IPhone)
|
||||
#include <base/guiIPhone.h>
|
||||
#elif __PLATFORM__ == IPad
|
||||
#elif defined(__PLATFORM__IPad)
|
||||
#include <base/guiIPad.h>
|
||||
#else
|
||||
#error you need to specify a platform ...
|
||||
|
34
Sources/importgl.h
Normal file
34
Sources/importgl.h
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
#ifndef __IMPORTGL_H__
|
||||
#define __IMPORTGL_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__PLATFORM__X11)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#elif defined(__PLATFORM__DoubleBuffer)
|
||||
|
||||
#elif defined(__PLATFORM__Android)
|
||||
#include <GLES/gl.h>
|
||||
void glOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
|
||||
#elif defined(__PLATFORM__AndroidTablet)
|
||||
#include <GLES/gl.h>
|
||||
void glOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
|
||||
#elif defined(__PLATFORM__IPhone)
|
||||
|
||||
#elif defined(__PLATFORM__IPad)
|
||||
|
||||
#else
|
||||
#error you need to specify a platform ...
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
85
build.xml
Normal file
85
build.xml
Normal file
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="EwolActivity" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<loadproperties srcFile="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
|
||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
||||
in between standard targets -->
|
||||
<!--
|
||||
<target name="-pre-build">
|
||||
</target>
|
||||
<target name="-pre-compile">
|
||||
</target>
|
||||
|
||||
/* This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
||||
<target name="-post-compile">
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
68
jni/Android.mk
Normal file
68
jni/Android.mk
Normal file
@ -0,0 +1,68 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_BUILD_PATH := $(LOCAL_PATH)/Object_android
|
||||
|
||||
LOCAL_MODULE := ewolabstraction
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../Sources
|
||||
|
||||
LOCAL_CFLAGS := -D__PLATFORM__Android -Wno-write-strings
|
||||
|
||||
#enable io stream in the STL ...
|
||||
#APP_STL := gnustl_static
|
||||
#APP_STL := stlport_shared
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
../Sources/demo.cpp \
|
||||
../Sources/base/guiAndroid.cpp \
|
||||
../Sources/tinyXML/tinyxml.cpp \
|
||||
../Sources/tinyXML/tinyxmlparser.cpp \
|
||||
../Sources/tinyXML/tinyxmlerror.cpp \
|
||||
../Sources/tinyXML/tinystr.cpp \
|
||||
../Sources/etk/Debug.cpp \
|
||||
../Sources/etk/DebugInternal.cpp \
|
||||
../Sources/etk/Memory.cpp \
|
||||
../Sources/etk/String.cpp \
|
||||
../Sources/etk/Stream.cpp \
|
||||
../Sources/etk/File.cpp \
|
||||
../Sources/etk/RegExp.cpp \
|
||||
../Sources/ewol/ewol.cpp \
|
||||
../Sources/ewol/Debug.cpp \
|
||||
../Sources/ewol/OObject.cpp \
|
||||
../Sources/ewol/OObject/2DText.cpp \
|
||||
../Sources/ewol/OObject/2DColored.cpp \
|
||||
../Sources/ewol/OObject/2DTextured.cpp \
|
||||
../Sources/ewol/Texture.cpp \
|
||||
../Sources/ewol/FontBitmap.cpp \
|
||||
../Sources/ewol/Widget.cpp \
|
||||
../Sources/ewol/WidgetManager.cpp \
|
||||
../Sources/ewol/Windows.cpp \
|
||||
../Sources/ewol/widget/Button.cpp \
|
||||
../Sources/ewol/widget/CheckBox.cpp \
|
||||
../Sources/ewol/widget/Entry.cpp \
|
||||
../Sources/ewol/widget/List.cpp \
|
||||
../Sources/ewol/widget/SizerHori.cpp \
|
||||
../Sources/ewol/widget/SizerVert.cpp \
|
||||
../Sources/ewol/widget/Test.cpp \
|
||||
../Sources/ewol/themeManager.cpp \
|
||||
../Sources/ewol/theme/Theme.cpp \
|
||||
../Sources/ewol/theme/EolElement.cpp \
|
||||
../Sources/ewol/theme/EolElementFrame.cpp \
|
||||
../Sources/ewol/theme/EolColor.cpp \
|
||||
../Sources/ewol/theme/EolBase.cpp \
|
||||
../Sources/ewol/theme/EolBaseCircle.cpp \
|
||||
../Sources/ewol/theme/EolBaseCirclePart.cpp \
|
||||
../Sources/ewol/theme/EolBaseLine.cpp \
|
||||
../Sources/ewol/theme/EolBasePolygone.cpp \
|
||||
../Sources/ewol/theme/EolBaseRect.cpp \
|
||||
../Sources/ewol/theme/EolBaseTriangle.cpp
|
||||
|
||||
#for freetype : https://github.com/cdave1/freetype2-android
|
||||
|
||||
# Ewol Test Software :
|
||||
CXXFILES += Main.cpp
|
||||
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
10
local.properties
Normal file
10
local.properties
Normal file
@ -0,0 +1,10 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked in Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
|
||||
# location of the SDK. This is only used by Ant
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
sdk.dir=/home/edupin/progperso/android/sdk-r15
|
40
proguard.cfg
Normal file
40
proguard.cfg
Normal file
@ -0,0 +1,40 @@
|
||||
-optimizationpasses 5
|
||||
-dontusemixedcaseclassnames
|
||||
-dontskipnonpubliclibraryclasses
|
||||
-dontpreverify
|
||||
-verbose
|
||||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
||||
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Application
|
||||
-keep public class * extends android.app.Service
|
||||
-keep public class * extends android.content.BroadcastReceiver
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
||||
-keep public class * extends android.preference.Preference
|
||||
-keep public class com.android.vending.licensing.ILicensingService
|
||||
|
||||
-keepclasseswithmembernames class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
|
||||
-keepclassmembers class * extends android.app.Activity {
|
||||
public void *(android.view.View);
|
||||
}
|
||||
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
-keep class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
11
project.properties
Normal file
11
project.properties
Normal file
@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
BIN
res/drawable/ic_luncher_ewoltest.png
Normal file
BIN
res/drawable/ic_luncher_ewoltest.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
13
res/layout/main.xml
Normal file
13
res/layout/main.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World, EwolActivity"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
4
res/values/strings.xml
Normal file
4
res/values/strings.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Ewol Test Application</string>
|
||||
</resources>
|
53
src/com/example/ewolActivity/EwolActivity.java
Normal file
53
src/com/example/ewolActivity/EwolActivity.java
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
|
||||
|
||||
package com.example.ewolAbstraction;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
// For No Title :
|
||||
import android.view.Window;
|
||||
|
||||
// For the full screen :
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* @brief Class :
|
||||
*
|
||||
*/
|
||||
public class EwolActivity extends Activity {
|
||||
|
||||
private GLSurfaceView mGLView;
|
||||
|
||||
static {
|
||||
System.loadLibrary("ewolabstraction");
|
||||
}
|
||||
|
||||
@Override protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Remove the title of the current display :
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
// set full screen Mode :
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
mGLView = new EwolGLSurfaceView(this);
|
||||
setContentView(mGLView);
|
||||
}
|
||||
|
||||
@Override protected void onPause() {
|
||||
super.onPause();
|
||||
mGLView.onPause();
|
||||
}
|
||||
|
||||
@Override protected void onResume() {
|
||||
super.onResume();
|
||||
mGLView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
88
src/com/example/ewolActivity/EwolGLSurfaceView.java
Normal file
88
src/com/example/ewolActivity/EwolGLSurfaceView.java
Normal file
@ -0,0 +1,88 @@
|
||||
|
||||
|
||||
package com.example.ewolAbstraction;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Class :
|
||||
*
|
||||
*/
|
||||
class EwolGLSurfaceView extends GLSurfaceView {
|
||||
private static native void nativePause();
|
||||
private static native void nativeEventInputMotion(int pointerID, float x, float y);
|
||||
private static native void nativeEventInputState(int pointerID, boolean isDown);
|
||||
private static native void nativeEventUnknow(int eventID);
|
||||
|
||||
public EwolGLSurfaceView(Context context) {
|
||||
super(context);
|
||||
mRenderer = new EwolRenderer();
|
||||
setRenderer(mRenderer);
|
||||
}
|
||||
|
||||
private boolean InputDown1 = false;
|
||||
private boolean InputDown2 = false;
|
||||
private boolean InputDown3 = false;
|
||||
|
||||
public boolean onTouchEvent(final MotionEvent event) {
|
||||
// TODO : unneed code :
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
nativePause();
|
||||
}
|
||||
// Wrapper on input events :
|
||||
int tmpActionType = event.getAction();
|
||||
|
||||
if (tmpActionType == MotionEvent.ACTION_MOVE) {
|
||||
final int pointerCount = event.getPointerCount();
|
||||
for (int p = 0; p < pointerCount; p++) {
|
||||
nativeEventInputMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
|
||||
}
|
||||
} else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
|
||||
|| tmpActionType == MotionEvent.ACTION_DOWN) {
|
||||
nativeEventInputState(0, true);
|
||||
InputDown1 = true;
|
||||
nativeEventInputMotion(event.getPointerId(0), event.getX(0), event.getY(0));
|
||||
} else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
|
||||
nativeEventInputState(0, false);
|
||||
InputDown1 = false;
|
||||
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) {
|
||||
nativeEventInputState(1, true);
|
||||
InputDown2 = true;
|
||||
nativeEventInputMotion(event.getPointerId(1), event.getX(1), event.getY(1));
|
||||
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) {
|
||||
nativeEventInputState(1, false);
|
||||
InputDown2 = false;
|
||||
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) {
|
||||
nativeEventInputState(2, true);
|
||||
InputDown3 = true;
|
||||
nativeEventInputMotion(event.getPointerId(2), event.getX(2), event.getY(2));
|
||||
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) {
|
||||
nativeEventInputState(2, false);
|
||||
InputDown3 = false;
|
||||
} else if(tmpActionType == MotionEvent.ACTION_UP){
|
||||
if (InputDown1) {
|
||||
nativeEventInputState(0, false);
|
||||
InputDown1 = false;
|
||||
} else if (InputDown2) {
|
||||
nativeEventInputState(1, false);
|
||||
InputDown2 = false;
|
||||
} else {
|
||||
nativeEventInputState(2, false);
|
||||
InputDown3 = false;
|
||||
}
|
||||
} else {
|
||||
nativeEventUnknow(tmpActionType);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
EwolRenderer mRenderer;
|
||||
}
|
37
src/com/example/ewolActivity/EwolRenderer.java
Normal file
37
src/com/example/ewolActivity/EwolRenderer.java
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
package com.example.ewolAbstraction;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Class :
|
||||
*
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
public void onSurfaceChanged(GL10 gl, int w, int h) {
|
||||
nativeResize(w, h);
|
||||
}
|
||||
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
nativeRender();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user