Integrate all the progress into master #6
|
@ -16,7 +16,7 @@ namespace GTETest {
|
|||
} animation[] = {
|
||||
{.scale_left = 1.0_gf, .scale_right = 1.0_gf},
|
||||
{.scale_left = 1.0_gf, .scale_right = 1.0_gf},
|
||||
|
||||
|
||||
{.scale_left = 1.2_gf, .scale_right = 1.5_gf},
|
||||
{.scale_left = 1.5_gf, .scale_right = 1.2_gf},
|
||||
{.scale_left = 1.2_gf, .scale_right = 1.5_gf},
|
||||
|
@ -68,6 +68,22 @@ namespace GTETest {
|
|||
};
|
||||
}
|
||||
|
||||
namespace Background {
|
||||
static constexpr GPU::AreaI16 Area[2] = {
|
||||
Make::AreaI16(-30, -30, 350, 350),
|
||||
Make::AreaI16(0, 0, GPU::Display::Width, GPU::Display::Width),
|
||||
};
|
||||
static constexpr GPU::PositionI16 AreaPivot[2] = {
|
||||
Make::PositionI16(Area[0].size.width/2, Area[0].size.height/2),
|
||||
Make::PositionI16(Area[1].size.width/2, Area[1].size.height/2),
|
||||
};
|
||||
|
||||
static GPU::POLY_G4 poly[2] = {
|
||||
Make::POLY_G4(Area[0], {GPU::Color24::Blue(), GPU::Color24::Red(), GPU::Color24::Green(), GPU::Color24::Purple()}),
|
||||
Make::POLY_G4(Area[1], {GPU::Color24::Blue(), GPU::Color24::Red(), GPU::Color24::Green(), GPU::Color24::Purple()}),
|
||||
};
|
||||
}
|
||||
|
||||
static auto doener_fish = GTE_Sprite::create(Make::POLY_FT4(
|
||||
Make::AreaI16(Make::PositionI16(0, 0), Assets::Main::DoenerFishInfo.size),
|
||||
Assets::Main::DoenerFishInfo.tim.get_page_offset_clut4(),
|
||||
|
@ -89,7 +105,7 @@ namespace GTETest {
|
|||
Shared::back_menu.reset();
|
||||
|
||||
GTE::set_geom_offset(0, 0);
|
||||
GTE::set_geom_screen(512);
|
||||
GTE::set_geom_screen(256);
|
||||
}
|
||||
|
||||
static bool update_or_exit() {
|
||||
|
@ -106,7 +122,16 @@ namespace GTETest {
|
|||
Jaby::animation_timer.reset();
|
||||
}
|
||||
|
||||
auto matrix = GTE::MATRIX::rotated(-gbl_rotation, gbl_rotation, -gbl_rotation);
|
||||
for(size_t n = 0; n < sizeof(Background::poly)/sizeof(Background::poly[0]); n++) {
|
||||
auto matrix = [](size_t n) -> GTE::MATRIX {
|
||||
auto matrix = GTE::MATRIX::translated(-Background::AreaPivot[n].x, -Background::AreaPivot[n].y);
|
||||
matrix.rotate(0.0_deg, 0.0_deg, (n == 0) ? gbl_rotation : -gbl_rotation);
|
||||
return matrix.translate(Background::Area[n].position.x + Background::AreaPivot[n].x, Background::Area[n].position.y + Background::AreaPivot[n].y);
|
||||
}(n);
|
||||
matrix.apply_to_area(Background::poly[n], Make::AreaI16(Make::PositionI16(), Background::Area[n].size));
|
||||
}
|
||||
|
||||
const auto matrix = GTE::MATRIX::rotated(-gbl_rotation, gbl_rotation, -gbl_rotation);
|
||||
doener_fish.apply(matrix);
|
||||
Jaby::star_eyes[0].apply();
|
||||
Jaby::star_eyes[1].apply();
|
||||
|
@ -117,6 +142,9 @@ namespace GTETest {
|
|||
}
|
||||
|
||||
static void render() {
|
||||
for(const auto& poly : Background::poly) {
|
||||
GPU::render(poly);
|
||||
}
|
||||
doener_fish.render();
|
||||
GPU::render(Jaby::star_base);
|
||||
Shared::back_menu.render();
|
||||
|
@ -130,7 +158,7 @@ namespace GTETest {
|
|||
if(update_or_exit()) {
|
||||
break;
|
||||
}
|
||||
GPU::swap_buffers_vsync(1);
|
||||
GPU::swap_buffers_vsync(1, false);
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,22 @@ namespace JabyEngine {
|
|||
|
||||
template<typename T>
|
||||
struct Poly4Interface {
|
||||
static constexpr Vertex vertex0_from(const AreaI16& area) {
|
||||
return area.get_top_left();
|
||||
}
|
||||
|
||||
static constexpr Vertex vertex1_from(const AreaI16& area) {
|
||||
return area.get_top_right();
|
||||
}
|
||||
|
||||
static constexpr Vertex vertex2_from(const AreaI16& area) {
|
||||
return area.get_bottom_left();
|
||||
}
|
||||
|
||||
static constexpr Vertex vertex3_from(const AreaI16& area) {
|
||||
return area.get_bottom_right();
|
||||
}
|
||||
|
||||
constexpr T& set_rect_size(const SizeI16& size) {
|
||||
static_cast<T*>(this)->vertex1 = static_cast<const T*>(this)->vertex0.add(size.width, 0);
|
||||
static_cast<T*>(this)->vertex2 = static_cast<const T*>(this)->vertex0.add(0, size.height);
|
||||
|
@ -228,10 +244,10 @@ namespace JabyEngine {
|
|||
|
||||
static constexpr POLY_F4 create(const AreaI16& area, Color24 color) {
|
||||
return POLY_F4::create({
|
||||
area.position,
|
||||
area.position.move(area.size.width, 0),
|
||||
area.position.move(0, area.size.height),
|
||||
area.position.move(area.size.width, area.size.height)
|
||||
POLY_F4::vertex0_from(area),
|
||||
POLY_F4::vertex1_from(area),
|
||||
POLY_F4::vertex2_from(area),
|
||||
POLY_F4::vertex3_from(area)
|
||||
}, color);
|
||||
}
|
||||
};
|
||||
|
@ -276,10 +292,10 @@ namespace JabyEngine {
|
|||
|
||||
static constexpr POLY_FT4 create(const AreaI16& area, const PageOffset& tex_offset, TPage tpage, PageClut clut, Color24 color = Color24::Grey()) {
|
||||
return POLY_FT4::create({
|
||||
{area.position, tex_offset},
|
||||
{area.position.move(area.size.width, 0), tex_offset.move(area.size.width, 0)},
|
||||
{area.position.move(0, area.size.height), tex_offset.move(0, area.size.height)},
|
||||
{area.position.move(area.size.width, area.size.height), tex_offset.move(area.size.width, area.size.height)}
|
||||
{POLY_FT4::vertex0_from(area), tex_offset},
|
||||
{POLY_FT4::vertex1_from(area), tex_offset.move(area.size.width, 0)},
|
||||
{POLY_FT4::vertex2_from(area), tex_offset.move(0, area.size.height)},
|
||||
{POLY_FT4::vertex3_from(area), tex_offset.move(area.size.width, area.size.height)}
|
||||
}, tpage, clut, color);
|
||||
}
|
||||
};
|
||||
|
@ -320,10 +336,10 @@ namespace JabyEngine {
|
|||
|
||||
static constexpr POLY_G4 create(const AreaI16& area, const Color24 (&color)[4]) {
|
||||
return POLY_G4::create({
|
||||
{area.position, color[0]},
|
||||
{area.position.move(area.size.width, 0), color[1]},
|
||||
{area.position.move(0, area.size.height), color[2]},
|
||||
{area.position.move(area.size.width, area.size.height), color[3]}
|
||||
{POLY_FT4::vertex0_from(area), color[0]},
|
||||
{POLY_FT4::vertex1_from(area), color[1]},
|
||||
{POLY_FT4::vertex2_from(area), color[2]},
|
||||
{POLY_FT4::vertex3_from(area), color[3]}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -373,10 +389,10 @@ namespace JabyEngine {
|
|||
|
||||
static constexpr POLY_GT4 create(const AreaI16& area, const PageOffset& tex_offset, TPage tpage, PageClut clut, const Color24 (&color)[4]) {
|
||||
return POLY_GT4::create({
|
||||
{area.position, tex_offset, color[0]},
|
||||
{area.position.move(area.size.width, 0), tex_offset.move(area.size.width, 0), color[1]},
|
||||
{area.position.move(0, area.size.height), tex_offset.move(0, area.size.height), color[2]},
|
||||
{area.position.move(area.size.width, area.size.height), tex_offset.move(area.size.width, area.size.height), color[3]}
|
||||
{POLY_FT4::vertex0_from(area), tex_offset, color[0]},
|
||||
{POLY_FT4::vertex1_from(area), tex_offset.move(area.size.width, 0), color[1]},
|
||||
{POLY_FT4::vertex2_from(area), tex_offset.move(0, area.size.height), color[2]},
|
||||
{POLY_FT4::vertex3_from(area), tex_offset.move(area.size.width, area.size.height), color[3]}
|
||||
}, tpage, clut);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -125,14 +125,23 @@ namespace JabyEngine {
|
|||
GPU::Vertex& apply_to(GPU::Vertex& vertex) const;
|
||||
GPU::Vertex apply_to(const GPU::Vertex& vertex) const;
|
||||
|
||||
GPU::POLY_FT4& apply_to(GPU::POLY_FT4& poly) const {
|
||||
template<typename T>
|
||||
T& apply_to_area(T& poly, const GPU::AreaI16& area) const {
|
||||
poly.vertex0 = MATRIX::apply_to(GPU::POLY_G4::vertex0_from(area));
|
||||
poly.vertex1 = MATRIX::apply_to(GPU::POLY_G4::vertex1_from(area));
|
||||
poly.vertex2 = MATRIX::apply_to(GPU::POLY_G4::vertex2_from(area));
|
||||
poly.vertex3 = MATRIX::apply_to(GPU::POLY_G4::vertex3_from(area));
|
||||
return poly;
|
||||
}
|
||||
|
||||
/*GPU::POLY_FT4& apply_to(GPU::POLY_FT4& poly) const {
|
||||
MATRIX::apply_to(poly.vertex0);
|
||||
MATRIX::apply_to(poly.vertex1);
|
||||
MATRIX::apply_to(poly.vertex2);
|
||||
MATRIX::apply_to(poly.vertex3);
|
||||
|
||||
return poly;
|
||||
}
|
||||
}*/
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue