Small improvements for code readability
This commit is contained in:
@@ -10,7 +10,7 @@ namespace JabyEngine {
|
||||
|
||||
struct GPU_IO::GP0 value;
|
||||
|
||||
static constexpr TexPage create(const PositionU16& tex_pos, TexturePageColor tex_color, SemiTransparency transparency = SemiTransparency::B_Half_add_F_Half, bool dither = false) {
|
||||
static constexpr TexPage create(const PositionU16& tex_pos, TextureColorMode tex_color, SemiTransparency transparency = SemiTransparency::B_Half_add_F_Half, bool dither = false) {
|
||||
return TexPage{.value = GPU_IO::Command::TexPage(tex_pos, transparency, tex_color, dither, false)};
|
||||
}
|
||||
};
|
||||
|
@@ -86,11 +86,11 @@ namespace JabyEngine {
|
||||
|
||||
uint16_t value;
|
||||
|
||||
static constexpr TPage create(uint16_t x, uint16_t y, ::JabyEngine::GPU::SemiTransparency transparency, TexturePageColor clut_color) {
|
||||
static constexpr TPage create(uint16_t x, uint16_t y, ::JabyEngine::GPU::SemiTransparency transparency, TextureColorMode clut_color) {
|
||||
return TPage{static_cast<uint16_t>(TexturePageX.as_value(x >> 6) | TexturePageY.as_value(y >> 8) | SemiTransparency.as_value(static_cast<uint16_t>(transparency)) | TextureClut.as_value(static_cast<uint16_t>(clut_color)))};
|
||||
}
|
||||
|
||||
static constexpr TPage create(const PositionU16& pos, ::JabyEngine::GPU::SemiTransparency transparency, TexturePageColor clut_color) {
|
||||
static constexpr TPage create(const PositionU16& pos, ::JabyEngine::GPU::SemiTransparency transparency, TextureColorMode clut_color) {
|
||||
return TPage::create(pos.x, pos.y, transparency, clut_color);
|
||||
}
|
||||
};
|
||||
|
@@ -21,11 +21,16 @@ namespace JabyEngine {
|
||||
#else
|
||||
static constexpr size_t Width = 320;
|
||||
static constexpr size_t Height = 240;
|
||||
static constexpr uint32_t frames_per_sec = 50;
|
||||
static constexpr uint32_t frames_per_sec = 60;
|
||||
#endif
|
||||
|
||||
static uint8_t current_id;
|
||||
|
||||
template<typename T>
|
||||
static constexpr Area<T> center(const Area<T>& area) {
|
||||
return Area<T>::create(Position<T>::create((Display::Width - area.size.width)/2, (Display::Height - area.size.height)/2), area.size);
|
||||
}
|
||||
|
||||
static void enable() {
|
||||
GPU_IO::GP1.write(GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::On));
|
||||
}
|
||||
|
@@ -12,11 +12,11 @@ namespace JabyEngine {
|
||||
static constexpr auto CLUTLoadPos = Configuration::BIOSFont::CLUTLoadPos;
|
||||
|
||||
static constexpr TexPage get_tex_page() {
|
||||
return TexPage::create(BIOS_Font::TextureLoadPos, GPU::TexturePageColor::$4bit);
|
||||
return TexPage::create(BIOS_Font::TextureLoadPos, GPU::TextureColorMode::clut4);
|
||||
}
|
||||
|
||||
static constexpr TPage get_tpage() {
|
||||
return TPage::create(TextureLoadPos.x, TextureLoadPos.y, SemiTransparency::B_add_F, TexturePageColor::$4bit);
|
||||
return TPage::create(TextureLoadPos.x, TextureLoadPos.y, SemiTransparency::B_add_F, TextureColorMode::clut4);
|
||||
}
|
||||
|
||||
static constexpr PageOffset get_offset_page() {
|
||||
|
@@ -93,10 +93,10 @@ namespace JabyEngine {
|
||||
B_add_F_Quarter = 3,
|
||||
};
|
||||
|
||||
enum struct TexturePageColor {
|
||||
$4bit = 0,
|
||||
$8bit = 1,
|
||||
$15bit = 2,
|
||||
enum struct TextureColorMode {
|
||||
clut4 = 0,
|
||||
clut8 = 1,
|
||||
direct16 = 2,
|
||||
};
|
||||
|
||||
struct Color24 : public internal::PredefinedColors<Color24> {
|
||||
@@ -249,8 +249,8 @@ namespace JabyEngine {
|
||||
static constexpr Area create(T position_x, T position_y, T size_width, T size_height) {
|
||||
return Area{Position<T>::create(position_x, position_y), Size<T>::create(size_width, size_height)};
|
||||
}
|
||||
|
||||
constexpr Area centered() const {
|
||||
|
||||
constexpr Area centered() const {
|
||||
return Area(this->position.sub(this->size.width/2, this->size.height/2), this->size);
|
||||
}
|
||||
|
||||
|
@@ -140,21 +140,21 @@ namespace JabyEngine {
|
||||
// ###################################################################
|
||||
|
||||
static constexpr GPU::TPage TPage() {
|
||||
return creator_template<GPU::TPage>(0_u16, 0_u16, GPU::SemiTransparency::B_add_F, GPU::TexturePageColor::$4bit);
|
||||
return creator_template<GPU::TPage>(0_u16, 0_u16, GPU::SemiTransparency::B_add_F, GPU::TextureColorMode::clut4);
|
||||
}
|
||||
static constexpr GPU::TPage TPage(uint16_t x, uint16_t y, GPU::SemiTransparency transparency, GPU::TexturePageColor clut_color) {
|
||||
static constexpr GPU::TPage TPage(uint16_t x, uint16_t y, GPU::SemiTransparency transparency, GPU::TextureColorMode clut_color) {
|
||||
return creator_template<GPU::TPage>(x, y, transparency, clut_color);
|
||||
}
|
||||
static constexpr GPU::TPage TPage(const GPU::PositionU16& tex_pos, GPU::SemiTransparency transparency, GPU::TexturePageColor clut_color) {
|
||||
static constexpr GPU::TPage TPage(const GPU::PositionU16& tex_pos, GPU::SemiTransparency transparency, GPU::TextureColorMode clut_color) {
|
||||
return creator_template<GPU::TPage>(tex_pos, transparency, clut_color);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
||||
static constexpr GPU::TexPage TexPage() {
|
||||
return creator_template<GPU::TexPage>(PositionU16(), GPU::TexturePageColor::$4bit, GPU::SemiTransparency::B_Half_add_F_Half, false);
|
||||
return creator_template<GPU::TexPage>(PositionU16(), GPU::TextureColorMode::clut4, GPU::SemiTransparency::B_Half_add_F_Half, false);
|
||||
}
|
||||
static constexpr GPU::TexPage TexPage(const GPU::PositionU16& tex_pos, GPU::TexturePageColor tex_color, GPU::SemiTransparency transparency = GPU::SemiTransparency::B_Half_add_F_Half, bool dither = false) {
|
||||
static constexpr GPU::TexPage TexPage(const GPU::PositionU16& tex_pos, GPU::TextureColorMode tex_color, GPU::SemiTransparency transparency = GPU::SemiTransparency::B_Half_add_F_Half, bool dither = false) {
|
||||
return creator_template<GPU::TexPage>(tex_pos, tex_color, transparency, dither);
|
||||
}
|
||||
|
||||
|
@@ -104,7 +104,7 @@ namespace JabyEngine {
|
||||
return Helper::construct_cmd<struct GP0>(0xA0, 0);
|
||||
}
|
||||
|
||||
static constexpr struct GP0 TexPage(const GPU::PositionU16& page_pos, GPU::SemiTransparency transparency, GPU::TexturePageColor tex_color, bool dither, bool draw_on_display_area) {
|
||||
static constexpr struct GP0 TexPage(const GPU::PositionU16& page_pos, GPU::SemiTransparency transparency, GPU::TextureColorMode tex_color, bool dither, bool draw_on_display_area) {
|
||||
constexpr auto TexXRange = BitRange::from_to(0, 3);
|
||||
constexpr auto TexYRange = BitRange::from_to(4, 4);
|
||||
constexpr auto TransparencyRange = BitRange::from_to(5, 6);
|
||||
|
Reference in New Issue
Block a user