Added posX constants of ball and racket to pong struct
This commit is contained in:
parent
b0d7f5cc48
commit
0462b187b4
@ -9,10 +9,12 @@ Pong_init() {
|
||||
// Cast away the const
|
||||
*(int *)&p->SCREEN_WIDTH = 640;
|
||||
*(int *)&p->SCREEN_HEIGHT = 480;
|
||||
*(int *)&p->BALL_POSX = 100;
|
||||
*(int *)&p->RACKET_POSX = 50;
|
||||
|
||||
p->ball = Ball_init(p->SCREEN_WIDTH, p->SCREEN_HEIGHT, 100);
|
||||
p->racketL = Racket_init(p->SCREEN_WIDTH, p->SCREEN_HEIGHT, 50, p->SCREEN_HEIGHT/2, SDL_SCANCODE_E, SDL_SCANCODE_D);
|
||||
p->racketR = Racket_init(p->SCREEN_WIDTH, p->SCREEN_HEIGHT, p->SCREEN_WIDTH - 50, p->SCREEN_HEIGHT/2, SDL_SCANCODE_I, SDL_SCANCODE_K);
|
||||
p->ball = Ball_init(p->SCREEN_WIDTH, p->SCREEN_HEIGHT, p->BALL_POSX);
|
||||
p->racketL = Racket_init(p->SCREEN_WIDTH, p->SCREEN_HEIGHT, p->RACKET_POSX, p->SCREEN_HEIGHT/2, SDL_SCANCODE_E, SDL_SCANCODE_D);
|
||||
p->racketR = Racket_init(p->SCREEN_WIDTH, p->SCREEN_HEIGHT, p->SCREEN_WIDTH - p->RACKET_POSX, p->SCREEN_HEIGHT/2, SDL_SCANCODE_I, SDL_SCANCODE_K);
|
||||
|
||||
p->window = SDL_CreateWindow( "Pong", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, p->SCREEN_WIDTH, p->SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
|
||||
if( p->window == NULL )
|
||||
|
@ -14,7 +14,9 @@ typedef struct Pong {
|
||||
//SDL_Texture* texture;
|
||||
SDL_Event e;
|
||||
Ball *ball;
|
||||
const int BALL_POSX;
|
||||
Racket *racketL;
|
||||
const int RACKET_POSX;
|
||||
Racket *racketR;
|
||||
} Pong;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user