// // Created by Adniklastrator on 2015-09-10. // #ifndef DAYDREAM_PADSYSTEM_H #define DAYDREAM_PADSYSTEM_H #include "Core/InputController.h" #include "Core/System.h" #include "Core/Component.h" #include "Core/CTransform.h" #include "Core/CTemplate.h" #include "Core/EventBroker.h" #include "Core/EKeyDown.h" #include "Core/EKeyUp.h" #include "Input/EBindKey.h" #include "Physics/EContact.h" #include "Physics/CRectangleShape.h" #include "Physics/CPhysics.h" #include "Physics/CCircleShape.h" #include "Physics/ESetImpulse.h" #include "Rendering/CSprite.h" #include "Rendering/CModel.h" #include "Game/CBall.h" #include "Game/CPad.h" #include "Game/CPowerUp.h" #include "Game/EResetBall.h" #include "Game/EMultiBall.h" #include "Game/EPowerUpTaken.h" #include "Game/EStageCleared.h" #include "Game/EPause.h" #include "Game/EHitLag.h" #include "Game/EActionButton.h" namespace dd { namespace Systems { class PadSystem : public System { public: PadSystem(World* world, std::shared_ptr eventBroker) : System(world, eventBroker) { } void Initialize() override; void Update(double dt) override; void UpdateEntity(double dt, EntityID entity, EntityID parent) override; EntityID& Entity() { return m_Entity; } void SetEntity(const EntityID& ent) { m_Entity = ent; } glm::vec3 Acceleration() const { return m_Acceleration; } void SetAcceleration(const glm::vec3& acceleration) { m_Acceleration = acceleration; } bool Left() const { return m_Left; } void SetLeft(const bool& left) { m_Left = left; } bool Right() const { return m_Right; } void SetRight(const bool& right) { m_Right = right; } float Edge() const { return m_Edge; } void SetEdge(const float& edge) { m_Edge = edge; } Components::Transform* Transform() const { return m_Transform; } void SetTransform(Components::Transform* transform) { m_Transform = transform; } Components::Pad* Pad() const { return m_Pad; } void SetPad(Components::Pad* pad) { m_Pad = pad; } bool IsPaused() const { return m_Pause; } void SetPause(const bool& pause) { m_Pause = pause; } private: EntityID m_Entity = 0; glm::vec3 m_Acceleration = glm::vec3(0.f, 0.f, 0.f); bool m_Left = false; bool m_Right = false; bool m_ReplaceBall = false; bool m_MultiBall = false; float m_Edge = 2.8f; Components::Transform* m_Transform = nullptr; Components::Pad* m_Pad = nullptr; bool m_Pause = false; dd::EventRelay m_EKeyDown; dd::EventRelay m_EKeyUp; dd::EventRelay m_EContact; dd::EventRelay m_EContactPowerUp; dd::EventRelay m_EStageCleared; dd::EventRelay m_EPause; bool OnKeyDown(const dd::Events::KeyDown &event); bool OnKeyUp(const dd::Events::KeyUp &event); bool OnContact(const dd::Events::Contact &event); bool OnContactPowerUp(const dd::Events::Contact &event); bool OnStageCleared(const dd::Events::StageCleared &event); bool OnPause(const dd::Events::Pause &event); class PadSteeringInputController; std::array, 4> m_PadInputControllers; }; class PadSystem::PadSteeringInputController : InputController { public: PadSteeringInputController(std::shared_ptr eventBroker) : InputController(eventBroker) { } protected: virtual bool OnCommand(const Events::InputCommand &event); }; } } #endif //DAYDREAM_PADSYSTEM_H