#include "raylib.h" #include "string.h" #include #include #include "sprite.h" #include "Input/inputHandler.h" #include "raymath.h" #include "List/list.h" #include "IsometricMap/isometricMap.h" #include "game.h" #include "DepthSorting/bucket.h" #include "DepthSorting/mergeSort.h" #include "Ui/screenIDs.h" #include "Ui/button.h" #include "Ui/uiContainer.h" #include "Ui/debug.h" int main(){ InitWindow(1280, 720, "basic window"); Game *game = GameInit(); // TODO: Screen structs, die zum Beispiel die UiContainer enthalten? UiContainer *pauseScreenUiContainer = UiContainerInitPauseUiContainer(); // Hides the operating systems own cursor HideCursor(); SetTargetFPS(60); while(!WindowShouldClose()){ // Moving cursor Sprite to Mouse Pos game->cursorSprite->x = GetMousePosition().x; game->cursorSprite->y = GetMousePosition().y; BeginDrawing(); switch(game->screen){ case SCREEN_EXIT: return 0; case SCREEN_MAINMENU: printf("MAINMENU \n"); return 0; case SCREEN_OPTIONS: printf("OPTIONS \n"); return 0; case SCREEN_GAME: ListActAllSprites(game); ClearBackground(RAYWHITE); BeginMode2D(*(game->camera)); //IsometricRendererRenderIsometricMap(game); //ListDrawAllSprites(game->sprites, game->layers, game->camera); IsometricMapDraw(game); EndMode2D(); DrawSpriteToScreen(game->cursorSprite); // User Input Handling mouseInput(game); keyboardInput(game->inputHandler, game->camera); if(IsKeyPressed(KEY_P)){ game->screen = SCREEN_PAUSE; } break; case SCREEN_PAUSE: ClearBackground(RAYWHITE); BeginMode2D(*(game->camera)); IsometricMapDraw(game); EndMode2D(); DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), (Color){0, 0, 0, 150}); int textWidthHalf = MeasureText("Paused", 28) / 2; DrawText("Paused", GetScreenWidth()/2 - textWidthHalf, GetScreenHeight()/2 - 14, 28, WHITE); UiContainerUpdateUiContainer(pauseScreenUiContainer, game); UiContainerDrawUiContainer(pauseScreenUiContainer); DebugDraw(game, pauseScreenUiContainer); DrawSpriteToScreen(game->cursorSprite); if(IsKeyPressed(KEY_P)){ game->screen = SCREEN_GAME; } break; default: printf("\n\n\n\n\n\n Wir haben ein problematisches Problem! Die Screen-ID [%d] ist nicht definiert. Hmmpf... früher bescheid wisse!\n\n\n\n\n\n", game->screen); return 1; break; } BeginDrawing(); DebugDraw(game, pauseScreenUiContainer); DrawFPS(GetScreenWidth() - 95, 10); EndDrawing(); } CloseWindow(); return 0; }