[DEV] start basic test of the scene
This commit is contained in:
parent
b6d11d78e2
commit
c84caed8ba
@ -9,25 +9,47 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <ewol/game/Element.h>
|
#include <ewol/game/Element.h>
|
||||||
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
|
|
||||||
static int32_t uniqueId = 0;
|
static int32_t uniqueId = 0;
|
||||||
|
|
||||||
|
|
||||||
game::Element::Element(void) :
|
game::Element::Element(etk::UString meshResource) :
|
||||||
m_position(0,0,0),
|
m_resource(NULL),
|
||||||
m_speed(0,0,0),
|
|
||||||
m_orientation(0,0,0),
|
|
||||||
m_uniqueId(uniqueId),
|
m_uniqueId(uniqueId),
|
||||||
m_groupId(0),
|
m_groupId(0),
|
||||||
m_type(0),
|
m_type(0),
|
||||||
m_visible(true),
|
m_visible(true),
|
||||||
m_mass(0)
|
m_mass(0)
|
||||||
{
|
{
|
||||||
|
ewol::MeshObj* tmpObject = NULL;
|
||||||
|
// get a resources :
|
||||||
|
if (meshResource != "") {
|
||||||
|
ewol::resource::Keep(meshResource, tmpObject);
|
||||||
|
m_resource = tmpObject;
|
||||||
|
}
|
||||||
uniqueId++;
|
uniqueId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
game::Element::~Element(void)
|
game::Element::~Element(void)
|
||||||
{
|
{
|
||||||
|
if (NULL != m_resource) {
|
||||||
|
ewol::MeshObj* tmpObject = static_cast<ewol::MeshObj*>(m_resource);
|
||||||
|
ewol::resource::Release(tmpObject);
|
||||||
|
m_resource = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void game::Element::Draw(void)
|
||||||
|
{
|
||||||
|
if (NULL != m_resource) {
|
||||||
|
m_resource->Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool game::Element::ArtificialIntelligence(int32_t deltaMicroSecond)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,32 +14,42 @@
|
|||||||
#include <etk/math/Vector3D.h>
|
#include <etk/math/Vector3D.h>
|
||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
|
#include <ePhysics/MeshProperty.h>
|
||||||
|
#include <ewol/renderer/resources/Mesh.h>
|
||||||
|
|
||||||
namespace game
|
namespace game
|
||||||
{
|
{
|
||||||
class Element
|
class Element
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
//ewol::??? m_resource; //!< Resource to display the element.
|
ewol::Mesh* m_resource; //!< Resource to display the element.
|
||||||
|
ephysics::MeshProperty m_property; //!< display property f the element.
|
||||||
protected:
|
protected:
|
||||||
vec3 m_position; //!< Current position of the element.
|
uint32_t m_uniqueId; //!< General element ID (uint16_t, because all is reference with the groupId like this only a uint32_t reference an element)
|
||||||
vec3 m_speed; //!< Speed of the element.
|
uint32_t m_groupId; //!< General group Id More than 65000 group can be really interesting to create supid game ...
|
||||||
vec3 m_orientation; //!< Display orientation ==> speed does not generate the orientation.
|
int32_t m_type; //!< type of this element
|
||||||
uint32_t m_uniqueId; //!< General element ID (uint16_t, because all is reference with the groupId like this only a uint32_t reference an element)
|
bool m_visible; //!< This is to know if the element is displayed or not ==> TODO : check if usefull ...
|
||||||
uint32_t m_groupId; //!< General group Id More than 65000 group can be really interesting to create supid game ...
|
float m_mass; //!< Current element Mass ==> for the physical calculation
|
||||||
int32_t m_type; //!< type of this element
|
|
||||||
bool m_visible; //!< This is to know if the element is displayed or not ==> TODO : check if usefull ...
|
|
||||||
float m_mass; //!< Current element Mass ==> for the physical calculation
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Basic constructor.
|
* @brief Basic constructor.
|
||||||
|
* @param[in] meshResource Resource name.
|
||||||
*/
|
*/
|
||||||
Element(void);
|
Element(etk::UString meshResource);
|
||||||
/**
|
/**
|
||||||
* @brief Basic destructor.
|
* @brief Basic destructor.
|
||||||
*/
|
*/
|
||||||
~Element(void);
|
~Element(void);
|
||||||
|
/**
|
||||||
|
* @brief Draw the element.
|
||||||
|
*/
|
||||||
|
void Draw(void);
|
||||||
|
/**
|
||||||
|
* @brief Process IA of this element.
|
||||||
|
* @param[in] deltaMicroSecond delta from the last call.
|
||||||
|
* @return true if this element must be destroyed
|
||||||
|
*/
|
||||||
|
bool ArtificialIntelligence(int32_t deltaMicroSecond);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,10 +25,57 @@ game::Engine::~Engine(void)
|
|||||||
|
|
||||||
void game::Engine::Process(int64_t lastTime, int32_t deltaTime)
|
void game::Engine::Process(int64_t lastTime, int32_t deltaTime)
|
||||||
{
|
{
|
||||||
|
for (int32_t iii=0; iii<m_elementsStatic.Size() ; iii++) {
|
||||||
|
if (NULL != m_elementsStatic[iii]) {
|
||||||
|
m_elementsStatic[iii]->ArtificialIntelligence(deltaTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int32_t iii=0; iii<m_elementsDynamic.Size() ; iii++) {
|
||||||
|
if (NULL != m_elementsDynamic[iii]) {
|
||||||
|
m_elementsDynamic[iii]->ArtificialIntelligence(deltaTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void game::Engine::Draw(void)
|
void game::Engine::Draw(ewol::DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
|
for (int32_t iii=0; iii<m_elementsStatic.Size() ; iii++) {
|
||||||
|
if (NULL != m_elementsStatic[iii]) {
|
||||||
|
m_elementsStatic[iii]->Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int32_t iii=0; iii<m_elementsDynamic.Size() ; iii++) {
|
||||||
|
if (NULL != m_elementsDynamic[iii]) {
|
||||||
|
m_elementsDynamic[iii]->Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void game::Engine::AddElement(game::Element* newElement, bool dynamic)
|
||||||
|
{
|
||||||
|
bool find=false;
|
||||||
|
if (true == dynamic) {
|
||||||
|
for (int32_t iii=0 ; iii<m_elementsDynamic.Size() ; iii++) {
|
||||||
|
if (NULL == m_elementsDynamic[iii]) {
|
||||||
|
m_elementsDynamic[iii] = newElement;
|
||||||
|
find = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (false==find) {
|
||||||
|
m_elementsDynamic.PushBack(newElement);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t iii=0 ; iii<m_elementsStatic.Size() ; iii++) {
|
||||||
|
if (NULL == m_elementsStatic[iii]) {
|
||||||
|
m_elementsStatic[iii] = newElement;
|
||||||
|
find = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (false==find) {
|
||||||
|
m_elementsStatic.PushBack(newElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/game/Element.h>
|
#include <ewol/game/Element.h>
|
||||||
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <ePhysics/World.h>
|
||||||
|
|
||||||
namespace game
|
namespace game
|
||||||
{
|
{
|
||||||
@ -22,6 +24,7 @@ namespace game
|
|||||||
//game::Map* m_map; //!< basic system map (BSD or other ...)
|
//game::Map* m_map; //!< basic system map (BSD or other ...)
|
||||||
etk::Vector<game::Element*> m_elementsStatic;
|
etk::Vector<game::Element*> m_elementsStatic;
|
||||||
etk::Vector<game::Element*> m_elementsDynamic;
|
etk::Vector<game::Element*> m_elementsDynamic;
|
||||||
|
ephysics::World m_world; //!< physical world engine
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Basic constructor.
|
* @brief Basic constructor.
|
||||||
@ -31,7 +34,6 @@ namespace game
|
|||||||
* @brief Basic destructor.
|
* @brief Basic destructor.
|
||||||
*/
|
*/
|
||||||
~Engine(void);
|
~Engine(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief periodic call for processing.
|
* @brief periodic call for processing.
|
||||||
* @param[in] lastTime Previous call time (if the system is in pause this time does restart at the same time the next time.
|
* @param[in] lastTime Previous call time (if the system is in pause this time does restart at the same time the next time.
|
||||||
@ -41,7 +43,13 @@ namespace game
|
|||||||
/**
|
/**
|
||||||
* @brief Display the environement.
|
* @brief Display the environement.
|
||||||
*/
|
*/
|
||||||
void Draw(void);
|
void Draw(ewol::DrawProperty& displayProp);
|
||||||
|
/**
|
||||||
|
* @brief Add an element on the system.
|
||||||
|
* @param[in] newElement element to display.
|
||||||
|
* @param[in] dynamic this element change of place.
|
||||||
|
*/
|
||||||
|
void AddElement(game::Element* newElement, bool dynamic);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,6 +93,9 @@ void widget::Scene::OnDraw(ewol::DrawProperty& displayProp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
if (NULL != m_gameEngine) {
|
||||||
|
m_gameEngine->Draw(displayProp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,28 +116,6 @@ void widget::Scene::PeriodicCall(int64_t localTime)
|
|||||||
if (NULL != m_gameEngine) {
|
if (NULL != m_gameEngine) {
|
||||||
m_gameEngine->Process(m_lastCallTime, deltaTime);
|
m_gameEngine->Process(m_lastCallTime, deltaTime);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
//EWOL_DEBUG(" currentTime = " << localTime << " last=" << m_lastCallTime << " delta=" << deltaTime);
|
|
||||||
while (deltaTime >= CYCLIC_CALL_PERIODE_US) {
|
|
||||||
//EWOL_DEBUG(" process = " << CYCLIC_CALL_PERIODE_US);
|
|
||||||
m_lastCallTime += CYCLIC_CALL_PERIODE_US;
|
|
||||||
deltaTime -= CYCLIC_CALL_PERIODE_US;
|
|
||||||
ScenePeriodicCall(m_lastCallTime, CYCLIC_CALL_PERIODE_US);
|
|
||||||
//EWOL_ERROR("Periodic Call ... " << localTime);
|
|
||||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
|
||||||
for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].Size(); iii++) {
|
|
||||||
if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) {
|
|
||||||
if(true == m_sceneElement.listAnimatedElements[jjj][iii]->IsEnable() ) {
|
|
||||||
// check if the element request an auto Kill ...
|
|
||||||
if (true == m_sceneElement.listAnimatedElements[jjj][iii]->Process(m_lastCallTime, CYCLIC_CALL_PERIODE_US) ) {
|
|
||||||
m_sceneElement.RmElement(jjj, iii);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,8 +129,19 @@ void widget::Scene::GenDraw(ewol::DrawProperty displayProp)
|
|||||||
m_size.x,
|
m_size.x,
|
||||||
m_size.y);
|
m_size.y);
|
||||||
float ratio = m_size.x / m_size.y;
|
float ratio = m_size.x / m_size.y;
|
||||||
|
if (true) {
|
||||||
|
mat4 tmpTranslate = etk::matTranslate(vec3(-m_size.x/2, -m_size.y/2, -1.0f));
|
||||||
|
mat4 tmpScale = etk::matScale(vec3(m_zoom, m_zoom, 1.0f));
|
||||||
|
mat4 tmpProjection = etk::matPerspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||||
|
mat4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||||
|
// set internal matrix system :
|
||||||
|
ewol::openGL::SetMatrix(tmpMat);
|
||||||
|
// Call the widget drawing methode
|
||||||
|
displayProp.m_origin = m_origin;
|
||||||
|
displayProp.m_size = m_size;
|
||||||
|
} else {
|
||||||
m_zoom = 1.0/1000.0;
|
m_zoom = 1.0/1000.0;
|
||||||
//EWOL_INFO("ratio : " << ratio);
|
//EWOL_INFO("ratio : " << ratio);
|
||||||
mat4 tmpProjection;
|
mat4 tmpProjection;
|
||||||
|
|
||||||
if (ratio >= 1.0) {
|
if (ratio >= 1.0) {
|
||||||
@ -162,9 +154,10 @@ void widget::Scene::GenDraw(ewol::DrawProperty displayProp)
|
|||||||
mat4 tmpMat = tmpProjection * tmpScale;
|
mat4 tmpMat = tmpProjection * tmpScale;
|
||||||
// set internal matrix system :
|
// set internal matrix system :
|
||||||
ewol::openGL::SetMatrix(tmpMat);
|
ewol::openGL::SetMatrix(tmpMat);
|
||||||
// Clear the screen with transparency ...
|
// Clear the screen with transparency ...
|
||||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
}
|
||||||
// Call the widget drawing methode
|
// Call the widget drawing methode
|
||||||
OnDraw(displayProp);
|
OnDraw(displayProp);
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ namespace widget {
|
|||||||
virtual void PeriodicCall(int64_t localTime);
|
virtual void PeriodicCall(int64_t localTime);
|
||||||
// Derived function
|
// Derived function
|
||||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <appl/TestButton.h>
|
#include <appl/TestButton.h>
|
||||||
#include <appl/TestButtonColor.h>
|
#include <appl/TestButtonColor.h>
|
||||||
#include <appl/TestLabel.h>
|
#include <appl/TestLabel.h>
|
||||||
|
#include <appl/TestScene.h>
|
||||||
|
|
||||||
|
|
||||||
static const char * l_eventChangeTheme = "event-change-theme";
|
static const char * l_eventChangeTheme = "event-change-theme";
|
||||||
@ -159,6 +160,12 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
|||||||
m_sizerVert->SubWidgetAdd(m_subWidget);
|
m_sizerVert->SubWidgetAdd(m_subWidget);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
m_subWidget = (ewol::Widget*)new TestScene();
|
||||||
|
if (NULL != m_subWidget) {
|
||||||
|
m_sizerVert->SubWidgetAdd(m_subWidget);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
172
test/human/appl/TestScene.cpp
Normal file
172
test/human/appl/TestScene.cpp
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <appl/Debug.h>
|
||||||
|
#include <appl/TestScene.h>
|
||||||
|
|
||||||
|
#include <ewol/widget/Button.h>
|
||||||
|
#include <ewol/widget/CheckBox.h>
|
||||||
|
#include <ewol/widget/SizerHori.h>
|
||||||
|
#include <ewol/widget/SizerVert.h>
|
||||||
|
#include <ewol/widget/Label.h>
|
||||||
|
#include <ewol/widget/Entry.h>
|
||||||
|
#include <ewol/widget/List.h>
|
||||||
|
#include <ewol/widget/ContextMenu.h>
|
||||||
|
#include <ewol/widget/PopUp.h>
|
||||||
|
#include <ewol/widget/Slider.h>
|
||||||
|
#include <ewol/widget/Spacer.h>
|
||||||
|
#include <ewol/widget/Menu.h>
|
||||||
|
#include <ewol/widget/meta/FileChooser.h>
|
||||||
|
#include <ewol/widget/meta/Parameter.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
|
static const char * l_eventAddBox = "event-add-box";
|
||||||
|
static const char * l_eventAddSphere = "event-add-sphere";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "TestScene"
|
||||||
|
|
||||||
|
TestScene::TestScene(void)
|
||||||
|
{
|
||||||
|
APPL_CRITICAL("Create "__class__" (start)");
|
||||||
|
widget::SizerVert* mySizerVert2 = NULL;
|
||||||
|
widget::SizerHori* mySizerHori = NULL;
|
||||||
|
widget::Button* myButton = NULL;
|
||||||
|
|
||||||
|
mySizerHori = new widget::SizerHori();
|
||||||
|
if (NULL == mySizerHori) {
|
||||||
|
APPL_DEBUG("Allocation error mySizerHori");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SubWidgetAdd(mySizerHori);
|
||||||
|
myButton = new widget::Button("Add Box");
|
||||||
|
if (NULL != myButton) {
|
||||||
|
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddBox);
|
||||||
|
mySizerHori->SubWidgetAdd(myButton);
|
||||||
|
}
|
||||||
|
myButton = new widget::Button("Add Sphere");
|
||||||
|
if (NULL != myButton) {
|
||||||
|
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddSphere);
|
||||||
|
mySizerHori->SubWidgetAdd(myButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
widget::Spacer* mySpacer = new widget::Spacer();
|
||||||
|
if (NULL != mySpacer) {
|
||||||
|
mySpacer->SetExpendX(false);
|
||||||
|
mySpacer->SetExpendY(false);
|
||||||
|
mySpacer->SetFillX(true);
|
||||||
|
mySpacer->SetFillY(false);
|
||||||
|
mySpacer->SetSize(10);
|
||||||
|
mySpacer->SetColor(0xFF000080);
|
||||||
|
SubWidgetAdd(mySpacer);
|
||||||
|
}
|
||||||
|
|
||||||
|
mySizerHori = new widget::SizerHori();
|
||||||
|
if (NULL == mySizerHori) {
|
||||||
|
APPL_DEBUG("Allocation error mySizerHori");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SubWidgetAdd(mySizerHori);
|
||||||
|
|
||||||
|
mySpacer = new widget::Spacer();
|
||||||
|
if (NULL != mySpacer) {
|
||||||
|
mySpacer->SetExpendX(false);
|
||||||
|
mySpacer->SetExpendY(false);
|
||||||
|
mySpacer->SetFillX(false);
|
||||||
|
mySpacer->SetFillY(true);
|
||||||
|
mySpacer->SetSize(10);
|
||||||
|
mySpacer->SetColor(0x00FF0080);
|
||||||
|
mySizerHori->SubWidgetAdd(mySpacer);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_testWidget = new widget::Scene(&m_gameEngine);
|
||||||
|
if (NULL != m_testWidget) {
|
||||||
|
m_testWidget->SetExpendX(true);
|
||||||
|
m_testWidget->SetExpendY(true);
|
||||||
|
m_testWidget->SetFillX(true);
|
||||||
|
m_testWidget->SetFillY(true);
|
||||||
|
mySizerHori->SubWidgetAdd(m_testWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
mySpacer = new widget::Spacer();
|
||||||
|
if (NULL != mySpacer) {
|
||||||
|
mySpacer->SetExpendX(false);
|
||||||
|
mySpacer->SetExpendY(false);
|
||||||
|
mySpacer->SetFillX(false);
|
||||||
|
mySpacer->SetFillY(true);
|
||||||
|
mySpacer->SetSize(10);
|
||||||
|
mySpacer->SetColor(0x0000FF80);
|
||||||
|
mySizerHori->SubWidgetAdd(mySpacer);
|
||||||
|
}
|
||||||
|
|
||||||
|
mySpacer = new widget::Spacer();
|
||||||
|
if (NULL != mySpacer) {
|
||||||
|
mySpacer->SetExpendX(false);
|
||||||
|
mySpacer->SetExpendY(false);
|
||||||
|
mySpacer->SetFillX(true);
|
||||||
|
mySpacer->SetFillY(false);
|
||||||
|
mySpacer->SetSize(10);
|
||||||
|
mySpacer->SetColor(0x00FFFF80);
|
||||||
|
SubWidgetAdd(mySpacer);
|
||||||
|
}
|
||||||
|
APPL_CRITICAL("Create "__class__" (end)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TestScene::~TestScene(void)
|
||||||
|
{
|
||||||
|
APPL_CRITICAL("Remove "__class__" ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include <ewol/game/Element.h>
|
||||||
|
class stupidCube : public game::Element
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
stupidCube(void) : game::Element("DATA:cube.obj") {};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void TestScene::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||||
|
{
|
||||||
|
widget::SizerVert::OnReceiveMessage(CallerObject, eventId, data);
|
||||||
|
|
||||||
|
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||||
|
if (m_testWidget == CallerObject) {
|
||||||
|
APPL_WARNING("Receive Event from tested Scene ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||||
|
}
|
||||||
|
if (eventId == l_eventAddBox) {
|
||||||
|
stupidCube * tmpp = new stupidCube();
|
||||||
|
m_gameEngine.AddElement(tmpp, true);
|
||||||
|
} else if (eventId == l_eventAddSphere) {
|
||||||
|
if (NULL!=m_testWidget) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestScene::OnObjectRemove(ewol::EObject * removeObject)
|
||||||
|
{
|
||||||
|
widget::SizerVert::OnObjectRemove(removeObject);
|
||||||
|
if (m_testWidget == removeObject) {
|
||||||
|
m_testWidget = NULL;
|
||||||
|
}
|
||||||
|
}
|
35
test/human/appl/TestScene.h
Normal file
35
test/human/appl/TestScene.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __TEST_SCENE_H__
|
||||||
|
#define __TEST_SCENE_H__
|
||||||
|
|
||||||
|
#include <appl/Debug.h>
|
||||||
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <ewol/widget/Scene.h>
|
||||||
|
#include <ewol/widget/SizerVert.h>
|
||||||
|
#include <ewol/game/Engine.h>
|
||||||
|
|
||||||
|
class TestScene : public widget::SizerVert
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
game::Engine m_gameEngine;
|
||||||
|
widget::Scene* m_testWidget;
|
||||||
|
public:
|
||||||
|
// Constructeur
|
||||||
|
TestScene(void);
|
||||||
|
virtual ~TestScene(void);
|
||||||
|
// Derived function
|
||||||
|
virtual const char * const GetObjectType(void) { return "TestButton"; };
|
||||||
|
// Derived function
|
||||||
|
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||||
|
// Derived function
|
||||||
|
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
BIN
test/human/data/cube.bmp
Normal file
BIN
test/human/data/cube.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 KiB |
47
test/human/data/cube.obj
Normal file
47
test/human/data/cube.obj
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# Blender3D v249 OBJ File: untitled.blend
|
||||||
|
# www.blender3d.org
|
||||||
|
mtllib cube.mtl
|
||||||
|
v 1.000000 -1.000000 -1.000000
|
||||||
|
v 1.000000 -1.000000 1.000000
|
||||||
|
v -1.000000 -1.000000 1.000000
|
||||||
|
v -1.000000 -1.000000 -1.000000
|
||||||
|
v 1.000000 1.000000 -1.000000
|
||||||
|
v 0.999999 1.000000 1.000001
|
||||||
|
v -1.000000 1.000000 1.000000
|
||||||
|
v -1.000000 1.000000 -1.000000
|
||||||
|
vt 0.748573 0.750412
|
||||||
|
vt 0.749279 0.501284
|
||||||
|
vt 0.999110 0.501077
|
||||||
|
vt 0.999455 0.750380
|
||||||
|
vt 0.250471 0.500702
|
||||||
|
vt 0.249682 0.749677
|
||||||
|
vt 0.001085 0.750380
|
||||||
|
vt 0.001517 0.499994
|
||||||
|
vt 0.499422 0.500239
|
||||||
|
vt 0.500149 0.750166
|
||||||
|
vt 0.748355 0.998230
|
||||||
|
vt 0.500193 0.998728
|
||||||
|
vt 0.498993 0.250415
|
||||||
|
vt 0.748953 0.250920
|
||||||
|
vn 0.000000 0.000000 -1.000000
|
||||||
|
vn -1.000000 -0.000000 -0.000000
|
||||||
|
vn -0.000000 -0.000000 1.000000
|
||||||
|
vn -0.000001 0.000000 1.000000
|
||||||
|
vn 1.000000 -0.000000 0.000000
|
||||||
|
vn 1.000000 0.000000 0.000001
|
||||||
|
vn 0.000000 1.000000 -0.000000
|
||||||
|
vn -0.000000 -1.000000 0.000000
|
||||||
|
usemtl cube.bmp
|
||||||
|
s off
|
||||||
|
f 5/1/1 1/2/1 4/3/1
|
||||||
|
f 5/1/1 4/3/1 8/4/1
|
||||||
|
f 3/5/2 7/6/2 8/7/2
|
||||||
|
f 3/5/2 8/7/2 4/8/2
|
||||||
|
f 2/9/3 6/10/3 3/5/3
|
||||||
|
f 6/10/4 7/6/4 3/5/4
|
||||||
|
f 1/2/5 5/1/5 2/9/5
|
||||||
|
f 5/1/6 6/10/6 2/9/6
|
||||||
|
f 5/1/7 8/11/7 6/10/7
|
||||||
|
f 8/11/7 7/12/7 6/10/7
|
||||||
|
f 1/2/8 2/9/8 3/13/8
|
||||||
|
f 1/2/8 3/13/8 4/14/8
|
BIN
test/human/data/sphere.blend
Normal file
BIN
test/human/data/sphere.blend
Normal file
Binary file not shown.
11
test/human/data/sphere.mtl
Normal file
11
test/human/data/sphere.mtl
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Blender MTL File: 'sphere.blend'
|
||||||
|
# Material Count: 1
|
||||||
|
newmtl
|
||||||
|
Ns 0
|
||||||
|
Ka 0.000000 0.000000 0.000000
|
||||||
|
Kd 0.8 0.8 0.8
|
||||||
|
Ks 0.8 0.8 0.8
|
||||||
|
d 1
|
||||||
|
illum 2
|
||||||
|
|
||||||
|
|
1000
test/human/data/sphere.obj
Normal file
1000
test/human/data/sphere.obj
Normal file
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,8 @@ FILE_LIST:= appl/Debug.cpp \
|
|||||||
appl/MainWindows.cpp \
|
appl/MainWindows.cpp \
|
||||||
appl/TestButton.cpp \
|
appl/TestButton.cpp \
|
||||||
appl/TestButtonColor.cpp \
|
appl/TestButtonColor.cpp \
|
||||||
appl/TestLabel.cpp
|
appl/TestLabel.cpp \
|
||||||
|
appl/TestScene.cpp
|
||||||
|
|
||||||
LOCAL_COPY_FOLDERS := data/*:theme/default \
|
LOCAL_COPY_FOLDERS := data/icon.*:theme/default \
|
||||||
|
data/cube.*: \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user