Created CPad and PadSystem. Doesn't do very much.

This commit is contained in:
PlatinumSkink
2015-09-10 16:40:49 +02:00
parent 2041640441
commit 84577cb2c8
8 changed files with 161 additions and 49 deletions
+30
View File
@@ -0,0 +1,30 @@
//
// Created by Administrator on 2015-09-10.
//
#ifndef DAYDREAM_CPAD_H
#define DAYDREAM_CPAD_H
#include "Core/Component.h"
#include "Core/EKeyDown.h"
#include "Core/EventBroker.h"
namespace dd
{
namespace Components
{
struct Pad : Component
{
//std::shared_ptr<dd::EventBroker> eventBroker;
//EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, CPad::OnKeyDown);
int Lives;
int Points;
};
}
}
#endif //DAYDREAM_CPAD_H
+3 -2
View File
@@ -9,6 +9,9 @@
#include "Core/CTransform.h"
//#include "Rendering/CSprite.h"
#include "Core/EventBroker.h"
#include "Game/CBrick.h"
#include "Core/World.h"
#include "Game/EStageCleared.h"
#include <fstream>
#include <iostream>
#include <intrin.h>
@@ -49,8 +52,6 @@ public:
void EndLevel();
private:
int numberOfBricks;
int tRows = 8;
+54
View File
@@ -0,0 +1,54 @@
//
// 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/EventBroker.h"
#include "Core/EKeyDown.h"
#include "Input/EBindKey.h"
namespace dd
{
namespace Systems
{
class PadSystem : public System
{
public:
PadSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override ;
private:
dd::EventRelay<PadSystem, dd::Events::KeyDown> m_EKeyDown;
class PadSteeringInputController;
std::array<std::shared_ptr<PadSteeringInputController>, 4> m_PadInputControllers;
bool OnKeyDown(const dd::Events::KeyDown &event);
};
class PadSystem::PadSteeringInputController : InputController<PadSystem>
{
public:
PadSteeringInputController(std::shared_ptr<dd::EventBroker> eventBroker)
: InputController(eventBroker)
{
}
protected:
virtual bool OnCommand(const Events::InputCommand &event);
};
}
}
#endif //DAYDREAM_PADSYSTEM_H