Merge remote-tracking branch 'origin/master' into GLrenderer

This commit is contained in:
tleety
2015-09-16 14:42:38 +02:00
12 changed files with 247 additions and 78 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ namespace Components
struct Ball : Component
{
int number = 0;
};
}
+26
View File
@@ -0,0 +1,26 @@
//
// Created by Administrator on 2015-09-15.
//
#ifndef DAYDREAM_CLIFE_H
#define DAYDREAM_CLIFE_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Life : Component {
int number = 0;
};
}
}
#endif //DAYDREAM_CLIFE_H
+27
View File
@@ -0,0 +1,27 @@
//
// Created by Administrator on 2015-09-15.
//
#ifndef DAYDREAM_ELIFELOST_H
#define DAYDREAM_ELIFELOST_H
#include "Core/EventBroker.h"
#include "Core/Entity.h"
namespace dd
{
namespace Events
{
struct LifeLost : Event
{
EntityID entity;
};
}
}
#endif //DAYDREAM_ELIFELOST_H
+14 -2
View File
@@ -10,13 +10,17 @@
#include "Rendering/CSprite.h"
#include "Rendering/CModel.h"
#include "Game/CBrick.h"
#include "Physics/EContact.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Game/CBall.h"
#include "Game/CLife.h"
#include "Game/EStageCleared.h"
#include "Game/ELifeLost.h"
#include "Physics/CBoxShape.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/ESetImpulse.h"
#include "Physics/EContact.h"
#include <fstream>
#include <iostream>
#include <intrin.h>
@@ -48,6 +52,7 @@ public:
void Initialize() override;
void CreateBasicLevel(int, int, glm::vec2, int);
void CreateLife(int);
void SaveLevel(int, int, glm::vec2, int); // Shouldn't be here, but I'm experimenting.
void LoadLevel(char[20]);
void CreateBrick(int, int, glm::vec2, int, int);
@@ -57,12 +62,17 @@ public:
void EndLevel();
void Update(double dt);
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
int lives = 3;
int pastLives = 3;
private:
dd::EventRelay<LevelSystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LevelSystem, dd::Events::LifeLost> m_ELifeLost;
bool OnContact(const dd::Events::Contact &event);
bool LifeLost(const dd::Events::LifeLost &event);
bool m_Initialized = false;
@@ -71,6 +81,8 @@ private:
int tLines = 8;
glm::vec2 tSpaceBetweenBricks = glm::vec2(2, 0.5);
int tSpaceToEdge = 0;
EntityID entityToRemove = NULL;
};
}
+15 -5
View File
@@ -7,20 +7,23 @@
#include "Core/InputController.h"
#include "Core/System.h"
#include "Core/Component.h"
#include "Core/CTransform.h"
#include "Core/EventBroker.h"
#include "Core/EKeyDown.h"
#include "Core/EKeyUp.h"
#include "Input/EBindKey.h"
#include "Physics/EContact.h"
#include "Core/CTransform.h"
#include "Physics/CBoxShape.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 "Core/Component.h"
#include "Physics/ESetImpulse.h"
#include "Physics/CCircleShape.h"
#include "Game/ELifeLost.h"
namespace dd
@@ -38,19 +41,26 @@ public:
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
private:
dd::EventRelay<PadSystem, dd::Events::KeyDown> m_EKeyDown;
dd::EventRelay<PadSystem, dd::Events::KeyUp> m_EKeyUp;
dd::EventRelay<PadSystem, dd::Events::Contact> m_EContact;
dd::EventRelay<PadSystem, dd::Events::LifeLost> m_ELifeLost;
bool OnKeyDown(const dd::Events::KeyDown &event);
bool OnKeyUp(const dd::Events::KeyUp &event);
bool OnContact(const dd::Events::Contact &event);
bool LifeLost(const dd::Events::LifeLost &event);
EntityID removeThisObject = NULL;
float slowdownModifier = 5.f;
float accelerationSpeed = 80.f;
float maxSpeed = 40.f;
@@ -60,7 +70,7 @@ private:
EntityID ent = 0;
Components::Transform* transform;
glm::vec3 acceleration = glm::vec3(0.f, 0.f, 0.f);
bool left = false, right = false;
bool left = false, right = false, replaceBall = false;
};
class PadSystem::PadSteeringInputController : InputController<PadSystem>