#ifndef SCUFENG_TEXT_H_ #define SCUFENG_TEXT_H_ #include #include "cglm/types.h" #include "scufeng/engine.h" #include "scufeng/Mesh.h" #include "scufcont/DString.h" typedef enum : uint8_t { TI_FIXED_WIDTH = 1, } SETextInputOptions; typedef struct { SETextInputOptions opts; bool active; size_t cursor; SEMesh cursor_mesh; SEMesh bg_mesh; SCDString text; int x; int y; float scale; vec3 text_color; float fixed_width; } SETextInput; SEResult se_font_load( const char *path, const unsigned int pixel_w, const unsigned int pixel_h ); int se_text_render( const char *text, int x, int y, float scale, const vec3 color ); SETextInput SETextInput_alloc( const char *text, const size_t text_len, const int x, const int y, vec3 color, vec4 bg_color, const SETextInputOptions opts ); void SETextInput_free(SETextInput *const ti); void SETextInput_deactivate(); void SETextInput_activate(SETextInput *const ti); SEResult SETextInput_char_insert_at_cursor(SETextInput *const ti, const char ch); void SETextInput_char_remove_at_cursor(SETextInput *const ti); bool SETextInput_is_pos_inside(const SETextInput *const ti, const float x, const float y); void SETextInput_fixed_width_set(SETextInput *const ti, const float w); void SETextInput_render_2d(SETextInput *const ti); void SETextInput_render_multiple_2d(SETextInput *const *const tis, const size_t ti_count); #endif // SCUFENG_TEXT_H_