Changed input field to rawptr
This commit is contained in:
parent
20fe936017
commit
55d122de0c
2 changed files with 35 additions and 44 deletions
42
ui.odin
42
ui.odin
|
|
@ -30,7 +30,7 @@ Element :: struct {
|
|||
area: rect2,
|
||||
id: int,
|
||||
using config: ElementConfiguration,
|
||||
data: ElementData,
|
||||
data: rawptr,
|
||||
type: ElementType,
|
||||
dimensions: Dimensions,
|
||||
}
|
||||
|
|
@ -41,22 +41,6 @@ ElementConfiguration :: struct {
|
|||
margin, padding: v2,
|
||||
}
|
||||
|
||||
ElementData :: struct {
|
||||
min, max: f32,
|
||||
value: ^f32,
|
||||
value_string: cstring,
|
||||
}
|
||||
|
||||
ElementData_Slider :: struct {
|
||||
min, max: f32,
|
||||
value: ^f32,
|
||||
}
|
||||
|
||||
ElementData_FloatInput :: struct {
|
||||
value: ^f32,
|
||||
value_string: cstring,
|
||||
}
|
||||
|
||||
ElementType :: enum {
|
||||
Container,
|
||||
Button,
|
||||
|
|
@ -190,33 +174,19 @@ assert_no_dimensions_percentage_in_auto_container :: proc(dimensions: Dimensions
|
|||
button :: proc(dimensions: Dimensions, config: ElementConfiguration) -> ^Element {
|
||||
assert_no_dimensions_percentage_in_auto_container(dimensions)
|
||||
area := _resolve_element_area(dimensions, config.margin)
|
||||
return _append_element({
|
||||
area = area,
|
||||
config = config,
|
||||
type = .Button,
|
||||
dimensions = dimensions})
|
||||
return _append_element({area = area, config = config, type = .Button, dimensions = dimensions})
|
||||
}
|
||||
|
||||
slider :: proc(dimensions: Dimensions, config: ElementConfiguration, data: ElementData_Slider) -> ^Element {
|
||||
slider :: proc(dimensions: Dimensions, config: ElementConfiguration, data: rawptr) -> ^Element {
|
||||
assert_no_dimensions_percentage_in_auto_container(dimensions)
|
||||
area := _resolve_element_area(dimensions, config.margin)
|
||||
return _append_element({
|
||||
area = area,
|
||||
config = config,
|
||||
type = .Slider,
|
||||
data = {max = data.max, min = data.min, value = data.value},
|
||||
dimensions = dimensions})
|
||||
return _append_element({area = area, config = config, type = .Slider, data = data, dimensions = dimensions})
|
||||
}
|
||||
|
||||
input_float :: proc(dimensions: Dimensions, config: ElementConfiguration, data: ElementData_FloatInput) -> ^Element {
|
||||
input_float :: proc(dimensions: Dimensions, config: ElementConfiguration, data: rawptr) -> ^Element {
|
||||
assert_no_dimensions_percentage_in_auto_container(dimensions)
|
||||
area := _resolve_element_area(dimensions, config.margin)
|
||||
return _append_element({
|
||||
area = area,
|
||||
config = config,
|
||||
type = .InputFloat,
|
||||
data = {value = data.value, value_string = data.value_string},
|
||||
dimensions = dimensions})
|
||||
return _append_element({area = area, config = config, type = .InputFloat, data = data, dimensions = dimensions})
|
||||
}
|
||||
|
||||
get_element_outer_area :: proc(element: Element) -> rect2 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue