Implement enough functionality to compile & match pokecrystal

This commit is contained in:
ISSOtm
2022-03-04 23:49:55 +01:00
committed by Eldred Habert
parent 6e406b22bb
commit 3fa1854332
12 changed files with 460 additions and 183 deletions

24
src/gfx/rgba.cpp Normal file
View File

@@ -0,0 +1,24 @@
#include "gfx/rgba.hpp"
#include <assert.h>
#include <stdint.h>
#include "gfx/main.hpp" // options
uint16_t Rgba::cgbColor() const {
if (isTransparent()) {
return transparent;
}
if (options.useColorCurve) {
assert(!"TODO");
} else {
return (red >> 3) | (green >> 3) << 5 | (blue >> 3) << 10;
}
}
uint8_t Rgba::grayIndex() const {
assert(isGray());
// Convert from [0; 256[ to [0; maxPalSize[
return static_cast<uint16_t>(255 - red) * options.maxPalSize() / 256;
}