[DEV] add scene start stop option config

This commit is contained in:
Edouard DUPIN 2014-06-22 19:07:50 +02:00
parent 73455cc61b
commit 45fb9f5ffe
2 changed files with 37 additions and 1 deletions

View File

@ -33,7 +33,7 @@
const char * const ege::widget::Scene::eventPlayTimeChange = "event-scene-play-time-change";
const char * const ege::widget::Scene::eventKillEnemy = "event-scene-kill-ennemy";
const char * const ege::widget::Scene::configStatus = "status";
ege::widget::Scene::Scene(bool _setAutoBullet, bool _setAutoCamera) :
@ -50,6 +50,7 @@ ege::widget::Scene::Scene(bool _setAutoBullet, bool _setAutoCamera) :
periodicCallEnable();
addEventId(eventPlayTimeChange);
addEventId(eventKillEnemy);
registerConfig(configStatus, "list", "start;stop", "Satus of the activity of the Scene");
m_debugDrawing = ewol::resource::Colored3DObject::keep();
@ -371,4 +372,34 @@ vec3 ege::widget::Scene::convertScreenPositionInMapPosition(const vec2& _posScre
}
bool ege::widget::Scene::onSetConfig(const ewol::object::Config& _conf) {
if (true == Widget::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configStatus) {
if(compare_no_case(_conf.getData(), "start") == true) {
resume();
} else if(compare_no_case(_conf.getData(), "stop") == true) {
pause();
}
return true;
}
return false;
}
bool ege::widget::Scene::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::Widget::onGetConfig(_config, _result)) {
return true;
}
if (_config == configStatus) {
if (m_isRunning == true) {
_result = "start";
} else {
_result = "stop";
}
return true;
}
return false;
}

View File

@ -37,8 +37,11 @@ namespace ege {
namespace widget {
class Scene : public ewol::Widget {
public:
// extern event
static const char * const eventPlayTimeChange;
static const char * const eventKillEnemy;
// configurations:
static const char * const configStatus;
protected:
ege::Environement m_env;
public:
@ -133,6 +136,8 @@ namespace ege {
protected: // Derived function
virtual void onDraw();
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
public: // Derived function
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
virtual void onRegenerateDisplay();