remove magic numbers, enforce const correctness

This commit is contained in:
scawful
2024-08-20 21:31:59 -04:00
parent e404eabe64
commit a8ed9b7f92
27 changed files with 832 additions and 814 deletions

View File

@@ -98,8 +98,10 @@ class Bitmap {
/**
* @brief Creates a bitmap object with the provided graphical data.
*/
void Create(int width, int height, int depth, const std::vector<uint8_t> &data);
void Create(int width, int height, int depth, int format, const std::vector<uint8_t> &data);
void Create(int width, int height, int depth,
const std::vector<uint8_t> &data);
void Create(int width, int height, int depth, int format,
const std::vector<uint8_t> &data);
void Reformat(int format);

View File

@@ -11,6 +11,8 @@ namespace yaze {
namespace app {
namespace gfx {
constexpr int NumberOfColors = 3143;
snes_color ConvertSNEStoRGB(uint16_t snes_color);
uint16_t ConvertRGBtoSNES(const snes_color& color);
uint16_t ConvertRGBtoSNES(const ImVec4& color);

View File

@@ -11,11 +11,17 @@ namespace yaze {
namespace app {
namespace gfx {
constexpr int kTilesheetWidth = 128;
constexpr int kTilesheetHeight = 32;
constexpr int kTilesheetDepth = 8;
constexpr uint8_t kGraphicsBitmap[8] = {0x80, 0x40, 0x20, 0x10,
0x08, 0x04, 0x02, 0x01};
std::vector<uint8_t> SnesTo8bppSheet(const std::vector<uint8_t>& sheet, int bpp);
std::vector<uint8_t> Bpp8SnesToIndexed(std::vector<uint8_t> data, uint64_t bpp = 0);
std::vector<uint8_t> SnesTo8bppSheet(const std::vector<uint8_t>& sheet,
int bpp);
std::vector<uint8_t> Bpp8SnesToIndexed(std::vector<uint8_t> data,
uint64_t bpp = 0);
struct tile8 {
uint32_t id;
@@ -151,7 +157,7 @@ class Tile16 {
/**
* @brief Object Attribute Memory tile abstraction container
*/
*/
class OamTile {
public:
int x_;