-
Notifications
You must be signed in to change notification settings - Fork 33
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 P2 #341
base: usage-examples
Are you sure you want to change the base?
5 Usage example for Graphics P2 #341
Conversation
✅ Deploy Preview for splashkit-io ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be great if u can separate the pull request to 5 different request, current_clip, pop_clip, push_clip, reset_clip and set_clip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the review for current _clip, fix it and I am happy to pass the PR
public static void Main() | ||
{ | ||
// Open a window with the title "Current Clip" and dimensions | ||
Window window= SplashKit.OpenWindow("Current Clip", 800, 600); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space after window, should look like this: Window window = SplashKit.OpenWindow("Current Clip", 800, 600);
using static SplashKitSDK.SplashKit; | ||
using SplashKitSDK; | ||
// Open a window with the title "Current Clip" and dimensions | ||
Window window= OpenWindow("Current Clip", 800, 600); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space after window, same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Window window= SplashKit.OpenWindow("Current Clip", 800, 600); | ||
|
||
// Push a clipping area | ||
Rectangle rectangle = SplashKit.CurrentClip(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add window in CurrentClip() -> CurrentClip(window), otherwise it is no need to create Window window.
Window window= OpenWindow("Current Clip", 800, 600); | ||
|
||
// Push a clipping area | ||
Rectangle rectangle = CurrentClip(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add window in CurrentClip() -> CurrentClip(window), otherwise it is no need to create Window window.
// Wait for 5 seconds | ||
delay(5000); | ||
|
||
// Close all windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the commits are the same as well, so it makes less confusion to the users.
@@ -0,0 +1,21 @@ | |||
from splashkit import * | |||
|
|||
# Open a window with the title "Current Clip" and dimensions of 800x600 pixels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check all commits and make sure it keeps the same please.
font = load_font("Arial", "arial.ttf") | ||
|
||
# Retrieve the current clipping area | ||
r = current_clip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 'rectangle' here. rectangle = current_clip(window)
rectangle rect = current_clip(win); | ||
|
||
// Draw the clipping information | ||
draw_text("Current Clip: " + std::to_string(rect.width) + " X " + std::to_string(rect.height), COLOR_BLACK, "Arial", 24, 100, 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use the same work as the above code. Width and Height.
r = current_clip() | ||
|
||
# Draw the clipping area dimensions as text on the screen | ||
draw_text("Current Clip: " + str(r.width) + " X " + str(r.height), color_black(), font, 24, 100, 100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use the same work as above code. Width and Height.
For pop clip: Checks
Tests done
|
For push clip: Checks
Tests done
|
For reset-clip: Checks
Tests done
|
Description
This is a usage example of the function set, pop, push, reset and current clip to display
Splashkit Function:
set-clip
push-clip
pop-clip
reset-clip
current-clip
Testing Checklist
Usage Example Checks