Prepare for textured sprites; better integration of GPU types
This commit is contained in:
@@ -30,9 +30,9 @@ namespace JabyEngine {
|
||||
while(!GPU_IO::GPUSTAT.is_set(GPU_IO::GPUSTAT_t::GP0ReadyForCMD));
|
||||
}
|
||||
|
||||
static void set_draw_area(uint16_t x, uint16_t y) {
|
||||
const auto top_left = GPU_IO::Command::DrawAreaTopLeft(x, y);
|
||||
const auto bottom_right = GPU_IO::Command::DrawAreaBottomRight((x + Display::Width - 1), (y + Display::Height - 1));
|
||||
static void set_draw_area(const PositionU16& pos) {
|
||||
const auto top_left = GPU_IO::Command::DrawAreaTopLeft(pos);
|
||||
const auto bottom_right = GPU_IO::Command::DrawAreaBottomRight(pos.move((Display::Width - 1), (Display::Height - 1)));
|
||||
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = top_left;
|
||||
@@ -43,21 +43,21 @@ namespace JabyEngine {
|
||||
static void copy_vram_to_vram(const AreaU16& dst, const PositionU16& src) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::VRAM2VRAM_Blitting();
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(src.x, src.y);
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(dst.position.x, dst.position.y);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(dst.size.width, dst.size.height);
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(src);
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(dst.position);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(dst.size);
|
||||
}
|
||||
|
||||
static void quick_fill_fast(const Color24& color, const AreaU16& area) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::QuickFill(color);
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(area.position.x, area.position.y);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(area.size.width, area.size.height);
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(area.position);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(area.size);
|
||||
}
|
||||
|
||||
static void set_draw_offset(int16_t x, int16_t y) {
|
||||
static void set_draw_offset(const PositionI16& offset) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::SetDrawOffset(x, y);
|
||||
GPU_IO::GP0 = GPU_IO::Command::SetDrawOffset(offset);
|
||||
}
|
||||
|
||||
static void reset_cmd_buffer() {
|
||||
@@ -86,8 +86,8 @@ namespace JabyEngine {
|
||||
static void set_dst(const PositionU16& position, const SizeU16& size) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::CPU2VRAM_Blitting();
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(position.x, position.y);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(size.width, size.height);
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(position);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(size);
|
||||
}
|
||||
|
||||
static void start(uint16_t blockCount, uint16_t wordsPerBlock = 0x10) {
|
||||
|
@@ -38,11 +38,11 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
uint32_t Display :: exchange_buffer_and_display() {
|
||||
const auto draw_area_y = (PublicDisplay::Height*PublicDisplay::current_id);
|
||||
const uint16_t draw_area_y = (PublicDisplay::Height*PublicDisplay::current_id);
|
||||
|
||||
GPU::internal::set_draw_area(0, draw_area_y);
|
||||
GPU::internal::set_draw_area({0, draw_area_y});
|
||||
PublicDisplay::current_id ^= 1;
|
||||
GPU_IO::GP1 = GPU_IO::Command::DisplayArea(0, (PublicDisplay::Height*PublicDisplay::current_id));
|
||||
GPU_IO::GP1 = GPU_IO::Command::DisplayArea({0, static_cast<uint16_t>((PublicDisplay::Height*PublicDisplay::current_id))});
|
||||
return draw_area_y;
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace JabyEngine {
|
||||
internal::wait_ready_for_CMD();
|
||||
|
||||
internal::wait_vsync(syncs);
|
||||
const auto draw_offset_y = internal::Display::exchange_buffer_and_display();
|
||||
internal::set_draw_offset(0, draw_offset_y);
|
||||
const int16_t draw_offset_y = internal::Display::exchange_buffer_and_display();
|
||||
internal::set_draw_offset({0, draw_offset_y});
|
||||
if(clear_screen) {
|
||||
internal::quick_fill_fast(Color24::Black(), AreaU16{0, static_cast<uint16_t>(draw_offset_y), Display::Width, Display::Height});
|
||||
}
|
||||
|
Reference in New Issue
Block a user