Kohi Game Engine
sui_textbox.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "standard_ui_system.h"
4 
5 #include <defines.h>
6 #include <renderer/nine_slice.h>
8 #include <systems/font_system.h>
9 
10 /*
11  * TODO: Textbox items
12  *
13  * - The ability to hightlight text, then add/remove/overwrite highlighted text.
14  */
15 typedef struct sui_textbox_internal_data {
30 
31  // Cached copy of the internal label's line height (taken in turn from its font.)
33 
34  // HACK: Need to store a pointer to the standard ui state here because
35  // the event system can only pass a single pointer, which is already occupied
36  // by "self". Should probably re-think this before adding too many more controls.
39 
40 KAPI b8 sui_textbox_control_create(standard_ui_state* state, const char* name, font_type type, kname font_name, u16 font_size, const char* text, struct sui_control* out_control);
41 
43 
47 
49 
51 
52 KAPI b8 sui_textbox_control_update(standard_ui_state* state, struct sui_control* self, struct frame_data* p_frame_data);
53 
54 KAPI b8 sui_textbox_control_render(standard_ui_state* state, struct sui_control* self, struct frame_data* p_frame_data, standard_ui_render_data* render_data);
55 
56 KAPI const char* sui_textbox_text_get(standard_ui_state* state, struct sui_control* self);
57 KAPI void sui_textbox_text_set(standard_ui_state* state, struct sui_control* self, const char* text);
This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:205
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
_Bool b8
8-bit boolean type
Definition: defines.h:58
float f32
32-bit floating point number
Definition: defines.h:47
signed int i32
Signed 32-bit integer.
Definition: defines.h:39
unsigned short u16
Unsigned 16-bit integer.
Definition: defines.h:22
A system responsible for the management of bitmap and system fonts.
font_type
Definition: font_system.h:33
u64 kname
A kname is a string hash made for quick comparisons versus traditional string comparisons.
Definition: kname.h:36
The standard UI system is responsible for managing standard ui elements throughout the engine....
Engine-level current frame-specific data.
Definition: frame_data.h:11
Definition: nine_slice.h:6
A range, typically of memory.
Definition: defines.h:69
Definition: standard_ui_system.h:41
Definition: standard_ui_system.h:123
Definition: standard_ui_system.h:63
Definition: standard_ui_system.h:70
Definition: standard_ui_system.h:47
Definition: sui_textbox.h:15
u32 group_id
Definition: sui_textbox.h:19
struct standard_ui_state * state
Definition: sui_textbox.h:37
range32 highlight_range
Definition: sui_textbox.h:26
sui_control cursor
Definition: sui_textbox.h:24
f32 label_line_height
Definition: sui_textbox.h:32
f32 text_view_offset
Definition: sui_textbox.h:28
sui_clip_mask clip_mask
Definition: sui_textbox.h:29
nine_slice nslice
Definition: sui_textbox.h:18
u16 draw_generation
Definition: sui_textbox.h:22
u32 draw_id
Definition: sui_textbox.h:21
sui_control content_label
Definition: sui_textbox.h:23
sui_control highlight_box
Definition: sui_textbox.h:25
u32 cursor_position
Definition: sui_textbox.h:27
u16 group_generation
Definition: sui_textbox.h:20
vec4 colour
Definition: sui_textbox.h:17
vec2i size
Definition: sui_textbox.h:16
KAPI void sui_textbox_on_mouse_down(standard_ui_state *state, struct sui_control *self, struct sui_mouse_event event)
KAPI b8 sui_textbox_control_load(standard_ui_state *state, struct sui_control *self)
KAPI b8 sui_textbox_control_size_set(standard_ui_state *state, struct sui_control *self, i32 width, i32 height)
KAPI void sui_textbox_text_set(standard_ui_state *state, struct sui_control *self, const char *text)
KAPI b8 sui_textbox_control_render(standard_ui_state *state, struct sui_control *self, struct frame_data *p_frame_data, standard_ui_render_data *render_data)
KAPI b8 sui_textbox_control_update(standard_ui_state *state, struct sui_control *self, struct frame_data *p_frame_data)
KAPI void sui_textbox_control_unload(standard_ui_state *state, struct sui_control *self)
KAPI void sui_textbox_control_destroy(standard_ui_state *state, struct sui_control *self)
struct sui_textbox_internal_data sui_textbox_internal_data
KAPI b8 sui_textbox_control_height_set(standard_ui_state *state, struct sui_control *self, i32 height)
KAPI b8 sui_textbox_control_width_set(standard_ui_state *state, struct sui_control *self, i32 width)
KAPI b8 sui_textbox_control_create(standard_ui_state *state, const char *name, font_type type, kname font_name, u16 font_size, const char *text, struct sui_control *out_control)
KAPI void sui_textbox_on_mouse_up(standard_ui_state *state, struct sui_control *self, struct sui_mouse_event event)
KAPI const char * sui_textbox_text_get(standard_ui_state *state, struct sui_control *self)
A 2-element integer-based vector.
Definition: math_types.h:280
A 4-element vector.
Definition: math_types.h:89