From 920157796a2e381d35ba97c15d58ea77eae60a72 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Sun, 24 May 2026 20:10:04 +0200 Subject: Project setup --- .clang-format | 9 +++++++++ .clangd | 2 ++ .gitattributes | 9 +++++++++ .gitignore | 8 ++++++++ CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ src/main.cpp | 26 ++++++++++++++++++++++++++ 6 files changed, 89 insertions(+) create mode 100644 .clang-format create mode 100644 .clangd create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 src/main.cpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..3857289 --- /dev/null +++ b/.clang-format @@ -0,0 +1,9 @@ +BasedOnStyle: GNU + +ColumnLimit: 100 +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +PointerAlignment: Left +BreakBeforeBraces: Allman +SpaceBeforeParens: ControlStatements \ No newline at end of file diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..5a804e9 --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + CompilationDatabase: build \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3ca65aa --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# Asset files should be treated by git as binary +*.png binary +*.jpg binary +*.ttf binary +*.mp3 binary +*.wav binary +*.raw binary +*.obj binary +*.gltf binary \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7493ec2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.idea/ +.vscode/ +.vs/ +cmake-build-debug/ +bin/ +build/ +out/ +CMakeSettings.json \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..fea8201 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.22) +project(my_raylib_game CXX) +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) + +if (MSVC) + add_compile_options(/W4) +else() + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +include(FetchContent) +set(FETCHCONTENT_QUIET FALSE) +set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) +set(BUILD_GAMES OFF CACHE BOOL "" FORCE) + +FetchContent_Declare( + raylib + GIT_REPOSITORY "https://github.com/raysan5/raylib.git" + GIT_TAG "master" + GIT_PROGRESS TRUE +) + +FetchContent_MakeAvailable(raylib) + +file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp") +set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/src/") + +add_executable(${PROJECT_NAME}) +target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES}) +target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE}) +target_link_libraries(${PROJECT_NAME} PRIVATE raylib) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..c2e66a5 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,26 @@ +#include "raylib.h" + +#define SCREEN_WIDTH (800) +#define SCREEN_HEIGHT (450) +#define WINDOW_TITLE "Hello World" + +int +main(void) +{ + InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, WINDOW_TITLE); + SetTargetFPS(60); + + while (!WindowShouldClose()) + { + BeginDrawing(); + + ClearBackground(RAYWHITE); + DrawText("Hello world!", 10, 10, 20, BLACK); + + EndDrawing(); + } + + CloseWindow(); + + return 0; +} -- cgit v1.2.3