Skip to content

Add move_mouse_to_point usage example for input API#765

Open
abdullah12121212 wants to merge 2 commits into
thoth-tech:mainfrom
abdullah12121212:add-move-mouse-to-point-usage-example
Open

Add move_mouse_to_point usage example for input API#765
abdullah12121212 wants to merge 2 commits into
thoth-tech:mainfrom
abdullah12121212:add-move-mouse-to-point-usage-example

Conversation

@abdullah12121212
Copy link
Copy Markdown

Description

Please include a summary of the changes and the related issue. Please also include relevant
motivation and context. List any dependencies that are required for this change.

This pull request adds usage examples for the move_mouse_to_point function in the SplashKit input API. The examples demonstrate how to use move_mouse_to_point (and its C# equivalent MoveMouse) to reposition the mouse cursor to specified point_2d locations on the window. Each example creates five target points (four corners and the center of the window) and lets the user press different keys to snap the mouse to those points. Colored circles and text labels are drawn at each target, so the behavior of the function is easy to see visually.

The examples are provided in C++, Python, and C# (both top-level and OOP styles), along with a demo GIF showing the output. This contribution is part of the ongoing capstone work to add usage examples for SplashKit input API functions.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (update or new)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can
reproduce. Please also list any relevant details for your test configuration.

I tested each example locally by compiling and running it with SplashKit installed on my machine. For each language version I opened the window, pressed the Q, E, A, D, and SPACE keys, and confirmed that the mouse cursor moved to the correct target point each time. I also confirmed the labels and coloured circles render in the right positions, and the demo GIF was recorded from the working C++ build.

Testing Checklist

  • Tested in latest Chrome
  • Tested in latest Firefox
  • npm run build
  • npm run preview

Checklist

Please delete options that are not relevant.

If involving code

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

If modified config files

  • I have checked the following files for changes:
    • package.json
    • astro.config.mjs
    • netlify.toml
    • docker-compose.yml
    • custom.css

Folders and Files Added/Modified

Please list the folders and files added/modified with this pull request and delete options that are not relevant.

  • Added:
    • public/usage-examples/input/move_mouse_to_point-1-example.cpp
    • public/usage-examples/input/move_mouse_to_point-1-example.py
    • public/usage-examples/input/move_mouse_to_point-1-example-oop.cs
    • public/usage-examples/input/move_mouse_to_point-1-example-top-level.cs
    • public/usage-examples/input/move_mouse_to_point-1-example.gif
    • folder/folder

Additional Notes

Please add any additional information that might be useful for the reviewers.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 9, 2026

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit bf37c43
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a0433783f3e9a0008b6fb88

Copy link
Copy Markdown

@jankiluitel jankiluitel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it looks good; the example is interactive, understandable, and successfully illustrates the mouse movement API in all supported languages. Users trying the example can easily understand the behaviour thanks to the visual target markers and keyboard mappings.

Before approving, a few minor recommendations:

  • There is a little discrepancy in the name between languages (MoveMouse in C#/C++ vs. move_mouse_to_point in Python). Aligning comments and explanations more closely with the names of the actual API functions being demonstrated should be beneficial.
  • For somewhat improved first-time usability, think about including a brief instruction line near the top, such as "Press Q/E/A/D/SPACE to teleport the cursor."
  • To provide consistency in readability across files, some draw_text calls' spacing and alignment might be standardised.* GIF preview enhances the quality of the documentation and is a welcome feature.

Overall, this is a solid contribution and ready for final review after minor polish.

Copy link
Copy Markdown

@222448082Ashen 222448082Ashen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peer Review

I've reviewed the move_mouse_to_point usage example.

Checks

  • All required files are present.
    • Example Title (.txt) move_mouse_to_point-1-example.txt
    • C++ code: move_mouse_to_point-1-example.cpp
    • C# code (top-level statements) move_mouse_to_point-1-example-top-level.cs
    • C# code (Object-Oriented Programming) move_mouse_to_point-1-example-oop.cs
    • Python code move_mouse_to_point-1-example.py
  • Code correctly uses SplashKit functions (verified against API documentation).
  • Code clearly demonstrates the function with interactive target points.
  • All versions maintain the same structure and comments.

Code Tests done

  • C++ code: Syntax verified (uses correct move_mouse(point_2d) overload)
  • C# top level code: Syntax verified (uses correct MoveMouse(Point2D) overload)
  • C# OOP code: Syntax verified (uses correct MoveMouse(Point2D) overload)
  • Python code: Syntax verified (uses correct move_mouse_to_point(point) function)

Website Tests done

  • npm run build
  • npm run preview
  • Usage example scraped correctly into usage-example-references.json

- Clarify function name discrepancy in comments: note that move_mouse in
  C++ and MoveMouse in C# are the equivalents of move_mouse_to_point
- Update instruction text to explicitly list keys (Q/E/A/D/SPACE) so
  users know the controls at a glance
- Fix extra whitespace in center point's fill_circle and draw_text calls
  to match the column alignment of the other four target points
abdullah12121212 pushed a commit to abdullah12121212/splashkit.io-starlight that referenced this pull request May 13, 2026
- Rebased out the move_mouse_to_point commit (those files belong to PR thoth-tech#765)
- Changed window title from 'Timer Started' to 'Start-Stop Stopwatch'
  to match the descriptive name in the .txt file, as suggested by reviewer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants