init'd second paddle, repositioning
authorMatthew Owens <matthew@owens.tech>
Sat, 3 Oct 2020 11:39:09 +0000 (12:39 +0100)
committerMatthew Owens <matthew@owens.tech>
Sat, 3 Oct 2020 11:39:09 +0000 (12:39 +0100)
src/main.c

index 139c5b8..c0cb765 100644 (file)
@@ -31,22 +31,30 @@ static const Vec2di baseWindowSize = { 1920, 1080 };
 static Vec2di windowSize;
 static Vec2df windowScale;
 
-Vbox pad, ball;
+Vbox pad, pad2, ball;
 Vec2df vline[2];
 
 static void paddle_init()
 {
+       // pad
        pad.r.w = 192 * windowScale.x;
        pad.r.h = 32 * windowScale.y;
 
        pad.r.x = (windowSize.x / 2) - (pad.r.w / 2);
-       pad.r.y = windowSize.y - ((windowSize.y / 8) - (pad.r.h / 2));
+       pad.r.y = windowSize.y - ((windowSize.y / 8));
 
        pad.c.r = pad.c.g = pad.c.b = 0x55;
        pad.c.a = 0xff;
 
-       COUT("pad.r (%d, %d, %d, %d)",
-               pad.r.x, pad.r.y, pad.r.w, pad.r.h);
+       // pad2
+       pad2.r.w = 192 * windowScale.x;
+       pad2.r.h = 32 * windowScale.y;
+
+       pad2.r.x = (windowSize.x / 2) - (pad2.r.w / 2);
+       pad2.r.y = windowSize.y / 8 - pad2.r.h;
+
+       pad2.c.r = pad2.c.g = pad2.c.b = 0x55;
+       pad2.c.a = 0xff;
 }
 
 static void ball_init()
@@ -223,6 +231,7 @@ static void render()
        SDL_SetRenderDrawColor(renderer, bgClr.r, bgClr.g, bgClr.b, bgClr.a);
        SDL_RenderClear(renderer);
        vbox_render(&pad);
+       vbox_render(&pad2);
        vbox_render(&ball);
        SDL_SetRenderDrawColor(renderer, 0x00, 0xff, 0x00, 0xff);
        SDL_RenderDrawLine(renderer, vline[0].x, vline[0].y, vline[1].x, vline[1].y);