diff --git a/Ui/screenIDs.h b/Ui/screenIDs.h new file mode 100644 index 0000000..bf95efd --- /dev/null +++ b/Ui/screenIDs.h @@ -0,0 +1,10 @@ +#ifndef BUTTONIDS_H_ +#define BUTTONIDS_H_ + +#define SCREEN_EXIT 0 +#define SCREEN_MAINMENU 1 +#define SCREEN_OPTIONS 2 +#define SCREEN_GAME 3 +#define SCREEN_PAUSE 4 + +#endif \ No newline at end of file diff --git a/animation.o b/animation.o new file mode 100644 index 0000000..75e4a75 Binary files /dev/null and b/animation.o differ diff --git a/animationHandler.o b/animationHandler.o new file mode 100644 index 0000000..21f4c01 Binary files /dev/null and b/animationHandler.o differ diff --git a/bucket.o b/bucket.o new file mode 100644 index 0000000..b9b0c0a Binary files /dev/null and b/bucket.o differ diff --git a/game.c b/game.c index b57fe37..88940df 100644 --- a/game.c +++ b/game.c @@ -7,6 +7,7 @@ #include "IsometricMap/isometricMap.h" #include "Textures/textureatlas.h" #include "stdio.h" +#include "Ui/screenIDs.h" // returns pointer to new Game instance Game *GameInit() @@ -30,6 +31,8 @@ Game *GameInit() game->inputHandler->cursorTextures = game->textures->cursorTextures; game->inputHandler->cursorSprite = game->cursorSprite; + game->screen = SCREEN_GAME; + game->camera = malloc(sizeof(Camera2D)); game->camera->target.x = 0; game->camera->target.y = 0; diff --git a/game.h b/game.h index 855a416..ce274d9 100644 --- a/game.h +++ b/game.h @@ -11,6 +11,7 @@ typedef struct Game{ struct InputHandler *inputHandler; struct Camera2D *camera; struct IsometricMap **layers; + int screen; } Game; // returns pointer to new Game instance diff --git a/game.o b/game.o new file mode 100644 index 0000000..df4b9e1 Binary files /dev/null and b/game.o differ diff --git a/inputHandler.o b/inputHandler.o new file mode 100644 index 0000000..08b8102 Binary files /dev/null and b/inputHandler.o differ diff --git a/isometricMap.o b/isometricMap.o new file mode 100644 index 0000000..6881c00 Binary files /dev/null and b/isometricMap.o differ diff --git a/list.o b/list.o new file mode 100644 index 0000000..b0440a7 Binary files /dev/null and b/list.o differ diff --git a/main.c b/main.c index 403d896..389fe9b 100644 --- a/main.c +++ b/main.c @@ -9,6 +9,7 @@ #include "game.h" #include "DepthSorting/bucket.h" #include "DepthSorting/mergeSort.h" +#include "Ui/screenIDs.h" int main(){ @@ -19,8 +20,10 @@ int main(){ // Hides the operating systems own cursor HideCursor(); - //SetTargetFPS(60); - + SetTargetFPS(60); + + + return uitest(game); // GAME MAIN ROUTINE while(!WindowShouldClose()){ @@ -59,4 +62,74 @@ int main(){ } - \ No newline at end of file +int uitest(Game * game){ + + while(!WindowShouldClose()){ + + // Moving cursor Sprite to Mouse Pos + game->cursorSprite->x = GetMousePosition().x; + game->cursorSprite->y = GetMousePosition().y; + + 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); + BeginDrawing(); + + 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); + + DrawFPS(GetScreenWidth() - 95, 10); + + EndDrawing(); + + if(IsKeyPressed(KEY_P)){ + game->screen = SCREEN_PAUSE; + } + + break; + case SCREEN_PAUSE: + ClearBackground(RAYWHITE); + + BeginDrawing(); + + DrawSpriteToScreen(game->cursorSprite); + DrawFPS(GetScreenWidth() - 95, 10); + + EndDrawing(); + + if(IsKeyPressed(KEY_P)){ + game->screen = SCREEN_GAME; + } + break; + } + + + + } + + CloseWindow(); + + return 0; +} \ No newline at end of file diff --git a/main.o b/main.o new file mode 100644 index 0000000..014bd99 Binary files /dev/null and b/main.o differ diff --git a/mergeSort.o b/mergeSort.o new file mode 100644 index 0000000..84c8b38 Binary files /dev/null and b/mergeSort.o differ diff --git a/spiel b/spiel new file mode 100755 index 0000000..36d4062 Binary files /dev/null and b/spiel differ diff --git a/sprite.o b/sprite.o new file mode 100644 index 0000000..83d073c Binary files /dev/null and b/sprite.o differ diff --git a/textureatlas.o b/textureatlas.o new file mode 100644 index 0000000..ddd110b Binary files /dev/null and b/textureatlas.o differ