Re-create PoolBox Paco
This commit is contained in:
33
examples/PoolBox/application/src/paco.cpp
Normal file
33
examples/PoolBox/application/src/paco.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "include/paco.hpp"
|
||||
|
||||
namespace object {
|
||||
const GPU::Color24 Paco :: Colors[] = {GPU::Color24::Red(), GPU::Color24::Green(), GPU::Color24::Blue(), GPU::Color24::Yellow()};
|
||||
|
||||
void Paco :: setup() {
|
||||
/*this->tex_page = Make::TexPage(Make::PositionU16(
|
||||
Assets::Main::PacoTIM.get_texture_x(), Assets::Main::PacoTIM.get_texture_y()),
|
||||
GPU::TexturePageColor::$4bit).linked();
|
||||
|
||||
this->sprite = Make::SPRT(
|
||||
Make::AreaI16(Make::PositionI16(0, 100), Make::SizeI16(120, 128)),
|
||||
Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(Assets::Main::PacoTIM.get_clut_x(), Assets::Main::PacoTIM.get_clut_y())),
|
||||
GPU::Color24::Blue()).linked();*/
|
||||
|
||||
this->timer.reset();
|
||||
this->tex_page.concat(this->sprite);
|
||||
}
|
||||
|
||||
void Paco :: update() {
|
||||
if(this->timer.is_expired_for(325_ms)) {
|
||||
static constexpr uint8_t LastIDX = (sizeof(Paco::Colors)/sizeof(Paco::Colors[0])) - 1;
|
||||
|
||||
this->color_idx = (this->color_idx == LastIDX) ? 0 : this->color_idx + 1;
|
||||
this->timer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void Paco :: render() {
|
||||
this->sprite->color = Paco::Colors[this->color_idx];
|
||||
GPU::render(this->tex_page);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user