Skip to content

Add vector_from_angle usage example - #796

Open
Osaid2993 wants to merge 2 commits into
thoth-tech:mainfrom
Osaid2993:usage-example-vector-from-angle
Open

Add vector_from_angle usage example#796
Osaid2993 wants to merge 2 commits into
thoth-tech:mainfrom
Osaid2993:usage-example-vector-from-angle

Conversation

@Osaid2993

Copy link
Copy Markdown

Description

Splashkit Function: vector_from_angle

Overview of example functionality: This example demonstrates how to create a vector from an angle and length using vector_from_angle. The user can rotate the vector with the Left and Right Arrow keys while the current angle is displayed on the screen.

Example Output:
vector_from_angle-1-example

Files Included

  • C++ code
  • C# code (Top-Level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • Relevant title for the example (.txt)
  • Screenshot

Usage Example Checks (READ CAREFULLY)

  • Code uses Splashkit function above
  • Code does not use non-Splashkit functions
  • Code does not use extra function declarations or extra classes
  • Code does not violate any of the Thoth Tech SplashKit Style Guide rules
  • Simple, clear demonstration of the function
  • Tested in Chrome and Firefox

@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 7f78466
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a6c4de806457f00077e4025

@Rhinoatron Rhinoatron left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great work on this task. The interactive rotating vector is a clear visual demonstration of vector_from_angle, and the on screen angle and instructions make the example easy to understand, all required files are also included. I’d like to request a change to the C# top-level version. It currently mixes OOP-style code with top level conventions by creating the window with new Window, using window.CloseRequested, accessing colours through Color, and constructing points with new(). Could you please update it to use the expected top-level SplashKit functions, such as OpenWindow, QuitRequested, ColorBlack(), and PointAt where appropriate? Please also close the window after the loop and keep the visual colours and instruction text consistent across all four versions. This will make the top level example clearer for beginners and more consistent with the other language implementations we have. Once that’s updated, I can review it again. 🙂

@Osaid2993

Copy link
Copy Markdown
Author

Hi @Rhinoatron, I’ve updated the C# top-level version to use the expected top-level SplashKit conventions. ready for another review.

@Rhinoatron Rhinoatron left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for making the requested changes, I can now see the C# top level version follows the expected SplashKit conventions, and the example clearly demonstrates vector_from_angle across all four languages. One optional consistency note: the vector colour, instruction colour, and instruction wording differ slightly between versions it would be good to align these later, but they don’t affect the functionality or clarity of the example. Approved.

@ralphweng2023 ralphweng2023 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The requested changes are in 7f78466. The top level version now opens with using static SplashKitSDK.SplashKit and calls OpenWindow and QuitRequested directly instead of going through a Window object.

Worth pointing out the angle display, since that is where these usually drift apart. The C++ casts to int before std::to_string and the other three use a format specifier, so all four print -40 the way the gif shows it. Approved.

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