initial commit

This commit is contained in:
izenynn
2025-02-17 21:05:45 +01:00
commit 06623aeb64
282 changed files with 113292 additions and 0 deletions

54
src/main.cpp Normal file
View File

@@ -0,0 +1,54 @@
#ifdef _MSC_VER
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#endif
#include "../lib/glfw/glfw3.h"
#include <iostream>
#include <vector>
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 600
int main() {
// init glfw
if ( !glfwInit() ) {
std::cout << "could not initialize glfw" << std::endl;
return -1;
}
// create window
//glfwWindowHint(GLFW_RESIZABLE, false);
glfwWindowHint(GLFW_SAMPLES, 8);
GLFWwindow* win = glfwCreateWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "", nullptr, nullptr);
if (!win) {
std::cout << "could not create opengl window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(win);
// main loop
float angle = 0;
double lastTime = glfwGetTime();
while ( !glfwWindowShouldClose(win) && !glfwGetKey(win, GLFW_KEY_ESCAPE) ) {
// get delta time
float deltaTime = static_cast<float>(glfwGetTime() - lastTime);
lastTime = glfwGetTime();
// get window size
int screenWidth, screenHeight;
glfwGetWindowSize(win, &screenWidth, &screenHeight);
// refresh screen
glfwSwapBuffers(win);
glfwPollEvents();
}
// shutdown
glfwTerminate();
}