pong/src/racket.h
Pradana AUMARS e10599f19a First implementation of Pong
* Movement of ball and rackets are correct
* Score is recorded and displayed on terminal, not on the window
* Ball is represented as a square and not a disc
* Window is fixed and not scalable
* Player controls are E-D (up-down) for Left, I-K (up-down) for Right
* Ball reset parameters are fixed (except for direction)
2021-06-27 16:41:52 +02:00

28 lines
645 B
C

#ifndef RACKET_H
#define RACKET_H
#include <SDL.h>
typedef struct Racket {
const int RACKET_WIDTH;
const int RACKET_HEIGHT;
const int RACKET_VELOCITY;
const int SCREEN_WIDTH;
const int SCREEN_HEIGHT;
const int posX;
int posY;
const int vel;
int score;
const SDL_Keycode up;
const SDL_Keycode down;
int updown;
} Racket;
Racket* Racket_init(int screen_width, int screen_height, int posX, int posY, SDL_Keycode up, SDL_Keycode down);
void Racket_free(Racket *r);
void Racket_handle_event(Racket *r, const Uint8* keystate);
void Racket_move(Racket *r);
int Racket_render(const Racket *r, SDL_Renderer *renderer);
#endif