Integrate all the progress into master #6
|
@ -9,13 +9,16 @@ namespace object {
|
|||
this->tex_page.concat(this->sprite);
|
||||
}
|
||||
|
||||
void Paco :: update() {
|
||||
bool 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();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Paco :: render() {
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace object {
|
|||
color_idx(0) {}
|
||||
|
||||
void setup();
|
||||
void update();
|
||||
bool update();
|
||||
void render();
|
||||
};
|
||||
}
|
|
@ -15,6 +15,7 @@ using NewFontWriter = ::JabyEngine::FontWriter;
|
|||
static object::Paco paco;
|
||||
static FontPrimitive font_buffer[2][256];
|
||||
static NewFontWriter new_font_writer;
|
||||
static uint8_t wiggle_count = 0;
|
||||
|
||||
static void setup() {
|
||||
static constexpr auto FontTIM = SimpleTIM(320, 0, 320, DefaultFont::Info.VRAMSize.height);
|
||||
|
@ -34,8 +35,10 @@ static void update() {
|
|||
const auto end_pos = cursor.write(FontWriter::Position::create(0, 32), "Cody is cute\n&\na \x1b[8;0;0mBAAAAABY!!!");
|
||||
cursor.write(end_pos, "\x1b[0;7;7mJaby was\nhere c:");
|
||||
|
||||
new_font_writer.write(Make::PositionI16(8, 8), "012345 ABCDEFGHIJKL\nabcedfghijkl");
|
||||
paco.update();
|
||||
new_font_writer.write(Make::PositionI16(8, 8), "012345 ABCDEFGHIJKL\nabcedfghijkl", GPU::Color24::Blue(), wiggle_count);
|
||||
if(paco.update()) {
|
||||
wiggle_count++;
|
||||
}wiggle_count++;
|
||||
}
|
||||
|
||||
static void render() {
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace JabyEngine {
|
|||
FontWriter::setup(buffer_info, vram_dst, Make::SizeI16(font_info.FontSize.width, font_info.FontSize.height));
|
||||
}
|
||||
|
||||
GPU::PositionI16 write(GPU::PositionI16 pos, const char* str);
|
||||
GPU::PositionI16 write(GPU::PositionI16 pos, const char* str, GPU::Color24 color = GPU::Color24::Grey(), uint8_t wiggle_count = 0);
|
||||
void render();
|
||||
};
|
||||
}
|
|
@ -4,11 +4,13 @@
|
|||
#include <stdio.h>
|
||||
|
||||
namespace JabyEngine {
|
||||
static constexpr int8_t WiggleValues[] = {0, 3, 5, 1, -2, -5, -4, 1};//{0, 2, 6, 2, 0, -2, -6, -2};
|
||||
|
||||
void FontWriter :: setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const GPU::SizeI16& font_size) {
|
||||
this->prim_buffer = buffer_info;
|
||||
this->tex_page = Make::TexPage(vram_dst.get_texture_position(), GPU::TexturePageColor::$4bit).linked();
|
||||
this->cur_primitive = buffer_info.double_buffer[GPU::Display::current_id];
|
||||
|
||||
|
||||
for(size_t buffer_id = 0; buffer_id < 2; buffer_id++) {
|
||||
for(size_t buffer_element_id = 0; buffer_element_id < buffer_info.single_buffer_length; buffer_element_id++) {
|
||||
this->prim_buffer.double_buffer[buffer_id][buffer_element_id] = Make::SPRT(
|
||||
|
@ -19,7 +21,7 @@ namespace JabyEngine {
|
|||
}
|
||||
}
|
||||
|
||||
GPU::PositionI16 FontWriter :: write(GPU::PositionI16 pos, const char* str) {
|
||||
GPU::PositionI16 FontWriter :: write(GPU::PositionI16 pos, const char* str, GPU::Color24 color, uint8_t wiggle_count) {
|
||||
const auto* primitive_end = &this->prim_buffer.double_buffer[GPU::Display::current_id][this->prim_buffer.single_buffer_length];
|
||||
const auto font_size = this->prim_buffer.double_buffer[0][0]->size;
|
||||
const auto row_count = 256/font_size.width;
|
||||
|
@ -41,13 +43,14 @@ namespace JabyEngine {
|
|||
auto& primitive = *this->cur_primitive++;
|
||||
|
||||
primitive->position = pos;
|
||||
primitive->position.move(0, -WiggleValues[wiggle_count&0b111]);
|
||||
primitive->tex_offset = GPU::PageOffset::from_tile_id(cur_char - '!', row_count, font_size);
|
||||
primitive->color = GPU::Color24::Grey();
|
||||
primitive->color = color;
|
||||
primitive.concat(*this->cur_primitive);
|
||||
|
||||
pos.move(primitive->size.width, 0);
|
||||
wiggle_count++;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue