Skip to content

5 Usage example for Graphics P3#345

Closed
huyhuynh2319 wants to merge 3 commits intothoth-tech:usage-examplesfrom
huyhuynh2319:5-usage-example-for-graphics-p3
Closed

5 Usage example for Graphics P3#345
huyhuynh2319 wants to merge 3 commits intothoth-tech:usage-examplesfrom
huyhuynh2319:5-usage-example-for-graphics-p3

Conversation

@huyhuynh2319
Copy link

@huyhuynh2319 huyhuynh2319 commented Dec 12, 2024

Description

This is a usage example of the function display details, name, width, height and draw pixel on window.

Splashkit Function:
display_details
display_name
display_width
display_height
draw_pixel_on_window

Testing Checklist

  • C++ code
  • C# code (top-level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • Screenshot
  • Title and explanation (.txt)

Usage Example Checks

  • Simple, clear demonstration of the function
  • Code uses Splashkit functions
  • Tested in Chrome and Firefox

@netlify
Copy link

netlify bot commented Dec 12, 2024

Deploy Preview for splashkit-usage-examples ready!

Name Link
🔨 Latest commit c298148
🔍 Latest deploy log https://app.netlify.com/sites/splashkit-usage-examples/deploys/675a62a8489ab30008fedce9
😎 Deploy Preview https://deploy-preview-345--splashkit-usage-examples.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 site configuration.

Copy link

@rmachu rmachu left a comment

Choose a reason for hiding this comment

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

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);
Copy link

Choose a reason for hiding this comment

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

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);
Copy link

Choose a reason for hiding this comment

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

Inconsistent delay with the other files and doesn't match the comment.

SplashKit.RefreshScreen();
SplashKit.Delay(3000);

SplashKit.CloseAllWindows();
Copy link

Choose a reason for hiding this comment

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

Close window is called twice.

@@ -0,0 +1,17 @@
from splashkit import *
Copy link

Choose a reason for hiding this comment

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

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
Copy link

Choose a reason for hiding this comment

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

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
Copy link

Choose a reason for hiding this comment

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

Different loop comments.

// Draw 100 random pixels on the window
for (int i = 0; i < 100; i++)
{
draw_pixel_on_window(COLOR_GRAY, rnd(800), rnd(600));
Copy link

Choose a reason for hiding this comment

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

Error in parameters. There should be a window parameter as well.


}
// Close all windows
close_all_windows;
Copy link

Choose a reason for hiding this comment

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

Missing '()' for function.

open_window("Falling Snow", 800, 600);

// Loop until the user requests to quit
while (!quit_requested())
Copy link

Choose a reason for hiding this comment

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

This caused the program to go unresponsive. I suggest removing this while loop and increase the number of pixels.

@omckeon
Copy link

omckeon commented Mar 14, 2025

These examples are not showing the usefulness of the functions very well, so will close this PR.
Only 1 example per PR for future PRs.

@omckeon omckeon closed this Mar 14, 2025
@huyhuynh2319 huyhuynh2319 deleted the 5-usage-example-for-graphics-p3 branch March 21, 2025 04:55
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.

3 participants