5 Usage example for Graphics P3#345
5 Usage example for Graphics P3#345huyhuynh2319 wants to merge 3 commits intothoth-tech:usage-examplesfrom huyhuynh2319:5-usage-example-for-graphics-p3
Conversation
✅ Deploy Preview for splashkit-usage-examples ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
rmachu
left a comment
There was a problem hiding this comment.
Hi! I have reviewed this pull request and suggest changes. Mostly with font, comments and spacing inconsistencies that apply to all the display functions programs. The draw pixel program is making the program go unresponsive when I tested it so I have suggested some changes there to help avoid the overload.
|
|
||
| // Write display details to the console | ||
|
|
||
| SplashKit.DrawText($" Name: {display.Name}", Color.Black, "Arial", 24, 100, 100); |
There was a problem hiding this comment.
Font is different from the cpp and py files. I suggest loading a font.
| } | ||
| // Keep the window open for 5 seconds | ||
| SplashKit.RefreshScreen(); | ||
| SplashKit.Delay(3000); |
There was a problem hiding this comment.
Inconsistent delay with the other files and doesn't match the comment.
| SplashKit.RefreshScreen(); | ||
| SplashKit.Delay(3000); | ||
|
|
||
| SplashKit.CloseAllWindows(); |
| @@ -0,0 +1,17 @@ | |||
| from splashkit import * | |||
There was a problem hiding this comment.
I suggest putting more spacing between the lines so that it is consistent with the other files and looks more organised.
| // Loop through all displays and print their details | ||
| for (int i = 0; i < number_of_displays(); i++) | ||
| { | ||
| display disp = display_details(i); // Get the details of the display |
There was a problem hiding this comment.
Comments are different from the others.
| // Loop through all displays and print their height | ||
| for (int i = 0; i < number_of_displays(); i++) | ||
| { | ||
| display disp = display_details(i); // Get the height of the display |
| // Draw 100 random pixels on the window | ||
| for (int i = 0; i < 100; i++) | ||
| { | ||
| draw_pixel_on_window(COLOR_GRAY, rnd(800), rnd(600)); |
There was a problem hiding this comment.
Error in parameters. There should be a window parameter as well.
|
|
||
| } | ||
| // Close all windows | ||
| close_all_windows; |
| open_window("Falling Snow", 800, 600); | ||
|
|
||
| // Loop until the user requests to quit | ||
| while (!quit_requested()) |
There was a problem hiding this comment.
This caused the program to go unresponsive. I suggest removing this while loop and increase the number of pixels.
|
These examples are not showing the usefulness of the functions very well, so will close this PR. |
Description
This is a usage example of the function display details, name, width, height and draw pixel on window.
Splashkit Function:
display_detailsdisplay_namedisplay_widthdisplay_heightdraw_pixel_on_windowTesting Checklist
Usage Example Checks