Revert "Added posX constants of ball and racket to pong struct"

This reverts commit 0462b187b4.
This commit is contained in:
Pradana AUMARS 2021-06-28 16:02:26 +02:00
parent 30fc668684
commit 40a904e100
2 changed files with 3 additions and 7 deletions

View File

@ -9,12 +9,10 @@ Pong_init() {
// Cast away the const // Cast away the const
*(int *)&p->SCREEN_WIDTH = 640; *(int *)&p->SCREEN_WIDTH = 640;
*(int *)&p->SCREEN_HEIGHT = 480; *(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, p->BALL_POSX); p->ball = Ball_init(p->SCREEN_WIDTH, p->SCREEN_HEIGHT, 100);
p->racketL = Racket_init(p->SCREEN_WIDTH, p->SCREEN_HEIGHT, p->RACKET_POSX, p->SCREEN_HEIGHT/2, SDL_SCANCODE_E, SDL_SCANCODE_D); 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 - p->RACKET_POSX, p->SCREEN_HEIGHT/2, SDL_SCANCODE_I, SDL_SCANCODE_K); 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->window = SDL_CreateWindow( "Pong", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, p->SCREEN_WIDTH, p->SCREEN_HEIGHT, SDL_WINDOW_SHOWN ); p->window = SDL_CreateWindow( "Pong", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, p->SCREEN_WIDTH, p->SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
if( p->window == NULL ) if( p->window == NULL )

View File

@ -14,9 +14,7 @@ typedef struct Pong {
//SDL_Texture* texture; //SDL_Texture* texture;
SDL_Event e; SDL_Event e;
Ball *ball; Ball *ball;
const int BALL_POSX;
Racket *racketL; Racket *racketL;
const int RACKET_POSX;
Racket *racketR; Racket *racketR;
} Pong; } Pong;