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

Add Vector Generation Physics Usage Examples #286

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

Conversation

ShaunR1991
Copy link

Description

This pull request adds simple usage examples for the following vector generation functions in SplashKit:

  • unit_vector
  • vector_from_angle
  • vector_from_line
  • vector_from_point_to_rect
  • vector_invert
  • vector_limit
  • vector_normal
  • vector_out_of_circle_from_circle
  • vector_out_of_circle_from_point
  • vector_out_of_rect_from_circle
  • vector_out_of_rect_from_point
  • vector_out_of_rect_from_rect
  • vector_point_to_point
  • vector_to
  • vector_to_point

The purpose of this update is to help users understand the functionality of these vector generation functions in SplashKit by providing detailed examples across supported languages (C++, C#, and Python).

Each example includes:

  • C++ Code
  • C# Code (Top-Level and Object-Oriented versions)
  • Python Code
  • Text Description File
  • Image of Output (if applicable)

No resource zip files are required for these examples.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (update or new)

How Has This Been Tested?

All functions were run and tested to ensure output was as expected.

Testing Checklist

  • Tested in latest Chrome
  • Tested in latest Firefox
  • npm run build
  • npm run preview

Checklist

If involving code

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

If modified config files

  • I have checked the following files for changes:
    • package.json
    • astro.config.mjs
    • netlify.toml
    • docker-compose.yml
    • custom.css

Additional Notes

Each example is designed to demonstrate only the basic functionality of vector generation functions in SplashKit. The resources provided will enable users to replicate, modify, and understand how to implement the functions and what the expected outputs might look like.

Copy link

netlify bot commented Nov 23, 2024

Deploy Preview for splashkit-usage-examples ready!

Name Link
🔨 Latest commit b315e2a
🔍 Latest deploy log https://app.netlify.com/sites/splashkit-usage-examples/deploys/67552d0d571fe70008816a09
😎 Deploy Preview https://deploy-preview-286--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

@ctrlvish ctrlvish left a comment

Choose a reason for hiding this comment

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

I've reviewed the following functions
unit_vector
vector_from_angle
vector_from_line
vector_from_point_to_rect
vector_invert
vector_limit
vector_normal
vector_out_of_circle_from_circle
vector_out_of_circle_from_point
vector_out_of_rect_from_circle
vector_out_of_rect_from_point
vector_out_of_rect_from_rect
vector_point_to_point
vector_to
vector_to_point

  • All required files are present.
    • Title and explanation (.txt)
    • C++ code
    • C# code (top-level statements)
    • C# code (Object-Oriented Programming)
    • Python code
  • Code correctly uses Splashkit functions.
  • Code clearly demonstrates the function.
  • All versions maintain the same structure and comments.
  • C++ code ran correctly.
  • C# top level code ran correctly.
  • C# OOP code ran correctly.
  • Python code ran correctly.

Feedback:
In these code files
vector_out_of_circle_from_circle-simple.cpp
vector_out_of_circle_from_point.cpp
vector_out_of_rect_from_circle.cpp

the line outer_circle.center = {150, 150}; produces an error for invalid syntax. C++ requires explicit construction of structs like point_2d.

@ShaunR1991
Copy link
Author

I've reviewed the following functions unit_vector vector_from_angle vector_from_line vector_from_point_to_rect vector_invert vector_limit vector_normal vector_out_of_circle_from_circle vector_out_of_circle_from_point vector_out_of_rect_from_circle vector_out_of_rect_from_point vector_out_of_rect_from_rect vector_point_to_point vector_to vector_to_point

  • All required files are present.

    • Title and explanation (.txt)
    • C++ code
    • C# code (top-level statements)
    • C# code (Object-Oriented Programming)
    • Python code
  • Code correctly uses Splashkit functions.

  • Code clearly demonstrates the function.

  • All versions maintain the same structure and comments.

  • C++ code ran correctly.

  • C# top level code ran correctly.

  • C# OOP code ran correctly.

  • Python code ran correctly.

Feedback: In these code files vector_out_of_circle_from_circle-simple.cpp vector_out_of_circle_from_point.cpp vector_out_of_rect_from_circle.cpp

the line outer_circle.center = {150, 150}; produces an error for invalid syntax. C++ requires explicit construction of structs like point_2d.

Thanks for the thorough review and good spot. Changes made and checked. Working as intended!

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