summaryrefslogtreecommitdiff
path: root/paddle.h
blob: 9570717f7f045d14188afe5ff384c536bde72e15 (plain)
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
#ifndef PADDLE_H
#define PADDLE_H

#include "SDL.h"
#include "SDL_opengl.h"

typedef struct {
	GLfloat x, y, z;
	GLfloat prev_x, prev_y;
	GLfloat w, h;
	GLfloat r, g, b;
} Paddle_t;

void GLPong_PaddleDraw(const Paddle_t * paddle);
void GLPong_PaddleInit(Paddle_t * paddle, GLfloat z, GLuint texture);
void GLPong_PaddleMove(Paddle_t * paddle, GLfloat x, GLfloat y);

static inline GLfloat
GLPong_PaddleXV(const Paddle_t * paddle) {
	return paddle->x - paddle->prev_x;
}

static inline GLfloat
GLPong_PaddleYV(const Paddle_t * paddle) {
	return paddle->y - paddle->prev_y;
}

#endif /* PADDLE_H */