pong/src/racket.h

30 lines
682 B
C

#ifndef RACKET_H
#define RACKET_H
#include <SDL.h>
#include "score.h"
static const int RACKET_WIDTH = 20;
static const int RACKET_HEIGHT = 100;
static const int RACKET_VELOCITY = 5;
typedef struct Racket {
const int SCREEN_WIDTH;
const int SCREEN_HEIGHT;
const int posX;
const SDL_Keycode up;
const SDL_Keycode down;
int posY;
Score* score;
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