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

Conflicts:
	assets
	src/GameWorld.cpp
	vs11/Returngeance/Returngeance.vcxproj.filters
This commit is contained in:
ViktorLjung
2014-05-12 14:03:02 +02:00
43 changed files with 1204 additions and 267 deletions
+27
View File
@@ -2,3 +2,30 @@
#include "DebugSystem.h"
#include "World.h"
void Systems::DebugSystem::Initialize()
{
// Subscribe to events
m_EKeyDown = decltype(m_EKeyDown)(std::bind(&Systems::DebugSystem::OnKeyDown, this, std::placeholders::_1));
EventBroker->Subscribe(m_EKeyDown);
}
void Systems::DebugSystem::Update(double dt)
{
}
bool Systems::DebugSystem::OnKeyDown(const Events::KeyDown &event)
{
if (event.KeyCode == GLFW_KEY_ENTER)
{
Events::PlaySound e;
e.Emitter = 0;
e.Resource = "Sounds/korvring.wav";
EventBroker->Publish<Events::PlaySound>(e);
return true;
}
return false;
}
+10 -2
View File
@@ -3,6 +3,8 @@
#include "System.h"
#include "Components/Transform.h"
#include "Events/KeyDown.h"
#include "Events/PlaySound.h"
namespace Systems
{
@@ -10,10 +12,16 @@ namespace Systems
class DebugSystem : public System
{
public:
DebugSystem(World* world)
: System(world) { }
DebugSystem(World* world, std::shared_ptr<::EventBroker> eventBroker)
: System(world, eventBroker) { }
void Initialize() override;
void Update(double dt) override;
EventRelay<Events::KeyDown> m_EKeyDown;
bool OnKeyDown(const Events::KeyDown &event);
//void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
};
+112 -50
View File
@@ -7,65 +7,127 @@ void Systems::FreeSteeringSystem::RegisterComponents(ComponentFactory* cf)
cf->Register("FreeSteering", []() { return new Components::FreeSteering(); });
}
void Systems::FreeSteeringSystem::Initialize()
{
m_InputController = std::unique_ptr<FreeSteeringInputController>(new FreeSteeringInputController(EventBroker));
}
void Systems::FreeSteeringSystem::Update(double dt)
{
}
void Systems::FreeSteeringSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
{
auto steering = m_World->GetComponent<Components::FreeSteering>(entity, "FreeSteering");
auto input = m_World->GetComponent<Components::Input>(entity, "Input");
if (steering && input)
if (steering)
{
auto transform = m_World->GetComponent<Components::Transform>(entity, "Transform");
glm::vec3 Camera_Right = glm::vec3(transform->Orientation * glm::vec4(1, 0, 0, 0));
glm::vec3 Camera_Forward = glm::vec3(transform->Orientation * glm::vec4(0, 0, -1, 0));
float speed = steering->Speed;
if (input->KeyState[GLFW_KEY_LEFT_SHIFT])
{
speed *= 4.0f;
}
if (input->KeyState[GLFW_KEY_LEFT_ALT])
{
speed /= 4.0f;
}
if (input->KeyState[GLFW_KEY_A])
{
transform->Position -= Camera_Right * (float)dt * speed;
}
else if (input->KeyState[GLFW_KEY_D])
{
transform->Position += Camera_Right * (float)dt * speed;
}
if (input->KeyState[GLFW_KEY_W])
{
transform->Position += Camera_Forward * (float)dt * speed;
}
if (input->KeyState[GLFW_KEY_S])
{
transform->Position -= Camera_Forward * (float)dt * speed;
}
if (input->KeyState[GLFW_KEY_SPACE])
{
transform->Position += glm::vec3(0, 1, 0) * (float)dt * speed;
}
if (input->KeyState[GLFW_KEY_LEFT_CONTROL])
{
transform->Position -= glm::vec3(0, 1, 0) * (float)dt * speed;
}
if (input->MouseState[GLFW_MOUSE_BUTTON_LEFT])
{
// TOUCHING THIS CODE MIGHT CAUSE THE UNIVERSE TO IMPLODE, ALSO DRAGONS // spelling tobias :3
//---------------------------------------------------------------------
transform->Orientation = glm::angleAxis<float>(input->dX / 300.f, glm::vec3(0, -1, 0)) * transform->Orientation;
transform->Orientation = transform->Orientation * glm::angleAxis<float>(input->dY / 300.f, glm::vec3(-1, 0, 0));
//---------------------------------------------------------------------
// TOUCHING THIS CODE MIGHT CAUSE THE UNIVERSE TO IMPLODE, ALSO DRAGONS
}
glm::vec3 cameraRight = glm::vec3(m_InputController->Orientation * glm::vec4(1, 0, 0, 0));
glm::vec3 cameraForward = glm::vec3(m_InputController->Orientation * glm::vec4(0, 0, -1, 0));
glm::vec3 movement;
movement += cameraRight * m_InputController->Movement.x;
movement.y += m_InputController->Movement.y;
movement += cameraForward * -m_InputController->Movement.z;
transform->Position += movement * steering->Speed * m_InputController->SpeedMultiplier * (float)dt;
transform->Orientation = m_InputController->Orientation;
}
}
bool Systems::FreeSteeringSystem::FreeSteeringInputController::OnCommand(const Events::InputCommand &event)
{
// Movement
if (event.Command == "+forward")
{
Movement.z += -1.f;
}
else if (event.Command == "-forward")
{
Movement.z -= -1.f;
}
else if (event.Command == "+backward")
{
Movement.z += 1.f;
}
else if (event.Command == "-backward")
{
Movement.z -= 1.f;
}
else if (event.Command == "+right")
{
Movement.x += 1.f;
}
else if (event.Command == "-right")
{
Movement.x -= 1.f;
}
else if (event.Command == "+left")
{
Movement.x += -1.f;
}
else if (event.Command == "-left")
{
Movement.x -= -1.f;
}
else if (event.Command == "+up")
{
Movement.y += 1.f;
}
else if (event.Command == "-up")
{
Movement.y -= 1.f;
}
else if (event.Command == "+down")
{
Movement.y += -1.f;
}
else if (event.Command == "-down")
{
Movement.y -= -1.f;
}
// Speed
else if (event.Command == "+fast")
{
SpeedMultiplier *= 4.f;
}
else if (event.Command == "-fast")
{
SpeedMultiplier /= 4.f;
}
else if (event.Command == "+slow")
{
SpeedMultiplier /= 4.f;
}
else if (event.Command == "-slow")
{
SpeedMultiplier *= 4.f;
}
// Mouse click
else if (event.Command == "+attack")
{
OrientationActive = true;
}
else if (event.Command == "-attack")
{
OrientationActive = false;
}
return true;
}
bool Systems::FreeSteeringSystem::FreeSteeringInputController::OnMouseMove(const Events::MouseMove &event)
{
if (OrientationActive)
{
// TOUCHING THIS CODE MIGHT CAUSE THE UNIVERSE TO IMPLODE, ALSO DRAGONS
//---------------------------------------------------------------------
Orientation = glm::angleAxis<float>(event.DeltaX / 300.f, glm::vec3(0, -1, 0)) * Orientation * glm::angleAxis<float>(event.DeltaY / 300.f, glm::vec3(-1, 0, 0));
//---------------------------------------------------------------------
// TOUCHING THIS CODE MIGHT CAUSE THE UNIVERSE TO IMPLODE, ALSO DRAGONS
}
return true;
}
+30 -3
View File
@@ -2,19 +2,46 @@
#include "System.h"
#include "Components/Transform.h"
#include "Components/Input.h"
#include "Components/FreeSteering.h"
#include "InputController.h"
namespace Systems
{
class FreeSteeringSystem : public System
{
public:
FreeSteeringSystem(World* world)
: System(world) { }
FreeSteeringSystem(World* world, std::shared_ptr<::EventBroker> eventBroker)
: System(world, eventBroker) { }
void RegisterComponents(ComponentFactory* cf) override;
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
private:
class FreeSteeringInputController;
std::unique_ptr<FreeSteeringInputController> m_InputController;
};
class FreeSteeringSystem::FreeSteeringInputController : InputController
{
public:
FreeSteeringInputController(std::shared_ptr<::EventBroker> eventBroker)
: InputController(eventBroker)
, SpeedMultiplier(1.f)
, OrientationActive(false) { }
glm::vec3 Movement;
glm::quat Orientation;
float SpeedMultiplier;
bool OrientationActive;
protected:
virtual bool OnCommand(const Events::InputCommand &event);
virtual bool OnMouseMove(const Events::MouseMove &event);
};
}
+112 -69
View File
@@ -7,80 +7,123 @@ void Systems::InputSystem::RegisterComponents(ComponentFactory* cf)
cf->Register("Input", []() { return new Components::Input(); });
}
void Systems::InputSystem::Initialize()
{
// Subscribe to events
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &Systems::InputSystem::OnKeyDown)
EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &Systems::InputSystem::OnKeyUp)
EVENT_SUBSCRIBE_MEMBER(m_EMousePress, &Systems::InputSystem::OnMousePress)
EVENT_SUBSCRIBE_MEMBER(m_EMouseRelease, &Systems::InputSystem::OnMouseRelease)
EVENT_SUBSCRIBE_MEMBER(m_EBindKey, &Systems::InputSystem::OnBindKey)
EVENT_SUBSCRIBE_MEMBER(m_EBindMouseButton, &Systems::InputSystem::OnBindMouseButton)
}
void Systems::InputSystem::Update(double dt)
{
m_LastKeyState = m_CurrentKeyState;
m_LastMouseState = m_CurrentMouseState;
// Keyboard input
for (int i = 0; i <= GLFW_KEY_LAST; ++i)
{
m_CurrentKeyState[i] = glfwGetKey(m_Renderer->GetWindow(), i);
}
// Mouse buttons
for (int i = 0; i <= GLFW_MOUSE_BUTTON_LAST; ++i)
{
m_CurrentMouseState[i] = glfwGetMouseButton(m_Renderer->GetWindow(), i);
}
// Cursor position
double xpos, ypos;
glfwGetCursorPos(m_Renderer->GetWindow(), &xpos, &ypos);
m_CurrentMouseDeltaX = xpos - m_LastMouseX;
m_CurrentMouseDeltaY = ypos - m_LastMouseY;
m_LastMouseX = xpos;
m_LastMouseY = ypos;
// Lock mouse while holding LMB
if (m_CurrentMouseState[GLFW_MOUSE_BUTTON_LEFT])
{
m_LastMouseX = m_Renderer->WIDTH / 2.f; // xpos;
m_LastMouseY = m_Renderer->HEIGHT / 2.f; // ypos;
glfwSetCursorPos(m_Renderer->GetWindow(), m_LastMouseX, m_LastMouseY);
}
// Hide/show cursor with LMB
if (m_CurrentMouseState[GLFW_MOUSE_BUTTON_LEFT] && !m_LastMouseState[GLFW_MOUSE_BUTTON_LEFT])
{
glfwSetInputMode(m_Renderer->GetWindow(), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
}
if (!m_CurrentMouseState[GLFW_MOUSE_BUTTON_LEFT] && m_LastMouseState[GLFW_MOUSE_BUTTON_LEFT])
{
glfwSetInputMode(m_Renderer->GetWindow(), GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}
#ifdef DEBUG
// Wireframe
if (m_CurrentKeyState[GLFW_KEY_F1] && !m_LastKeyState[GLFW_KEY_F1])
{
m_Renderer->DrawWireframe(!m_Renderer->DrawWireframe());
}
// Normals
if (m_CurrentKeyState[GLFW_KEY_F2] && !m_LastKeyState[GLFW_KEY_F2])
{
m_Renderer->DrawNormals(!m_Renderer->DrawNormals());
}
// Bounds
if (m_CurrentKeyState[GLFW_KEY_F3] && !m_LastKeyState[GLFW_KEY_F3])
{
m_Renderer->DrawBounds(!m_Renderer->DrawBounds());
}
#endif
// #ifdef DEBUG
// // Wireframe
// if (m_CurrentKeyState[GLFW_KEY_F1] && !m_LastKeyState[GLFW_KEY_F1])
// {
// m_Renderer->DrawWireframe(!m_Renderer->DrawWireframe());
// }
// // Normals
// if (m_CurrentKeyState[GLFW_KEY_F2] && !m_LastKeyState[GLFW_KEY_F2])
// {
// m_Renderer->DrawNormals(!m_Renderer->DrawNormals());
// }
// // Bounds
// if (m_CurrentKeyState[GLFW_KEY_F3] && !m_LastKeyState[GLFW_KEY_F3])
// {
// m_Renderer->DrawBounds(!m_Renderer->DrawBounds());
// }
// #endif
}
void Systems::InputSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
bool Systems::InputSystem::OnKeyDown(const Events::KeyDown &event)
{
auto input = m_World->GetComponent<Components::Input>(entity, "Input");
if (input == nullptr)
return;
auto bindingIt = m_KeyBindings.find(event.KeyCode);
if (bindingIt != m_KeyBindings.end())
{
PublishCommand(0, bindingIt->second, false);
}
input->KeyState = m_CurrentKeyState;
input->LastKeyState = m_LastKeyState;
input->MouseState = m_CurrentMouseState;
input->LastMouseState = m_LastMouseState;
input->dX = m_CurrentMouseDeltaX;
input->dY = m_CurrentMouseDeltaY;
return true;
}
std::array<int, GLFW_KEY_LAST+1> Systems::InputSystem::m_CurrentKeyState;
std::array<int, GLFW_KEY_LAST+1> Systems::InputSystem::m_LastKeyState;
bool Systems::InputSystem::OnKeyUp(const Events::KeyUp &event)
{
auto bindingIt = m_KeyBindings.find(event.KeyCode);
if (bindingIt != m_KeyBindings.end())
{
PublishCommand(0, bindingIt->second, true);
}
return true;
}
bool Systems::InputSystem::OnMousePress(const Events::MousePress &event)
{
auto bindingIt = m_MouseButtonBindings.find(event.Button);
if (bindingIt != m_MouseButtonBindings.end())
{
PublishCommand(0, bindingIt->second, false);
}
return true;
}
bool Systems::InputSystem::OnMouseRelease(const Events::MouseRelease &event)
{
auto bindingIt = m_MouseButtonBindings.find(event.Button);
if (bindingIt != m_MouseButtonBindings.end())
{
PublishCommand(0, bindingIt->second, true);
}
return true;
}
bool Systems::InputSystem::OnBindKey(const Events::BindKey &event)
{
if (event.Command.empty())
{
m_KeyBindings.erase(event.KeyCode);
}
else
{
m_KeyBindings[event.KeyCode] = event.Command;
LOG_DEBUG("Input: Bound key %c to %s", (char)event.KeyCode, event.Command.c_str());
}
return true;
}
bool Systems::InputSystem::OnBindMouseButton(const Events::BindMouseButton &event)
{
if (event.Command.empty())
{
m_MouseButtonBindings.erase(event.Button);
}
else
{
m_MouseButtonBindings[event.Button] = event.Command;
LOG_DEBUG("Input: Bound mouse button %i to %s", event.Button, event.Command.c_str());
}
return true;
}
void Systems::InputSystem::PublishCommand(int playerID, std::string command, bool release /*= false*/)
{
if (release && command.at(0) == '+')
{
command[0] = '-';
}
Events::InputCommand e;
e.PlayerID = playerID;
e.Command = command;
EventBroker->Publish(e);
LOG_DEBUG("Input: Published command %s for player %i", e.Command.c_str(), playerID);
}
+31 -11
View File
@@ -2,10 +2,17 @@
#define InputSystem_h__
#include <array>
#include <unordered_map>
#include "System.h"
#include "Renderer.h"
#include "Components/Input.h"
#include "Events/KeyUp.h"
#include "Events/KeyDown.h"
#include "Events/MousePress.h"
#include "Events/MouseRelease.h"
#include "Events/BindKey.h"
#include "Events/BindMouseButton.h"
#include "Events/InputCommand.h"
namespace Systems
{
@@ -13,22 +20,35 @@ namespace Systems
class InputSystem : public System
{
public:
InputSystem(World* world, std::shared_ptr<Renderer> renderer)
: System(world), m_Renderer(renderer) { }
InputSystem(World* world, std::shared_ptr<::EventBroker> eventBroker)
: System(world, eventBroker) { }
void RegisterComponents(ComponentFactory* cf) override;
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
private:
std::shared_ptr<Renderer> m_Renderer;
static std::array<int, GLFW_KEY_LAST+1> m_CurrentKeyState;
static std::array<int, GLFW_KEY_LAST+1> m_LastKeyState;
std::array<int, GLFW_MOUSE_BUTTON_LAST+1> m_CurrentMouseState;
std::array<int, GLFW_MOUSE_BUTTON_LAST+1> m_LastMouseState;
float m_CurrentMouseDeltaX, m_CurrentMouseDeltaY;
float m_LastMouseX, m_LastMouseY;
// Input binding tables
std::unordered_map<int, std::string> m_KeyBindings; // GLFW_KEY... -> command string
std::unordered_map<int, std::string> m_MouseButtonBindings; // GLFW_MOUSE_BUTTON... -> command string
// Input events
EventRelay<Events::KeyDown> m_EKeyDown;
bool OnKeyDown(const Events::KeyDown &event);
EventRelay<Events::KeyUp> m_EKeyUp;
bool OnKeyUp(const Events::KeyUp &event);
EventRelay<Events::MousePress> m_EMousePress;
bool OnMousePress(const Events::MousePress &event);
EventRelay<Events::MouseRelease> m_EMouseRelease;
bool OnMouseRelease(const Events::MouseRelease &event);
// Input binding events
EventRelay<Events::BindKey> m_EBindKey;
bool OnBindKey(const Events::BindKey &event);
EventRelay<Events::BindMouseButton> m_EBindMouseButton;
bool OnBindMouseButton(const Events::BindMouseButton &event);
void PublishCommand(int playerID, std::string command, bool release = false);
};
}
+1 -1
View File
@@ -25,7 +25,7 @@
#include "PhysicsSystem.h"
#include "World.h"
Systems::PhysicsSystem::PhysicsSystem(World* world) : System(world)
void Systems::PhysicsSystem::Initialize()
{
m_Accumulator = 0;
+4 -1
View File
@@ -63,8 +63,11 @@ namespace Systems
class PhysicsSystem : public System
{
public:
PhysicsSystem(World* world);
PhysicsSystem(World* world, std::shared_ptr<::EventBroker> eventBroker)
: System(world, eventBroker) { }
void RegisterComponents(ComponentFactory* cf) override;
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
-91
View File
@@ -1,91 +0,0 @@
#ifndef PhysicsSystem_h__
#define PhysicsSystem_h__
#include "System.h"
#include "Components/Transform.h"
#include "Components/Physics.h"
#include "Components/Sphere.h"
#include "Components/Box.h"
#include "Components/Vehicle.h"
#include "Components/Input.h"
// Math and base include
#include <Common/Base/hkBase.h>
#include <Common/Base/Memory/System/Util/hkMemoryInitUtil.h>
#include <Common/Base/System/Error/hkDefaultError.h>
#include <Common/Base/Monitor/hkMonitorStream.h>
#include <Common/Base/Config/hkConfigVersion.h>
#include <Common/Base/Memory/System/hkMemorySystem.h>
#include <Common/Base/Memory/Allocator/Malloc/hkMallocAllocator.h>
#include <Common/Base/Container/String/hkStringBuf.h>
// Dynamics includes
#include <Physics2012/Collide/hkpCollide.h>
#include <Physics2012/Collide/Agent/ConvexAgent/SphereBox/hkpSphereBoxAgent.h>
#include <Physics2012/Collide/Shape/Convex/Box/hkpBoxShape.h>
#include <Physics2012/Collide/Shape/Convex/Sphere/hkpSphereShape.h>
#include <Physics2012/Collide/Dispatch/hkpAgentRegisterUtil.h>
#include <Physics2012/Dynamics/World/hkpWorld.h>
#include <Physics2012/Dynamics/Entity/hkpRigidBody.h>
#include <Physics2012/Utilities/Dynamics/Inertia/hkpInertiaTensorComputer.h>
// Visual Debugger includes
#include <Common/Visualize/hkVisualDebugger.h>
#include <Physics2012/Utilities/VisualDebugger/hkpPhysicsContext.h>
#include "Physics/VehicleSetup.h"
#include <unordered_map>
namespace Systems
{
class PhysicsSystem : public System
{
public:
PhysicsSystem(World* world);
void RegisterComponents(ComponentFactory* cf) override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
void OnComponentCreated(std::string type, std::shared_ptr<Component> component) override;
void OnComponentRemoved(std::string type, Component* component) override;
void OnEntityCommit(EntityID entity) override;
private:
<<<<<<< HEAD
=======
>>>>>>> havok
double m_Accumulator;
hkpWorld* m_PhysicsWorld;
void SetUpPhysicsState(EntityID entity, EntityID parent);
void TearDownPhysicsState(EntityID entity, EntityID parent);
hkVisualDebugger* m_VisualDebugger;
void SetupVisualDebugger(hkpPhysicsContext* worlds);
void StepVisualDebugger();
static void HK_CALL HavokErrorReport(const char* msg, void*);
void SetupPhysics(hkpWorld* physicsWorld);
std::unordered_map<EntityID, hkpRigidBody*> m_RigidBodies;
std::unordered_map<EntityID, hkpVehicleInstance*> m_Vehicles;
std::vector<EntityID> m_Wheels;
hkpVehicleInstance* Systems::PhysicsSystem::createVehicle(VehicleSetup& vehicleSetup, hkpRigidBody* chassis);
};
}
#endif // PhysicsSystem_h__
+3 -2
View File
@@ -24,8 +24,9 @@ namespace Systems
class RenderSystem : public System
{
public:
RenderSystem(World* world, std::shared_ptr<Renderer> renderer)
: System(world), m_Renderer(renderer) { }
RenderSystem(World* world, std::shared_ptr<::EventBroker> eventBroker, std::shared_ptr<Renderer> renderer)
: System(world, eventBroker)
, m_Renderer(renderer) { }
void RegisterComponents(ComponentFactory* cf) override;
void RegisterResourceTypes(ResourceManager* rm) override;
+17 -2
View File
@@ -2,8 +2,7 @@
#include "SoundSystem.h"
#include "World.h"
Systems::SoundSystem::SoundSystem(World* world)
: System(world)
void Systems::SoundSystem::Initialize()
{
//initialize OpenAL
ALCdevice* Device = alcOpenDevice(NULL);
@@ -22,6 +21,10 @@ Systems::SoundSystem::SoundSystem(World* world)
alSpeedOfSound(340.29f); // Speed of sound
alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);
// Subscribe to events
m_EPlaySound = decltype(m_EPlaySound)(std::bind(&Systems::SoundSystem::OnPlaySound, this, std::placeholders::_1));
EventBroker->Subscribe(m_EPlaySound);
}
void Systems::SoundSystem::RegisterComponents(ComponentFactory* cf)
@@ -143,3 +146,15 @@ ALuint Systems::SoundSystem::CreateSource()
return source;
}
bool Systems::SoundSystem::OnPlaySound(const Events::PlaySound &event)
{
LOG_DEBUG("Events::PlaySound.Resource = %s", event.Resource.c_str());
ALuint buffer = *m_World->GetResourceManager()->Load<Sound>("Sound", event.Resource);
ALuint source = m_Sources.begin()->second;
alSourcei(source, AL_BUFFER, buffer);
alSourcePlay(source);
return true;
}
+9 -1
View File
@@ -7,6 +7,7 @@
#include "System.h"
#include "Components/Transform.h"
#include "Components/SoundEmitter.h"
#include "Events/PlaySound.h"
#include "Sound.h"
namespace Systems
@@ -15,9 +16,12 @@ namespace Systems
class SoundSystem : public System
{
public:
SoundSystem(World* world);
SoundSystem(World* world, std::shared_ptr<::EventBroker> eventBroker)
: System(world, eventBroker) { }
void RegisterComponents(ComponentFactory* cf) override;
void RegisterResourceTypes(ResourceManager* rm) override;
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
@@ -39,6 +43,10 @@ private:
//short bytesPerSample, bitsPerSample;
//unsigned long dataSize;
// Events
EventRelay<Events::PlaySound> m_EPlaySound;
bool OnPlaySound(const Events::PlaySound &event);
std::map<Component*, ALuint> m_Sources;
std::map<std::string, ALuint> m_BufferCache; // string = fileName
};
+2 -3
View File
@@ -10,9 +10,8 @@ namespace Systems
class TransformSystem : public System
{
public:
TransformSystem(World* world)
: System(world) { }
TransformSystem(World* world, std::shared_ptr<::EventBroker> eventBroker)
: System(world, eventBroker) { }
//void Update(double dt) override;
//void UpdateEntity(double dt, EntityID entity, EntityID parent) override;