dimensions convenience
This commit is contained in:
parent
f647602220
commit
c5fdf60e08
1 changed files with 21 additions and 0 deletions
21
ui.odin
21
ui.odin
|
|
@ -60,6 +60,7 @@ ElementType :: enum {
|
||||||
Button,
|
Button,
|
||||||
Slider,
|
Slider,
|
||||||
InputFloat,
|
InputFloat,
|
||||||
|
InputText,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Label,
|
Label,
|
||||||
Custom0,
|
Custom0,
|
||||||
|
|
@ -92,6 +93,26 @@ Dimensions :: struct {
|
||||||
width, height: Size,
|
width, height: Size,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dimensions_pixels :: proc {
|
||||||
|
dimensions_pixels_size,
|
||||||
|
dimensions_pixels_v,
|
||||||
|
dimensions_pixels_width_height,
|
||||||
|
}
|
||||||
|
dimensions_pixels_width_height :: proc(w, h: Size_Pixels) -> Dimensions {return {w, h}}
|
||||||
|
dimensions_pixels_v :: proc(v: v2) -> Dimensions {return {Size_Pixels(v.x), Size_Pixels(v.y)}}
|
||||||
|
dimensions_pixels_size :: proc(s: Size_Pixels) -> Dimensions {return {s, s}}
|
||||||
|
|
||||||
|
dimensions_percentage :: proc {
|
||||||
|
dimensions_percentage_size,
|
||||||
|
dimensions_percentage_v,
|
||||||
|
dimensions_percentage_width_height,
|
||||||
|
}
|
||||||
|
dimensions_percentage_width_height :: proc(w, h: Size_Percentage) -> Dimensions {return {w, h}}
|
||||||
|
dimensions_percentage_v :: proc(v: v2) -> Dimensions {return {Size_Percentage(v.x), Size_Percentage(v.y)}}
|
||||||
|
dimensions_percentage_size :: proc(s: Size_Percentage) -> Dimensions {return {s, s}}
|
||||||
|
|
||||||
|
dimensions_auto :: proc() -> Dimensions {return {Size_Auto(true), Size_Auto(true)}}
|
||||||
|
|
||||||
Axis :: enum {X, Y}
|
Axis :: enum {X, Y}
|
||||||
|
|
||||||
init :: proc(ctx: ^Context, element_capacity: int, measure_text_callback: MeasureTextProc, measure_text_callback_data: rawptr, allocator := context.allocator) {
|
init :: proc(ctx: ^Context, element_capacity: int, measure_text_callback: MeasureTextProc, measure_text_callback_data: rawptr, allocator := context.allocator) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue