#ifndef CHIP8_FONT_HPP
#define CHIP8_FONT_HPP

#include <array>

namespace chip8::font
{
	template <typename ... Ts>
	constexpr auto build_byte_array(Ts ... bytes)
	{
		return std::array<std::byte, sizeof...(Ts)>{std::byte(bytes)...};
	}

	static constexpr auto c_bytes_per_symbol = std::size_t {5};
	static constexpr auto c_symbol_count = std::size_t {16};
	static constexpr auto c_font_offset = std::size_t {0};

	constexpr auto raw_data = build_byte_array(
		0xF0, 0x90, 0x90, 0x90, 0xF0, // 0
		0x20, 0x60, 0x20, 0x20, 0x70, // 1
		0xF0, 0x10, 0xF0, 0x80, 0xF0, // 2
		0xF0, 0x10, 0xF0, 0x10, 0xF0, // 3
		0x90, 0x90, 0xF0, 0x10, 0x10, // 4
		0xF0, 0x80, 0xF0, 0x10, 0xF0, // 5
		0xF0, 0x80, 0xF0, 0x90, 0xF0, // 6
		0xF0, 0x10, 0x20, 0x40, 0x40, // 7
		0xF0, 0x90, 0xF0, 0x90, 0xF0, // 8
		0xF0, 0x90, 0xF0, 0x10, 0xF0, // 9
		0xF0, 0x90, 0xF0, 0x90, 0x90, // A
		0xE0, 0x90, 0xE0, 0x90, 0xE0, // B
		0xF0, 0x80, 0x80, 0x80, 0xF0, // C
		0xE0, 0x90, 0x90, 0x90, 0xE0, // D
		0xF0, 0x80, 0xF0, 0x80, 0xF0, // E
		0xF0, 0x80, 0xF0, 0x80, 0x80  // F
	);

	static_assert(raw_data.size() == c_symbol_count * c_bytes_per_symbol,
		"Number of bytes in font array does not match the required count");
}

#endif /* CHIP8_FONT_HPP */
