diff --git a/examples/PoolBox/application/include/asset_mgr.hpp b/examples/PoolBox/application/include/asset_mgr.hpp index 0a49790a..5850ce20 100644 --- a/examples/PoolBox/application/include/asset_mgr.hpp +++ b/examples/PoolBox/application/include/asset_mgr.hpp @@ -10,9 +10,9 @@ namespace Assets { GPU::SizeI16 size; }; - static constexpr auto PacoTIM = SimpleTIM(896, 0, 960, 510); + static constexpr auto PacoTIM = SimpleTIM::create(896, 0, 960, 510); static constexpr auto DoenerFishInfo = ImageInfo{ - .tim = SimpleTIM(896 + 30, 0, 960 + 16, 510), + .tim = SimpleTIM::create(896 + 30, 0, 960 + 16, 510), .size = GPU::SizeI16::create(128, 64) }; diff --git a/examples/PoolBox/application/src/Overlay/ControllerTest/include/controller_test_assets.hpp b/examples/PoolBox/application/src/Overlay/ControllerTest/include/controller_test_assets.hpp index 0117f36d..55764ac1 100644 --- a/examples/PoolBox/application/src/Overlay/ControllerTest/include/controller_test_assets.hpp +++ b/examples/PoolBox/application/src/Overlay/ControllerTest/include/controller_test_assets.hpp @@ -4,5 +4,5 @@ namespace ControllerTest { using namespace JabyEngine; - static constexpr auto ControllerButtonTIM = SimpleTIM(384, 0, 384, 511); + static constexpr auto ControllerButtonTIM = SimpleTIM::create(384, 0, 384, 511); } \ No newline at end of file diff --git a/examples/PoolBox/application/src/Overlay/GPUTest/include/gpu_test_assets.hpp b/examples/PoolBox/application/src/Overlay/GPUTest/include/gpu_test_assets.hpp index d255a1bd..aab812d4 100644 --- a/examples/PoolBox/application/src/Overlay/GPUTest/include/gpu_test_assets.hpp +++ b/examples/PoolBox/application/src/Overlay/GPUTest/include/gpu_test_assets.hpp @@ -4,6 +4,6 @@ namespace GPUTest { using namespace JabyEngine; - static constexpr auto TexPageTIM = SimpleTIM(384, 0, 384, 511); - static constexpr auto IconTIM = SimpleTIM(384, 256, 384, 510); + static constexpr auto TexPageTIM = SimpleTIM::create(384, 0, 384, 511); + static constexpr auto IconTIM = SimpleTIM::create(384, 256, 384, 510); } \ No newline at end of file diff --git a/examples/PoolBox/application/src/Overlay/GTETest/include/gte_test_assets.hpp b/examples/PoolBox/application/src/Overlay/GTETest/include/gte_test_assets.hpp index 16c9a768..cf3ef791 100644 --- a/examples/PoolBox/application/src/Overlay/GTETest/include/gte_test_assets.hpp +++ b/examples/PoolBox/application/src/Overlay/GTETest/include/gte_test_assets.hpp @@ -5,7 +5,7 @@ namespace GTETest { using namespace JabyEngine; - static constexpr auto JabySTARTim = SimpleTIM( + static constexpr auto JabySTARTim = SimpleTIM::create( // v Doenerfisch rotates so we need some space Assets::Main::DoenerFishInfo.tim.get_texture_x(), Assets::Main::DoenerFishInfo.tim.get_texture_y() + Assets::Main::DoenerFishInfo.size.height + 2, Assets::Main::DoenerFishInfo.tim.get_clut_x() + 16, Assets::Main::DoenerFishInfo.tim.get_clut_y() diff --git a/examples/PoolBox/application/src/font_writer.cpp b/examples/PoolBox/application/src/font_writer.cpp index 35d7ce53..3ee50adc 100644 --- a/examples/PoolBox/application/src/font_writer.cpp +++ b/examples/PoolBox/application/src/font_writer.cpp @@ -6,7 +6,7 @@ namespace FontWriter { using namespace JabyEngine; - static constexpr auto LibraryFontTIM = SimpleTIM(320, 0, 320, DefaultFont::Info.texture_size.height); + static constexpr auto LibraryFontTIM = SimpleTIM::create(320, 0, 320, DefaultFont::Info.texture_size.height); static FontPrimitive font_buffer[2*256]; Wiggle wiggle = {Make::PositionI8(0, 0), Make::PositionI8(1, -2), Make::PositionI8(0, -4), Make::PositionI8(-1, -2), Make::PositionI8(0, 0), Make::PositionI8(1, 2), Make::PositionI8(0, 4), Make::PositionI8(-1, 2)}; diff --git a/include/PSX/File/file_types.hpp b/include/PSX/File/file_types.hpp index 542dbf99..da8a35b6 100644 --- a/include/PSX/File/file_types.hpp +++ b/include/PSX/File/file_types.hpp @@ -14,7 +14,6 @@ namespace JabyEngine { }; // TODO: Call TIM? - // TODO: Add create function? struct SimpleTIM { static constexpr auto TextureX = BitRange::from_to(0, 8); static constexpr auto TextureY = BitRange::from_to(9, 16); @@ -23,9 +22,8 @@ namespace JabyEngine { uint32_t raw; - constexpr SimpleTIM() : raw(0) {} - - constexpr SimpleTIM(uint16_t texX, uint16_t texY, uint16_t clutX, uint16_t clutY) : raw(TextureX.as_value(texX >> 1) | TextureY.as_value(texY >> 1) | ClutX.as_value(clutX >> 4) | ClutY.as_value(static_cast(clutY))) { + static constexpr SimpleTIM create(uint16_t texX, uint16_t texY, uint16_t clutX, uint16_t clutY) { + return SimpleTIM{.raw = TextureX.as_value(texX >> 1) | TextureY.as_value(texY >> 1) | ClutX.as_value(clutX >> 4) | ClutY.as_value(static_cast(clutY))}; } constexpr uint16_t get_texture_x() const { @@ -79,5 +77,5 @@ namespace JabyEngine { #pragma pack(pop) - typedef CopyTo Overlay; + using Overlay = CopyTo; } \ No newline at end of file diff --git a/src/Library/src/BootLoader/gpu_boot.cpp b/src/Library/src/BootLoader/gpu_boot.cpp index 65e41da8..9413bc05 100644 --- a/src/Library/src/BootLoader/gpu_boot.cpp +++ b/src/Library/src/BootLoader/gpu_boot.cpp @@ -78,7 +78,7 @@ namespace JabyEngine { const auto bytes_ready = decompress_logo(); // Upload SplashScreen picture - auto state = FileProcessor::create(&__boot_loader_end, SimpleTIM(32, 0, 0, 0)); + auto state = FileProcessor::create(&__boot_loader_end, SimpleTIM::create(32, 0, 0, 0)); state.process(bytes_ready); // Now load the BIOS font to the specified location diff --git a/support/include/FontWriter/fonts.hpp b/support/include/FontWriter/fonts.hpp index 220e50ed..f8645092 100644 --- a/support/include/FontWriter/fonts.hpp +++ b/support/include/FontWriter/fonts.hpp @@ -11,6 +11,6 @@ namespace JabyEngine { struct BIOSFont { static constexpr auto Info = FontInfo::create(Make::SizeU16(64, 96), Make::SizeU8(16, 16), Make::SizeU8(12, 16)); - static constexpr auto TIM = SimpleTIM(JabyEngine::GPU::BIOS_Font::TextureLoadPos.x, JabyEngine::GPU::BIOS_Font::TextureLoadPos.y, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.x, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.y); + static constexpr auto TIM = SimpleTIM::create(JabyEngine::GPU::BIOS_Font::TextureLoadPos.x, JabyEngine::GPU::BIOS_Font::TextureLoadPos.y, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.x, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.y); }; } \ No newline at end of file