commit 2a7bbf9e6b4a9d898f0be87aa5bac445d1d6aee6 Author: Dominik Madarász Date: Sun Jan 10 13:23:11 2021 +0100 Meta: skeleton raylib diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fcb6a2f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b666055 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.15) +project(eco2d) + +find_package(raylib 3.5 QUIET) + +if (NOT raylib_FOUND) + include(FetchContent) + + FetchContent_Declare( + raylib + URL https://github.com/raysan5/raylib/archive/master.tar.gz + ) + + FetchContent_GetProperties(raylib) + if (NOT raylib_POPULATED) + set(FETCHCONTENT_QUIET NO) + FetchContent_Populate(raylib) + + set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + + # build raylib + add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR}) + endif() +endif() + + +set(CMAKE_C_STANDARD 11) + +add_executable(eco2d code/apps/client/main.c) + +target_link_libraries(eco2d raylib) diff --git a/code/apps/client/main.c b/code/apps/client/main.c new file mode 100644 index 0000000..3eecc8c --- /dev/null +++ b/code/apps/client/main.c @@ -0,0 +1,41 @@ +#include "raylib.h" + +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + //-------------------------------------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + // TODO: Update your variables here + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; +}