Skip to content

Add mouse_shown usage example for input API - #740

Merged
Osaid2993 merged 3 commits into
thoth-tech:mainfrom
Abod-A:add-mouse-shown-usage-example
Sep 25, 2026
Merged

Osaid2993 merged 3 commits into
thoth-tech:mainfrom
Abod-A:add-mouse-shown-usage-example

Conversation

@Abod-A

@Abod-A Abod-A commented Apr 27, 2026 •

Copy link
Copy Markdown

Description

Adds a usage example for the mouse_shown function in the SplashKit input API. The example demonstrates how to check whether the mouse cursor is visible, and includes implementations in C++ (OOP and top-level), C#, and Python, along with a GIF preview and description text.

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?

The example was compiled and run locally using SplashKit. The output was verified to correctly display whether the mouse
cursor is shown or hidden. A GIF was recorded to demonstrate the expected behaviour.

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/mouse_shown-1-example.cpp
    • public/usage-examples/input/mouse_shown-1-example-oop.cs
    • public/usage-examples/input/mouse_shown-1-example-top-level.cs
    • public/usage-examples/input/mouse_shown-1-example.py
    • public/usage-examples/input/mouse_shown-1-example.txt
    • public/usage-examples/input/mouse_shown-1-example.gif

Additional Notes

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

@netlify

netlify Bot commented Apr 27, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 276ab08
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/69f816924b10770008a07715

@Osaid2993 Osaid2993 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work overall. The example is useful, and beginner friendly, and I like that it restores the mouse visibility before closing.

@jankiluitel jankiluitel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I noticed a few issues that could be improved before final approval:

  1. In the C++ file, string status; is used, but there is no #include <string> and it is not written as std::string. This could cause a compile issue depending on the environment.

  2. The C# top-level file includes both using SplashKitSDK; and using static SplashKitSDK.SplashKit;. This may be needed for KeyCode, but the style could be made clearer and consistent.

Overall, the example is useful and easy to understand, but these small consistency and style points could be improved.

- Add #include <string> and use std::string in C++ example
- Swap using directive order in top-level C# to match project style
@Abod-A
Abod-A force-pushed the add-mouse-shown-usage-example branch from 78c8006 to 276ab08 Compare May 4, 2026 03:46
@Abod-A

Abod-A commented May 4, 2026

Copy link
Copy Markdown
Author

I noticed a few issues that could be improved before final approval:

  1. In the C++ file, string status; is used, but there is no #include <string> and it is not written as std::string. This could cause a compile issue depending on the environment.
  2. The C# top-level file includes both using SplashKitSDK; and using static SplashKitSDK.SplashKit;. This may be needed for KeyCode, but the style could be made clearer and consistent.

Overall, the example is useful and easy to understand, but these small consistency and style points could be improved.

i have made the changes and updated based on the feedback, thank you.

@Abod-A

Abod-A commented May 4, 2026

Copy link
Copy Markdown
Author

Nice work overall. The example is useful, and beginner friendly, and I like that it restores the mouse visibility before closing.

thank you for your kind feedback. :))

@anandika-nair

Copy link
Copy Markdown

The example is clear, interactive, and beginner-friendly, and it demonstrates the mouse_shown function well. The previously mentioned consistency and C++ string issues also appear to have been addressed appropriately. I also like that the example restores the mouse visibility before closing, which is a thoughtful usability detail. The implementations across the different languages look consistent and easy to follow, and the comments are concise and helpful throughout. Overall, the PR looks good to me and I’m happy to approve.

@jankiluitel jankiluitel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall, it looks nice; I appreciate you responding to the previous comments!

The example is now clear, consistent, and simple to comprehend in all languages once the C++ problem with std::string and missing include was fixed.

One little recommendation: for clarity and consistency with other examples, think about standardising the sequence of the using statements in the C# top-level file.

Other than that, everything appears to be in order.

@222448082Ashen 222448082Ashen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Description

This PR adds a new usage example for the mouse_shown, show_mouse, and hide_mouse functions in SplashKit. These examples demonstrate how to programmatically control and query the visibility of the mouse cursor within a SplashKit window.

Motivation:
Providing clear examples for mouse visibility control helps developers create more immersive UI experiences, such as hiding the cursor during gameplay or showing custom cursors.

Dependencies:
No new dependencies required.

Type of change

  • 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?

The Python implementation was tested locally by running the mouse_shown-1-example.py script.

  1. Run the script.
  2. Press 'H' to hide the mouse.
  3. Press 'S' to show the mouse.
  4. Verify the status text updates correctly based on the return value of mouse_shown().
  • Tested in latest Chrome
  • npm run build

Checklist

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

  • Added:
    • public/usage-examples/input/mouse_shown-1-example.py
    • public/usage-examples/input/mouse_shown-1-example.cpp
    • public/usage-examples/input/mouse_shown-1-example-oop.cs
    • public/usage-examples/input/mouse_shown-1-example-top-level.cs
    • public/usage-examples/input/mouse_shown-1-example.gif
    • public/usage-examples/input/mouse_shown-1-example.txt
  • Modified:
    • scripts/json-files/guides-groups.json
    • scripts/json-files/usage-example-references.json
    • src/content/docs/troubleshoot/MacOS/index.mdx
    • src/content/docs/troubleshoot/MacOS/issue-10-using-older-osx-version.mdx

Additional Notes

Warning on Deletions: This PR currently includes the deletion of existing troubleshooting documentation (issue-11-string-error-during-global-install.mdx) and several older usage examples (audio/stop_music, color/string_to_color, graphics/option_scale_bmp). Please verify if these deletions were intended.

@netlify

netlify Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for splashkit ready!

Name Link
🔨 Latest commit b96acde
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6ab6b320b81e210008d9eeb9
😎 Deploy Preview https://deploy-preview-740--splashkit.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Osaid2993
Osaid2993 merged commit a94de3d into thoth-tech:main Sep 25, 2026
7 checks passed
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.

5 participants