Prepare C arg list
This commit is contained in:
parent
4f44f69b40
commit
7904da6875
|
@ -22,7 +22,8 @@ void font_writer_setup() {
|
|||
|
||||
void font_writer_update() {
|
||||
auto state = JabyEngine::State::create(JabyEngine::Make::PositionI16(8, 8), wiggle_count);
|
||||
new_font_writer.write(state, "012345 ABCDEFGHIJKL\nabcedfghijkl", JabyEngine::GPU::Color24::Blue(), &wiggle);
|
||||
new_font_writer.write(state, "012345 ABCDEFGHIJKL\nabcedfghijkl\n", JabyEngine::GPU::Color24::Blue(), &wiggle);
|
||||
new_font_writer.write(state, "Miau: %i", JabyEngine::GPU::Color24::Red(), &wiggle, 12345);
|
||||
|
||||
if(timer.is_expired_for(50_ms)) {
|
||||
timer.reset();
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __STDARG__H
|
||||
#define __STDARG__H
|
||||
|
||||
typedef __builtin_va_list va_list;
|
||||
#define va_start __builtin_va_start
|
||||
#define va_end __builtin_va_end
|
||||
|
||||
#endif // !__STDARG__H
|
|
@ -1,9 +1,16 @@
|
|||
#pragma once
|
||||
#include "Type/types.hpp"
|
||||
#include <stdarg.h>
|
||||
|
||||
namespace JabyEngine {
|
||||
class FontWriter {
|
||||
private:
|
||||
#define __write_impl(start, color, wiggle) \
|
||||
va_list list; \
|
||||
va_start(list, start); \
|
||||
FontWriter::write(state, str, color, wiggle, list); \
|
||||
va_end(list)
|
||||
|
||||
FontBufferInfo prim_buffer;
|
||||
GPU::TexPage::Linked tex_page;
|
||||
FontPrimitive* cur_primitive;
|
||||
|
@ -24,7 +31,18 @@ namespace JabyEngine {
|
|||
FontWriter::setup(buffer_info, vram_dst, Make::SizeI16(font_info.font_size.width, font_info.font_size.height));
|
||||
}
|
||||
|
||||
void write(State& state, const char* str, GPU::Color24 color = GPU::Color24::Grey(), Wiggle* wiggle = nullptr);
|
||||
void write(State& state, const char* str, ...) {
|
||||
__write_impl(str, GPU::Color24::Grey(), nullptr);
|
||||
}
|
||||
void write(State& state, const char* str, GPU::Color24 color, ...) {
|
||||
__write_impl(color, color, nullptr);
|
||||
}
|
||||
void write(State& state, const char* str, GPU::Color24 color, Wiggle* wiggle, ...) {
|
||||
__write_impl(wiggle, color, wiggle);
|
||||
}
|
||||
void write(State& state, const char* str, GPU::Color24 color, Wiggle* wiggle, va_list b);
|
||||
void render();
|
||||
|
||||
#undef __write_impl
|
||||
};
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace JabyEngine {
|
|||
}
|
||||
}
|
||||
|
||||
void FontWriter :: write(State& state, const char* str, GPU::Color24 color, Wiggle* wiggle) {
|
||||
void FontWriter :: write(State& state, const char* str, GPU::Color24 color, Wiggle* wiggle, va_list b) {
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue