Added open_window usage example#770
Conversation
❌ Deploy Preview for splashkit failed.
|
himanshigaba22
left a comment
There was a problem hiding this comment.
Nice first contribution - the example is simple and easy to understand 👍
Just a few quick fixes:
- The
.txtfile should only be one line (just the title) - Add
using static SplashKitSDK.SplashKit;in the C# top-level file - Use function-style colours like
color_black()instead ofCOLOR_BLACKorColor.SKY_BLUE - Add
close_all_windows()in the C++ version - In Python, use
refresh_screen_with_target_fps(60)
Also, can you confirm if usage-example-references.json has been updated?
Once these are fixed, it should be good to go 👍
|
This is a clear beginner-friendly example and the visual output demonstrates open_window nicely, but I noticed a few important changes needed before merge. Similar to the feedback of [himanshigaba22] the .txt file should only contain the title, the C# top-level example should follow the usual usage example format, and the language-specific style conventions (such as colour usage and refresh functions .should be kept consistent with existing SplashKit examples. The C++ version should also include proper cleanup at the end. One major thing I noticed is the lack of code comments, since usage examples are meant to help beginners understand not just what the code does but how to use the function, adding simple explanatory comments across the examples would make this much more useful. |
|
@himanshigaba22 @anandika-nair Thanks both for the feedback! I’ve now updated the example by fixing the I also updated the Additionally, I added beginner-friendly comments across all language versions to make the example clearer and easier for new users to understand. |
|
Thanks for addressing all the earlier feedback! I’ve gone through the updated changes and the previously raised issues look resolved now. The example is much more consistent and beginner-friendly in its current state. The only thing I could not find is the required .png output file in the submission, which is needed as part of the usage example files. Once that’s added, I’ll be happy to approve this PR :) |
|
Hey @anandika-nair,
|
himanshigaba22
left a comment
There was a problem hiding this comment.
Nice , it’s clear and the output looks good 👍
Just one small thing - in the Python version, colours are still written as Color.SKY_BLUE and Color.WHITE. These should be function-style like color_sky_blue() and color_white() to match the usual convention.
Once that’s fixed, it should be good to go 👍
|
Thanks for the feedback, I have now changed the py file. |
himanshigaba22
left a comment
There was a problem hiding this comment.
Looks good now - all the changes have been addressed and everything is consistent 👍
Happy to approve!
ralphweng2023
left a comment
There was a problem hiding this comment.
Looks clean overall, output matches the .png and the C++/C#/top-level all run fine for me. Two real things though:
- The Python
draw_text("...", color_black(), 290, 270)won't run as-is. The unsuffixeddraw_textin Python is the 6-arg overload(text, clr, fnt, font_size, x, y), so a 4-arg call fails at runtime. For the(text, color, x, y)shape you wantdraw_text_no_font_no_size(...)— two of those calls inside the loop. - In the OOP
.csyou're usingSplashKit.ClearWindow(wind, ...),SplashKit.DrawText(...),SplashKit.RefreshWindow(wind), which is the same shape as the top-level file. The OOP version usually prefers the methods onWindowitself (wind.Clear(...),wind.DrawText(...),wind.Refresh()), which is the thing that makes it distinct from top-level. The OOP value-add is small foropen_windowanyway, but worth tightening.
Tiny: all five files end without a trailing newline (the \ No newline at end of file marker shows on each in the diff). Easy fix on re-save.
Once the Python overload is sorted should be good to go.
|
@ralphweng2023 Thanks for the detailed feedback! I’ve now updated the Python version to use the correct |

Description
Splashkit Function:
open_windowOverview of example functionality: This example demonstrates how to use the
open_windowfunction to create a simple window and display basic text and shapes on the screen. It provides a beginner-friendly introduction to opening and refreshing a SplashKit window.Example Output:
Files Included
Usage Example Checks