46 lines
987 B
C++
46 lines
987 B
C++
#define CUTE_C2_IMPLEMENTATION
|
|
#define CUTE_GL_IMPLEMENTATION
|
|
#define CUTE_ANI_IMPLEMENTATION
|
|
#include "game.h"
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
Game* game = nullptr;
|
|
int main()
|
|
{
|
|
|
|
game = new Game(1920, 1080, "Game");
|
|
|
|
float deltaTime = 0.0f;
|
|
float oldTime = 0.0f;
|
|
|
|
game->init();
|
|
|
|
// Main loop
|
|
while (!glfwWindowShouldClose(game->getWindow())) {
|
|
float newTime = glfwGetTime();
|
|
deltaTime = newTime - oldTime;
|
|
if (deltaTime > 0.1f) { deltaTime = 0.1f; }
|
|
oldTime = newTime;
|
|
game->handleEvents(deltaTime);
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
glClearColor(0.35f, 0.7f, 1.0f, 1.0f);
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
game->renderImgui();
|
|
game->render();
|
|
|
|
glfwSwapBuffers(game->getWindow());
|
|
glfwPollEvents();
|
|
}
|
|
ImGui_ImplOpenGL3_Shutdown();
|
|
ImGui_ImplGlfw_Shutdown();
|
|
ImGui::DestroyContext();
|
|
|
|
glfwDestroyWindow(game->getWindow());
|
|
glfwTerminate();
|
|
delete game;
|
|
} |