32 lines
699 B
C
32 lines
699 B
C
#ifndef BALL_H
|
|
#define BALL_H
|
|
|
|
#include <SDL.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "racket.h"
|
|
|
|
typedef struct Ball {
|
|
const int BALL_WIDTH;
|
|
const int BALL_HEIGHT;
|
|
const int BALL_VELOCITY;
|
|
const int BALL_POSX_START;
|
|
const int BALL_ANGLE_MIN_OFFSET;
|
|
const int BALL_ANGLE_MAX_OFFSET;
|
|
const int SCREEN_WIDTH;
|
|
const int SCREEN_HEIGHT;
|
|
int posX;
|
|
int posY;
|
|
int velX;
|
|
int velY;
|
|
} Ball;
|
|
|
|
Ball* Ball_init(int screen_width, int screen_height, int posX_start);
|
|
void Ball_reset(Ball *b, int direction);
|
|
void Ball_free(Ball *b);
|
|
//void Ball_handle_event(Ball *b, SDL_Event *e);
|
|
int Ball_collision(const Ball *b, const Racket *r);
|
|
int Ball_render(const Ball *b, SDL_Renderer *renderer);
|
|
|
|
#endif
|