From 3bb78f6b44c62776847152071752363217e6fb56 Mon Sep 17 00:00:00 2001 From: Seth Date: Mon, 21 Oct 2024 18:47:04 +1300 Subject: [PATCH] added comments and removed old code --- main.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/main.c b/main.c index d417970..34a7d94 100644 --- a/main.c +++ b/main.c @@ -4,17 +4,17 @@ #include #include #include -#define SCREEN_WIDTH 11 -#define SCREEN_HEIGHT 20 -#define PADDLE_SIZE 2 -#define SLEEP_TIME_MS 100 * 1000 -#define PADDLE_HEIGHT SCREEN_HEIGHT-4 -#define Y_BLOCK_LAYERS 10 +#define SCREEN_WIDTH 11 //set the width of the game screen +#define SCREEN_HEIGHT 20 //set the height of the game screen +#define PADDLE_SIZE 2 //set the paddle size. the blocks are added this amount either size of a central block. +#define SLEEP_TIME_MS 100 * 1000 //set the time to sleep between frames +#define PADDLE_HEIGHT SCREEN_HEIGHT-4 //the negative number is distance from the bottom +#define Y_BLOCK_LAYERS 10 //add the amount of layers of blocks from the top of the screen #define X_BLOCK_LAYERS SCREEN_WIDTH -uint8_t screen[SCREEN_WIDTH][SCREEN_HEIGHT]; +uint8_t screen[SCREEN_WIDTH][SCREEN_HEIGHT]; //this is the array the game lives in -enum PIXEL_TYPE { +enum PIXEL_TYPE { //used to set what kind of pixel is shown on the screen array PIXEL_EMPTY=0u, PIXEL_BALL=1u, PIXEL_BLOCK=2u, @@ -23,7 +23,7 @@ enum PIXEL_TYPE { PIXEL_PADDLE_RIGHT=5u } PIXEL_TYPE; -void clearScreen() { +void clearScreen() { //clears the screen of all pixels to redraw the screen for (int y = 0; y < SCREEN_HEIGHT; y++) { for (int x=0; x