x.ttf.render_sokol #
struct TTF_render_Sokol #
struct TTF_render_Sokol {
pub mut:
bmp &ttf.BitMap = unsafe { nil } // Base bitmap render
// rendering fields
sg_img gfx.Image // sokol image
sg_smp gfx.Sampler // sokol sampler
scale_reduct f32 = 2.0 // scale of the cpu texture for filtering
device_dpi int = 72 // device DPI
}
TTF_render_Sokol is a structure containing data for rendering a TTF font as a sokol texture.
fn (TTF_render_Sokol) format_texture #
fn (mut tf_skl TTF_render_Sokol) format_texture()
format_texture formats the BMP (bitmap).
fn (TTF_render_Sokol) create_text #
fn (mut tf_skl TTF_render_Sokol) create_text(in_txt string, in_font_size f32)
create_text prepares the text in_txt in size in_font_size as a sokol texture.
fn (TTF_render_Sokol) create_text_block #
fn (mut tf_skl TTF_render_Sokol) create_text_block(in_txt string, in_w int, in_h int, in_font_size f32)
create_text_block prepares a block of text as a sokol texture.
fn (TTF_render_Sokol) create_texture #
fn (mut tf_skl TTF_render_Sokol) create_texture()
create_texture creates the sokol texture from the internal buffer state.
fn (TTF_render_Sokol) destroy_texture #
fn (tf_skl TTF_render_Sokol) destroy_texture()
destroy_texture detroys the internal sokol texture.
fn (TTF_render_Sokol) update_text_texture #
fn (mut tf_skl TTF_render_Sokol) update_text_texture()
update_text_texture updates the sokol texture with current internal state.
Note: Only use if .dynamic is set.
fn (TTF_render_Sokol) draw_text_bmp #
fn (tf_skl TTF_render_Sokol) draw_text_bmp(ctx &gg.Context, x f32, y f32)
draw_text_bmp renders the internal state to the current sokol pipeline.