basic structure added, pause working (p)

main
JanEhehalt 3 years ago
parent 2b3a7e33a3
commit 4af98f19bf

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -7,6 +7,7 @@
#include "IsometricMap/isometricMap.h" #include "IsometricMap/isometricMap.h"
#include "Textures/textureatlas.h" #include "Textures/textureatlas.h"
#include "stdio.h" #include "stdio.h"
#include "Ui/screenIDs.h"
// returns pointer to new Game instance // returns pointer to new Game instance
Game *GameInit() Game *GameInit()
@ -30,6 +31,8 @@ Game *GameInit()
game->inputHandler->cursorTextures = game->textures->cursorTextures; game->inputHandler->cursorTextures = game->textures->cursorTextures;
game->inputHandler->cursorSprite = game->cursorSprite; game->inputHandler->cursorSprite = game->cursorSprite;
game->screen = SCREEN_GAME;
game->camera = malloc(sizeof(Camera2D)); game->camera = malloc(sizeof(Camera2D));
game->camera->target.x = 0; game->camera->target.x = 0;
game->camera->target.y = 0; game->camera->target.y = 0;

@ -11,6 +11,7 @@ typedef struct Game{
struct InputHandler *inputHandler; struct InputHandler *inputHandler;
struct Camera2D *camera; struct Camera2D *camera;
struct IsometricMap **layers; struct IsometricMap **layers;
int screen;
} Game; } Game;
// returns pointer to new Game instance // returns pointer to new Game instance

BIN
game.o

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
list.o

Binary file not shown.

@ -9,6 +9,7 @@
#include "game.h" #include "game.h"
#include "DepthSorting/bucket.h" #include "DepthSorting/bucket.h"
#include "DepthSorting/mergeSort.h" #include "DepthSorting/mergeSort.h"
#include "Ui/screenIDs.h"
int main(){ int main(){
@ -19,8 +20,10 @@ int main(){
// Hides the operating systems own cursor // Hides the operating systems own cursor
HideCursor(); HideCursor();
//SetTargetFPS(60); SetTargetFPS(60);
return uitest(game);
// GAME MAIN ROUTINE // GAME MAIN ROUTINE
while(!WindowShouldClose()){ while(!WindowShouldClose()){
@ -59,4 +62,74 @@ int main(){
} }
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;
}

BIN
main.o

Binary file not shown.

Binary file not shown.

BIN
spiel

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save