aboutsummaryrefslogtreecommitdiff
path: root/menu.c
blob: c1db1f71dce9cc0872522917b8d9dbf07cdd4f43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "all.h"

void UpdateMenu(void) {
	if (IsKeyPressed(KEY_ENTER)) {
		if (LoadMap(game.map_path)) {
			game.mode = STATE_PLAYING;
			game.cursor_captured = true;
			DisableCursor();
		}
	}
}

void DrawMenu(void) {
	BeginDrawing();
	ClearBackground(BLACK);

	int screenWidth = GetScreenWidth();
	int screenHeight = GetScreenHeight();

	const char *title = "STALAG";
	const char *sub = "Press ENTER to Start";

	int titleSize = 60;
	int subSize = 20;

	Vector2 titlePos = { 
		(float)(screenWidth - MeasureTextEx(game.font_ui, title, (float)titleSize, 4).x) / 2, 
		(float)screenHeight / 2 - 40 
	};
	Vector2 subPos = { 
		(float)(screenWidth - MeasureTextEx(game.font_ui, sub, (float)subSize, 2).x) / 2, 
		(float)screenHeight / 2 + 40 
	};

	DrawTextEx(game.font_ui, title, titlePos, (float)titleSize, 4, WHITE);
	DrawTextEx(game.font_ui, sub, subPos, (float)subSize, 2, GRAY);

	EndDrawing();
}