metaforce/Runtime/Graphics/CGraphicsPalette.hpp

45 lines
951 B
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-03-19 00:07:31 +00:00
#include "RetroTypes.hpp"
#include "GX.hpp"
2016-03-19 00:07:31 +00:00
#include <memory>
2021-04-10 08:42:06 +00:00
namespace metaforce {
class CInputStream;
2016-03-19 00:07:31 +00:00
enum class EPaletteFormat : std::underlying_type_t<GXTlutFmt> {
IA8 = GX_TL_IA8,
RGB565 = GX_TL_RGB565,
RGB5A3 = GX_TL_RGB5A3,
2016-03-19 00:07:31 +00:00
};
2018-12-08 05:30:43 +00:00
class CGraphicsPalette {
static u32 sCurrentFrameCount;
2018-12-08 05:30:43 +00:00
friend class CTextRenderBuffer;
EPaletteFormat x0_fmt;
u32 x4_frameLoaded{};
u32 x8_entryCount;
std::unique_ptr<u16[]> xc_entries;
GXTlutObj x10_tlutObj;
bool x1c_locked = false;
2018-12-08 05:30:43 +00:00
2016-03-19 00:07:31 +00:00
public:
explicit CGraphicsPalette(EPaletteFormat fmt, int count);
explicit CGraphicsPalette(CInputStream& in);
2022-08-09 22:27:33 +00:00
~CGraphicsPalette();
u16* Lock() {
x1c_locked = true;
return xc_entries.get();
}
void UnLock();
2022-05-14 06:47:29 +00:00
void Load();
[[nodiscard]] const u16* GetPaletteData() const { return xc_entries.get(); }
static void SetCurrentFrameCount(u32 frameCount) { sCurrentFrameCount = frameCount; }
2016-03-19 00:07:31 +00:00
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce