Draw first triangle
This commit is contained in:
@@ -21,17 +21,27 @@ namespace JabyEngine {
|
||||
static constexpr uint16_t ScanlinesV = 240;
|
||||
#endif //JABYENGINE_PAL
|
||||
|
||||
static void exchange_buffer_and_display();
|
||||
static uint32_t exchange_buffer_and_display();
|
||||
};
|
||||
|
||||
void wait_vsync(uint8_t syncs);
|
||||
|
||||
static void wait_ready_for_CMD() {
|
||||
while(!GPU_IO::GPUSTAT.is_set(GPU_IO::GPUSTAT_t::GP0ReadyForCMD));
|
||||
}
|
||||
|
||||
static void set_draw_area(uint16_t x, uint16_t y) {
|
||||
GPU_IO::GP0 = GPU_IO::Command::DrawAreaTopLeft(x, y);
|
||||
GPU_IO::GP0 = GPU_IO::Command::DrawAreaBottomRight((x + Display::Width), (y + Display::Height));
|
||||
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));
|
||||
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = top_left;
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = bottom_right;
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -39,17 +49,19 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void reset_cmd_buffer() {
|
||||
GPU_IO::GP1 = GPU_IO::Command::ResetCMDBufer();
|
||||
static void set_draw_offset(int16_t x, int16_t y) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::SetDrawOffset(x, y);
|
||||
}
|
||||
|
||||
static void wait_ready_for_CMD() {
|
||||
while(!GPU_IO::GPUSTAT.is_set(GPU_IO::GPUSTAT_t::GP0ReadyForCMD));
|
||||
static void reset_cmd_buffer() {
|
||||
GPU_IO::GP1 = GPU_IO::Command::ResetCMDBufer();
|
||||
}
|
||||
|
||||
namespace DMA {
|
||||
|
||||
Reference in New Issue
Block a user