diff --git a/Makefile b/Makefile index b84729a..bbc2b46 100644 --- a/Makefile +++ b/Makefile @@ -284,6 +284,33 @@ src/system/timing.c.s: $(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/timing.c.s .PHONY : src/system/timing.c.s +src/toolbox/drawing.obj: src/toolbox/drawing.c.obj + +.PHONY : src/toolbox/drawing.obj + +# target to build an object file +src/toolbox/drawing.c.obj: + $(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/drawing.c.obj +.PHONY : src/toolbox/drawing.c.obj + +src/toolbox/drawing.i: src/toolbox/drawing.c.i + +.PHONY : src/toolbox/drawing.i + +# target to preprocess a source file +src/toolbox/drawing.c.i: + $(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/drawing.c.i +.PHONY : src/toolbox/drawing.c.i + +src/toolbox/drawing.s: src/toolbox/drawing.c.s + +.PHONY : src/toolbox/drawing.s + +# target to generate assembly for a file +src/toolbox/drawing.c.s: + $(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/drawing.c.s +.PHONY : src/toolbox/drawing.c.s + src/toolbox/toolbox.obj: src/toolbox/toolbox.c.obj .PHONY : src/toolbox/toolbox.obj @@ -337,6 +364,9 @@ help: @echo "... src/system/timing.obj" @echo "... src/system/timing.i" @echo "... src/system/timing.s" + @echo "... src/toolbox/drawing.obj" + @echo "... src/toolbox/drawing.i" + @echo "... src/toolbox/drawing.s" @echo "... src/toolbox/toolbox.obj" @echo "... src/toolbox/toolbox.i" @echo "... src/toolbox/toolbox.s" diff --git a/src/main.c b/src/main.c index 86cce72..63bd026 100644 --- a/src/main.c +++ b/src/main.c @@ -23,6 +23,7 @@ Made by Sem van der Hoeven #include "sprites/sprites.h" #include "system/timing.h" #include "system/control_input.h" +#include "toolbox/drawing.h" #define printf psvDebugScreenPrintf @@ -556,10 +557,7 @@ 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); - for (int i = 0; i < 10; i++) - { - vita2d_draw_rectangle(i, i, SCREEN_WIDTH - 2*i, SCREEN_HEIGTH - 2*i,RGBA8(98, 124, 158,255)); - } + drawing_draw_rectangle_open(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH, 10, RGBA8(98, 124, 158, 255)); } void draw_gameover() diff --git a/src/toolbox/drawing.c b/src/toolbox/drawing.c index cd9d4f8..5ac0046 100644 --- a/src/toolbox/drawing.c +++ b/src/toolbox/drawing.c @@ -1 +1,12 @@ -#include "drawing.h" \ No newline at end of file +#include "drawing.h" + +void drawing_draw_rectangle_open(float x, float y, float width, float heigth, int thiccness, unsigned int color) +{ + 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); + } +} \ No newline at end of file diff --git a/src/toolbox/drawing.h b/src/toolbox/drawing.h index 2d09b3b..6f7d402 100644 --- a/src/toolbox/drawing.h +++ b/src/toolbox/drawing.h @@ -3,17 +3,17 @@ #include -/** - * @brief draws a line with a specified width - * - * @param x0 the start x coordinate of the line - * @param y0 the start y coordinate of the line - * @param x1 the end x coordinate of the line - * @param y1 the end y coordinate of the line - * @param thiccness the width of the line - * @param color the color of the line - */ -void drawing_draw_line_thiccness(float x0, float y0, float x1, float y1, int thiccness, unsigned int color); +// /** +// * @brief draws a line with a specified width +// * +// * @param x0 the start x coordinate of the line +// * @param y0 the start y coordinate of the line +// * @param x1 the end x coordinate of the line +// * @param y1 the end y coordinate of the line +// * @param thiccness the width of the line +// * @param color the color of the line +// */ +// void drawing_draw_line_thiccness(float x0, float y0, float x1, float y1, int thiccness, unsigned int color); /** * @brief draws an open rectangle