diff --git a/src/main.c b/src/main.c index 83f2d4f..dae11b1 100644 --- a/src/main.c +++ b/src/main.c @@ -22,7 +22,7 @@ Made by Sem van der Hoeven #define printf psvDebugScreenPrintf #define SCREEN_HEIGTH 544 -#define SCREEN_WIDTH 940 +#define SCREEN_WIDTH 960 #define SIMPLE_ENEMY_MAX_AMOUNT 20 #define ENEMY_MAX_AMOUNT 40 #define BULLET_MARGIN 5.0 // extra hitbox space to make sure bullets hit @@ -551,7 +551,15 @@ void draw_game() sprintf(score_text, "score: %07d", score); vita2d_pvf_draw_text(pvf, 700, 100, RGBA8(0, 255, 0, 255), 1.0f, score_text); - drawing_draw_rectangle_open(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH, 10, RGBA8(98, 124, 158, 255)); + drawing_draw_rectangle_open(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH, 10, MAIN_BORDER_COLOR); + drawing_draw_hline(0, 10, SCREEN_WIDTH, 10, MAIN_BORDER_COLOR); + for (int i = 0; i < 3; i++) + { + int box_x = SCREEN_WIDTH - 18 * i - 20; + vita2d_draw_rectangle(box_x, 2, 16, 16, SECONDARY_BORDER_COLOR); + drawing_draw_rectangle_open(box_x, 2, 16, 16, 2, COLOR_BLACK); + } + drawing_draw_rectangle_open(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH, 3, COLOR_BLACK); // line around screen } void draw_gameover() diff --git a/src/toolbox/drawing.c b/src/toolbox/drawing.c index 5ac0046..e9a1970 100644 --- a/src/toolbox/drawing.c +++ b/src/toolbox/drawing.c @@ -4,9 +4,25 @@ void drawing_draw_rectangle_open(float x, float y, float width, float heigth, in { for (int i = 0; i < thiccness; i++) { - vita2d_draw_line(x, y + i, x + width, y + i, color); - vita2d_draw_line(x + i, y, x + i, y + heigth, color); - vita2d_draw_line(x, y - i, x + width, y - i, color); - vita2d_draw_line(x + width - i, y, x + width - i, y + heigth, color); + vita2d_draw_line(x, y + i, x + width, y + i, color); // top + vita2d_draw_line(x + i, y, x + i, y + heigth, color); // left + vita2d_draw_line(x, y - i + heigth, x + width, y - i + heigth, color); // bottom + vita2d_draw_line(x + width - i, y, x + width - i, y + heigth, color); // right + } +} + +void drawing_draw_hline(float x0, float y0, float width, int thiccness, unsigned int color) +{ + for (int i = 0; i < thiccness; i++) + { + vita2d_draw_line(x0, y0 + i, x0 + width, y0 + i, color); + } +} + +void drawing_draw_vline(float x0, float y0, float height, int thiccness, unsigned int color) +{ + for (int i = 0; i < thiccness; i++) + { + vita2d_draw_line(x0 + i, y0, x0 + i, y0 + height, color); } } \ No newline at end of file diff --git a/src/toolbox/drawing.h b/src/toolbox/drawing.h index 6f7d402..f51462d 100644 --- a/src/toolbox/drawing.h +++ b/src/toolbox/drawing.h @@ -2,6 +2,9 @@ #define DRAWING_H #include +#define MAIN_BORDER_COLOR (RGBA8(98, 124, 158, 255)) +#define SECONDARY_BORDER_COLOR (RGBA8(181, 181, 181,255)) +#define COLOR_BLACK (RGBA8(0, 0, 0, 255)) // /** // * @brief draws a line with a specified width @@ -27,4 +30,26 @@ */ void drawing_draw_rectangle_open(float x, float y, float width, float heigth, int thiccness, unsigned int color); +/** + * @brief draws a horizontal line with the specified width and thiccness + * + * @param x0 the start x position of the line + * @param y0 the start y position of the line + * @param width the width of the line + * @param thiccness the thiccness of the line + * @param color the color of the line + */ +void drawing_draw_hline(float x0, float y0, float width, int thiccness, unsigned int color); + +/** + * @brief draws a vertical line with the specified heigth and thiccness + * + * @param x0 the start x pos of the line + * @param y0 the start y pos of the line + * @param height the heigth of the line + * @param thiccness the thiccness of the line + * @param color the color of the line + */ +void drawing_draw_vline(float x0, float y0, float height, int thiccness, unsigned int color); + #endif // !DRAWING_H