diff --git a/include/scene.h b/include/scene.h index 48dc117..24bb610 100644 --- a/include/scene.h +++ b/include/scene.h @@ -8,7 +8,7 @@ class Scene { public: - Scene(); + Scene(int width, int height); ~Scene(); void Init(); diff --git a/source/main.cpp b/source/main.cpp index c62dbfd..3889708 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -39,6 +39,9 @@ namespace { +const int kInitWindowWidth = 1280; +const int kInitWindowHeight = 720; + const int kTargetFps = 60; const auto kFrameDuration = std::chrono::milliseconds(1000 / kTargetFps); @@ -55,7 +58,7 @@ GLFWwindow* CreateGlfwWindow() { glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); #endif - GLFWwindow* window = glfwCreateWindow(1280, 720, "TerraVisor", nullptr, nullptr); + GLFWwindow* window = glfwCreateWindow(kInitWindowWidth, kInitWindowHeight, "TerraVisor", nullptr, nullptr); if (!window) { std::cerr << "Failed to create GLFW window" << std::endl; glfwTerminate(); @@ -123,7 +126,7 @@ int main() { if (!InitializeGlew()) return -1; - Scene scene; + Scene scene(kInitWindowWidth, kInitWindowHeight); scene.Init(); InitializeImGui(window); diff --git a/source/scene.cpp b/source/scene.cpp index 8853efc..8897473 100644 --- a/source/scene.cpp +++ b/source/scene.cpp @@ -29,16 +29,17 @@ const std::string kFragmentShaderPath = "shaders/fragment.glsl"; } // namespace -Scene::Scene() : window_width(1280), - window_height(720), - shader_program_(-1), - vao_(-1), - angle_(0.0f), - scale_(1.0f), - aspect_(1280.0f / 720.0f), - near_z_(0.1f), far_z_(100.0f), - fov_(glm::pi() / 4.0f) - {}; +Scene::Scene(int width, int height) + : window_width(width), + window_height(height), + shader_program_(-1), + vao_(-1), + angle_(0.0f), + scale_(1.0f), + aspect_(1280.0f / 720.0f), + near_z_(0.1f), far_z_(100.0f), + fov_(glm::pi() / 4.0f) +{} Scene::~Scene() { glDeleteProgram(shader_program_);