Basic dynaic game is OK

This commit is contained in:
Edouard Dupin 2012-04-11 01:33:24 +02:00
parent b7362f524a
commit 59b78d1c00
10 changed files with 60 additions and 39 deletions

View File

@ -19,8 +19,8 @@ else ifeq ($(PLATFORM), IMac)
else ifeq ($(PLATFORM), IOs) else ifeq ($(PLATFORM), IOs)
else ifeq ($(PLATFORM), Android) else ifeq ($(PLATFORM), Android)
PROJECT_NDK?=$(realpath $(PROJECT_MODULE)/android/ndk/) PROJECT_NDK:=$(PROJECT_MODULE)/android/ndk/
PROJECT_SDK?=$(realpath $(PROJECT_MODULE)/android/sdk/) PROJECT_SDK:=$(PROJECT_MODULE)/android/sdk/
else 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

View File

@ -27,7 +27,7 @@
#include <time.h> #include <time.h>
#include <stdint.h> #include <stdint.h>
#include <pthread.h> #include <pthread.h>
#include <tools_debug.h> #include <Debug.h>
#include <ewol/threadMsg.h> #include <ewol/threadMsg.h>
@ -57,49 +57,49 @@ extern "C"
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnCreate( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnCreate( JNIEnv* env )
{ {
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EDN_DEBUG("** Activity On Create **"); APPL_DEBUG("** Activity On Create **");
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EWOL_SystemStart(); EWOL_SystemStart();
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStart( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStart( JNIEnv* env )
{ {
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EDN_DEBUG("** Activity On Start **"); APPL_DEBUG("** Activity On Start **");
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnReStart( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnReStart( JNIEnv* env )
{ {
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EDN_DEBUG("** Activity On Re-Start **"); APPL_DEBUG("** Activity On Re-Start **");
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnResume( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnResume( JNIEnv* env )
{ {
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EDN_DEBUG("** Activity On Resume **"); APPL_DEBUG("** Activity On Resume **");
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnPause( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnPause( JNIEnv* env )
{ {
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EDN_DEBUG("** Activity On Pause **"); APPL_DEBUG("** Activity On Pause **");
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
// All the openGl has been destroyed ... // All the openGl has been destroyed ...
// TODO : Mark all the texture to be reloaded ... // TODO : Mark all the texture to be reloaded ...
EWOL_NativeGLDestroy(); EWOL_NativeGLDestroy();
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStop( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStop( JNIEnv* env )
{ {
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EDN_DEBUG("** Activity On Stop **"); APPL_DEBUG("** Activity On Stop **");
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnDestroy( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnDestroy( JNIEnv* env )
{ {
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EDN_DEBUG("** Activity On Destroy **"); APPL_DEBUG("** Activity On Destroy **");
EDN_DEBUG("*******************************************"); APPL_DEBUG("*******************************************");
EWOL_SystemStop(); EWOL_SystemStop();
} }

View File

@ -22,4 +22,4 @@
******************************************************************************* *******************************************************************************
*/ */
const char * etkLibName = "Etk "; const char * etkLibName = "Etk ";

View File

@ -25,4 +25,4 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
const char * ewolLibName = "ewol "; const char * ewolLibName = "ewol ";

View File

@ -36,10 +36,11 @@ ewol::GameElement::GameElement(void)
m_visible = true; m_visible = true;
m_position.x = 0.0; m_position.x = 0.0;
m_position.y = 0.0; m_position.y = 0.0;
m_acceleration.x = 0.0; m_speed.x = 0.0;
m_acceleration.y = 0.0; m_speed.y = 0.0;
m_size = 64.0; m_size = 64.0;
m_angle = 0.0; m_angle = 0.0;
m_gravity = 0.0;
} }

View File

@ -37,9 +37,10 @@ namespace ewol {
protected: protected:
bool m_visible; bool m_visible;
coord2D_ts m_position; coord2D_ts m_position;
coord2D_ts m_acceleration; coord2D_ts m_speed;
etkFloat_t m_size; etkFloat_t m_size;
etkFloat_t m_angle; etkFloat_t m_angle;
etkFloat_t m_gravity;
public: public:
GameElement(void); GameElement(void);
virtual ~GameElement(void); virtual ~GameElement(void);
@ -48,15 +49,20 @@ namespace ewol {
coord2D_ts PositionGet(void) { return m_position; }; coord2D_ts PositionGet(void) { return m_position; };
void PositionSet(coord2D_ts state) { m_position = state; }; void PositionSet(coord2D_ts state) { m_position = state; };
void PositionSet(etkFloat_t xxx, etkFloat_t yyy) { m_position.x = xxx; m_position.y = yyy; }; void PositionSet(etkFloat_t xxx, etkFloat_t yyy) { m_position.x = xxx; m_position.y = yyy; };
coord2D_ts AccelerationGet(void) { return m_acceleration; }; coord2D_ts SpeedGet(void) { return m_speed; };
void AccelerationSet(coord2D_ts state) { m_acceleration = state; }; void SpeedSet(coord2D_ts state) { m_speed = state; };
void SpeedSet(etkFloat_t xxx, etkFloat_t yyy) { m_speed.x = xxx; m_speed.y = yyy; };
etkFloat_t SizeGet(void) { return m_size; }; etkFloat_t SizeGet(void) { return m_size; };
void SizeSet(etkFloat_t state) { m_size = state; }; void SizeSet(etkFloat_t state) { m_size = state; };
etkFloat_t AngleGet(void) { return m_angle; }; etkFloat_t AngleGet(void) { return m_angle; };
void AngleSet(etkFloat_t state) { m_angle = state; }; void AngleSet(etkFloat_t state) { m_angle = state; };
etkFloat_t GravityGet(void) { return m_gravity; };
void GravitySet(etkFloat_t state) { m_gravity = state; };
virtual bool Process(int64_t time, int32_t deltaTime, etk::VectorType<ewol::GameElement*> & listOfElement); virtual bool Process(int64_t time, int32_t deltaTime, etk::VectorType<ewol::GameElement*> & listOfElement);
virtual void Draw(etk::VectorType<ewol::Sprite*> & listOfSprite, etk::VectorType<ewol::Sprite*> & listOfEffects); virtual void Draw(etk::VectorType<ewol::Sprite*> & listOfSprite, etk::VectorType<ewol::Sprite*> & listOfEffects);
virtual void RemoveElement(int32_t idOfElement); virtual void RemoveElement(int32_t idOfElement);
virtual bool HaveImpact(int32_t type, coord2D_ts position, etkFloat_t size) {return false;};
virtual void Explosion(int32_t type, coord2D_ts position, etkFloat_t pxAtenuation, etkFloat_t power) { } ;
int32_t LoadSprite(etk::VectorType<ewol::Sprite*> listOfElement[NB_BOUBLE_BUFFER], etk::UString fileName, coord2D_ts maxSize); int32_t LoadSprite(etk::VectorType<ewol::Sprite*> listOfElement[NB_BOUBLE_BUFFER], etk::UString fileName, coord2D_ts maxSize);
}; };

View File

@ -28,9 +28,11 @@
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
extern const char * const ewolEventButtonPressed = "ewol Button Pressed"; extern const char * const ewolEventButtonPressed = "ewol-button-Pressed";
extern const char * const ewolEventButtonEnter = "ewol Button Enter"; extern const char * const ewolEventButtonDown = "ewol-button-down";
extern const char * const ewolEventButtonLeave = "ewol Button Leave"; extern const char * const ewolEventButtonUp = "ewol-button-up";
extern const char * const ewolEventButtonEnter = "ewol-button-enter";
extern const char * const ewolEventButtonLeave = "ewol-button-leave";
/** /**
@ -51,6 +53,8 @@ void ewol::WIDGET_ButtonInit(void)
void ewol::Button::Init(void) void ewol::Button::Init(void)
{ {
AddEventId(ewolEventButtonPressed); AddEventId(ewolEventButtonPressed);
AddEventId(ewolEventButtonDown);
AddEventId(ewolEventButtonUp);
AddEventId(ewolEventButtonEnter); AddEventId(ewolEventButtonEnter);
AddEventId(ewolEventButtonLeave); AddEventId(ewolEventButtonLeave);
m_hasAnImage = false; m_hasAnImage = false;
@ -277,11 +281,15 @@ bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, co
{ {
//EWOL_DEBUG("Event on BT ..."); //EWOL_DEBUG("Event on BT ...");
if (1 == IdInput) { if (1 == IdInput) {
if(ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
GenerateEventId(ewolEventButtonDown);
}
if(ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
GenerateEventId(ewolEventButtonUp);
}
if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent
|| ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent
|| ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) { || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
// nothing to do ...
//EWOL_DEBUG(" ==> generate event : " << ewolEventButtonPressed);
GenerateEventId(ewolEventButtonPressed); GenerateEventId(ewolEventButtonPressed);
MarkToReedraw(); MarkToReedraw();
return true; return true;

View File

@ -30,6 +30,8 @@
#include <ewol/widget/Drawable.h> #include <ewol/widget/Drawable.h>
extern const char * const ewolEventButtonPressed; extern const char * const ewolEventButtonPressed;
extern const char * const ewolEventButtonDown;
extern const char * const ewolEventButtonUp;
extern const char * const ewolEventButtonEnter; extern const char * const ewolEventButtonEnter;
extern const char * const ewolEventButtonLeave; extern const char * const ewolEventButtonLeave;

View File

@ -167,11 +167,15 @@ void ewol::Scene::AddElement(ewol::GameElement* newElement)
*/ */
void ewol::Scene::PeriodicCall(int64_t localTime) void ewol::Scene::PeriodicCall(int64_t localTime)
{ {
//EWOL_ERROR("Periodic Call ... " << localTime); //EWOL_ERROR("Periodic Call ... " << localTime);
for (int32_t iii=0; iii<m_listAnimatedElements.Size(); iii++) { for (int32_t iii=0; iii<m_listAnimatedElements.Size(); iii++) {
if (NULL != m_listAnimatedElements[iii]) { if (NULL != m_listAnimatedElements[iii]) {
// find an empty slot ... // check if the element request an auto Kill ...
m_listAnimatedElements[iii]->Process(localTime, 100, m_listAnimatedElements); if (true == m_listAnimatedElements[iii]->Process(localTime, 20000, m_listAnimatedElements) ) {
delete(m_listAnimatedElements[iii]);
m_listAnimatedElements[iii] = NULL;
}
} }
} }
MarkToReedraw(); MarkToReedraw();

View File

@ -24,4 +24,4 @@
#include <parserSVG/Debug.h> #include <parserSVG/Debug.h>
const char * parserSVGLibName = "parserSVG "; const char * parserSVGLibName = "parserSVG";