Commit ca8d4ac6 authored by Max Kobelt's avatar Max Kobelt
Browse files
parent 84e41ff8
cmake_minimum_required(VERSION 3.13)
project("Space Intruders" VERSION 0.1.0)
cmake_minimum_required(VERSION 3.11) # FetchContent is available in 3.11+
project("SpaceIntruders" VERSION 0.1.0)
add_executable(SpaceIntruders main.c)
\ No newline at end of file
# Set this to the minimal version you want to support
find_package(raylib 2.5 QUIET) # Let CMake search for a raylib-config.cmake
# You could change the QUIET above to REQUIRED and remove this if() clause
# This part downloads raylib and builds it if it's not installed on your system
if (NOT raylib_FOUND) # If there's none, fetch and build raylib
include(FetchContent)
FetchContent_Declare(
raylib
URL https://github.com/raysan5/raylib/archive/master.tar.gz
)
FetchContent_GetProperties(raylib)
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
set(FETCHCONTENT_QUIET NO)
FetchContent_Populate(raylib)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # or games
# build raylib
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
endif()
endif()
# This is the main part:
add_executable(${PROJECT_NAME} main.c)
#set(raylib_VERBOSE 1)
target_link_libraries(${PROJECT_NAME} raylib)
#include <stdio.h>
#include <stdlib.h>
#include <raylib.h>
#include <stddef.h>
int main() {
const size_t screenWidth = 800, screenHeight = 450;
InitWindow(screenWidth, screenHeight, "Space Intruders");
SetTargetFPS(60);
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
}
CloseWindow();
return 0;
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment