From 40a904e100cd57324b008287cc7e9105077b6e57 Mon Sep 17 00:00:00 2001 From: Pradana AUMARS Date: Mon, 28 Jun 2021 16:02:26 +0200 Subject: [PATCH] Revert "Added posX constants of ball and racket to pong struct" This reverts commit 0462b187b4ce81afa7298033b5469ac3e9e8f018. --- src/pong.c | 8 +++----- src/pong.h | 2 -- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pong.c b/src/pong.c index 7352bd8..7bcd144 100644 --- a/src/pong.c +++ b/src/pong.c @@ -9,12 +9,10 @@ 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, 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->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->window = SDL_CreateWindow( "Pong", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, p->SCREEN_WIDTH, p->SCREEN_HEIGHT, SDL_WINDOW_SHOWN ); if( p->window == NULL ) diff --git a/src/pong.h b/src/pong.h index 7c9cc74..caf88f5 100644 --- a/src/pong.h +++ b/src/pong.h @@ -14,9 +14,7 @@ typedef struct Pong { //SDL_Texture* texture; SDL_Event e; Ball *ball; - const int BALL_POSX; Racket *racketL; - const int RACKET_POSX; Racket *racketR; } Pong;