-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaystate.h
31 lines (26 loc) · 1.08 KB
/
playstate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// #include "dimension.h"
#ifndef PLAYSTATE_H
#define PLAYSTATE_H
#include "util.h"
#include "pongball.h"
#include "racket.h"
typedef struct PlayState
{
struct Racket player, enemy;
struct PongBall ball;
Uint32 last_update_ms;
struct Score score;
// Dimmensions of the frame within which the game is played.
const Dimensions *frame;
void (*playstate_init)(struct PlayState *p, const Dimensions *frame, struct Racket player, struct Racket enemy, struct PongBall pongball);
void (*playstate_play)(struct PlayState *p, Uint32 now_ms);
void (*playstate_run_collisions)(struct PlayState *p, Uint32 delta_ms);
void (*playstate_play_movements)(struct PlayState *p, Uint32 delta_ms);
void (*playstate_handle_event)(struct PlayState *p, SDL_Event *e);
void (*playstate_reset)(struct PlayState *p);
void (*playstate_render)(SDL_Renderer *r, const struct PlayState *p);
void (*playstate_play_enemy)(struct PlayState *p);
int (*playstate_yhits_racket)(struct PongBall *ball, const struct Racket *racket);
} PlayState;
PlayState *new_playState();
#endif