mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Implement enough functionality to compile & match pokecrystal
This commit is contained in:
24
src/gfx/rgba.cpp
Normal file
24
src/gfx/rgba.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user