Support clearing existing text
This commit is contained in:
parent
376cf02697
commit
107fcbd64e
|
@ -34,6 +34,8 @@ namespace JabyEngine {
|
|||
FontWriter::setup(vram_dst, Make::SizeI16(font_info.font_size.width, font_info.font_size.height));
|
||||
}
|
||||
|
||||
void clear();
|
||||
|
||||
void write(State& state, const char* str, ...) {
|
||||
__write_impl(str, GPU::Color24::Grey(), nullptr);
|
||||
}
|
||||
|
|
|
@ -63,13 +63,17 @@ namespace JabyEngine {
|
|||
this->last_primitive = nullptr;
|
||||
}
|
||||
|
||||
void FontWriter :: clear() {
|
||||
this->last_primitive = &this->tex_page[GPU::update_id()];
|
||||
}
|
||||
|
||||
void FontWriter :: write(State& state, const char* str, GPU::Color24 color, const Wiggle* wiggle, va_list list) {
|
||||
static const auto exchang_str = [](const char* str, const char* new_str) -> pair<const char*, const char*> {
|
||||
return {str + 1, new_str};
|
||||
};
|
||||
|
||||
if(!this->last_primitive) {
|
||||
this->last_primitive = &this->tex_page[GPU::update_id()];
|
||||
FontWriter::clear();
|
||||
}
|
||||
|
||||
const auto row_count = 256/font_size.width;
|
||||
|
|
Loading…
Reference in New Issue