summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-12-10 17:05:01 +0500
committerilotterytea <iltsu@alright.party>2024-12-10 17:05:01 +0500
commit6b7805045f943b92ca6d6239be600e6583bd982d (patch)
tree1ba72329c33e15a31fc3008969abe1d784e63c86
parent9debcbabad69fb449655b39ca5010b1637d4cc41 (diff)
feat: raylib initialization
-rw-r--r--CMakeLists.txt15
-rw-r--r--src/main.c15
2 files changed, 28 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e2f4b00..f20b02d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,3 +23,18 @@ file(GLOB_RECURSE SRC_FILES "src/*.c" "src/*.h")
target_sources(Hyperspace PRIVATE ${SRC_FILES})
+# raylib
+find_package(raylib QUIET)
+if (NOT raylib_FOUND)
+ include(FetchContent)
+ FetchContent_Declare(
+ raylib
+ GIT_REPOSITORY https://github.com/raysan5/raylib.git
+ GIT_TAG 5.0
+ GIT_SHALLOW 1
+ )
+ FetchContent_MakeAvailable(raylib)
+endif()
+
+target_link_libraries(Hyperspace PRIVATE raylib)
+
diff --git a/src/main.c b/src/main.c
index 5368eae..7c5fcbf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,17 @@
-#include <stdio.h>
+#include "raylib.h"
int main(int argc, char *argv[]) {
- printf("hi world!\n");
+ InitWindow(800, 600, "hyperspace (demo)");
+
+ SetTargetFPS(60);
+
+ while (!WindowShouldClose()) {
+ BeginDrawing();
+ ClearBackground(WHITE);
+ DrawText("hi world!", GetScreenWidth() / 2.0 - 16 * 4,
+ GetScreenHeight() / 2.0 - 16, 32, BLACK);
+ EndDrawing();
+ }
+
return 0;
}