Restructured solution. "Escape-The-Dawn" now links into a .lib, which is used in "Executable" to facilitate easier unit testing.

This commit is contained in:
2014-03-06 18:57:12 +01:00
parent 5a15491573
commit b87b1f5704
10 changed files with 271 additions and 72 deletions
+63
View File
@@ -0,0 +1,63 @@
#include <string>
#include <sstream>
#include <GL/glew.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <glext.h>
#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;
};
+14 -4
View File
@@ -16,13 +16,13 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
@@ -42,7 +42,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(SolutionDir)\Libraries\glew-1.10.0\lib\Debug\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Debug;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)bin\</OutDir>
<IntDir>$(SolutionDir)build\$(Configuration)\</IntDir>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
<TargetName>$(ProjectName)-$(Configuration)</TargetName>
<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>
@@ -52,7 +52,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(SolutionDir)\Libraries\glew-1.10.0\lib\Release\Win32;$(SolutionDir)\Libraries\glfw-3.0.4\lib\Release;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)bin\</OutDir>
<IntDir>$(SolutionDir)build\$(Configuration)\</IntDir>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
<TargetName>$(ProjectName)-$(Configuration)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -69,6 +69,12 @@
</Link>
<PostBuildEvent />
<PostBuildEvent />
<Lib>
<AdditionalDependencies>opengl32.lib;glu32.lib;glew32sd.lib;glfw3.lib</AdditionalDependencies>
<ForceSymbolReferences>
</ForceSymbolReferences>
</Lib>
<ProjectReference />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -86,8 +92,12 @@
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>opengl32.lib;glu32.lib;glew32s.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Lib>
<AdditionalDependencies>opengl32.lib;glu32.lib;glew32s.lib;glfw3.lib;</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Engine.h" />
<ClCompile Include="main.cpp" />
<ClCompile Include="Model.cpp" />
<ClCompile Include="Renderer\Renderer.cpp" />
@@ -26,6 +26,7 @@
<Filter>Systems</Filter>
</ClCompile>
<ClCompile Include="Model.cpp" />
<ClCompile Include="Engine.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Component.h" />
+62 -62
View File
@@ -1,62 +1,62 @@
#include <string>
#include <sstream>
#include <GL/glew.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <glext.h>
#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;
}
//#include <string>
//#include <sstream>
//
//#include <GL/glew.h>
//#define GLFW_INCLUDE_GLU
//#include <GLFW/glfw3.h>
//#include <glext.h>
//
//#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;
//}