Repository navigation
Add mouse_shown usage example for input API - #740
Conversation
❌ Deploy Preview for splashkit failed.
|
Osaid2993
left a comment
There was a problem hiding this comment.
Nice work overall. The example is useful, and beginner friendly, and I like that it restores the mouse visibility before closing.
jankiluitel
left a comment
There was a problem hiding this comment.
I noticed a few issues that could be improved before final approval:
-
In the C++ file,
string status;is used, but there is no#include <string>and it is not written asstd::string. This could cause a compile issue depending on the environment. -
The C# top-level file includes both
using SplashKitSDK;andusing static SplashKitSDK.SplashKit;. This may be needed forKeyCode, 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
78c8006 to
276ab08
Compare
i have made the changes and updated based on the feedback, thank you. |
thank you for your kind feedback. :)) |
|
The example is clear, interactive, and beginner-friendly, and it demonstrates the |
jankiluitel
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
- Run the script.
- Press 'H' to hide the mouse.
- Press 'S' to show the mouse.
- 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.pypublic/usage-examples/input/mouse_shown-1-example.cpppublic/usage-examples/input/mouse_shown-1-example-oop.cspublic/usage-examples/input/mouse_shown-1-example-top-level.cspublic/usage-examples/input/mouse_shown-1-example.gifpublic/usage-examples/input/mouse_shown-1-example.txt
- Modified:
scripts/json-files/guides-groups.jsonscripts/json-files/usage-example-references.jsonsrc/content/docs/troubleshoot/MacOS/index.mdxsrc/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.
✅ Deploy Preview for splashkit ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
expected)
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
Checklist
Please delete options that are not relevant.
If involving code
If modified config files
Folders and Files Added/Modified
Please list the folders and files added/modified with this pull request and delete options that are not relevant.
Additional Notes
Please add any additional information that might be useful for the reviewers.