Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 Usage example for Graphics P3 #345

Open
wants to merge 3 commits into
base: usage-examples
Choose a base branch
from

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

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.

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.

2 participants