From fab3ff01fca637f5cd03690facdbe2c48059a15f Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Thu, 18 Jan 2018 15:20:01 +0100 Subject: [PATCH] Main Header File added --- breakout.c | 2 +- button.h | 2 +- main.c | 38 ++------------------------------------ main.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 38 deletions(-) create mode 100644 main.h diff --git a/breakout.c b/breakout.c index a38b0ff..bb43112 100644 --- a/breakout.c +++ b/breakout.c @@ -318,7 +318,7 @@ Paddle PADDLE_CreateDefault(){ .TextureIndex = 0, .Speed = 10, .SteeringAngle = 40.0f, - .Mode = MouseControl + .Mode = KeyboardControl }; // Objekt für die Eigenschaften des Balls } diff --git a/button.h b/button.h index f9b1459..6e4c663 100644 --- a/button.h +++ b/button.h @@ -5,7 +5,7 @@ typedef struct buttonStruct { SDL_Rect TargetRect; void (*OnClick)(); -}; +} Button; // End Structs // Prototypes diff --git a/main.c b/main.c index 107b1c3..01f94c8 100644 --- a/main.c +++ b/main.c @@ -13,42 +13,7 @@ #include "gamestate.h" #include "highscores.h" -#ifndef __nullptr__ -#define Nullptr(type) (type *)0 -#endif // __nullptr__ - -#define ae "\204" -#define oe "\224" -#define ue "\201" -#define ss "\341" - -// Prototypes -void GAME_ChangeState(GameState state); -void HandleSDLEvents(); -void mousePress(SDL_MouseButtonEvent b); -void keyPress(SDL_KeyboardEvent b); -void toggleFullscreen(); -void windowChanged(SDL_WindowEvent b); -void DrawBackground(SDL_Renderer * renderer); -void INITIALIZE(); -void QUIT(); -int readIntFromIO(char * m1, char * m2, char * m3, int min, int max); -// End Prototypes - -// Default Render Size (Upscaled for bigger monitors) -const int width = 1920; -const int height = 1080; -float XScale = 1.0f, YScale = 1.0f; -// End render properties - -int numKeys; -const Uint8 * keystate; // TODO: export all this into scenery and enemy waves -SDL_Window * window; -SDL_Renderer * renderer; -SDL_Event event; -bool running = true, fullscreen = false; -GameState gameState = Game; -Scenery scenery; +#include "main.h" int main(int argc, char * args[]){ printf("Spielbereiche\n\t- 1: Hauptmen"ue "\n\t- 2: Spiel\n\t- 3: Level Select\n\t- 4: Settings\n\t- 5: Highscores\n"); @@ -89,6 +54,7 @@ void GAME_ChangeState(GameState state){ switch (gameState) { case Highscores: HIGHSCORES_ReloadList(); + HIGHSCORES_GenerateTexture(renderer); printf("State was changed to Highscores!\n"); break; default: diff --git a/main.h b/main.h new file mode 100644 index 0000000..85d4f06 --- /dev/null +++ b/main.h @@ -0,0 +1,51 @@ +#ifndef __main_h__ +#define __main_h__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __nullptr__ +#define Nullptr(type) (type *)0 +#endif // __nullptr__ + +#define ae "\204" +#define oe "\224" +#define ue "\201" +#define ss "\341" + +// Prototypes +void GAME_ChangeState(GameState state); +void HandleSDLEvents(); +void GAME_Escape(); +void mousePress(SDL_MouseButtonEvent b); +void keyPress(SDL_KeyboardEvent b); +void toggleFullscreen(); +void windowChanged(SDL_WindowEvent b); +void DrawBackground(SDL_Renderer * renderer); +void INITIALIZE(); +void QUIT(); +int readIntFromIO(char * m1, char * m2, char * m3, int min, int max); +// End Prototypes + +// Default Render Size (Upscaled for bigger monitors) +const int width = 1920; +const int height = 1080; +float XScale = 1.0f, YScale = 1.0f; +// End render properties + +int numKeys; +const Uint8 * keystate; // TODO: export all this into scenery and enemy waves +SDL_Window * window; +SDL_Renderer * renderer; +SDL_Event event; +bool running = true, fullscreen = false; +GameState gameState = Game; +Scenery scenery; + +#endif // __main_h__