build #1
2 changed files with 6 additions and 20 deletions
Removed minor redundancies
commit
b45f1008a7
1
TODO.MD
1
TODO.MD
|
|
@ -2,6 +2,7 @@
|
|||
- Web read/write
|
||||
- Ship with default setup
|
||||
- Set grid
|
||||
- Math evaluation field
|
||||
|
||||
DONE:
|
||||
- Fix -vet errors
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ UiElementData_Slider :: struct {
|
|||
UiElementData_FloatInput :: struct {
|
||||
value: ^f32,
|
||||
value_string: cstring,
|
||||
tag: bit_set[enum{UpdateMatrix}],
|
||||
}
|
||||
|
||||
UiElementData_TextInput :: struct {
|
||||
|
|
@ -212,14 +211,6 @@ ProgramDialogType :: enum {
|
|||
.Error = "Error",
|
||||
}
|
||||
|
||||
ProgramMessageType :: enum {
|
||||
ChangeMatrixTypeClearData,
|
||||
}
|
||||
|
||||
@rodata program_messages := [ProgramMessageType]cstring {
|
||||
.ChangeMatrixTypeClearData = "Changing the matrix type will delete all current matrices.\nAre you sure you want to do this?",
|
||||
}
|
||||
|
||||
program: Program
|
||||
|
||||
InputFloatField :: [32]byte
|
||||
|
|
@ -298,7 +289,6 @@ Program :: struct {
|
|||
grid_snap: bool,
|
||||
font_style: FontStyle,
|
||||
state: ProgramState,
|
||||
message_type: ProgramMessageType,
|
||||
dialog_type: ProgramDialogType,
|
||||
dialog_data: ProgramData_DialogState,
|
||||
dialog_message: cstring,
|
||||
|
|
@ -475,6 +465,7 @@ program_update :: proc() {
|
|||
|
||||
ui_elements, top_bar_container, matrix_container := program_build_workspace_ui(&program.ui_context)
|
||||
ui_overlay_elements: []ui.Element
|
||||
program.animation.matrix_count = program.matrix_count
|
||||
|
||||
switch program.state {
|
||||
case .Normal:
|
||||
|
|
@ -882,7 +873,7 @@ program_build_workspace_ui :: proc(ctx: ^ui.Context) -> (elements: []ui.Element,
|
|||
ui.element(.Button, button_dimensions, button_config, button_data)
|
||||
|
||||
button_data = new(UiElementData_Button, context.temp_allocator)
|
||||
button_tooltip = fmt.ctprint("Add rotation\nmatrix", sep = "")
|
||||
button_tooltip = fmt.ctprint("Add skew\nmatrix", sep = "")
|
||||
button_config = {margin = button_margin, label = RAYGUI_ICON_SKEW_MATRIX, tooltip = button_tooltip}
|
||||
button_data^ = {type = .AddSkewMatrix}
|
||||
ui.same_line()
|
||||
|
|
@ -1178,6 +1169,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
|||
case .AddSkewMatrixConfirm:
|
||||
inputs := program.dialog_data.input_float_values
|
||||
program_add_skew_matrix(inputs[0], inputs[1])
|
||||
program.state = .Normal
|
||||
case .ExitDialog:
|
||||
program.state = .Normal
|
||||
case .StartTransformation:
|
||||
|
|
@ -1246,22 +1238,15 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
|||
case .CloseProgram:
|
||||
program.window_should_close = true
|
||||
}
|
||||
if data.type in UiButtonRecalculateFinishGroup {
|
||||
program.animation.matrix_count = program.matrix_count
|
||||
}
|
||||
}
|
||||
case .Slider:
|
||||
data := cast(^UiElementData_Slider)element.data
|
||||
rl.GuiSlider(area, element.label, "", data.value, data.min, data.max)
|
||||
case .InputFloat:
|
||||
data := cast(^UiElementData_FloatInput)element.data
|
||||
value_previous := data.value^
|
||||
if rl.GuiValueBoxFloat(area, element.label, data.value_string, data.value, focus_element_id == element.id) == 1 {
|
||||
focus_element_id = element.id
|
||||
}
|
||||
if value_previous != data.value^ && .UpdateMatrix in data.tag {
|
||||
program.animation.matrix_count = program.matrix_count
|
||||
}
|
||||
case .InputText:
|
||||
data := cast(^UiElementData_TextInput)element.data
|
||||
if rl.GuiTextBox(area, data.str, i32(program.font_style.size), focus_element_id == element.id) == 1 {
|
||||
|
|
@ -1366,7 +1351,7 @@ ui_mat3 :: proc(idx: int, mat: []f32, value_strings: []InputFloatField, dimensio
|
|||
#unroll for row in 0..<3 {
|
||||
data := new(UiElementData_FloatInput, allocator)
|
||||
index := row * 3 + col
|
||||
data^ = {value = &mat[index], value_string = cstring(&value_strings[index][0]), tag = {.UpdateMatrix}}
|
||||
data^ = {value = &mat[index], value_string = cstring(&value_strings[index][0])}
|
||||
ui.element(.InputFloat, matrix_input_dimensions, matrix_input_config, data)
|
||||
ui.same_line()
|
||||
}
|
||||
|
|
@ -1377,7 +1362,7 @@ ui_mat3 :: proc(idx: int, mat: []f32, value_strings: []InputFloatField, dimensio
|
|||
|
||||
ui_labeled_input_float_element :: proc(label: cstring, margin: f32, value: ^f32, value_string: ^InputFloatField, allocator := context.temp_allocator) -> ^ui.Element {
|
||||
label_element := ui.element(.Label, {}, {label = fmt.ctprintf("%s: ", label), color = ui.col(rl.WHITE), margin = margin})
|
||||
dimensions := ui.Dimensions{ui.Size_Pixels(64.0), ui.dimensions_pixels(ui.rect_get_size(ui.get_element_outer_area(label_element^))).height}
|
||||
dimensions := ui.Dimensions{ui.Size_Pixels(128.0), ui.dimensions_pixels(ui.rect_get_size(ui.get_element_outer_area(label_element^))).height}
|
||||
ui.same_line()
|
||||
input_data := new(UiElementData_FloatInput, context.temp_allocator)
|
||||
input_data^ = {value = value, value_string = cstring(&value_string[0])}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue