add border around main game for #4

This commit is contained in:
SemvdH
2021-08-25 17:06:39 +02:00
parent d69c2236ec
commit 2ea7e749a3
3 changed files with 55 additions and 6 deletions

View File

@@ -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);
}
}

View File

@@ -2,6 +2,9 @@
#define DRAWING_H
#include <vita2d.h>
#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