From eefbe48546e8f0b6f35de975d66e921b041d4dc7 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 14 Aug 2013 22:48:01 +0200 Subject: [PATCH] [DEV] start to have a generic game engine --- ege/ElementGame.cpp | 39 ++++++++++++++- ege/ElementGame.h | 76 +++++++++++++++++++++------- ege/ElementGameIA.cpp | 63 ------------------------ ege/ElementGameIA.h | 67 ------------------------- ege/Environement.cpp | 40 +++++++++++++++ ege/Environement.h | 21 +++++++- ege/Scene.cpp | 112 ++++++++++++++++++++++++++---------------- ege/Scene.h | 23 ++++++--- lutin_ege.py | 1 - 9 files changed, 240 insertions(+), 202 deletions(-) delete mode 100644 ege/ElementGameIA.cpp delete mode 100644 ege/ElementGameIA.h diff --git a/ege/ElementGame.cpp b/ege/ElementGame.cpp index fa4b6a9..7026049 100644 --- a/ege/ElementGame.cpp +++ b/ege/ElementGame.cpp @@ -43,7 +43,8 @@ ege::ElementGame::ElementGame(ege::Environement& _env) : m_group(0), m_fixe(true), m_radius(0), - m_elementInPhysicsSystem(false) + m_elementInPhysicsSystem(false), + m_IA(NULL) { static uint32_t unique=0; m_uID = unique; @@ -53,6 +54,10 @@ ege::ElementGame::ElementGame(ege::Environement& _env) : ege::ElementGame::~ElementGame(void) { + // in every case remove IA + IADisable(); + // same ... + DynamicDisable(); EGE_DEBUG("Destroy element : uId=" << m_uID); } @@ -71,6 +76,9 @@ void ege::ElementGame::SetFireOn(int32_t groupIdSource, int32_t type, float powe float previousLife = m_life; m_life += power; m_life = etk_avg(0, m_life, m_lifeMax); + if (m_life<=0) { + EGE_DEBUG("[" << GetUID() << "] element is killed ..." << GetType()); + } if (m_life!=previousLife) { OnLifeChange(); } @@ -351,4 +359,33 @@ void ege::ElementGame::DynamicDisable(void) } } +void ege::ElementGame::IAEnable(void) +{ + if (NULL != m_IA) { + // IA already started ... + return; + } + DynamicEnable(); + m_IA = new localIA(*this); + if (NULL == m_IA) { + EGE_ERROR("Can not start the IA ==> allocation error"); + return; + } + m_env.GetDynamicWorld()->addAction(m_IA); +} + +void ege::ElementGame::IADisable(void) +{ + if (NULL == m_IA) { + // IA already stopped ... + return; + } + m_env.GetDynamicWorld()->removeAction(m_IA); + // Remove IA : + delete(m_IA); + m_IA = NULL; +} + + + diff --git a/ege/ElementGame.h b/ege/ElementGame.h index 4a500a9..519da72 100644 --- a/ege/ElementGame.h +++ b/ege/ElementGame.h @@ -45,6 +45,19 @@ namespace ege * @brief Destructor */ virtual ~ElementGame(void); + /** + * @brief Get the element Type description string + * @return A pointer on the descriptive string (Do not free it ==> it might be a const) + */ + virtual const etk::UString& GetType(void) const; + private: + uint32_t m_uID; //!< This is a reference on a basic element ID + public: + /** + * @brief Get the curent Element Unique ID in the all Game. + * @return The requested Unique ID. + */ + inline uint32_t GetUID(void) const { return m_uID; }; protected: ewol::Mesh* m_mesh; //!< Mesh of the Element (can be NULL) btCollisionShape* m_shape; //!< shape of the element (set a copy here to have the debug display of it) @@ -88,22 +101,6 @@ namespace ege * @brief Call chan the element life change */ virtual void OnLifeChange(void) {} - private: - uint32_t m_uID; //!< This is a reference on a basic element ID - public: - /** - * @brief Get the curent Element Unique ID in the all Game. - * @return The requested Unique ID. - */ - inline uint32_t GetUID(void) const - { - return m_uID; - } - /** - * @brief Get the element Type description string - * @return A pointer on the descriptive string (Do not free it ==> it might be a const) - */ - virtual const etk::UString& GetType(void) const; protected: int32_t m_group; //!< Every element has a generic group public: @@ -203,10 +200,51 @@ namespace ege bool m_elementInPhysicsSystem; public: /** - * @brief For intelligent system : this activate the Dynamic object + * @brief Set the elment in the physique engine */ - virtual void DynamicEnable(void); - virtual void DynamicDisable(void); + void DynamicEnable(void); + /** + * @brief Remove this element from the physique engine + */ + void DynamicDisable(void); + private: + class localIA : public btActionInterface + { + private: + ege::ElementGame& m_element; + public: + /** + * @brief Constructor + */ + localIA(ElementGame& element) : m_element(element) { }; + /** + * @brief Destructor + */ + virtual ~localIA(void) { }; + + // herited function + void debugDraw(btIDebugDraw* debugDrawer) { }; + // herited function + void updateAction(btCollisionWorld* collisionWorld, btScalar step) + { + m_element.IAAction(step); + } + }; + localIA* m_IA; + public: + /** + * @brief Enable periodic call Of this object for processing Artificial Intelligence + */ + void IAEnable(void); + /** + * @brief Disable periodic call Of this object for processing Artificial Intelligence + */ + void IADisable(void); + /** + * @brief Periodic call for intelligence artificial. + * @param[in] step : step of time in s + */ + virtual void IAAction(float _step) { }; }; }; diff --git a/ege/ElementGameIA.cpp b/ege/ElementGameIA.cpp deleted file mode 100644 index 38ad4c3..0000000 --- a/ege/ElementGameIA.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -ege::ElementGameIA::ElementGameIA(ege::Environement& _env) : - ElementGame(_env), - m_IA(*this), - m_isDynamicStarted(false) -{ - -} - -ege::ElementGameIA::~ElementGameIA(void) -{ - DynamicDisable(); -} - - -void ege::ElementGameIA::DynamicEnable(void) -{ - ege::ElementGame::DynamicEnable(); - if (false == m_isDynamicStarted) { - m_env.GetDynamicWorld()->addAction(&m_IA); - m_isDynamicStarted = true; - } -} - -void ege::ElementGameIA::DynamicDisable(void) -{ - ege::ElementGame::DynamicDisable(); - if (true == m_isDynamicStarted) { - m_env.GetDynamicWorld()->removeAction(&m_IA); - m_isDynamicStarted = false; - } -} - - - - diff --git a/ege/ElementGameIA.h b/ege/ElementGameIA.h deleted file mode 100644 index 5b1c5ff..0000000 --- a/ege/ElementGameIA.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EGE_ELEMENT_GAME_IA_H__ -#define __EGE_ELEMENT_GAME_IA_H__ - -#include - -namespace ege -{ - class ElementGameIA : public ege::ElementGame - { - private: - class localIA : public btActionInterface - { - private: - ElementGameIA& m_element; - public: - /** - * @brief Constructor - */ - localIA(ElementGameIA& element) : m_element(element) { }; - /** - * @brief Destructor - */ - virtual ~localIA(void) { }; - - // herited function - void debugDraw(btIDebugDraw* debugDrawer) { }; - // herited function - void updateAction(btCollisionWorld* collisionWorld, btScalar step) - { - m_element.IAAction(step); - } - }; - localIA m_IA; - public: - /** - * @brief Constructor - */ - ElementGameIA(ege::Environement& _env); - /** - * @brief Destructor - */ - virtual ~ElementGameIA(void); - /** - * @brief Periodic call for intelligence artificial. - * @param[in] step : step of time in s - */ - virtual void IAAction(float _step)=0; - - private: - bool m_isDynamicStarted; - public: - virtual void DynamicEnable(void); - virtual void DynamicDisable(void); - }; -}; - -#endif - - diff --git a/ege/Environement.cpp b/ege/Environement.cpp index 7717181..96b4795 100644 --- a/ege/Environement.cpp +++ b/ege/Environement.cpp @@ -111,6 +111,46 @@ void ege::Environement::GetElementNearestFixed(const vec3& _sourcePosition, } } +static etk::Hash& GetHachTableCreating(void) +{ + static etk::Hash s_table; + return s_table; +} + + +void ege::Environement::AddCreator(const etk::UString& _type, ege::createElement_tf _creator) +{ + if (NULL == _creator) { + EGE_ERROR("Try to add an empty CREATOR ..."); + return; + } + GetHachTableCreating().Add(_type, _creator); +} + +ege::ElementGame* ege::Environement::CreateElement(const etk::UString& _type, const etk::UString& _description, bool _autoAddElement) +{ + if (false==GetHachTableCreating().Exist(_type)) { + EGE_ERROR("Request creating of an type that is not known '" << _type << "'"); + return NULL; + } + ege::createElement_tf pointerFunction = GetHachTableCreating()[_type]; + if (NULL == pointerFunction) { + EGE_ERROR("NULL pointer ==> internal error... '" << _type << "'"); + // internal error + return NULL; + } + ege::ElementGame* tmpElement = pointerFunction(*this, _description); + if (NULL == tmpElement) { + EGE_ERROR("Sub creator han an error when creating element : '" << _type << "'"); + return NULL; + } + if (_autoAddElement==true) { + AddElementGame(tmpElement); + } + return tmpElement; +} + + void ege::Environement::AddElementGame(ege::ElementGame* _newElement) { // prevent memory allocation and un allocation ... diff --git a/ege/Environement.h b/ege/Environement.h index 46ed571..e3d8dd4 100644 --- a/ege/Environement.h +++ b/ege/Environement.h @@ -9,6 +9,7 @@ #ifndef __EGE_ENVIRONEMENT_H__ #define __EGE_ENVIRONEMENT_H__ +#include #include class btDynamicsWorld; @@ -17,6 +18,9 @@ class btDynamicsWorld; namespace ege { class ElementGame; + class Environement; + typedef ege::ElementGame* (*createElement_tf)(ege::Environement& _env, const etk::UString& _description); + class Environement { private: @@ -25,7 +29,22 @@ namespace ege { public: Environement(void) : m_dynamicsWorld(NULL) { }; virtual ~Environement(void) { }; - + public: + /** + * @brief Add a creator element system + * @param[in] _type Type of the element. + * @param[in] _creator Function pointer that reference the element creating. + */ + static void AddCreator(const etk::UString& _type, ege::createElement_tf _creator); + /** + * @brief Create an element on the curent scene. + * @param[in] _type Type of the element that might be created. + * @param[in] _description String that describe the content of the element properties. + * @param[in] _autoAddElement this permit to add the element if it is created ==> no more action ... + * @return NULL if an error occured OR the pointer on the element and it is already added on the system. + * @note Pointer is return in case of setting properties on it... + */ + ege::ElementGame* CreateElement(const etk::UString& _type, const etk::UString& _description, bool _autoAddElement=true); public: class ResultNearestElement { diff --git a/ege/Scene.cpp b/ege/Scene.cpp index efda31f..22dd080 100644 --- a/ege/Scene.cpp +++ b/ege/Scene.cpp @@ -41,12 +41,17 @@ const char * const ege::Scene::eventKillEnemy = "event-scene-kill-ennemy"; #define WALK_FLAG_RIGHT (1<<3) #define WALK_FLAG_CAUTION (1<<4) -ege::Scene::Scene(void) : +ege::Scene::Scene(btDefaultCollisionConfiguration* _collisionConfiguration, + btCollisionDispatcher* _dispatcher, + btBroadphaseInterface* _broadphase, + btConstraintSolver* _solver, + btDynamicsWorld* _dynamicsWorld, + ege::Camera* _camera) : m_gameTime(0), m_angleView(M_PI/3.0), m_finger_DoubleTouch(false), m_dynamicsWorld(NULL), - m_camera(vec3(0,0,0), 0, DEG_TO_RAD(45) ,50), + m_camera(NULL), m_isRunning(true), m_walk(0), m_debugMode(false), @@ -60,26 +65,48 @@ ege::Scene::Scene(void) : ewol::resource::Keep(m_debugDrawing); - m_zoom = 1.0/1000.0; m_ratioTime = 1.0f; - - m_collisionConfiguration = new btDefaultCollisionConfiguration(); + if (NULL != _collisionConfiguration) { + m_collisionConfiguration = _collisionConfiguration; + } else { + m_collisionConfiguration = new btDefaultCollisionConfiguration(); + } ///use the default collision dispatcher. - m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration); - - m_broadphase = new btDbvtBroadphase(); + if (NULL != _dispatcher) { + m_dispatcher = _dispatcher; + } else { + m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration); + } + if (NULL != _broadphase) { + m_broadphase = _broadphase; + } else { + m_broadphase = new btDbvtBroadphase(); + } ///the default constraint solver. - btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver; - m_solver = sol; + if (NULL != _solver) { + m_solver = _solver; + } else { + m_solver = new btSequentialImpulseConstraintSolver(); + } + + if (NULL != _dynamicsWorld) { + m_dynamicsWorld = _dynamicsWorld; + } else { + m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration); + // By default we set no gravity + m_dynamicsWorld->setGravity(btVector3(0,0,0)); + } - m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration); - // in space, we set no gravity ... - m_dynamicsWorld->setGravity(btVector3(0,0,0)); m_env.SetDynamicWorld(m_dynamicsWorld); - // SET THE STATION .. - m_camera.SetEye(vec3(0,0,0)); + if (NULL != _camera) { + m_camera = _camera; + } else { + m_camera = new ege::Camera(vec3(0,0,0), 0, DEG_TO_RAD(45) ,50); + // SET THE STATION .. + m_camera->SetEye(vec3(0,0,0)); + } } @@ -162,12 +189,12 @@ void ege::Scene::OnDraw(void) //EGE_DEBUG("Draw (start)"); mat4 tmpMatrix; if (m_dynamicsWorld) { - m_env.GetOrderedElementForDisplay(m_displayElementOrdered, m_camera.GetOrigin(), m_camera.GetViewVector()); + m_env.GetOrderedElementForDisplay(m_displayElementOrdered, m_camera->GetOrigin(), m_camera->GetViewVector()); //EGE_DEBUG("DRAW : " << m_displayElementOrdered.Size() << " elements"); // TODO : Remove this ==> no more needed ==> checked in the Generate the list of the element ordered for (int32_t iii=0; iiiPreCalculationDraw(m_camera); + m_displayElementOrdered[iii].element->PreCalculationDraw(*m_camera); } // note : the first pass is done at the reverse way to prevent multiple display od the same point in the screen // (and we remember that the first pass is to display all the non transparent elements) @@ -186,12 +213,12 @@ void ege::Scene::OnDraw(void) } } for (int32_t iii=0; iiiDrawLife(m_debugDrawing, m_camera); + m_displayElementOrdered[iii].element->DrawLife(m_debugDrawing, *m_camera); } #ifdef DEBUG if (true == m_debugMode) { for (int32_t iii=0; iiiDrawDebug(m_debugDrawing, m_camera); + m_displayElementOrdered[iii].element->DrawDebug(m_debugDrawing, *m_camera); } } #endif @@ -247,7 +274,7 @@ void ege::Scene::PeriodicCall(const ewol::EventTime& _event) //EWOL_DEBUG("Time: m_lastCallTime=" << m_lastCallTime << " deltaTime=" << deltaTime); // update camera positions: - m_camera.PeriodicCall(curentDelta); + m_camera->PeriodicCall(curentDelta); //EGE_DEBUG("stepSimulation (start)"); ///step the simulation @@ -261,13 +288,14 @@ void ege::Scene::PeriodicCall(const ewol::EventTime& _event) int32_t numberEnnemyKilled=0; int32_t victoryPoint=0; etk::Vector& elementList = m_env.GetElementGame(); - for (int32_t iii=0; iii=0; --iii) { if(NULL != elementList[iii]) { if (true == elementList[iii]->NeedToRemove()) { if (elementList[iii]->GetGroup() > 1) { numberEnnemyKilled++; victoryPoint++; } + EGE_DEBUG("[" << elementList[iii]->GetUID() << "] element Removing ... " << elementList[iii]->GetType()); m_env.RmElementGame(elementList[iii]); } } @@ -290,14 +318,14 @@ void ege::Scene::PeriodicCall(const ewol::EventTime& _event) walkValue = -1; } if (walkValue!=0) { - float angleZ = m_camera.GetAngleZ(); + float angleZ = m_camera->GetAngleZ(); vec3 offsetPosition( cosf(angleZ-M_PI/2.0)*walkValue, -sinf(angleZ-M_PI/2.0)*walkValue, 0); //EWOL_DEBUG("Walk : " << ((int32_t)(angles.z/M_PI*180+180)%360-180) << " ==> " << angles); // walk is 6 km/h - vec3 pos = m_camera.GetEye() + offsetPosition*l_walkRatio*curentDelta; - m_camera.SetEye(pos); + vec3 pos = m_camera->GetEye() + offsetPosition*l_walkRatio*curentDelta; + m_camera->SetEye(pos); } walkValue=0; if( (m_walk&WALK_FLAG_LEFT)!=0 @@ -310,14 +338,14 @@ void ege::Scene::PeriodicCall(const ewol::EventTime& _event) walkValue = -1; } if (walkValue != 0) { - float angleZ = m_camera.GetAngleZ(); + float angleZ = m_camera->GetAngleZ(); vec3 offsetPosition( cosf(angleZ)*walkValue, -sinf(angleZ)*walkValue, 0); //EWOL_DEBUG("Walk : " << ((int32_t)(angles.z/M_PI*180+180)%360-180) << " ==> " << angles); // lateral walk is 4 km/h - vec3 pos = m_camera.GetEye() + offsetPosition*l_walkLateralRatio*curentDelta; - m_camera.SetEye(pos); + vec3 pos = m_camera->GetEye() + offsetPosition*l_walkLateralRatio*curentDelta; + m_camera->SetEye(pos); } } } @@ -351,8 +379,8 @@ float tmp___localTime1 = (float)(ewol::GetTime() - tmp___startTime1) / 1000.0f; EWOL_DEBUG(" SCENE111 : " << tmp___localTime1 << "ms "); int64_t tmp___startTime2 = ewol::GetTime(); #endif - ewol::openGL::SetCameraMatrix(m_camera.GetMatrix()); - //mat4 tmpMat = tmpProjection * m_camera.GetMatrix(); + ewol::openGL::SetCameraMatrix(m_camera->GetMatrix()); + //mat4 tmpMat = tmpProjection * m_camera->GetMatrix(); // set internal matrix system : //ewol::openGL::SetMatrix(tmpMat); ewol::openGL::SetMatrix(tmpProjection); @@ -397,7 +425,7 @@ vec2 ege::Scene::CalculateDeltaAngle(const vec2& posScreen) vec3 ege::Scene::ConvertScreenPositionInMapPosition(const vec2& posScreen) { - return m_camera.projectOnZGround(CalculateDeltaAngle(posScreen)); + return m_camera->projectOnZGround(CalculateDeltaAngle(posScreen)); } bool ege::Scene::OnEventInput(const ewol::EventInput& _event) @@ -430,8 +458,8 @@ bool ege::Scene::OnEventInput(const ewol::EventInput& _event) if (ewol::keyEvent::statusMove == _event.GetStatus()) { vec2 tmppPos = relPos-m_centerButtonStartPos; tmppPos *= M_PI/(360.0f*6); - m_camera.SetAngleZ(m_camera.GetAngleZ()- tmppPos.x()); - m_camera.SetAngleTeta(m_camera.GetAngleTeta()-tmppPos.y()); + m_camera->SetAngleZ(m_camera->GetAngleZ()- tmppPos.x()); + m_camera->SetAngleTeta(m_camera->GetAngleTeta()-tmppPos.y()); } // update register position ... m_centerButtonStartPos = relPos; @@ -440,12 +468,12 @@ bool ege::Scene::OnEventInput(const ewol::EventInput& _event) if (ewol::keyEvent::statusMove == _event.GetStatus()) { vec3 nextPosition = ConvertScreenPositionInMapPosition(relPos); vec3 tmppPos = nextPosition-m_finger_StartPosMoving; - vec3 oldposition = m_camera.GetEye(); + vec3 oldposition = m_camera->GetEye(); // update the camera positions: oldposition.setX(oldposition.x() - tmppPos.x()); oldposition.setY(oldposition.y() - tmppPos.y()); // set the new position - m_camera.SetEye(oldposition); + m_camera->SetEye(oldposition); } // update register position ... m_leftButtonStartPos = relPos; @@ -453,16 +481,16 @@ bool ege::Scene::OnEventInput(const ewol::EventInput& _event) } else if (4 == _event.GetId()) { if (ewol::keyEvent::statusSingle == _event.GetStatus()) { // scrool input - float cameraDistance = m_camera.GetDistance()-3; + float cameraDistance = m_camera->GetDistance()-3; EGE_DEBUG("New camera distance : " << etk_avg(10, cameraDistance, 100)); - m_camera.SetDistance(etk_avg(10, cameraDistance, 100)); + m_camera->SetDistance(etk_avg(10, cameraDistance, 100)); } } else if (5 == _event.GetId()) { if (ewol::keyEvent::statusSingle == _event.GetStatus()) { // scrool output - float cameraDistance = m_camera.GetDistance()+3; + float cameraDistance = m_camera->GetDistance()+3; EGE_DEBUG("New camera distance : " << etk_avg(10, cameraDistance, 100)); - m_camera.SetDistance(etk_avg(10, cameraDistance, 100)); + m_camera->SetDistance(etk_avg(10, cameraDistance, 100)); } } /* @@ -504,9 +532,9 @@ bool ege::Scene::OnEventInput(const ewol::EventInput& _event) realDistance /= 2.0f; if (m_finger_oldDistance>=0) { float distanceDelta = m_finger_oldDistance-realDistance; - m_camera.SetDistance(etk_avg(10,m_camera.GetDistance()+distanceDelta/3.0f,100)); + m_camera->SetDistance(etk_avg(10,m_camera->GetDistance()+distanceDelta/3.0f,100)); float angleDelta = m_finger_oldAngle - fingerAngle; - m_camera.SetAngleZ(m_camera.GetAngleZ()+angleDelta); + m_camera->SetAngleZ(m_camera->GetAngleZ()+angleDelta); } m_finger_oldDistance = realDistance; m_finger_oldAngle = fingerAngle; @@ -536,9 +564,9 @@ bool ege::Scene::OnEventInput(const ewol::EventInput& _event) realDistance /= 2.0f; if (m_finger_oldDistance>=0) { float distanceDelta = m_finger_oldDistance-realDistance; - m_camera.SetDistance(etk_avg(10,m_camera.GetDistance()+distanceDelta/3.0f,100)); + m_camera->SetDistance(etk_avg(10,m_camera->GetDistance()+distanceDelta/3.0f,100)); float angleDelta = m_finger_oldAngle - fingerAngle; - m_camera.SetAngleZ(m_camera.GetAngleZ()+angleDelta); + m_camera->SetAngleZ(m_camera->GetAngleZ()+angleDelta); } m_finger_oldDistance = realDistance; m_finger_oldAngle = fingerAngle; diff --git a/ege/Scene.h b/ege/Scene.h index 3b4b633..80b91e7 100644 --- a/ege/Scene.h +++ b/ege/Scene.h @@ -46,7 +46,12 @@ namespace ege { * @brief Constructor of the widget classes * @return (no execption generated (not managed in embended platform)) */ - Scene(void); + Scene(btDefaultCollisionConfiguration* _collisionConfiguration=NULL, + btCollisionDispatcher* _dispatcher=NULL, + btBroadphaseInterface* _broadphase=NULL, + btConstraintSolver* _solver=NULL, + btDynamicsWorld* _dynamicsWorld=NULL, + ege::Camera* _camera=NULL); /** * @brief Destructor of the widget classes */ @@ -70,14 +75,12 @@ namespace ege { btConstraintSolver* m_solver; btDynamicsWorld* m_dynamicsWorld; // camera section - ege::Camera m_camera; //!< Display point of view. + ege::Camera* m_camera; //!< Display point of view. vec3 m_cameraMovePointStart; //!< Position where the mouse start to move // Other elements bool m_isRunning; //!< the display is running (not in pause) float m_ratioTime; //!< Ratio time for the speed of the game ... uint32_t m_walk; //!< Wolk properties - bool m_debugMode; - ewol::Colored3DObject* m_debugDrawing; //!< for the debug draw elements // Note : This is only for temporary elements : on the display etk::Vector m_displayElementOrdered; public: @@ -93,20 +96,24 @@ namespace ege { * @brief Toggle between pause and running */ void PauseToggle(void); + protected: + bool m_debugMode; + ewol::Colored3DObject* m_debugDrawing; //!< for the debug draw elements + public: + /** + * @brief Toggle the debug mode ==> usefull for DEBUG only ... + */ void DebugToggle(void) { m_debugMode = m_debugMode?false:true; }; protected: // Derived function virtual void ScenePeriodicCall(int64_t localTime, int32_t deltaTime) { }; - // camera properties : - private: - float m_zoom; public: vec2 CalculateDeltaAngle(const vec2& posScreen); vec3 ConvertScreenPositionInMapPosition(const vec2& posScreen); /** * @brief Get the current camera reference for the scene rendering */ - ege::Camera& GetCamera(void) { return m_camera; }; + ege::Camera& GetCamera(void) { return *m_camera; }; /** * @brief Set the curent Time Ratio (default 1) */ diff --git a/lutin_ege.py b/lutin_ege.py index 84fe0ff..75f781e 100644 --- a/lutin_ege.py +++ b/lutin_ege.py @@ -13,7 +13,6 @@ def Create(target): 'ege/AudioEngine.cpp', 'ege/Camera.cpp', 'ege/ElementGame.cpp', - 'ege/ElementGameIA.cpp', 'ege/Particule.cpp', 'ege/ParticuleEngine.cpp', 'ege/Scene.cpp',