From c0c2a19ffd1c215955b39a9fc74730a940e9b60d Mon Sep 17 00:00:00 2001 From: Laurin Muth Date: Sat, 22 Nov 2025 13:54:12 +0100 Subject: [PATCH 1/2] Fix error in 03_mouse_move_paint_app sample Fix error which happens when clicking the "Clear" button --- samples/05_mouse/03_mouse_move_paint_app/app/main.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/05_mouse/03_mouse_move_paint_app/app/main.rb b/samples/05_mouse/03_mouse_move_paint_app/app/main.rb index 9303949b..794df50d 100644 --- a/samples/05_mouse/03_mouse_move_paint_app/app/main.rb +++ b/samples/05_mouse/03_mouse_move_paint_app/app/main.rb @@ -198,7 +198,6 @@ def draw_buttons if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred state.filled_squares.clear - inputs.mouse.previous_click = nil end outputs.labels << state.clear_button.label From 342ba82b71d7ab5f79b3c86864720d6aff882274 Mon Sep 17 00:00:00 2001 From: Laurin Muth Date: Sat, 22 Nov 2025 14:00:00 +0100 Subject: [PATCH 2/2] Remove unnecessary code in 03_mouse_move_paint_app sample Remove "point" and "position" calls --- .../05_mouse/03_mouse_move_paint_app/app/main.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/05_mouse/03_mouse_move_paint_app/app/main.rb b/samples/05_mouse/03_mouse_move_paint_app/app/main.rb index 794df50d..9cc035fe 100644 --- a/samples/05_mouse/03_mouse_move_paint_app/app/main.rb +++ b/samples/05_mouse/03_mouse_move_paint_app/app/main.rb @@ -28,9 +28,9 @@ In this sample app, new_entity is used to create a new button that clears the grid. (Remember, you can use state to define ANY property and it will be retained across frames.) - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + - args.inputs.mouse.click.(x|y): The x and y location of the mouse. - - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. + - args.inputs.mouse.click.created_at: The frame the mouse click occurred in. - args.outputs.labels: An array. The values in the array generate a label. The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] @@ -138,17 +138,17 @@ def check_click if state.mouse_held && # mouse needs to be down !inputs.mouse.click && # must not be first click - ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag" + ((inputs.mouse.previous_click.x - inputs.mouse.x).abs > 15) # Need to move 15 pixels before "drag" state.mouse_dragging = true end # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type. - if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) - search_lines(inputs.mouse.click.point, :click) + if ((inputs.mouse.click) && (inputs.mouse.click.inside_rect? state.grid_border)) + search_lines(inputs.mouse.click, :click) # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type. - elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) - search_lines(inputs.mouse.position, :drag) + elsif ((state.mouse_dragging) && (inputs.mouse.inside_rect? state.grid_border)) + search_lines(inputs.mouse, :drag) end end @@ -195,7 +195,7 @@ def draw_buttons # If the mouse is clicked inside the borders of the clear button, # the filled_squares collection is emptied and the squares are cleared. - if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) + if inputs.mouse.click && inputs.mouse.click.inside_rect?(state.clear_button.border) state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred state.filled_squares.clear end