Added usage example for brightness_of#708
Added usage example for brightness_of#708jasveena15 wants to merge 8 commits intothoth-tech:mainfrom
Conversation
❌ Deploy Preview for splashkit failed.
|
kottochii
left a comment
There was a problem hiding this comment.
Top level statement file is not shown when browsing on the website.
222448082Ashen
left a comment
There was a problem hiding this comment.
PR Description
- Title: Added usage example for
brightness_of - Author Description: Adds a new usage example for the
brightness_offunction in SplashKit, demonstrating calculation and display of brightness values for different purple shades. - Type of Change: New Feature / Documentation
Peer-Review Checklist
General Code Quality
- My code follows the style guidelines of this project
- I have performed a self-review of my own code - The example is well-structured and follows the established pattern for usage examples.
- I have commented my code in hard-to-understand areas - Code is simple and self-explanatory.
- My changes generate no new warnings
Functionality & Testing
- Local Execution:
- Verified the C++ version compiles and runs correctly.
- Verified the Python version uses appropriate function names (
draw_text_no_font_no_size). - Verified the C# versions (OOP and Top-level) follow project conventions.
- Visual Consistency: The example renders purple shades and clearly displays their brightness values.
Specific File Type Review
Usage Examples (Color)
- C++: brightness_of-1-example.cpp - Correct use of
std::to_stringandrgba_color. - C#: OOP and Top-level - Consistent naming and use of
SplashKit.BrightnessOf. - Python: brightness_of-1-example.py - Uses the correct
drawingfunctions andstr()for conversion. - Documentation: brightness_of-1-example.txt - Provides a clear explanation of the example's purpose.
Reviewer Notes
The usage example is a high-quality addition accurately demonstrating the brightness_of API. The use of purple shades provides a clear visual progression that helps beginners understand the concept.
kottochii
left a comment
There was a problem hiding this comment.
Peer review
Issues found
[ ] Due to the naming convention, the OOP file is not shown under examples on the website.
Examples tested
All examples have been run and perform as required.
ralphweng2023
left a comment
There was a problem hiding this comment.
Peer Review
I've reviewed the brightness_of usage example. Nice creative idea using purple shades of varying brightness — it clearly demonstrates the function and the visual output is effective. However, there are a few issues that need to be addressed.
Issues
-
C# top-level file has wrong filename. The file is named
brightness_of-1-example-top.csbut the convention requiresbrightness_of-1-example-top-level.cs(note:-top-level, not-top). The auto-generation script looks for-top-level.csspecifically (seeapi-pages-script.cjsline 268), so this file will not be detected during build. Please rename tobrightness_of-1-example-top-level.cs. -
Top-level C# uses OOP-style calls. The top-level C# file should use
using static SplashKitSDK.SplashKit;and call functions directly (e.g.,OpenWindow(...),ClearScreen(...),BrightnessOf(...)) instead of prefixing everything withSplashKit.. The current code reads identically to the OOP version. -
OOP C# missing namespace. The OOP C# file should wrap the class in a namespace:
namespace BrightnessOfExample { ... }. -
Missing
close_all_windows()in C++ and C# files. The Python version correctly callsclose_window(window)after the loop, but the C++ and C# versions do not have a cleanup call. Please addclose_all_windows()(C++) /SplashKit.CloseAllWindows()(C#) /CloseAllWindows()(top-level C#) after the loop. -
Uses
window_close_requested()instead ofquit_requested(). The style guide recommendswhile (!quit_requested())for the main loop. Both work, butquit_requested()is the convention used in other approved examples. -
Missing newline at end of files. All files are missing a trailing newline.
Checks
- All required files are present.
- Example Title (.txt)
- C++ code (SplashKit)
- C# code (top-level statements) —
⚠️ wrong filename - C# code (Object-Oriented Programming)
- Python code
- Output screenshot (.png)
Code Tests done
- C++ SplashKit code ran correctly.
- C# top level code ran correctly.
- C# OOP code ran correctly.
- Python code ran correctly.
Note: I was unable to compile and run the code locally as I do not have the SplashKit SDK installed on this machine. Please verify all 4 variants compile and run correctly.
kottochii
left a comment
There was a problem hiding this comment.
Peer review
As the issues have been addressed, I approve this.
fixed all the requested changes
fixed the issues |
ralphweng2023
left a comment
There was a problem hiding this comment.
All issues from my previous review have been addressed. Nice work on the fixes — the usage example looks great now. Approved.
Second Peer ReviewI've reviewed the Checks
Code Tests done
Website Tests done
Review SummaryThe example is clear, visually effective, and beginner-friendly. The use of different purple shades to demonstrate brightness values is a good approach and makes the functionality easy to understand. However, there are a few small style-related adjustments needed before approval:
ConclusionEverything works correctly and the example is well structured. Once these minor style adjustments are made, it should be ready for approval. |
Description
This pull request adds a new usage example for the
brightness_offunction in SplashKit.The example demonstrates how to calculate and display brightness values of different purple shades. It visually renders three coloured circles (dark, medium, and light purple) and shows their corresponding brightness values on screen.
This helps users understand how brightness varies with colour intensity and how to use the
brightness_offunction in practical scenarios.Type of change
expected)
How Has This Been Tested?
Tested Python version using:
skm python3 program.py
Tested C++ version using:
g++ program.cpp -l SplashKit -o test_program
./test_program
Tested C# versions using:
dotnet run
Verified that:
Testing Checklist
Checklist
If involving code
Folders and Files Added/Modified
Additional Notes
This example follows the standard usage example structure and naming conventions used across the SplashKit documentation.
It is designed to be simple, visual, and beginner-friendly while clearly demonstrating the functionality of the brightness_of API.