[DEV] update new ewol interface 0.9
This commit is contained in:
parent
449d1b13d3
commit
d22d7ade73
@ -15,10 +15,8 @@
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <etk/math/Matrix4.h>
|
||||
|
||||
namespace ege
|
||||
{
|
||||
class Camera
|
||||
{
|
||||
namespace ege {
|
||||
class Camera {
|
||||
protected:
|
||||
mat4 m_matrix; //!< transformation matrix.
|
||||
float m_offsetFactor; //!< this variable is used to move the camera to the top position of the system == > automaticly
|
||||
|
@ -27,7 +27,7 @@
|
||||
#undef __class__
|
||||
#define __class__ "CollisionShapeCreator"
|
||||
|
||||
btCollisionShape* ege::collision::createShape(const ewol::object::Shared<ege::resource::Mesh>& _mesh) {
|
||||
btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resource::Mesh>& _mesh) {
|
||||
if (nullptr == _mesh) {
|
||||
return new btEmptyShape();;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace ege {
|
||||
namespace collision {
|
||||
btCollisionShape* createShape(const ewol::object::Shared<ege::resource::Mesh>& _mesh);
|
||||
btCollisionShape* createShape(const std::shared_ptr<ege::resource::Mesh>& _mesh);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
@ -95,7 +95,7 @@ void ege::ElementGame::FunctionFreeShape(void* _pointer) {
|
||||
}
|
||||
|
||||
bool ege::ElementGame::loadMesh(const std::string& _meshFileName) {
|
||||
ewol::object::Shared<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::keep(_meshFileName);
|
||||
std::shared_ptr<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::create(_meshFileName);
|
||||
if(nullptr == tmpMesh) {
|
||||
EGE_ERROR("can not load the resources : " << _meshFileName);
|
||||
return false;
|
||||
@ -103,7 +103,7 @@ bool ege::ElementGame::loadMesh(const std::string& _meshFileName) {
|
||||
return setMesh(tmpMesh);
|
||||
}
|
||||
|
||||
bool ege::ElementGame::setMesh(const ewol::object::Shared<ege::resource::Mesh>& _mesh) {
|
||||
bool ege::ElementGame::setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh) {
|
||||
if (nullptr!=m_mesh) {
|
||||
removeShape();
|
||||
m_mesh.reset();
|
||||
@ -181,7 +181,7 @@ const float ege::ElementGame::getInvMass() {
|
||||
return 0.0000000001f;
|
||||
};
|
||||
|
||||
static void drawSphere(const ewol::object::Shared<ewol::resource::Colored3DObject>& _draw,
|
||||
static void drawSphere(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw,
|
||||
btScalar _radius,
|
||||
int _lats,
|
||||
int _longs,
|
||||
@ -229,7 +229,7 @@ const float lifeHeight = 0.3f;
|
||||
const float lifeWidth = 2.0f;
|
||||
const float lifeYPos = 1.7f;
|
||||
|
||||
void ege::ElementGame::drawLife(const ewol::object::Shared<ewol::resource::Colored3DObject>& _draw, const ege::Camera& _camera) {
|
||||
void ege::ElementGame::drawLife(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const ege::Camera& _camera) {
|
||||
if (nullptr == _draw) {
|
||||
return;
|
||||
}
|
||||
@ -267,7 +267,7 @@ void ege::ElementGame::drawLife(const ewol::object::Shared<ewol::resource::Color
|
||||
}
|
||||
|
||||
static void drawShape(const btCollisionShape* _shape,
|
||||
const ewol::object::Shared<ewol::resource::Colored3DObject>& _draw,
|
||||
const std::shared_ptr<ewol::resource::Colored3DObject>& _draw,
|
||||
mat4 _transformationMatrix,
|
||||
std::vector<vec3> _tmpVertices) {
|
||||
if( nullptr == _draw
|
||||
@ -434,7 +434,7 @@ static void drawShape(const btCollisionShape* _shape,
|
||||
}
|
||||
}
|
||||
|
||||
void ege::ElementGame::drawDebug(const ewol::object::Shared<ewol::resource::Colored3DObject>& _draw, const ege::Camera& _camera) {
|
||||
void ege::ElementGame::drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const ege::Camera& _camera) {
|
||||
m_debugText.clear();
|
||||
m_debugText.setColor(etk::Color<>(0x00, 0xFF, 0x00, 0xFF));
|
||||
m_debugText.setPos(vec3(-20,32,0));
|
||||
|
@ -75,7 +75,7 @@ namespace ege {
|
||||
return m_uID;
|
||||
};
|
||||
private:
|
||||
ewol::object::Shared<ege::resource::Mesh> m_mesh; //!< Mesh of the Element (can be nullptr)
|
||||
std::shared_ptr<ege::resource::Mesh> m_mesh; //!< Mesh of the Element (can be nullptr)
|
||||
btCollisionShape* m_shape; //!< shape of the element (set a copy here to have the debug display of it)
|
||||
public:
|
||||
/**
|
||||
@ -91,7 +91,7 @@ namespace ege {
|
||||
* @note : this remove the shape and the mesh properties.
|
||||
* @return true if no error occured
|
||||
*/
|
||||
bool setMesh(const ewol::object::Shared<ege::resource::Mesh>& _mesh);
|
||||
bool setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh);
|
||||
/**
|
||||
* @brief set the shape properties.
|
||||
* @param[in] _shape The shape pointer.
|
||||
@ -103,7 +103,7 @@ namespace ege {
|
||||
* @brief get a pointer on the Mesh file.
|
||||
* @return the mesh pointer.
|
||||
*/
|
||||
inline const ewol::object::Shared<ege::resource::Mesh>& getMesh() {
|
||||
inline const std::shared_ptr<ege::resource::Mesh>& getMesh() {
|
||||
return m_mesh;
|
||||
};
|
||||
/**
|
||||
@ -186,7 +186,7 @@ namespace ege {
|
||||
/**
|
||||
* @brief draw the current life of the element
|
||||
*/
|
||||
virtual void drawLife(const ewol::object::Shared<ewol::resource::Colored3DObject>& _draw, const ege::Camera& _camera);
|
||||
virtual void drawLife(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const ege::Camera& _camera);
|
||||
|
||||
protected:
|
||||
// For debug only ...
|
||||
@ -196,7 +196,7 @@ namespace ege {
|
||||
* @brief Debug display of the current element
|
||||
* @param[in,out] draw Basic system to draw the debug shape and informations
|
||||
*/
|
||||
virtual void drawDebug(const ewol::object::Shared<ewol::resource::Colored3DObject>& _draw, const ege::Camera& _camera);
|
||||
virtual void drawDebug(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const ege::Camera& _camera);
|
||||
|
||||
/**
|
||||
* @brief get the theoric position. Sometimes, the element has move due to an explosion or something else, then its real position in not the one that woult it be at the end ...
|
||||
|
@ -27,7 +27,7 @@ ege::Light::~Light() {
|
||||
|
||||
}
|
||||
|
||||
void ege::Light::link(const ewol::object::Shared<ewol::resource::Program>& _prog, const std::string& _baseName) {
|
||||
void ege::Light::link(const std::shared_ptr<ewol::resource::Program>& _prog, const std::string& _baseName) {
|
||||
if (nullptr == _prog) {
|
||||
return;
|
||||
}
|
||||
@ -38,7 +38,7 @@ void ege::Light::link(const ewol::object::Shared<ewol::resource::Program>& _prog
|
||||
m_GL_specularColor = _prog->getUniform(_baseName+".specularColor");
|
||||
}
|
||||
|
||||
void ege::Light::draw(const ewol::object::Shared<ewol::resource::Program>& _prog) {
|
||||
void ege::Light::draw(const std::shared_ptr<ewol::resource::Program>& _prog) {
|
||||
_prog->uniform3(m_GL_direction, m_direction);
|
||||
_prog->uniform3(m_GL_halfplane, m_halfplane);
|
||||
_prog->uniform4(m_GL_ambientColor, m_ambientColor);
|
||||
|
@ -33,8 +33,8 @@ namespace ege {
|
||||
public:
|
||||
Light();
|
||||
~Light();
|
||||
void link(const ewol::object::Shared<ewol::resource::Program>& _prog, const std::string& _baseName);
|
||||
void draw(const ewol::object::Shared<ewol::resource::Program>& _prog);
|
||||
void link(const std::shared_ptr<ewol::resource::Program>& _prog, const std::string& _baseName);
|
||||
void draw(const std::shared_ptr<ewol::resource::Program>& _prog);
|
||||
void setDirection(const vec3& val) {
|
||||
m_direction = val;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ ege::MaterialGlId::MaterialGlId() :
|
||||
}
|
||||
|
||||
|
||||
void ege::MaterialGlId::link(const ewol::object::Shared<ewol::resource::Program>& _prog, const std::string& _baseName) {
|
||||
void ege::MaterialGlId::link(const std::shared_ptr<ewol::resource::Program>& _prog, const std::string& _baseName) {
|
||||
if (nullptr == _prog) {
|
||||
return;
|
||||
}
|
||||
@ -43,7 +43,7 @@ ege::Material::~Material() {
|
||||
|
||||
}
|
||||
|
||||
void ege::Material::draw(const ewol::object::Shared<ewol::resource::Program>& _prog, const MaterialGlId& _glID) {
|
||||
void ege::Material::draw(const std::shared_ptr<ewol::resource::Program>& _prog, const MaterialGlId& _glID) {
|
||||
_prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
|
||||
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
|
||||
_prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor);
|
||||
@ -56,8 +56,8 @@ void ege::Material::draw(const ewol::object::Shared<ewol::resource::Program>& _p
|
||||
void ege::Material::setTexture0(const std::string& _filename) {
|
||||
ivec2 tmpSize(256, 256);
|
||||
// prevent overloard error :
|
||||
ewol::object::Shared<ewol::resource::TextureFile> tmpCopy = m_texture0;
|
||||
m_texture0 = ewol::resource::TextureFile::keep(_filename, tmpSize);
|
||||
std::shared_ptr<ewol::resource::TextureFile> tmpCopy = m_texture0;
|
||||
m_texture0 = ewol::resource::TextureFile::create(_filename, tmpSize);
|
||||
if (m_texture0 == nullptr) {
|
||||
EGE_ERROR("Can not load specific texture : " << _filename);
|
||||
// retreave previous texture:
|
||||
|
@ -28,7 +28,7 @@ namespace ege {
|
||||
int32_t m_GL_shininess;
|
||||
int32_t m_GL_texture0;
|
||||
MaterialGlId();
|
||||
void link(const ewol::object::Shared<ewol::resource::Program>& _prog, const std::string& _baseName);
|
||||
void link(const std::shared_ptr<ewol::resource::Program>& _prog, const std::string& _baseName);
|
||||
};
|
||||
class Material {
|
||||
private:
|
||||
@ -37,13 +37,13 @@ namespace ege {
|
||||
vec4 m_diffuseFactor;
|
||||
vec4 m_specularFactor;
|
||||
float m_shininess;
|
||||
ewol::object::Shared<ewol::resource::TextureFile> m_texture0;
|
||||
std::shared_ptr<ewol::resource::TextureFile> m_texture0;
|
||||
public:
|
||||
std::vector<uint32_t> m_listIndexFaces;
|
||||
public:
|
||||
Material();
|
||||
~Material();
|
||||
void draw(const ewol::object::Shared<ewol::resource::Program>& _prog, const ege::MaterialGlId& _glID);
|
||||
void draw(const std::shared_ptr<ewol::resource::Program>& _prog, const ege::MaterialGlId& _glID);
|
||||
void setAmbientFactor(const vec4& _val) {
|
||||
m_ambientFactor = _val;
|
||||
}
|
||||
|
@ -14,13 +14,17 @@
|
||||
#undef __class__
|
||||
#define __class__ "resource::Mesh"
|
||||
|
||||
ege::resource::Mesh::Mesh(const std::string& _fileName, const std::string& _shaderName) :
|
||||
ewol::Resource(_fileName),
|
||||
ege::resource::Mesh::Mesh() :
|
||||
m_normalMode(normalModeNone),
|
||||
m_checkNormal(false),
|
||||
m_pointerShape(nullptr),
|
||||
m_functionFreeShape(nullptr) {
|
||||
addObjectType("ewol::resource::Mesh");
|
||||
addObjectType("ege::resource::Mesh");
|
||||
|
||||
}
|
||||
|
||||
void ege::resource::Mesh::init(const std::string& _fileName, const std::string& _shaderName) {
|
||||
ewol::Resource::init(_fileName);
|
||||
EGE_VERBOSE("Load a new mesh : '" << _fileName << "'");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
@ -32,7 +36,7 @@ ege::resource::Mesh::Mesh(const std::string& _fileName, const std::string& _shad
|
||||
m_light.setSpecularColor(vec4(0.0,0.0,0.0,1));
|
||||
|
||||
//EGE_DEBUG(m_name << " " << m_light);
|
||||
m_GLprogram = ewol::resource::Program::keep(_shaderName);
|
||||
m_GLprogram = ewol::resource::Program::create(_shaderName);
|
||||
if (m_GLprogram != nullptr) {
|
||||
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
|
||||
m_GLtexture = m_GLprogram->getAttribute("EW_texture2d");
|
||||
@ -44,17 +48,17 @@ ege::resource::Mesh::Mesh(const std::string& _fileName, const std::string& _shad
|
||||
m_light.link(m_GLprogram, "EW_directionalLight");
|
||||
}
|
||||
// this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
|
||||
m_verticesVBO = ewol::resource::VirtualBufferObject::keep(4);
|
||||
m_verticesVBO = ewol::resource::VirtualBufferObject::create(4);
|
||||
|
||||
// load the curent file :
|
||||
std::string tmpName = etk::tolower(_fileName);
|
||||
// select the corect loader :
|
||||
if (end_with(tmpName, ".obj") == true) {
|
||||
if (etk::end_with(tmpName, ".obj") == true) {
|
||||
if (loadOBJ(_fileName) == false) {
|
||||
EGE_ERROR("Error To load OBJ file " << tmpName );
|
||||
return;
|
||||
}
|
||||
} else if (end_with(tmpName, ".emf") ) {
|
||||
} else if (etk::end_with(tmpName, ".emf") ) {
|
||||
if (loadEMF(_fileName) == false) {
|
||||
EGE_ERROR("Error To load EMF file " << tmpName );
|
||||
return;
|
||||
@ -1010,18 +1014,3 @@ void ege::resource::Mesh::setShape(void* _shape) {
|
||||
}
|
||||
m_pointerShape=_shape;
|
||||
}
|
||||
|
||||
ewol::object::Shared<ege::resource::Mesh> ege::resource::Mesh::keep(const std::string& _meshName) {
|
||||
ewol::object::Shared<ege::resource::Mesh> object = ewol::dynamic_pointer_cast<ege::resource::Mesh>(getManager().localKeep(_meshName));
|
||||
if (object != nullptr) {
|
||||
return object;
|
||||
}
|
||||
EGE_DEBUG("CREATE: Mesh: '" << _meshName << "'");
|
||||
object = ewol::object::makeShared(new ege::resource::Mesh(_meshName));
|
||||
if (object == nullptr) {
|
||||
EGE_ERROR("allocation error of a resource : ??Mesh??" << _meshName);
|
||||
return nullptr;
|
||||
}
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ namespace ege {
|
||||
enum normalMode m_normalMode; // select the normal mode of display
|
||||
bool m_checkNormal; //!< when enable, this check the normal of the mesh before sending it at the 3d card
|
||||
protected:
|
||||
ewol::object::Shared<ewol::resource::Program> m_GLprogram;
|
||||
std::shared_ptr<ewol::resource::Program> m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLMatrixPosition;
|
||||
@ -110,10 +110,13 @@ namespace ege {
|
||||
etk::Hash<ege::Material*> m_materials;
|
||||
std::vector<ege::PhysicsShape*> m_physics; //!< collision shape module ... (independent of bullet lib)
|
||||
protected:
|
||||
ewol::object::Shared<ewol::resource::VirtualBufferObject> m_verticesVBO;
|
||||
std::shared_ptr<ewol::resource::VirtualBufferObject> m_verticesVBO;
|
||||
protected:
|
||||
Mesh();
|
||||
void init(const std::string& _fileName, const std::string& _shaderName="DATA:textured3D2.prog");
|
||||
public:
|
||||
Mesh(const std::string& _fileName, const std::string& _shaderName="DATA:textured3D2.prog");
|
||||
virtual ~Mesh();
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(Mesh);
|
||||
public:
|
||||
virtual void draw(mat4& _positionMatrix, bool _enableDepthTest=true, bool _enableDepthUpdate=true);
|
||||
virtual void draw(mat4& _positionMatrix,
|
||||
@ -172,14 +175,6 @@ namespace ege {
|
||||
void setFreeShapeFunction(void (*_functionFreeShape)(void* _pointer)) {
|
||||
m_functionFreeShape = _functionFreeShape;
|
||||
};
|
||||
public:
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
* @note Never free this pointer by your own...
|
||||
* @param[in] _filename Name of the ewol mesh file.
|
||||
* @return pointer on the resource or nullptr if an error occured.
|
||||
*/
|
||||
static ewol::object::Shared<ege::resource::Mesh> keep(const std::string& _meshname);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -10,16 +10,18 @@
|
||||
#include <ege/resource/ParticuleMesh.h>
|
||||
#include <ewol/resource/Manager.h>
|
||||
|
||||
ege::resource::ParticuleMesh::ParticuleMesh(const std::string& _fileName, const std::string& _shaderName) :
|
||||
ege::resource::Mesh(_fileName, _shaderName)
|
||||
{
|
||||
ege::resource::ParticuleMesh::ParticuleMesh() {
|
||||
addObjectType("ege::resource::ParticuleMesh");
|
||||
}
|
||||
|
||||
void ege::resource::ParticuleMesh::init(const std::string& _fileName, const std::string& _shaderName) {
|
||||
ege::resource::Mesh::init(_fileName, _shaderName);
|
||||
if (m_GLprogram != nullptr) {
|
||||
m_GLMainColor = m_GLprogram->getUniform("EW_mainColor");
|
||||
}
|
||||
}
|
||||
|
||||
ege::resource::ParticuleMesh::~ParticuleMesh()
|
||||
{
|
||||
ege::resource::ParticuleMesh::~ParticuleMesh() {
|
||||
|
||||
}
|
||||
|
||||
@ -125,19 +127,3 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
|
||||
}
|
||||
glBindBuffer(GL_ARRAY_BUFFER,0);
|
||||
}
|
||||
|
||||
ewol::object::Shared<ege::resource::ParticuleMesh> ege::resource::ParticuleMesh::keep(const std::string& _meshName, const std::string& _shaderName)
|
||||
{
|
||||
ewol::object::Shared<ege::resource::ParticuleMesh> object = ewol::dynamic_pointer_cast<ege::resource::ParticuleMesh>(getManager().localKeep(_meshName));
|
||||
if (object != nullptr) {
|
||||
return object;
|
||||
}
|
||||
object = ewol::object::makeShared(new ege::resource::ParticuleMesh(_meshName, _shaderName));
|
||||
if (object == nullptr) {
|
||||
EGE_ERROR("allocation error of a resource : ??Mesh??" << _meshName);
|
||||
return nullptr;
|
||||
}
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -16,22 +16,17 @@ namespace ege {
|
||||
class ParticuleMesh : public ege::resource::Mesh {
|
||||
protected:
|
||||
int32_t m_GLMainColor;
|
||||
protected:
|
||||
ParticuleMesh();
|
||||
void init(const std::string& _fileName, const std::string& _shaderName="DATA:ParticuleMesh.prog");
|
||||
public:
|
||||
ParticuleMesh(const std::string& _fileName, const std::string& _shaderName);
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(ParticuleMesh);
|
||||
virtual ~ParticuleMesh();
|
||||
public:
|
||||
virtual void draw(mat4& _positionMatrix,
|
||||
const etk::Color<float>& _mainColor,
|
||||
bool _enableDepthTest = true,
|
||||
bool _enableDepthUpdate = true);
|
||||
public:
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
* @note Never free this pointer by your own...
|
||||
* @param[in] _filename Name of the ewol mesh file.
|
||||
* @return pointer on the resource or nullptr if an error occured.
|
||||
*/
|
||||
static ewol::object::Shared<ege::resource::ParticuleMesh> keep(const std::string& _meshName, const std::string& _shaderName="DATA:ParticuleMesh.prog");
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -19,18 +19,22 @@ extern const char * const ewolEventMeshPressed = "ewol-mesh-Pressed";
|
||||
|
||||
|
||||
|
||||
ege::widget::Mesh::Mesh(const std::string& _filename) :
|
||||
m_meshName(_filename),
|
||||
ege::widget::Mesh::Mesh():
|
||||
m_position(0,0,0),
|
||||
m_angle(0,0,0),
|
||||
m_angleSpeed(0,0,0),
|
||||
m_cameraDistance(10.0) {
|
||||
addObjectType("ege::widget::Mesh");
|
||||
addEventId(ewolEventMeshPressed);
|
||||
}
|
||||
|
||||
void ege::widget::Mesh::init(const std::string& _filename) {
|
||||
ewol::Widget::init(_filename);
|
||||
m_meshName = _filename;
|
||||
// Limit event at 1:
|
||||
setMouseLimit(1);
|
||||
if (_filename!="") {
|
||||
m_object = ege::resource::Mesh::keep(m_meshName);
|
||||
m_object = ege::resource::Mesh::create(m_meshName);
|
||||
if (nullptr == m_object) {
|
||||
EGE_ERROR("Can not load the resource : \"" << m_meshName << "\"");
|
||||
}
|
||||
@ -97,7 +101,7 @@ void ege::widget::Mesh::setFile(const std::string& _filename) {
|
||||
if( _filename!=""
|
||||
&& m_meshName != _filename ) {
|
||||
m_meshName = _filename;
|
||||
m_object = ege::resource::Mesh::keep(m_meshName);
|
||||
m_object = ege::resource::Mesh::create(m_meshName);
|
||||
if (nullptr == m_object) {
|
||||
EGE_ERROR("Can not load the resource : \"" << m_meshName << "\"");
|
||||
}
|
||||
|
@ -25,14 +25,16 @@ namespace ege {
|
||||
private:
|
||||
// mesh name :
|
||||
std::string m_meshName;
|
||||
ewol::object::Shared<ege::resource::Mesh> m_object;
|
||||
std::shared_ptr<ege::resource::Mesh> m_object;
|
||||
// mesh display properties:
|
||||
vec3 m_position;
|
||||
vec3 m_angle;
|
||||
vec3 m_angleSpeed;
|
||||
float m_cameraDistance;
|
||||
protected:
|
||||
Mesh();
|
||||
void init(const std::string& _filename); // automatic considering in the appl Data older
|
||||
public:
|
||||
Mesh(const std::string& _filename); // automatic considering in the appl Data older
|
||||
virtual ~Mesh();
|
||||
public: // Derived function
|
||||
virtual void onRegenerateDisplay();
|
||||
|
@ -33,26 +33,30 @@
|
||||
|
||||
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) :
|
||||
ege::widget::Scene::Scene() :
|
||||
m_gameTime(0),
|
||||
m_angleView(M_PI/3.0),
|
||||
m_dynamicsWorld(nullptr),
|
||||
m_camera(nullptr),
|
||||
m_isRunning(true),
|
||||
m_isRunning(*this, "status", gameStart, "Satus of the activity of the Scene"),
|
||||
m_debugMode(false),
|
||||
m_debugDrawing(nullptr) {
|
||||
addObjectType("ege::widget::Scene");
|
||||
addEventId(eventPlayTimeChange);
|
||||
addEventId(eventKillEnemy);
|
||||
}
|
||||
|
||||
void ege::widget::Scene::init(bool _setAutoBullet, bool _setAutoCamera) {
|
||||
ewol::Widget::init();
|
||||
setKeyboardRepeate(false);
|
||||
setCanHaveFocus(true);
|
||||
periodicCallEnable();
|
||||
addEventId(eventPlayTimeChange);
|
||||
addEventId(eventKillEnemy);
|
||||
registerConfig(configStatus, "list", "start;stop", "Satus of the activity of the Scene");
|
||||
m_isRunning.add(gameStart, "start", "Scene is started");
|
||||
m_isRunning.add(gameStop, "stop", "Scene is stopped");
|
||||
|
||||
m_debugDrawing = ewol::resource::Colored3DObject::keep();
|
||||
m_debugDrawing = ewol::resource::Colored3DObject::create();
|
||||
|
||||
m_ratioTime = 1.0f;
|
||||
if (_setAutoBullet == true) {
|
||||
@ -146,21 +150,21 @@ void ege::widget::Scene::onRegenerateDisplay() {
|
||||
|
||||
void ege::widget::Scene::pause() {
|
||||
EGE_DEBUG("Set pause");
|
||||
m_isRunning = false;
|
||||
m_isRunning.set(gameStop);
|
||||
}
|
||||
|
||||
void ege::widget::Scene::resume() {
|
||||
EGE_DEBUG("Set resume");
|
||||
m_isRunning = true;
|
||||
m_isRunning.set(gameStart);
|
||||
}
|
||||
|
||||
void ege::widget::Scene::pauseToggle() {
|
||||
if(true == m_isRunning) {
|
||||
if(m_isRunning.get() == gameStart) {
|
||||
EGE_DEBUG("Set Toggle: pause");
|
||||
m_isRunning=false;
|
||||
m_isRunning.set(gameStop);
|
||||
} else {
|
||||
EGE_DEBUG("Set Toggle: resume");
|
||||
m_isRunning=true;
|
||||
m_isRunning.set(gameStart);
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,7 +249,7 @@ void ege::widget::Scene::periodicCall(const ewol::event::Time& _event) {
|
||||
curentDelta *= m_ratioTime;
|
||||
}
|
||||
// check if the processing is availlable
|
||||
if (false == m_isRunning) {
|
||||
if (m_isRunning.get() == gameStart) {
|
||||
markToRedraw();
|
||||
return;
|
||||
}
|
||||
@ -371,35 +375,12 @@ vec3 ege::widget::Scene::convertScreenPositionInMapPosition(const vec2& _posScre
|
||||
return m_camera->projectOnZGround(calculateDeltaAngle(_posScreen));
|
||||
}
|
||||
|
||||
|
||||
bool ege::widget::Scene::onSetConfig(const ewol::object::Config& _conf) {
|
||||
if (true == Widget::onSetConfig(_conf)) {
|
||||
return true;
|
||||
void ege::widget::Scene::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
|
||||
ewol::Widget::onParameterChangeValue(_paramPointer);
|
||||
if (_paramPointer == m_isRunning) {
|
||||
// nothing to do ...
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -40,16 +40,16 @@ namespace ege {
|
||||
// extern event
|
||||
static const char * const eventPlayTimeChange;
|
||||
static const char * const eventKillEnemy;
|
||||
// configurations:
|
||||
static const char * const configStatus;
|
||||
protected:
|
||||
ege::Environement m_env;
|
||||
public:
|
||||
protected:
|
||||
/**
|
||||
* @brief Constructor of the widget classes
|
||||
* @return (no execption generated (not managed in embended platform))
|
||||
*/
|
||||
Scene(bool _setAutoBullet=true, bool _setAutoCamera=true);
|
||||
Scene();
|
||||
void init(bool _setAutoBullet=true, bool _setAutoCamera=true);
|
||||
public:
|
||||
/**
|
||||
* @brief Destructor of the widget classes
|
||||
*/
|
||||
@ -73,7 +73,13 @@ namespace ege {
|
||||
// camera section
|
||||
ege::Camera* m_camera; //!< display point of view.
|
||||
// Other elements
|
||||
bool m_isRunning; //!< the display is running (not in pause)
|
||||
public:
|
||||
enum gameStatus {
|
||||
gameStart,
|
||||
gameStop
|
||||
};
|
||||
protected:
|
||||
ewol::object::ParamList<enum gameStatus> m_isRunning; //!< the display is running (not in pause)
|
||||
float m_ratioTime; //!< Ratio time for the speed of the game ...
|
||||
// Note : This is only for temporary elements : on the display
|
||||
std::vector<ege::Environement::ResultNearestElement> m_displayElementOrdered;
|
||||
@ -92,7 +98,7 @@ namespace ege {
|
||||
void pauseToggle();
|
||||
protected:
|
||||
bool m_debugMode;
|
||||
ewol::object::Shared<ewol::resource::Colored3DObject> m_debugDrawing; //!< for the debug draw elements
|
||||
std::shared_ptr<ewol::resource::Colored3DObject> m_debugDrawing; //!< for the debug draw elements
|
||||
public:
|
||||
/**
|
||||
* @brief Toggle the debug mode == > usefull for DEBUG only ...
|
||||
@ -136,8 +142,7 @@ 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;
|
||||
virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer);
|
||||
public: // Derived function
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp);
|
||||
virtual void onRegenerateDisplay();
|
||||
|
Loading…
x
Reference in New Issue
Block a user