diff --git a/Escape-the-Dawn.sln b/Escape-the-Dawn.sln index 213283c..a932c57 100644 --- a/Escape-the-Dawn.sln +++ b/Escape-the-Dawn.sln @@ -3,13 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Escape-the-Dawn", "Escape-the-Dawn\Escape-the-Dawn.vcxproj", "{FE405CFA-8FCE-4867-92CF-797E73B36482}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tests", "Tests\Tests.vcxproj", "{B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}" - ProjectSection(ProjectDependencies) = postProject - {A9755CAA-62DC-442D-B82C-F548546CFD38} = {A9755CAA-62DC-442D-B82C-F548546CFD38} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Executable", "Executable\Executable.vcxproj", "{A9755CAA-62DC-442D-B82C-F548546CFD38}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -20,14 +13,6 @@ Global {FE405CFA-8FCE-4867-92CF-797E73B36482}.Debug|Win32.Build.0 = Debug|Win32 {FE405CFA-8FCE-4867-92CF-797E73B36482}.Release|Win32.ActiveCfg = Release|Win32 {FE405CFA-8FCE-4867-92CF-797E73B36482}.Release|Win32.Build.0 = Release|Win32 - {B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}.Debug|Win32.ActiveCfg = Debug|Win32 - {B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}.Debug|Win32.Build.0 = Debug|Win32 - {B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}.Release|Win32.ActiveCfg = Release|Win32 - {B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}.Release|Win32.Build.0 = Release|Win32 - {A9755CAA-62DC-442D-B82C-F548546CFD38}.Debug|Win32.ActiveCfg = Debug|Win32 - {A9755CAA-62DC-442D-B82C-F548546CFD38}.Debug|Win32.Build.0 = Debug|Win32 - {A9755CAA-62DC-442D-B82C-F548546CFD38}.Release|Win32.ActiveCfg = Release|Win32 - {A9755CAA-62DC-442D-B82C-F548546CFD38}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj b/Escape-the-Dawn/Escape-the-Dawn.vcxproj index 6f3a242..07148a6 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj @@ -16,13 +16,13 @@ - StaticLibrary + Application true MultiByte v110 - StaticLibrary + Application false true MultiByte @@ -65,7 +65,7 @@ true Console - opengl32.lib;glu32.lib;glew32sd.lib;glfw3.lib;%(AdditionalDependencies) + OpenAL32.lib;opengl32.lib;glu32.lib;SOIL.lib;glew32sd.lib;glfw3.lib;%(AdditionalDependencies) @@ -90,7 +90,7 @@ false true true - opengl32.lib;glu32.lib;glew32s.lib;glfw3.lib;%(AdditionalDependencies) + OpenAL32.lib;opengl32.lib;glu32.lib;SOIL.lib;glew32s.lib;glfw3.lib;%(AdditionalDependencies) OpenAL32.lib;opengl32.lib;glu32.lib;SOIL.lib;glew32s.lib;glfw3.lib; @@ -101,7 +101,9 @@ + + diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters index 70e92ec..7752005 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters @@ -45,6 +45,8 @@ + + diff --git a/Escape-the-Dawn/GameWorld.cpp b/Escape-the-Dawn/GameWorld.cpp new file mode 100644 index 0000000..98fc8f6 --- /dev/null +++ b/Escape-the-Dawn/GameWorld.cpp @@ -0,0 +1,87 @@ +#include "GameWorld.h" + + + + +void GameWorld::Update(double dt) +{ + World::Update(dt); +} + +void GameWorld::RegisterComponents() +{ + m_ComponentFactory.Register("Bounds", []() { return new Components::Bounds(); }); + m_ComponentFactory.Register("Camera", []() { return new Components::Camera(); }); + m_ComponentFactory.Register("Collision", []() { return new Components::Collision(); }); + m_ComponentFactory.Register("DirectionalLight", []() { return new Components::DirectionalLight(); }); + m_ComponentFactory.Register("Input", []() { return new Components::Input(); }); + m_ComponentFactory.Register("Model", []() { return new Components::Model(); }); + m_ComponentFactory.Register("ParticleEmitter", []() { return new Components::ParticleEmitter(); }); + m_ComponentFactory.Register("PointLight", []() { return new Components::PointLight(); }); + m_ComponentFactory.Register("PowerUp", []() { return new Components::PowerUp(); }); + m_ComponentFactory.Register("SoundEmitter", []() { return new Components::SoundEmitter(); }); + m_ComponentFactory.Register("Sprite", []() { return new Components::Sprite(); }); + m_ComponentFactory.Register("Stat", []() { return new Components::Stat(); }); + m_ComponentFactory.Register("Template", []() { return new Components::Template(); }); + m_ComponentFactory.Register("Transform", []() { return new Components::Transform(); }); +} + +void GameWorld::RegisterSystems() +{ + //m_SystemFactory.Register("LevelGenerationSystem", [this]() { return new Systems::LevelGenerationSystem(this); }); + m_SystemFactory.Register("InputSystem", [this]() { return new Systems::InputSystem(this, m_Renderer); }); + //m_SystemFactory.Register("CollisionSystem", [this]() { return new Systems::CollisionSystem(this); }); + //m_SystemFactory.Register("ParticleSystem", [this]() { return new Systems::ParticleSystem(this); }); + m_SystemFactory.Register("PlayerSystem", [this]() { return new Systems::PlayerSystem(this); }); + m_SystemFactory.Register("SoundSystem", [this]() { return new Systems::SoundSystem(this); }); + m_SystemFactory.Register("RenderSystem", [this]() { return new Systems::RenderSystem(this, m_Renderer); }); +} + +void GameWorld::Initialize() +{ + World::Initialize(); + + //AddSystem("LevelGenerationSystem"); + AddSystem("InputSystem"); + //AddSystem("CollisionSystem"); + //AddSystem("ParticleSystem"); + AddSystem("PlayerSystem"); + AddSystem("SoundSystem"); + AddSystem("RenderSystem"); + + std::shared_ptr transform; + std::shared_ptr model; + std::shared_ptr camera; + EntityID ent; + + ent = CreateEntity(); + transform = AddComponent(ent, "Transform"); + transform->Position = glm::vec3(0.f, 0.f, 0.f); + model = AddComponent(ent, "Model"); + model->ModelFile = "ship.obj"; + auto soundEmitter = AddComponent(ent, "SoundEmitter"); + soundEmitter->Gain = 1; + soundEmitter->MaxDistance = FLT_MAX; + soundEmitter->ReferenceDistance = 10; + soundEmitter->Loop = true; + + soundEmitter->Pitch = 1; + GetSystem("SoundSystem")->PlaySound(soundEmitter, "Sounds/hallelujah.wav"); + + + ent = CreateEntity(); + SetProperty(ent, "Name", std::string("Camera")); + transform = AddComponent(ent, "Transform"); + AddComponent(ent, "Input"); + transform->Position = glm::vec3(0.f, 2.f, 10.f); + camera = AddComponent(ent, "Camera"); + camera->FOV = 45.f; + camera->FarClip = 1000.f; + camera->NearClip = 0.01f; + transform->Orientation = glm::angleAxis(glm::radians(25.0f),glm::vec3(1,0,0)); +} + +GameWorld::GameWorld(std::shared_ptr renderer) : m_Renderer(renderer), World() +{ + +} diff --git a/Escape-the-Dawn/GameWorld.h b/Escape-the-Dawn/GameWorld.h index 1628205..43ebc3c 100644 --- a/Escape-the-Dawn/GameWorld.h +++ b/Escape-the-Dawn/GameWorld.h @@ -42,88 +42,4 @@ private: std::shared_ptr m_Renderer; }; -GameWorld::GameWorld(std::shared_ptr renderer) - : m_Renderer(renderer), World() -{ - -} - -void GameWorld::Initialize() -{ - World::Initialize(); - - //AddSystem("LevelGenerationSystem"); - AddSystem("InputSystem"); - //AddSystem("CollisionSystem"); - //AddSystem("ParticleSystem"); - AddSystem("PlayerSystem"); - AddSystem("SoundSystem"); - AddSystem("RenderSystem"); - - std::shared_ptr transform; - std::shared_ptr model; - std::shared_ptr camera; - EntityID ent; - - ent = CreateEntity(); - transform = AddComponent(ent, "Transform"); - transform->Position = glm::vec3(0.f, 0.f, 0.f); - model = AddComponent(ent, "Model"); - model->ModelFile = "ship.obj"; - auto soundEmitter = AddComponent(ent, "SoundEmitter"); - soundEmitter->Gain = 1; - soundEmitter->MaxDistance = FLT_MAX; - soundEmitter->ReferenceDistance = 10; - soundEmitter->Loop = true; - - soundEmitter->Pitch = 1; - GetSystem("SoundSystem")->PlaySound(soundEmitter, "Sounds/hallelujah.wav"); - - - ent = CreateEntity(); - SetProperty(ent, "Name", std::string("Camera")); - transform = AddComponent(ent, "Transform"); - AddComponent(ent, "Input"); - transform->Position = glm::vec3(0.f, 2.f, 10.f); - camera = AddComponent(ent, "Camera"); - camera->FOV = 45.f; - camera->FarClip = 1000.f; - camera->NearClip = 0.01f; - transform->Orientation = glm::angleAxis(glm::radians(25.0f),glm::vec3(1,0,0)); -} - -void GameWorld::RegisterSystems() -{ - //m_SystemFactory.Register("LevelGenerationSystem", [this]() { return new Systems::LevelGenerationSystem(this); }); - m_SystemFactory.Register("InputSystem", [this]() { return new Systems::InputSystem(this, m_Renderer); }); - //m_SystemFactory.Register("CollisionSystem", [this]() { return new Systems::CollisionSystem(this); }); - //m_SystemFactory.Register("ParticleSystem", [this]() { return new Systems::ParticleSystem(this); }); - m_SystemFactory.Register("PlayerSystem", [this]() { return new Systems::PlayerSystem(this); }); - m_SystemFactory.Register("SoundSystem", [this]() { return new Systems::SoundSystem(this); }); - m_SystemFactory.Register("RenderSystem", [this]() { return new Systems::RenderSystem(this, m_Renderer); }); -} - -void GameWorld::RegisterComponents() -{ - m_ComponentFactory.Register("Bounds", []() { return new Components::Bounds(); }); - m_ComponentFactory.Register("Camera", []() { return new Components::Camera(); }); - m_ComponentFactory.Register("Collision", []() { return new Components::Collision(); }); - m_ComponentFactory.Register("DirectionalLight", []() { return new Components::DirectionalLight(); }); - m_ComponentFactory.Register("Input", []() { return new Components::Input(); }); - m_ComponentFactory.Register("Model", []() { return new Components::Model(); }); - m_ComponentFactory.Register("ParticleEmitter", []() { return new Components::ParticleEmitter(); }); - m_ComponentFactory.Register("PointLight", []() { return new Components::PointLight(); }); - m_ComponentFactory.Register("PowerUp", []() { return new Components::PowerUp(); }); - m_ComponentFactory.Register("SoundEmitter", []() { return new Components::SoundEmitter(); }); - m_ComponentFactory.Register("Sprite", []() { return new Components::Sprite(); }); - m_ComponentFactory.Register("Stat", []() { return new Components::Stat(); }); - m_ComponentFactory.Register("Template", []() { return new Components::Template(); }); - m_ComponentFactory.Register("Transform", []() { return new Components::Transform(); }); -} - -void GameWorld::Update(double dt) -{ - World::Update(dt); -} - #endif // GameWorld_h__ diff --git a/Executable/main.cpp b/Escape-the-Dawn/main.cpp similarity index 100% rename from Executable/main.cpp rename to Escape-the-Dawn/main.cpp diff --git a/Executable/Executable.vcxproj b/Executable/Executable.vcxproj deleted file mode 100644 index 55c1a25..0000000 --- a/Executable/Executable.vcxproj +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {A9755CAA-62DC-442D-B82C-F548546CFD38} - Executable - - - - Application - true - v110 - MultiByte - - - Application - false - v110 - true - MultiByte - - - - - - - - - - - - - $(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) - $(SolutionDir)bin\ - $(SolutionName)-$(Configuration) - $(SolutionDir)obj\$(ProjectName)\ - $(BOOST_ROOT)\lib32-msvc-11.0;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86); - - - $(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) - $(SolutionDir)bin\ - $(SolutionName)-$(Configuration) - $(SolutionDir)obj\$(ProjectName)\ - $(BOOST_ROOT)\lib32-msvc-11.0;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86); - - - - Level3 - Disabled - true - GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;DEBUG;_MBCS;%(PreprocessorDefinitions) - - - true - Console - - - - - Level3 - MaxSpeed - true - true - true - GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) - - - true - true - true - - - - - - - - {fe405cfa-8fce-4867-92cf-797e73b36482} - - - - - - \ No newline at end of file diff --git a/Executable/Executable.vcxproj.filters b/Executable/Executable.vcxproj.filters deleted file mode 100644 index 8755a3a..0000000 --- a/Executable/Executable.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/Libraries/glew-1.10.0/lib/Release/Win32/glew32s.lib b/Libraries/glew-1.10.0/lib/Release/Win32/glew32s.lib index 660a427..5beb729 100644 Binary files a/Libraries/glew-1.10.0/lib/Release/Win32/glew32s.lib and b/Libraries/glew-1.10.0/lib/Release/Win32/glew32s.lib differ diff --git a/Tests/Debug/boost_unit_test_framework-vc110-gd-1_55.dll b/Tests/Debug/boost_unit_test_framework-vc110-gd-1_55.dll deleted file mode 100644 index 548d50c..0000000 Binary files a/Tests/Debug/boost_unit_test_framework-vc110-gd-1_55.dll and /dev/null differ diff --git a/Tests/Release/boost_unit_test_framework-vc110-1_55.dll b/Tests/Release/boost_unit_test_framework-vc110-1_55.dll deleted file mode 100644 index 492bd71..0000000 Binary files a/Tests/Release/boost_unit_test_framework-vc110-1_55.dll and /dev/null differ diff --git a/Tests/Tests.vcxproj b/Tests/Tests.vcxproj deleted file mode 100644 index 18b7ec3..0000000 --- a/Tests/Tests.vcxproj +++ /dev/null @@ -1,107 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {B9A8F4AA-BE85-45EA-84DD-652D13DD22BE} - Tests - - - - Application - true - v110 - MultiByte - - - Application - false - v110 - true - MultiByte - - - - - - - - - - - - - $(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) - $(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath) - $(ProjectDir)$(Configuration)\ - $(SolutionDir)obj\$(ProjectName)\ - - - $(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) - $(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath) - $(ProjectDir)$(Configuration)\ - $(SolutionDir)obj\$(ProjectName)\ - - - - Level3 - Disabled - true - - - true - Console - boost_unit_test_framework-vc110-gd-1_55.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - "$(OutDir)$(TargetName)$(TargetExt)" --log_level=test_suite - - - Running tests - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - boost_unit_test_framework-vc110-1_55.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - "$(OutDir)$(TargetName)$(TargetExt)" --log_level=test_suite - - - Running tests - - - - - - - - {fe405cfa-8fce-4867-92cf-797e73b36482} - - - - - - \ No newline at end of file diff --git a/Tests/Tests.vcxproj.filters b/Tests/Tests.vcxproj.filters deleted file mode 100644 index 8755a3a..0000000 --- a/Tests/Tests.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/Tests/main.cpp b/Tests/main.cpp deleted file mode 100644 index fdbaa18..0000000 --- a/Tests/main.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "logging.h" - -#include "World.h" -#include "GameWorld.h" -#include "Components/Transform.h" - -#define BOOST_TEST_MODULE World -#define BOOST_TEST_DYN_LINK -#include - -BOOST_AUTO_TEST_CASE(Parenting) -{ - World world; - - // Parenting - EntityID ent1 = world.CreateEntity(); - BOOST_CHECK(ent1 != 0); // 0 is reserved for world - BOOST_CHECK(ent1 == 1); - BOOST_CHECK(world.GetEntityParent(ent1) == 0); - EntityID ent2 = world.CreateEntity(ent1); - BOOST_CHECK(ent2 != 0); - BOOST_CHECK(ent2 == ent1 + 1); - BOOST_CHECK(world.GetEntityParent(ent2) == ent1); -} - -BOOST_AUTO_TEST_CASE(SceneGraphTraversal) -{ - std::shared_ptr renderer(new Renderer()); - renderer->Initialize(); - GameWorld world(renderer); - - EntityID ent1 = world.CreateEntity(); - auto t1 = world.AddComponent(ent1, "Transform"); - BOOST_REQUIRE(t1 != nullptr); - t1->Position[0] = 1.0f; - t1->Position[1] = 1.0f; - t1->Position[2] = 1.0f; - EntityID ent2 = world.CreateEntity(ent1); - auto t2 = world.AddComponent(ent2, "Transform"); - BOOST_REQUIRE(t2 != nullptr); - t2->Position[0] = 1.0f; - t2->Position[1] = 1.0f; - t2->Position[2] = 1.0f; - - world.Update(0.0); - - LOG_INFO("ent1: %f %f %f", t1->Position[0], t1->Position[1], t1->Position[2]); - LOG_INFO("ent2: %f %f %f", t2->Position[0], t2->Position[1], t2->Position[2]); -} - -BOOST_AUTO_TEST_CASE(Recycling) -{ - World world; - - // EntityID recycling - EntityID ent11 = world.CreateEntity(); // 1 - world.RemoveEntity(ent11); - EntityID ent12 = world.CreateEntity(); // 1 - BOOST_REQUIRE(ent11 == ent12); -} - -BOOST_AUTO_TEST_CASE(ComponentCreation) -{ - World world; - - EntityID ent = world.CreateEntity(); - BOOST_CHECK(world.AddComponent(ent, "Transform") != 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(ent, "String") == "derpfish"); - BOOST_CHECK(world.GetProperty(ent, "Integer") == 123); - BOOST_CHECK(world.GetProperty(ent, "Float") == 0.04f); -} \ No newline at end of file