breakout/breakout.h

66 lines
2.1 KiB
C
Raw Normal View History

#ifndef __breakout_h__
#define __breakout_h__
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#include <SDL2/SDL.h>
#include "vector.h"
// Structs
typedef struct ballStruct {
Vector Location, Momentum;
SDL_Rect TargetRect;
double Size, Rotation, RotationValue;
int TextureIndex;
} Ball; // Objekt für die Eigenschaften des Balls
typedef struct paddleStruct {
SDL_Rect TargetRect;
int TextureIndex;
} Paddle; // Objekt für die Eigenschaften des Paddles
typedef struct blockStruct {
SDL_Rect TargetRect;
2018-01-12 16:49:17 +01:00
int TextureIndex, HP;
} Block; // Objekt für die Eigenschaften des Paddles
// End Structs
// Prototypes
void BREAKOUT_INITIALIZE(SDL_Renderer * renderer, int width, int height);
void BREAKOUT_ChangeSize(int width, int height);
void BREAKOUT_Update(Uint8 * keystate);
void BREAKOUT_Draw(SDL_Renderer * renderer);
void BREAKOUT_DEINITIALIZE();
void BALL_Initialize(SDL_Renderer * renderer);
Ball BALL_CreateDefault();
void BALL_Draw(SDL_Renderer * renderer, Ball * obj);
2018-01-11 16:47:40 +01:00
bool BALL_CollideWithRect(Ball * obj, SDL_Rect * rect);
bool RECT_Collide(SDL_Rect * rect1, SDL_Rect * rect2);
void BALL_SteerMomentum(Ball * obj, Paddle * paddle);
2018-01-12 14:04:44 +01:00
void RECT_SetTargetPos(SDL_Rect * rect, Vector * Location);
SDL_Point BALL_GetCenter(Ball * obj);
void BALL_Update(Ball * obj, Paddle * paddle);
void BALL_DestroyObject(Ball * obj);
void BALL_Deinitialize();
void PADDLE_Initialize(SDL_Renderer * renderer);
Paddle PADDLE_CreateDefault();
void PADDLE_Draw(SDL_Renderer * renderer, Paddle * obj);
bool KeyPressed(Uint8 * keystate, Uint8 * keyArray);
void constrain(int * variable, int min, int max);
void PADDLE_Update(Paddle * obj, Uint8 * keystate);
void PADDLE_DestroyObject(Paddle * obj);
void PADDLE_Deinitialize();
void BLOCK_Initialize(SDL_Renderer * renderer);
Block BLOCK_CreateDefault() ;
void BLOCK_Draw(SDL_Renderer * renderer, Block * obj);
2018-01-12 16:49:17 +01:00
void BLOCK_DealDamage(Block * obj, int dmg);
void BLOCK_Update(Block * obj);
void BLOCK_DestroyObject(Block * obj);
void BLOCK_Deinitialize();
// End Prototypes
#endif // __breakout_h__