Prepare for textured sprites; better integration of GPU types

This commit is contained in:
2023-05-31 22:29:19 +02:00
parent 1ff6367918
commit d99b7445be
5 changed files with 69 additions and 30 deletions

View File

@@ -114,27 +114,31 @@ namespace JabyEngine {
return {(0b101u << 29)};
}
static constexpr GP0_t DrawAreaTopLeft(uint16_t x, uint16_t y) {
return Helper::DrawAreaTemplate(0xE3, x, y);
/*static constexpr GP0_t DrawMode(const GPU::PositionU16& page_pos, SemiTransparency transparency, TexturePageColor tex_color, bool dither) {
}*/
static constexpr GP0_t DrawAreaTopLeft(const GPU::PositionU16& position) {
return Helper::DrawAreaTemplate(0xE3, position.x, position.y);
}
static constexpr GP0_t DrawAreaBottomRight(uint16_t x, uint16_t y) {
return Helper::DrawAreaTemplate(0xE4, x, y);
static constexpr GP0_t DrawAreaBottomRight(const GPU::PositionU16& position) {
return Helper::DrawAreaTemplate(0xE4, position.x, position.y);
}
static GP0_t SetDrawOffset(int16_t x, int16_t y) {
static GP0_t SetDrawOffset(const GPU::PositionI16& offset) {
constexpr auto X = BitRange::from_to(0, 10);
constexpr auto Y = BitRange::from_to(11, 21);
return {Helper::construct_cmd(0xE5, X.as_value(static_cast<int32_t>(x)) | Y.as_value(static_cast<int32_t>(y)))};
return {Helper::construct_cmd(0xE5, X.as_value(static_cast<int32_t>(offset.x)) | Y.as_value(static_cast<int32_t>(offset.y)))};
}
static constexpr GP0_t TopLeftPosition(uint16_t x, uint16_t y) {
return {(static_cast<uint32_t>(y) << 16u) | x};
static constexpr GP0_t TopLeftPosition(const GPU::PositionU16& position) {
return {(static_cast<uint32_t>(position.y) << 16u) | position.x};
}
static constexpr GP0_t WidthHeight(uint16_t w, uint16_t h) {
return {(static_cast<uint32_t>(h) << 16u) | w};
static constexpr GP0_t WidthHeight(const GPU::SizeU16& size) {
return {(static_cast<uint32_t>(size.height) << 16u) | size.width};
}
static constexpr GP1_t Reset() {
@@ -153,11 +157,11 @@ namespace JabyEngine {
return {Helper::construct_cmd(0x04, static_cast<uint32_t>(dir))};
}
static constexpr GP1_t DisplayArea(uint16_t x, uint16_t y) {
static constexpr GP1_t DisplayArea(const GPU::PositionU16& position) {
constexpr auto X = BitRange::from_to(0, 9);
constexpr auto Y = BitRange::from_to(10, 18);
return {Helper::construct_cmd(0x05, X.as_value(static_cast<uint32_t>(x)) | Y.as_value(static_cast<uint32_t>(y)))};
return {Helper::construct_cmd(0x05, X.as_value(static_cast<uint32_t>(position.x)) | Y.as_value(static_cast<uint32_t>(position.y)))};
}
static constexpr GP1_t HorizontalDisplayRange(uint16_t x1, uint16_t x2) {