diff --git a/Escape-the-Dawn.sln b/Escape-the-Dawn.sln index db93554..75bbb7b 100644 --- a/Escape-the-Dawn.sln +++ b/Escape-the-Dawn.sln @@ -5,6 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Escape-the-Dawn", "Escape-t EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tests", "Tests\Tests.vcxproj", "{B9A8F4AA-BE85-45EA-84DD-652D13DD22BE}" 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 @@ -19,6 +21,10 @@ Global {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/Engine.h b/Escape-the-Dawn/Engine.h new file mode 100644 index 0000000..a93eb0f --- /dev/null +++ b/Escape-the-Dawn/Engine.h @@ -0,0 +1,63 @@ +#include +#include + +#include +#define GLFW_INCLUDE_GLU +#include +#include + +#include "logging.h" +#include "glerror.h" + +#include "World.h" + +class Engine +{ +public: + Engine(int argc, char* argv[]) + { + // Initialize GLFW + if (!glfwInit()) { + LOG_ERROR("GLFW: Initialization failed"); + exit(EXIT_FAILURE); + } + + // Create a window + m_Window = glfwCreateWindow(1280, 720, "OpenGL", nullptr, nullptr); + if (!m_Window) { + LOG_ERROR("GLFW: Failed to create window"); + exit(EXIT_FAILURE); + } + glfwMakeContextCurrent(m_Window); + + // GL version info + glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]); + glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]); + glVendor = (GLchar*)glGetString(GL_VENDOR); + std::stringstream ss; + ss << glVendor << " OpenGL " << glVersion[0] << "." << glVersion[1]; +#ifdef DEBUG + ss << " DEBUG"; +#endif + LOG_INFO(ss.str().c_str()); + glfwSetWindowTitle(m_Window, ss.str().c_str()); + + // Initialize GLEW + if (glewInit() != GLEW_OK) { + LOG_ERROR("GLEW: Initialization failed"); + exit(EXIT_FAILURE); + } + } + + bool Running() const { return !glfwWindowShouldClose(m_Window); } + + void Tick() + { + glfwPollEvents(); + } + +private: + GLFWwindow* m_Window; + GLint glVersion[2]; + GLchar* glVendor; +}; \ No newline at end of file diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj b/Escape-the-Dawn/Escape-the-Dawn.vcxproj index 26d0e12..5ef1ca6 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj @@ -16,13 +16,13 @@ - Application + StaticLibrary true MultiByte v110 - Application + StaticLibrary false true MultiByte @@ -42,7 +42,7 @@ $(SolutionDir)\Libraries\glew-1.10.0\lib\Debug\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Debug;$(LibraryPath) $(SolutionDir)bin\ - $(SolutionDir)build\$(Configuration)\ + $(SolutionDir)obj\$(ProjectName)\ $(ProjectName)-$(Configuration) $(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) @@ -52,7 +52,7 @@ $(SolutionDir)\Libraries\glew-1.10.0\lib\Release\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Release;$(LibraryPath) $(SolutionDir)bin\ - $(SolutionDir)build\$(Configuration)\ + $(SolutionDir)obj\$(ProjectName)\ $(ProjectName)-$(Configuration) @@ -69,6 +69,12 @@ + + opengl32.lib;glu32.lib;glew32sd.lib;glfw3.lib + + + + @@ -86,8 +92,12 @@ true opengl32.lib;glu32.lib;glew32s.lib;glfw3.lib;%(AdditionalDependencies) + + opengl32.lib;glu32.lib;glew32s.lib;glfw3.lib; + + diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters index e38c793..bec9a08 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters @@ -26,6 +26,7 @@ Systems + diff --git a/Escape-the-Dawn/main.cpp b/Escape-the-Dawn/main.cpp index c9bc467..bc7063c 100644 --- a/Escape-the-Dawn/main.cpp +++ b/Escape-the-Dawn/main.cpp @@ -1,62 +1,62 @@ -#include -#include - -#include -#define GLFW_INCLUDE_GLU -#include -#include - -#include "logging.h" -#include "glerror.h" - -#include "World.h" - -GLFWwindow* window; -GLint glVersion[2]; -GLchar* glVendor; - -int main(int argc, char* argv[]) -{ - // Initialize GLFW - if (!glfwInit()) - { - LOG_ERROR("GLFW: Initialization failed"); - return 1; - } - - // Create a window - window = glfwCreateWindow(1280, 720, "OpenGL", nullptr, nullptr); - if (!window) - { - LOG_ERROR("GLFW: Failed to create window"); - return 1; - } - glfwMakeContextCurrent(window); - - // GL version info - glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]); - glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]); - glVendor = (GLchar*)glGetString(GL_VENDOR); - std::stringstream ss; - ss << glVendor << " OpenGL " << glVersion[0] << "." << glVersion[1]; -#ifdef DEBUG - ss << " DEBUG"; -#endif - LOG_INFO(ss.str().c_str()); - glfwSetWindowTitle(window, ss.str().c_str()); - - // Initialize GLEW - if (glewInit() != GLEW_OK) - { - LOG_ERROR("GLEW: Initialization failed"); - return 1; - } - - // Main loop - while (!glfwWindowShouldClose(window)) - { - glfwPollEvents(); - } - - return 0; -} \ No newline at end of file +//#include +//#include +// +//#include +//#define GLFW_INCLUDE_GLU +//#include +//#include +// +//#include "logging.h" +//#include "glerror.h" +// +//#include "World.h" +// +//GLFWwindow* window; +//GLint glVersion[2]; +//GLchar* glVendor; +// +//int main(int argc, char* argv[]) +//{ +// // Initialize GLFW +// if (!glfwInit()) +// { +// LOG_ERROR("GLFW: Initialization failed"); +// return 1; +// } +// +// // Create a window +// window = glfwCreateWindow(1280, 720, "OpenGL", nullptr, nullptr); +// if (!window) +// { +// LOG_ERROR("GLFW: Failed to create window"); +// return 1; +// } +// glfwMakeContextCurrent(window); +// +// // GL version info +// glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]); +// glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]); +// glVendor = (GLchar*)glGetString(GL_VENDOR); +// std::stringstream ss; +// ss << glVendor << " OpenGL " << glVersion[0] << "." << glVersion[1]; +//#ifdef DEBUG +// ss << " DEBUG"; +//#endif +// LOG_INFO(ss.str().c_str()); +// glfwSetWindowTitle(window, ss.str().c_str()); +// +// // Initialize GLEW +// if (glewInit() != GLEW_OK) +// { +// LOG_ERROR("GLEW: Initialization failed"); +// return 1; +// } +// +// // Main loop +// while (!glfwWindowShouldClose(window)) +// { +// glfwPollEvents(); +// } +// +// return 0; +//} \ No newline at end of file diff --git a/Executable/Executable.vcxproj b/Executable/Executable.vcxproj new file mode 100644 index 0000000..249515e --- /dev/null +++ b/Executable/Executable.vcxproj @@ -0,0 +1,90 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {A9755CAA-62DC-442D-B82C-F548546CFD38} + Executable + + + + Application + true + v110 + MultiByte + + + Application + false + v110 + true + MultiByte + + + + + + + + + + + + + $(SolutionDir)\Escape-the-Dawn;$(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)\ + + + $(SolutionDir)\Escape-the-Dawn;$(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)\ + + + + Level3 + Disabled + true + GLEW_STATIC;DEBUG;_MBCS;%(PreprocessorDefinitions) + + + true + + + + + Level3 + MaxSpeed + true + true + true + GLEW_STATIC;_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 new file mode 100644 index 0000000..8755a3a --- /dev/null +++ b/Executable/Executable.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {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/Executable/main.cpp b/Executable/main.cpp new file mode 100644 index 0000000..8b6c4e5 --- /dev/null +++ b/Executable/main.cpp @@ -0,0 +1,10 @@ +#include "Engine.h" + +int main(int argc, char* argv[]) +{ + Engine engine(argc, argv); + while (engine.Running()) + engine.Tick(); + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/Tests/Tests.vcxproj b/Tests/Tests.vcxproj index b6294b2..75763b5 100644 --- a/Tests/Tests.vcxproj +++ b/Tests/Tests.vcxproj @@ -42,11 +42,13 @@ $(SolutionDir)\Escape-the-Dawn\;$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(BOOST_ROOT);$(IncludePath) $(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath) $(ProjectDir)$(Configuration)\ + $(SolutionDir)obj\$(ProjectName)\ $(SolutionDir)\Escape-the-Dawn\;$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(BOOST_ROOT);$(IncludePath) $(BOOST_ROOT)\lib32-msvc-11.0;$(LibraryPath) $(ProjectDir)$(Configuration)\ + $(SolutionDir)obj\$(ProjectName)\ @@ -83,11 +85,6 @@ {fe405cfa-8fce-4867-92cf-797e73b36482} - true - true - false - true - false diff --git a/Tests/main.cpp b/Tests/main.cpp index bc0a4f0..4668e93 100644 --- a/Tests/main.cpp +++ b/Tests/main.cpp @@ -1,5 +1,5 @@ #include "World.h" -#include "Components/Transform.h" +#include "Components/TransformComponent.h" #define BOOST_TEST_MODULE World #define BOOST_TEST_DYN_LINK