#pragma once
#include "../GPU/gpu_internal.hpp"
#include <stdio.hpp>

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(), GPU::AreaU16::create(GPU::PositionU16::create((x + sub_x), (y + sub_y)), GPU::SizeU16::create(16, 16)));
        }
    }

#ifdef __USE_DEBUG_COLOR__
    #define __debug_boot_color_at(color, x, y, scale) { \
        ::JabyEngine::GPU::internal::quick_fill_fast(color, ::JabyEngine::GPU::AreaU16::create(64*x, 64*y, static_cast<uint16_t>(64*scale), static_cast<uint16_t>(64*scale))); \
    }

    #define __debug_boot_print_at(color, x, y, scale, ...) { \
        __debug_boot_color_at(color, x, y, scale); \
        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__
}