[nostalgia/core] Add color 16 functions

This commit is contained in:
2020-03-29 13:35:23 -05:00
parent a81582d3cd
commit 11cb4d5a44
2 changed files with 28 additions and 3 deletions
+20
View File
@@ -83,12 +83,32 @@ ox::Error model(T *io, NostalgiaGraphic *ng) {
[[nodiscard]] uint8_t blue32(Color16 c) noexcept;
[[nodiscard]] constexpr Color16 color16(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
return r | (g << 5) | (b << 10) | (a << 15);
}
[[nodiscard]] uint8_t red32(Color32 c) noexcept;
[[nodiscard]] uint8_t green32(Color32 c) noexcept;
[[nodiscard]] uint8_t blue32(Color32 c) noexcept;
[[nodiscard]] constexpr uint8_t red16(Color16 c) noexcept {
return c & 0b0000000000011111;
}
[[nodiscard]] constexpr uint8_t green16(Color16 c) noexcept {
return (c & 0b0000001111100000) >> 5;
}
[[nodiscard]] constexpr uint8_t blue16(Color16 c) noexcept {
return (c & 0b0111110000000000) >> 10;
}
[[nodiscard]] constexpr uint8_t alpha16(Color16 c) noexcept {
return c >> 15;
}
void puts(Context *ctx, int column, int row, const char *str);
void setTile(Context *ctx, int layer, int column, int row, uint8_t tile);