Commit 28a3711c authored by Valentin Bartschies's avatar Valentin Bartschies
Browse files

Add game.h

parent b5329cf4
build/
.vscode/settings.json
  • Eigentlich sollten die Projektdateien alle in dem build/ Ordner sein

  • Keine Ahnung, das wurde von VS code irgendwie da erstellt deswegen hab ich das erstmal zum gitignore dazugetan, dass ich das nicht mit pushe.

Please register or sign in to reply
#pragma once
void initGame();
void drawGame();
void calcGame();
\ No newline at end of file
......@@ -20,18 +20,27 @@ int main() {
enum { MENU, GAME } state = MENU;
initMenu();
initGame();
while (!WindowShouldClose()) {
if (IsKeyPressed(KEY_F11)) {
ToggleFullscreen();
}
if (IsKeyPressed(KEY_ENTER) && state == MENU) {
state = GAME;
} // Enter to start the game when in menu
if (IsKeyPressed(KEY_BACKSPACE) && state == GAME) {
state = MENU;
} // Backspace to go back to the menu
float scale = min((float) GetScreenWidth() / GAME_SCREEN_WIDTH, (float) GetScreenHeight() / GAME_SCREEN_HEIGHT);
if (state == MENU) {
calcMenu();
} else if (state == GAME) {
// todo
calcGame();
}
BeginDrawing();
......@@ -40,7 +49,7 @@ int main() {
if (state == MENU) {
drawMenu();
} else if (state == GAME) {
// todo
drawGame();
}
EndTextureMode();
......
......@@ -37,9 +37,11 @@ void calcMenu() {
if (IsKeyPressed(KEY_BACKSPACE) && letterCount > 0) {
name[--letterCount] = 0;
}
}
void drawMenu() {
ClearBackground(BLACK); // To clear the screen when you go back into the menu
DrawText("PLAY", playBtnPos.x, playBtnPos.y, PLAY_FONT_SIZE, RED);
DrawRectangleRec(inputBox, LIGHTGRAY);
DrawRectangleLines(inputBox.x, inputBox.y, inputBox.width, inputBox.height, RED);
......
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