Place stars in Jabys eyes

This commit is contained in:
jaby 2024-04-21 17:06:15 +02:00
parent 6d2e1a7f8b
commit b4099a7f97
3 changed files with 31 additions and 7 deletions

View File

@ -8,11 +8,29 @@ namespace GTETest {
using namespace JabyEngine;
using namespace GTETest;
static auto jaby_star_base = Make::SPRT(
namespace Jaby {
static constexpr auto Position = Make::PositionI16(GPU::Display::Width - 64, GPU::Display::Height - 64);
static constexpr GPU::POLY_FT4::Linked make_star_eye(GPU::PositionI16 pos) {
return Make::POLY_FT4(
Make::AreaI16(pos, GPU::SizeI16(8, 8)),
JabySTARTim.get_page_offset_clut4().add(0, 64),
Make::TPage(JabySTARTim.get_texture_position(), GPU::SemiTransparency::B_add_F, GPU::TextureColorMode::clut4),
Make::PageClut(JabySTARTim.get_clut_position()),
GPU::Color24::Grey()
).linked();
}
static auto star_base = Make::SPRT(
// TODO: improve magic numbers
Make::AreaI16(GPU::Display::Width - 64, GPU::Display::Height - 64, 64, 64),
Make::AreaI16(Position, Make::SizeI16(64, 64)),
Make::OffsetPageWithClut(JabySTARTim.get_page_offset_clut4(), Make::PageClut(JabySTARTim.get_clut_position()))
);
).linked();
static GPU::POLY_FT4::Linked star_eyes[2] = {
make_star_eye(Position.add(12, 31)),
make_star_eye(Position.add(33, 33))};
}
static auto doener_fish = GTE_Sprite::create(Make::POLY_FT4(
Make::AreaI16(Make::PositionI16(0, 0), Assets::Main::DoenerFishInfo.size),
@ -25,6 +43,7 @@ namespace GTETest {
static auto gbl_rotation = 0.0_deg;
static void setup() {
Jaby::star_base.concat(Jaby::star_eyes[0].concat(Jaby::star_eyes[1]));
doener_fish.area.position = GPU::PositionI16::create(100, 100);
Shared::back_menu.reset();
@ -47,8 +66,9 @@ namespace GTETest {
static void render() {
doener_fish.render();
GPU::render(jaby_star_base);
GPU::render(Jaby::star_base);
Shared::back_menu.render();
GPU::wait_for_render(); //< Because we are single buffer
}
void main() {

View File

@ -71,6 +71,10 @@ namespace JabyEngine {
internal::render(reinterpret_cast<const uint32_t*>(&primitives), (sizeof(T)/sizeof(uint32_t))*N);
}
static void wait_for_render() {
while(!GPU_IO::GPUSTAT.read().is_set(GPU_IO::GPUSTAT::GP0ReadyForCMD));
}
uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true);
}
}

View File

@ -28,7 +28,7 @@ namespace JabyEngine {
void wait_vsync(uint8_t syncs);
static void wait_ready_for_CMD() {
while(!GPU_IO::GPUSTAT.read().is_set(GPU_IO::GPUSTAT::GP0ReadyForCMD));
GPU::wait_for_render();
}
static void set_draw_area(const PositionU16& pos) {