45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
// text.h
|
|
#pragma once
|
|
#ifndef TEXT_RENDERER_H
|
|
#define TEXT_RENDERER_H
|
|
|
|
#include <stdint.h>
|
|
|
|
struct text_t;
|
|
|
|
#ifdef __cplusplus
|
|
#include <cstdint>
|
|
extern "C" {
|
|
#else
|
|
#include <stdint.h>
|
|
#endif
|
|
|
|
// initializes a new text renderer with given width and height
|
|
text_t* text_init(int width, int height);
|
|
// shares cache, prefer when using the same font to save memory
|
|
text_t* text_init_shared(text_t* source, int width, int height);
|
|
// destroys the text renderer and frees resources
|
|
void text_destroy(text_t* text);
|
|
// pushes new text buffer to be rendered, can be stacked
|
|
void text_push(text_t* text,
|
|
const char* str,
|
|
float speed,
|
|
bool outline);
|
|
// load font and set as current font
|
|
void text_set_font(text_t* text, const char* font_path, float size);
|
|
// finish whole current text buffer immediately
|
|
void text_show_all_current(text_t* text);
|
|
// returns true if text is still animating
|
|
bool text_is_animating(text_t* text);
|
|
// advance, call every frame, returns true when it touched the framebuffer
|
|
bool text_nextframe(text_t* text, float deltatime);
|
|
// gets the framebuffer of the text renderer
|
|
const uint32_t* text_getfb(text_t* text);
|
|
// clears the text buffer and the frame buffer
|
|
void text_clear(text_t* text);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // TEXT_RENDERER_H
|