aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--all.h3
-rw-r--r--game.c5
-rw-r--r--interface.c8
4 files changed, 13 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 0eee797..57b58db 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ LDFLAGS := ./vendor/$(RAYLIB_VER)/lib/libraylib.a -lm
16GAME := bin/stalag 16GAME := bin/stalag
17HEXDUMP := bin/hexdump 17HEXDUMP := bin/hexdump
18PACKER := bin/packer 18PACKER := bin/packer
19SOURCES := main.c map.c game.c player.c 19SOURCES := main.c map.c game.c player.c interface.c
20 20
21ifeq ($(SYSTEM), linux_amd64) 21ifeq ($(SYSTEM), linux_amd64)
22 LDFLAGS += -lX11 22 LDFLAGS += -lX11
diff --git a/all.h b/all.h
index 6c17f7f..ec07c39 100644
--- a/all.h
+++ b/all.h
@@ -138,6 +138,9 @@ void DrawGame(void);
138bool LoadMap(const char *filename); 138bool LoadMap(const char *filename);
139void UnloadMap(void); 139void UnloadMap(void);
140 140
141// Interface
142void DrawCrosshair(void);
143
141// Player 144// Player
142void UpdatePlayer(void); 145void UpdatePlayer(void);
143 146
diff --git a/game.c b/game.c
index 19a1875..dc54ce5 100644
--- a/game.c
+++ b/game.c
@@ -324,10 +324,7 @@ void DrawGame(void) {
324 324
325 EndMode3D(); 325 EndMode3D();
326 326
327 int screenWidth = GetScreenWidth(); 327 DrawCrosshair();
328 int screenHeight = GetScreenHeight();
329 DrawLine(screenWidth / 2 - 10, screenHeight / 2, screenWidth / 2 + 10, screenHeight / 2, GREEN);
330 DrawLine(screenWidth / 2, screenHeight / 2 - 10, screenWidth / 2, screenHeight / 2 + 10, GREEN);
331 328
332 DrawTextEx(game.font_ui, TextFormat("%i FPS", GetFPS()), (Vector2){ 10, 10 }, 20, 2, GREEN); 329 DrawTextEx(game.font_ui, TextFormat("%i FPS", GetFPS()), (Vector2){ 10, 10 }, 20, 2, GREEN);
333 DrawTextEx(game.font_ui, TextFormat("VSync: %s", game.vsync ? "ON" : "OFF"), (Vector2){ 10, 35 }, 20, 2, GREEN); 330 DrawTextEx(game.font_ui, TextFormat("VSync: %s", game.vsync ? "ON" : "OFF"), (Vector2){ 10, 35 }, 20, 2, GREEN);
diff --git a/interface.c b/interface.c
new file mode 100644
index 0000000..a376ed2
--- /dev/null
+++ b/interface.c
@@ -0,0 +1,8 @@
1#include "all.h"
2
3void DrawCrosshair(void) {
4 int screenWidth = GetScreenWidth();
5 int screenHeight = GetScreenHeight();
6 DrawLine(screenWidth / 2 - 10, screenHeight / 2, screenWidth / 2 + 10, screenHeight / 2, GREEN);
7 DrawLine(screenWidth / 2, screenHeight / 2 - 10, screenWidth / 2, screenHeight / 2 + 10, GREEN);
8}