Merge branch 'master' of github.com:sippeangelo/Escape-the-Dawn
Conflicts: Escape-the-Dawn/Systems/SoundsSystem.cpp
This commit is contained in:
@@ -4,15 +4,14 @@
|
|||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Bounds : Component
|
struct Bounds : Component
|
||||||
{
|
{
|
||||||
//Axis Aligned Bounding Box
|
//Axis Aligned Bounding Box
|
||||||
glm::vec3 origin;
|
glm::vec3 Origin;
|
||||||
glm::vec3 volumeVector; //The vector that defines the volume of the BB, it goes from one corner to the opposite one
|
glm::vec3 VolumeVector; //The vector that defines the volume of the BB, it goes from one corner to the opposite one
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,17 +40,14 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LibraryPath>$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\lib\Win32;$(SolutionDir)\Libraries\glew-1.10.0\lib\Debug\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Debug;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\lib\Win32;$(SolutionDir)\Libraries\SOIL\lib\Debug;$(SolutionDir)\Libraries\glew-1.10.0\lib\Debug\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Debug;$(LibraryPath)</LibraryPath>
|
||||||
<LibraryPath>$(SolutionDir)\Libraries\SOIL\lib\Debug;$(SolutionDir)\Libraries\glew-1.10.0\lib\Debug\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Debug;$(LibraryPath)</LibraryPath>
|
|
||||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
||||||
<TargetName>$(ProjectName)-$(Configuration)</TargetName>
|
<TargetName>$(ProjectName)-$(Configuration)</TargetName>
|
||||||
<IncludePath>$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
<IncludePath>$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
||||||
<IncludePath>$(SolutionDir)\Libraries\SOIL\src;\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<IncludePath>$(SolutionDir)\Libraries\SOIL\src;\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
<IncludePath>$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
||||||
<IncludePath>$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LibraryPath>$(SolutionDir)\Libraries\SOIL\lib\Release;$(SolutionDir)\Libraries\glew-1.10.0\lib\Release\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Release;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)\Libraries\SOIL\lib\Release;$(SolutionDir)\Libraries\glew-1.10.0\lib\Release\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Release;$(LibraryPath)</LibraryPath>
|
||||||
@@ -101,11 +98,16 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Engine.h" />
|
<ClCompile Include="Engine.h" />
|
||||||
|
<ClCompile Include="Frame.cpp" />
|
||||||
|
<ClCompile Include="GameFrame.cpp" />
|
||||||
|
<ClCompile Include="GUIManager.cpp" />
|
||||||
|
<ClCompile Include="MenuFrame.cpp" />
|
||||||
<ClCompile Include="Model.cpp" />
|
<ClCompile Include="Model.cpp" />
|
||||||
<ClCompile Include="Renderer.cpp" />
|
<ClCompile Include="Renderer.cpp" />
|
||||||
<ClCompile Include="ShaderProgram.cpp" />
|
<ClCompile Include="ShaderProgram.cpp" />
|
||||||
<ClCompile Include="Systems\CollisionSystem.cpp" />
|
<ClCompile Include="Systems\CollisionSystem.cpp" />
|
||||||
<ClCompile Include="Texture.cpp" />
|
<ClCompile Include="Texture.cpp" />
|
||||||
|
<ClCompile Include="TextFrame.cpp" />
|
||||||
<ClCompile Include="World.cpp" />
|
<ClCompile Include="World.cpp" />
|
||||||
<ClCompile Include="Systems\InputSystem.cpp" />
|
<ClCompile Include="Systems\InputSystem.cpp" />
|
||||||
<ClCompile Include="Systems\LevelGenerationSystem.cpp" />
|
<ClCompile Include="Systems\LevelGenerationSystem.cpp" />
|
||||||
@@ -133,9 +135,13 @@
|
|||||||
<ClInclude Include="Components\Template.h" />
|
<ClInclude Include="Components\Template.h" />
|
||||||
<ClInclude Include="Components\Transform.h" />
|
<ClInclude Include="Components\Transform.h" />
|
||||||
<ClInclude Include="Entity.h" />
|
<ClInclude Include="Entity.h" />
|
||||||
|
<ClInclude Include="Frame.h" />
|
||||||
|
<ClInclude Include="GameFrame.h" />
|
||||||
<ClInclude Include="GameWorld.h" />
|
<ClInclude Include="GameWorld.h" />
|
||||||
|
<ClInclude Include="GUIManager.h" />
|
||||||
<ClInclude Include="logging.h" />
|
<ClInclude Include="logging.h" />
|
||||||
<ClInclude Include="glerror.h" />
|
<ClInclude Include="glerror.h" />
|
||||||
|
<ClInclude Include="MenuFrame.h" />
|
||||||
<ClInclude Include="Model.h" />
|
<ClInclude Include="Model.h" />
|
||||||
<ClInclude Include="Renderer.h" />
|
<ClInclude Include="Renderer.h" />
|
||||||
<ClInclude Include="ShaderProgram.h" />
|
<ClInclude Include="ShaderProgram.h" />
|
||||||
@@ -148,6 +154,7 @@
|
|||||||
<ClInclude Include="Systems\RenderSystem.h" />
|
<ClInclude Include="Systems\RenderSystem.h" />
|
||||||
<ClInclude Include="Systems\SoundSystem.h" />
|
<ClInclude Include="Systems\SoundSystem.h" />
|
||||||
<ClInclude Include="Texture.h" />
|
<ClInclude Include="Texture.h" />
|
||||||
|
<ClInclude Include="TextFrame.h" />
|
||||||
<ClInclude Include="World.h" />
|
<ClInclude Include="World.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
#ifndef SoundEmitter_h__
|
#ifndef SoundEmitter_h__
|
||||||
#define SoundEmitter_h__
|
#define SoundEmitter_h__
|
||||||
|
|
||||||
|
#include "AL/al.h"
|
||||||
|
#include "AL/alc.h"
|
||||||
|
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
#include "Components/SoundEmitter.h"
|
#include "Components/SoundEmitter.h"
|
||||||
#include <AL/al.h>
|
#include <AL/al.h>
|
||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
namespace System
|
namespace Systems
|
||||||
{
|
{
|
||||||
|
|
||||||
class SoundSystem : public System
|
class SoundSystem : public System
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SoundSystem(World* world) : System(world)
|
SoundSystem(World* world);
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
void Update(double dt) override;
|
void Update(double dt) override;
|
||||||
void Update(double dt, EntityID entity, EntityID parent) override;
|
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
|
||||||
void OnComponentCreated(std::string type, std::shared_ptr<Component> component) override;
|
void OnComponentCreated(std::string type, std::shared_ptr<Component> component) override;
|
||||||
void PlaySound(std::shared_ptr<Components::SoundEmitter> emitter, std::string fileName);
|
void PlaySound(std::shared_ptr<Components::SoundEmitter> emitter, std::string fileName);
|
||||||
void LoadFile(const char* fileName);
|
void LoadFile(const char* fileName);
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
//#include <fstream>
|
//#include <fstream>
|
||||||
|
|
||||||
|
|
||||||
System::SoundSystem::SoundSystem(World* world)
|
Systems::SoundSystem::SoundSystem(World* world)
|
||||||
|
: System(world)
|
||||||
{
|
{
|
||||||
|
|
||||||
//initialize OpenAL
|
//initialize OpenAL
|
||||||
@@ -18,12 +19,12 @@ System::SoundSystem::SoundSystem(World* world)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::SoundSystem::Update(double dt)
|
void Systems::SoundSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::SoundSystem::Update(double dt, EntityID entity, EntityID parent)
|
void Systems::SoundSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
{
|
{
|
||||||
auto soundEmitter = m_World->GetComponent<Components::SoundEmitter>(entity, "SoundEmitter");
|
auto soundEmitter = m_World->GetComponent<Components::SoundEmitter>(entity, "SoundEmitter");
|
||||||
if(soundEmitter == nullptr)
|
if(soundEmitter == nullptr)
|
||||||
@@ -32,7 +33,7 @@ void System::SoundSystem::Update(double dt, EntityID entity, EntityID parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::SoundSystem::PlaySound(std::shared_ptr<Components::SoundEmitter> emitter, std::string fileName)
|
void Systems::SoundSystem::PlaySound(std::shared_ptr<Components::SoundEmitter> emitter, std::string fileName)
|
||||||
{
|
{
|
||||||
//LoadFile(fileName);
|
//LoadFile(fileName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,13 @@
|
|||||||
#define World_h__
|
#define World_h__
|
||||||
|
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
#include <map>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/any.hpp>
|
||||||
|
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
|
||||||
#include "Factory.h"
|
#include "Factory.h"
|
||||||
@@ -36,6 +39,17 @@ public:
|
|||||||
|
|
||||||
EntityID GetEntityParent(EntityID entity);
|
EntityID GetEntityParent(EntityID entity);
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
T GetProperty(EntityID entity, std::string property)
|
||||||
|
{
|
||||||
|
return boost::any_cast<T>(m_EntityProperties[entity][property]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetProperty(EntityID entity, std::string property, boost::any value)
|
||||||
|
{
|
||||||
|
m_EntityProperties[entity][property] = value;
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
std::shared_ptr<T> AddComponent(EntityID entity, std::string componentType);
|
std::shared_ptr<T> AddComponent(EntityID entity, std::string componentType);
|
||||||
std::shared_ptr<Component> AddComponent(EntityID entity, std::string componentType);
|
std::shared_ptr<Component> AddComponent(EntityID entity, std::string componentType);
|
||||||
@@ -59,6 +73,8 @@ protected:
|
|||||||
// A bottom to top tree. A map of child entities to parent entities.
|
// A bottom to top tree. A map of child entities to parent entities.
|
||||||
std::unordered_map<EntityID, EntityID> m_EntityParents;
|
std::unordered_map<EntityID, EntityID> m_EntityParents;
|
||||||
|
|
||||||
|
std::unordered_map<EntityID, std::unordered_map<std::string, boost::any>> m_EntityProperties;
|
||||||
|
|
||||||
std::unordered_map<std::string, std::vector<std::shared_ptr<Component>>> m_ComponentsOfType;
|
std::unordered_map<std::string, std::vector<std::shared_ptr<Component>>> m_ComponentsOfType;
|
||||||
std::unordered_map<EntityID, std::map<std::string, std::shared_ptr<Component>>> m_EntityComponents;
|
std::unordered_map<EntityID, std::map<std::string, std::shared_ptr<Component>>> m_EntityComponents;
|
||||||
|
|
||||||
|
|||||||
@@ -39,13 +39,13 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(SolutionDir)\Libraries\SOIL\src;\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
||||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||||
<TargetName>$(SolutionName)-$(Configuration)</TargetName>
|
<TargetName>$(SolutionName)-$(Configuration)</TargetName>
|
||||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(SolutionDir)\Libraries\SOIL\src;\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
||||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||||
<TargetName>$(SolutionName)-$(Configuration)</TargetName>
|
<TargetName>$(SolutionName)-$(Configuration)</TargetName>
|
||||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
||||||
|
|||||||
+4
-4
@@ -39,13 +39,13 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<IncludePath>$(BOOST_ROOT);$(SolutionDir)\Escape-the-Dawn;$(SolutionDir)\Libraries\SOIL\src;\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath)</LibraryPath>
|
||||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<IncludePath>$(BOOST_ROOT);$(SolutionDir)\Escape-the-Dawn;$(SolutionDir)\Libraries\SOIL\src;\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath)</LibraryPath>
|
||||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<PostBuildEvent />
|
<PostBuildEvent />
|
||||||
<PreBuildEvent />
|
<PreBuildEvent />
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>$(OutDir)$(TargetName)$(TargetExt) --log_level=test_suite</Command>
|
<Command>"$(OutDir)$(TargetName)$(TargetExt)" --log_level=test_suite</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Message>Running tests</Message>
|
<Message>Running tests</Message>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent />
|
<PreBuildEvent />
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>$(OutDir)$(TargetName)$(TargetExt) --log_level=test_suite</Command>
|
<Command>"$(OutDir)$(TargetName)$(TargetExt)" --log_level=test_suite</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Message>Running tests</Message>
|
<Message>Running tests</Message>
|
||||||
|
|||||||
+21
-1
@@ -1,6 +1,7 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
#include "GameWorld.h"
|
||||||
#include "Components/Transform.h"
|
#include "Components/Transform.h"
|
||||||
|
|
||||||
#define BOOST_TEST_MODULE World
|
#define BOOST_TEST_MODULE World
|
||||||
@@ -24,15 +25,19 @@ BOOST_AUTO_TEST_CASE(Parenting)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(SceneGraphTraversal)
|
BOOST_AUTO_TEST_CASE(SceneGraphTraversal)
|
||||||
{
|
{
|
||||||
World world;
|
std::shared_ptr<Renderer> renderer(new Renderer());
|
||||||
|
renderer->Initialize();
|
||||||
|
GameWorld world(renderer);
|
||||||
|
|
||||||
EntityID ent1 = world.CreateEntity();
|
EntityID ent1 = world.CreateEntity();
|
||||||
auto t1 = world.AddComponent<Components::Transform>(ent1, "Transform");
|
auto t1 = world.AddComponent<Components::Transform>(ent1, "Transform");
|
||||||
|
BOOST_REQUIRE(t1 != nullptr);
|
||||||
t1->Position[0] = 1.0f;
|
t1->Position[0] = 1.0f;
|
||||||
t1->Position[1] = 1.0f;
|
t1->Position[1] = 1.0f;
|
||||||
t1->Position[2] = 1.0f;
|
t1->Position[2] = 1.0f;
|
||||||
EntityID ent2 = world.CreateEntity(ent1);
|
EntityID ent2 = world.CreateEntity(ent1);
|
||||||
auto t2 = world.AddComponent<Components::Transform>(ent2, "Transform");
|
auto t2 = world.AddComponent<Components::Transform>(ent2, "Transform");
|
||||||
|
BOOST_REQUIRE(t2 != nullptr);
|
||||||
t2->Position[0] = 1.0f;
|
t2->Position[0] = 1.0f;
|
||||||
t2->Position[1] = 1.0f;
|
t2->Position[1] = 1.0f;
|
||||||
t2->Position[2] = 1.0f;
|
t2->Position[2] = 1.0f;
|
||||||
@@ -62,3 +67,18 @@ BOOST_AUTO_TEST_CASE(ComponentCreation)
|
|||||||
BOOST_CHECK(world.AddComponent(ent, "Transform") != nullptr);
|
BOOST_CHECK(world.AddComponent(ent, "Transform") != nullptr);
|
||||||
BOOST_CHECK(world.AddComponent(ent, "Input") != nullptr);
|
BOOST_CHECK(world.AddComponent(ent, "Input") != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(Properties)
|
||||||
|
{
|
||||||
|
World world;
|
||||||
|
|
||||||
|
EntityID ent = world.CreateEntity();
|
||||||
|
|
||||||
|
world.SetProperty(ent, "String", std::string("derpfish"));
|
||||||
|
world.SetProperty(ent, "Integer", 123);
|
||||||
|
world.SetProperty(ent, "Float", 0.04f);
|
||||||
|
|
||||||
|
BOOST_CHECK(world.GetProperty<std::string>(ent, "String") == "derpfish");
|
||||||
|
BOOST_CHECK(world.GetProperty<int>(ent, "Integer") == 123);
|
||||||
|
BOOST_CHECK(world.GetProperty<float>(ent, "Float") == 0.04f);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user