Support printing 8bit as color codes and introduce color code define
This commit is contained in:
parent
053dbd3f90
commit
5487d9aca8
|
@ -3,6 +3,18 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
|
static void render_num(uint8_t value, uint16_t x, uint16_t y) {
|
||||||
|
static constexpr auto BitCount = 8;
|
||||||
|
|
||||||
|
for(size_t n = 0; n < BitCount; n++) {
|
||||||
|
const uint16_t sub_x = (16*((BitCount - 1) - n));
|
||||||
|
const uint16_t sub_y = (n&1)*16;
|
||||||
|
|
||||||
|
GPU::internal::quick_fill_fast((value & (1 << n)) ? GPU::Color24::Blue() : GPU::Color24::Red(), {{static_cast<uint16_t>(x + sub_x), static_cast<uint16_t>(y + sub_y)}, {16, 16}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __USE_DEBUG_COLOR__
|
||||||
#define __debug_boot_color_at(color, x, y, scale) { \
|
#define __debug_boot_color_at(color, x, y, scale) { \
|
||||||
::JabyEngine::GPU::internal::quick_fill_fast(color, {{64*x, 64*y}, {static_cast<uint16_t>(64*scale), static_cast<uint16_t>(64*scale)}}); \
|
::JabyEngine::GPU::internal::quick_fill_fast(color, {{64*x, 64*y}, {static_cast<uint16_t>(64*scale), static_cast<uint16_t>(64*scale)}}); \
|
||||||
}
|
}
|
||||||
|
@ -11,4 +23,8 @@ namespace JabyEngine {
|
||||||
__debug_boot_color_at(color, x, y, scale); \
|
__debug_boot_color_at(color, x, y, scale); \
|
||||||
printf(__VA_ARGS__); \
|
printf(__VA_ARGS__); \
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define __debug_boot_color_at(...)
|
||||||
|
#define __debug_boot_print_at(color, x, y, scale, ...) printf(__VA_ARGS__)
|
||||||
|
#endif // __USE_DEBUG_COLOR__
|
||||||
}
|
}
|
Loading…
Reference in New Issue