From fb8d6348b422222915f159b3c98f1e24d31445f7 Mon Sep 17 00:00:00 2001 From: miaurizius Date: Sun, 12 Apr 2026 21:47:11 +0200 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ CMakeLists.txt | 14 ++++++++++++++ src/main.cpp | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8b1aab2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +cmake-build-debug \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3a3b204 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 4.2) +project(Cinecraft) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED on) + +find_package(SDL3 REQUIRED) + +add_executable(app src/main.cpp) + +target_link_libraries(app PRIVATE SDL3::SDL3 GL) \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..aff8520 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,36 @@ +#include +#include + +int main() { + SDL_Init(SDL_INIT_VIDEO); + + SDL_Window* window = SDL_CreateWindow( + "Cinecraft", + 800, 600, + SDL_WINDOW_OPENGL + ); + + SDL_GLContext context = SDL_GL_CreateContext(window); + + bool running = true; + SDL_Event e; + + while (running) { + while (SDL_PollEvent(&e)) { + if (e.type == SDL_EVENT_QUIT) { + running = false; + } + } + + glClearColor(0.1f, 0.2f, 0.3f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + + SDL_GL_SwapWindow(window); + } + + SDL_GL_DestroyContext(context); + SDL_DestroyWindow(window); + SDL_Quit(); + + return 0; +} \ No newline at end of file