diff --git a/include/arm9/console.h b/include/arm9/console.h index c73672f..3ad9d42 100644 --- a/include/arm9/console.h +++ b/include/arm9/console.h @@ -161,6 +161,12 @@ PrintConsole *consoleGet(void); /** + * @brief Returns the currently used foreground color. + * @return The foreground color in RGB565. + */ +u16 consoleGetFgColor(void); + +/** * @brief Initialise the console. * @param screen The screen to use for the console. * @param console A pointer to the console data to initialize (if it's NULL, the default console will be used). diff --git a/source/arm9/console.c b/source/arm9/console.c index 8e00cc0..a10fdc9 100644 --- a/source/arm9/console.c +++ b/source/arm9/console.c @@ -572,6 +572,12 @@ } //--------------------------------------------------------------------------------- +u16 consoleGetFgColor(void){ +//--------------------------------------------------------------------------------- + return colorTable[currentConsole->fg]; +} + +//--------------------------------------------------------------------------------- void consoleSetFont(PrintConsole* console, ConsoleFont* font){ //--------------------------------------------------------------------------------- diff --git a/source/arm9/ui.c b/source/arm9/ui.c index 5c744f0..663f732 100644 --- a/source/arm9/ui.c +++ b/source/arm9/ui.c @@ -118,11 +118,20 @@ }*/ -/*void uiPrintProgressBar(unsigned x, unsigned y, unsigned width, unsigned height, - double percentage) +void uiPrintProgressBar(unsigned int x, unsigned int y, unsigned int width, + unsigned int height, float percentage) { - // TODO -}*/ + u16 *fb = consoleGet()->frameBuffer; + const u16 color = consoleGetFgColor(); + + for(u32 xx = x; xx < (u32)((x + width / 100) * percentage); xx++) + { + for(u32 yy = y; yy < y + height; yy++) + { + fb[xx * 240 + yy] = color; + } + } +} static void uiDrawPPM(unsigned start_x, unsigned start_y, const u8 *data)