Create const variables for window dimensions
This commit is contained in:
parent
590982cde3
commit
74ac6aec9a
|
@ -8,7 +8,7 @@
|
|||
|
||||
class Scene {
|
||||
public:
|
||||
Scene();
|
||||
Scene(int width, int height);
|
||||
~Scene();
|
||||
|
||||
void Init();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -29,8 +29,9 @@ const std::string kFragmentShaderPath = "shaders/fragment.glsl";
|
|||
|
||||
} // namespace
|
||||
|
||||
Scene::Scene() : window_width(1280),
|
||||
window_height(720),
|
||||
Scene::Scene(int width, int height)
|
||||
: window_width(width),
|
||||
window_height(height),
|
||||
shader_program_(-1),
|
||||
vao_(-1),
|
||||
angle_(0.0f),
|
||||
|
@ -38,7 +39,7 @@ Scene::Scene() : window_width(1280),
|
|||
aspect_(1280.0f / 720.0f),
|
||||
near_z_(0.1f), far_z_(100.0f),
|
||||
fov_(glm::pi<float>() / 4.0f)
|
||||
{};
|
||||
{}
|
||||
|
||||
Scene::~Scene() {
|
||||
glDeleteProgram(shader_program_);
|
||||
|
|
Loading…
Reference in New Issue