Info message with the weird icon label embedding
This commit is contained in:
parent
2b91b8783c
commit
dda52d2c0d
2 changed files with 38 additions and 1 deletions
2
config
2
config
|
|
@ -1 +1 @@
|
|||
{"window_size":[1917.00000000,1098.00000000]}
|
||||
{"window_size":[2502.00000000,1371.00000000]}
|
||||
|
|
@ -51,12 +51,21 @@ RAYGUI_ICON_TRASH :: "#143#"
|
|||
RAYGUI_ICON_DOWN :: "#120#"
|
||||
RAYGUI_ICON_UP :: "#121#"
|
||||
RAYGUI_ICON_SNAP :: "#136#"
|
||||
RAYGUI_ICON_INFO :: "#191#"
|
||||
RAYGUI_ICON_CODE :: "#252#"
|
||||
|
||||
TRANSFORMATION_RECTANGLE_COLOR_ORIGIN :: rl.RED
|
||||
TRANSFORMATION_RECTANGLE_COLOR_MIDDLE :: rl.MAGENTA
|
||||
TRANSFORMATION_RECTANGLE_COLOR_NEXT :: rl.GRAY
|
||||
TRANSFORMATION_RECTANGLE_COLOR_LAST :: rl.BLUE
|
||||
|
||||
PROGRAM_COLOR_SYNTHAS :: rl.Color{127, 241, 204, 255}
|
||||
PROGRAM_INFO :: "Transformation Visualizer V1.0 (2026.09.16)\n" +
|
||||
"By Synthasmagoria\n" +
|
||||
"Made using Raylib, Raygui and Odin\n" +
|
||||
"Source code here:"
|
||||
PROGRAM_REPOSITORY_URL :: "https://offgrd.xyz/git/Synthasmagoria/transformation_visualizer"
|
||||
|
||||
@rodata default_project_load_location := "default"
|
||||
@rodata font_data := #load("assets/fonts/cmuntb.ttf")
|
||||
|
||||
|
|
@ -124,6 +133,8 @@ UiButtonType :: enum {
|
|||
MatrixMoveDown,
|
||||
CenterView,
|
||||
CloseProgram,
|
||||
DisplayInfo,
|
||||
OpenSourceCode,
|
||||
}
|
||||
|
||||
UiButtonRecalculateFinishGroup :: bit_set[UiButtonType]{
|
||||
|
|
@ -197,6 +208,7 @@ ProgramDialogType :: enum {
|
|||
SaveProject,
|
||||
LoadProject,
|
||||
CloseUnsavedProjectPrompt,
|
||||
Info,
|
||||
Error,
|
||||
}
|
||||
|
||||
|
|
@ -208,6 +220,7 @@ ProgramDialogType :: enum {
|
|||
.SaveProject = "Save project",
|
||||
.LoadProject = "Load project",
|
||||
.CloseUnsavedProjectPrompt = "Unsaved project",
|
||||
.Info = "Info",
|
||||
.Error = "Error",
|
||||
}
|
||||
|
||||
|
|
@ -564,6 +577,8 @@ program_update :: proc() {
|
|||
program.window_should_close = true
|
||||
case .Error:
|
||||
program.state = .Normal
|
||||
case .Info:
|
||||
program.state = .Normal
|
||||
}
|
||||
program.animation.matrix_count = program.matrix_count
|
||||
program.state = .Normal
|
||||
|
|
@ -794,6 +809,15 @@ program_build_dialog_ui :: proc(ctx: ^ui.Context, dialog_type: ProgramDialogType
|
|||
ui_confirm_and_cancel_buttons("Add", .ProjectLoadConfirm, element_margin)
|
||||
case .CloseUnsavedProjectPrompt:
|
||||
ui_confirm_and_cancel_buttons("Confirm", .CloseProgram, element_margin)
|
||||
case .Info:
|
||||
label_dimensions := ui.dimensions_pixels_v(program_screen_size() * 0.3)
|
||||
label_config := ui.ElementConfiguration{label = PROGRAM_INFO, color = ui.col(PROGRAM_COLOR_SYNTHAS)}
|
||||
ui.element(.Label, label_dimensions, label_config)
|
||||
|
||||
button_config := ui.ElementConfiguration{margin = 4, label = RAYGUI_ICON_CODE}
|
||||
button_data := new(UiElementData_Button, context.temp_allocator)
|
||||
button_data^ = {type = .OpenSourceCode}
|
||||
ui.element(.Button, ui.dimensions_pixels(48, 48), button_config, button_data)
|
||||
case .Error:
|
||||
button_data: ^UiElementData_Button
|
||||
button_data = new(UiElementData_Button, context.temp_allocator)
|
||||
|
|
@ -975,6 +999,15 @@ program_build_workspace_ui :: proc(ctx: ^ui.Context) -> (elements: []ui.Element,
|
|||
toggle_data^ = {value = &program.grid_snap}
|
||||
ui.same_line()
|
||||
ui.element(.Toggle, toggle_dimensions, toggle_config, toggle_data)
|
||||
|
||||
ui.same_line()
|
||||
ui.element(.Divider, divider_dimensions, divider_config)
|
||||
|
||||
button_config = {margin = top_bar_element_margin, label = RAYGUI_ICON_INFO, tooltip = "Display information"}
|
||||
button_data = new(UiElementData_Button, context.temp_allocator)
|
||||
button_data^ = {type = .DisplayInfo}
|
||||
ui.same_line()
|
||||
ui.element(.Button, button_dimensions, button_config, button_data)
|
||||
}
|
||||
ui.container_end()
|
||||
|
||||
|
|
@ -1244,10 +1277,14 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
|||
program.grid.offset = program_screen_size() / 2.0
|
||||
program.grid.zoom = 1.0
|
||||
program.grid.cell_size_px = 50.0
|
||||
case .DisplayInfo:
|
||||
program_show_dialog(&program, .Info, element.label)
|
||||
case .DismissError:
|
||||
program.state = .Normal
|
||||
case .CloseProgram:
|
||||
program.window_should_close = true
|
||||
case .OpenSourceCode:
|
||||
rl.OpenURL(PROGRAM_REPOSITORY_URL)
|
||||
}
|
||||
}
|
||||
case .Slider:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue