|
|
|
|
@ -24,6 +24,8 @@ int main(){
|
|
|
|
|
// TODO: Screen structs, die zum Beispiel die UiContainer enthalten?
|
|
|
|
|
UiContainer *pauseScreenUiContainer = UiContainerInitPauseUiContainer();
|
|
|
|
|
|
|
|
|
|
UiContainer *mainMenuScreenUiContainer = UiContainerInitMainMenuUiContainer();
|
|
|
|
|
|
|
|
|
|
// Hides the operating systems own cursor
|
|
|
|
|
HideCursor();
|
|
|
|
|
|
|
|
|
|
@ -37,58 +39,57 @@ int main(){
|
|
|
|
|
game->cursorSprite->y = GetMousePosition().y;
|
|
|
|
|
|
|
|
|
|
BeginDrawing();
|
|
|
|
|
ClearBackground(RAYWHITE);
|
|
|
|
|
switch(game->screen){
|
|
|
|
|
case SCREEN_EXIT:
|
|
|
|
|
printf("EXIT \n");
|
|
|
|
|
return 0;
|
|
|
|
|
case SCREEN_MAINMENU:
|
|
|
|
|
printf("MAINMENU \n");
|
|
|
|
|
return 0;
|
|
|
|
|
// MainMenu hat aktuell nur paar Buttons
|
|
|
|
|
UiContainerUpdateUiContainer(mainMenuScreenUiContainer, game);
|
|
|
|
|
UiContainerDrawUiContainer(mainMenuScreenUiContainer);
|
|
|
|
|
break;
|
|
|
|
|
case SCREEN_OPTIONS:
|
|
|
|
|
printf("OPTIONS \n");
|
|
|
|
|
return 0;
|
|
|
|
|
case SCREEN_GAME:
|
|
|
|
|
|
|
|
|
|
// Updating Sprites
|
|
|
|
|
ListActAllSprites(game);
|
|
|
|
|
|
|
|
|
|
ClearBackground(RAYWHITE);
|
|
|
|
|
|
|
|
|
|
BeginMode2D(*(game->camera));
|
|
|
|
|
|
|
|
|
|
//IsometricRendererRenderIsometricMap(game);
|
|
|
|
|
//ListDrawAllSprites(game->sprites, game->layers, game->camera);
|
|
|
|
|
// Drawing IsometricMap
|
|
|
|
|
BeginMode2D(*(game->camera)); // Sorgt dafür, dass die Kameraposition beachtet wird
|
|
|
|
|
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));
|
|
|
|
|
// Still drawing isometric map, which is not updated atm
|
|
|
|
|
BeginMode2D(*(game->camera)); // Sorgt dafür, dass die Kameraposition beachtet wird
|
|
|
|
|
IsometricMapDraw(game);
|
|
|
|
|
EndMode2D();
|
|
|
|
|
|
|
|
|
|
// darkened background + "Paused" Text
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
// Button / UI stuff
|
|
|
|
|
UiContainerUpdateUiContainer(pauseScreenUiContainer, game);
|
|
|
|
|
UiContainerDrawUiContainer(pauseScreenUiContainer);
|
|
|
|
|
|
|
|
|
|
// Debug Menu
|
|
|
|
|
DebugDraw(game, pauseScreenUiContainer);
|
|
|
|
|
|
|
|
|
|
DrawSpriteToScreen(game->cursorSprite);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(IsKeyPressed(KEY_P)){
|
|
|
|
|
game->screen = SCREEN_GAME;
|
|
|
|
|
}
|
|
|
|
|
@ -98,9 +99,11 @@ int main(){
|
|
|
|
|
return 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
BeginDrawing();
|
|
|
|
|
// Dinge die grundsätzlich immer gedrawed werden sollen
|
|
|
|
|
// Debug Menu, FPS anzeige, Cursor
|
|
|
|
|
DebugDraw(game, pauseScreenUiContainer);
|
|
|
|
|
DrawFPS(GetScreenWidth() - 95, 10);
|
|
|
|
|
DrawSpriteToScreen(game->cursorSprite);
|
|
|
|
|
EndDrawing();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|