Skip to content
Snippets Groups Projects
Commit 2a0fa130 authored by BATON Theau's avatar BATON Theau
Browse files

Changing Props -> BasicProps

parent 7f1850cf
No related branches found
No related tags found
No related merge requests found
Showing
with 118 additions and 8 deletions
...@@ -31,6 +31,12 @@ namespace megu::kernel { ...@@ -31,6 +31,12 @@ namespace megu::kernel {
} }
} }
void FixedArray::update_physic(double time) const {
if(this->_update != nullptr) {
this->_update(time);
}
}
void FixedArray::apply(Kernel & kernel, PhysicEngine & engine) { void FixedArray::apply(Kernel & kernel, PhysicEngine & engine) {
engine.get().push(0, *this); engine.get().push(0, *this);
} }
......
#pragma once #pragma once
#include <kernel/back/props/Physical.hpp> #include <kernel/back/component/Physical.hpp>
#include <kernel/back/engine/PhysicEngine.hpp> #include <kernel/back/engine/PhysicEngine.hpp>
#include <vector> #include <vector>
#include <functional> #include <functional>
...@@ -16,6 +16,10 @@ namespace megu::kernel { ...@@ -16,6 +16,10 @@ namespace megu::kernel {
void erase(const Fixed &); void erase(const Fixed &);
void erase(const Position &); void erase(const Position &);
void setCollideLambda(CollideLambda &);
void setUpdateLambda(UpdateLambda &);
void update_physic(double) const override;
void on_collide(const Kernel &, const PhysicEngine &, Physical &, double) override; void on_collide(const Kernel &, const PhysicEngine &, Physical &, double) override;
void apply(Kernel & k, PhysicEngine &) override; void apply(Kernel & k, PhysicEngine &) override;
......
#pragma once #pragma once
#include <kernel/back/props/Physical.hpp> #include <kernel/back/component/Physical.hpp>
#include <kernel/back/engine/PhysicEngine.hpp> #include <kernel/back/engine/PhysicEngine.hpp>
#include <engine/physic/front/object/TangibleMovable.hpp> #include <engine/physic/front/object/TangibleMovable.hpp>
......
#pragma once #pragma once
#include <kernel/back/engine/GraphicEngine.hpp>
#include <kernel/back/engine/PhysicEngine.hpp>
#include <utility/Identifiable.hpp> #include <utility/Identifiable.hpp>
#include <kernel/back/component/Physical.hpp>
#include <kernel/back/component/Graphical.hpp>
#include "Physical.hpp" #include <kernel/back/engine/PhysicEngine.hpp>
#include "Graphical.hpp" #include <kernel/back/engine/GraphicEngine.hpp>
namespace megu::kernel { namespace megu::kernel {
class Props : public Identifiable { template <class Pe, class Ge>
class BaseProps : virtual public Identifiable {
public: public:
virtual Physical<PhysicEngine> * getPhysicComponent() = 0; using Graphical_Component = Graphical<Ge>;
virtual Graphical<GraphicEngine> * getGraphicComponent() = 0; using Physical_Component = Physical<Pe>;
virtual Graphical_Component * getGraphicComponent() = 0;
virtual Physical_Component * getPhysicComponent() = 0;
}; };
using Prop = BaseProps<PhysicEngine, GraphicEngine>;
} }
\ No newline at end of file
#include "PropsDynamic.hpp"
namespace megu::kernel {
PropsDynamic::PropsDynamic(Sprite & sprite, Movable & movable)
: _graphic(sprite), _physic(movable) {}
}
\ No newline at end of file
#pragma once
#include <kernel/front/props/Props.hpp>
#include <kernel/front/component/graphic/Sprite.hpp>
#include <kernel/front/component/physic/Movable.hpp>
namespace megu::kernel {
class PropsDynamic : public Prop {
public:
PropsDynamic(Sprite &, Movable &);
inline Prop::Graphical_Component * getGraphicComponent() {return &this->_graphic;}
inline Prop::Physical_Component * getPhysicComponent() {return &this->_physic;}
private:
Sprite & _graphic;
Movable & _physic;
};
}
\ No newline at end of file
#include "PropsStatic.hpp"
namespace megu::kernel {
PropsStatic::PropsStatic(Sprite & sprite, Fixed & fixed)
: _graphic(sprite), _physic(fixed) {}
}
\ No newline at end of file
#pragma once
#include <kernel/front/props/Props.hpp>
#include <kernel/front/component/graphic/Sprite.hpp>
#include <kernel/front/component/physic/Fixed.hpp>
namespace megu::kernel {
class PropsStatic : public Prop {
public:
PropsStatic(Sprite &, Fixed &);
inline Prop::Graphical_Component * getGraphicComponent() override {return &this->_graphic;}
inline Prop::Physical_Component * getPhysicComponent() override {return &this->_physic;}
private:
Sprite & _graphic;
Fixed & _physic;
};
}
\ No newline at end of file
#include "PropsTileMap.hpp"
namespace megu::kernel {
PropsTileMap::PropsTileMap(Tilemap & tilemap, FixedArray & fixedarray)
: _graphic(tilemap), _physic(fixedarray) {}
}
\ No newline at end of file
#pragma once
#include <kernel/front/props/Props.hpp>
#include <kernel/front/component/graphic/TileMap.hpp>
#include <kernel/front/component/physic/FixedArray.hpp>
namespace megu::kernel {
class PropsTileMap : public Prop {
public:
PropsTileMap(Tilemap &, FixedArray &);
inline Prop::Graphical_Component * getGraphicComponent() override {return &this->_graphic;}
inline Prop::Physical_Component * getPhysicComponent() override {return &this->_physic;}
private:
Tilemap & _graphic;
FixedArray & _physic;
};
}
\ No newline at end of file
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
#include "Resolver.hpp" #include "Resolver.hpp"
#include <kernel/back/engine/GraphicEngine.hpp> #include <kernel/back/engine/GraphicEngine.hpp>
#include <kernel/back/props/Props.hpp> #include <kernel/front/props/Props.hpp>
namespace megu::kernel { namespace megu::kernel {
class GraphicResolver : public Resolver<GraphicEngine, Graphical<GraphicEngine>> { class Kernel;
class GraphicResolver : public Resolver<GraphicEngine, Prop::Graphical_Component> {
public: public:
void resolve(Kernel &, GraphicEngine &, double) override; void resolve(Kernel &, GraphicEngine &, double) override;
}; };
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
#include "Resolver.hpp" #include "Resolver.hpp"
#include <kernel/back/engine/PhysicEngine.hpp> #include <kernel/back/engine/PhysicEngine.hpp>
#include <kernel/back/props/Props.hpp> #include <kernel/front/props/Props.hpp>
namespace megu::kernel { namespace megu::kernel {
class PhysicResolver : public Resolver<PhysicEngine, Physical<PhysicEngine>> { class PhysicResolver : public Resolver<PhysicEngine, Prop::Physical_Component> {
public: public:
void resolve(Kernel &, PhysicEngine &, double) override; void resolve(Kernel &, PhysicEngine &, double) override;
}; };
......
#pragma once #pragma once
#include <optional>
#include <utility/Identifiable.hpp> #include <utility/Identifiable.hpp>
#include <kernel/back/props/Component.hpp>
#include <engine/utility/ref_set.hpp> #include <engine/utility/ref_set.hpp>
#include <optional> #include <kernel/back/component/Component.hpp>
namespace megu::kernel { namespace megu::kernel {
template <class E, class O> template <class E, class O>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment