diff --git a/odin/src/gui/runtime.odin b/odin/src/gui/runtime.odin index b5b239a..6c2086a 100644 --- a/odin/src/gui/runtime.odin +++ b/odin/src/gui/runtime.odin @@ -266,10 +266,61 @@ run_gui_app :: proc(state: ^core.Comic_State) -> shared.App_Error { } } + if app.editor.active && !interaction_locked { + if rl.IsKeyPressed(.B) && !rl.IsKeyDown(.LEFT_CONTROL) && !rl.IsKeyDown(.RIGHT_CONTROL) { + app.editor.current_tool = .Pen + } + if rl.IsKeyPressed(.E) { + app.editor.current_tool = .Eraser + } + if rl.IsKeyPressed(.L) { + app.editor.current_tool = .Line + } + if rl.IsKeyPressed(.R) { + app.editor.current_tool = .Rectangle + } + if rl.IsKeyPressed(.C) && !rl.IsKeyDown(.LEFT_CONTROL) && !rl.IsKeyDown(.RIGHT_CONTROL) { + app.editor.current_tool = .Circle + } + if rl.IsKeyPressed(.I) { + app.editor.current_tool = .Color_Pick + } + if rl.IsKeyPressed(.LEFT_BRACKET) { + app.editor.brush_size = max(app.editor.brush_size - 2, 1) + } + if rl.IsKeyPressed(.RIGHT_BRACKET) { + app.editor.brush_size = min(app.editor.brush_size + 2, 80) + } + if rl.IsKeyPressed(.ZERO) { + app.editor.zoom = 1.0 + app.editor.pan_offset = rl.Vector2{} + app.editor.needs_redraw = true + } + if rl.IsKeyPressed(.EQUAL) || rl.IsKeyPressed(.KP_ADD) { + app.editor.zoom = min(app.editor.zoom + 0.25, 8.0) + app.editor.needs_redraw = true + } + if rl.IsKeyPressed(.MINUS) || rl.IsKeyPressed(.KP_SUBTRACT) { + app.editor.zoom = max(app.editor.zoom - 0.25, 0.25) + app.editor.needs_redraw = true + } + if rl.IsKeyDown(.LEFT_CONTROL) || rl.IsKeyDown(.RIGHT_CONTROL) { + if rl.IsKeyPressed(.Z) { + editor_undo(&app.editor) + } + if rl.IsKeyPressed(.S) { + push_status(&app.status_msg, &app.action_log, editor_commit(&app)) + } + } + if rl.IsKeyPressed(.A) && !rl.IsKeyDown(.LEFT_CONTROL) && !rl.IsKeyDown(.RIGHT_CONTROL) { + app.editor.show_adjust_panel = !app.editor.show_adjust_panel + } + } + // Compact mode forces the sidebar collapsed if bp == .Compact { app.sidebar_collapsed = true } - if !interaction_locked { + if !interaction_locked && !app.editor.active { if rl.IsKeyPressed(.B) && (rl.IsKeyDown(.LEFT_CONTROL) || rl.IsKeyDown(.RIGHT_CONTROL)) { app.sidebar_collapsed = !app.sidebar_collapsed status := "Sidebar expanded"