![]() |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
#include <Vector2.hpp>
Public Member Functions | |
| constexpr | Vector2 (const ::Vector2 &vec) |
| constexpr | Vector2 (float x) |
| constexpr | Vector2 (float x, float y) |
| Vector2 | Add (const ::Vector2 &vector2) const |
| Add two vectors (v1 + v2) | |
| Vector2 | Add (float value) const |
| Add vector and float value. | |
| float | Angle (const ::Vector2 &vector2) const |
| Calculate angle from two vectors in X-axis. | |
| bool | CheckCollision (::Rectangle rec) const |
| Check if point is inside rectangle. | |
| bool | CheckCollision (::Vector2 center, float radius) const |
| Check if point is inside circle. | |
| bool | CheckCollision (::Vector2 p1, ::Vector2 p2, ::Vector2 p3) const |
| Check if point is inside a triangle. | |
| bool | CheckCollisionCircle (float radius, ::Rectangle rec) const |
| Check collision between circle and rectangle. | |
| bool | CheckCollisionCircle (float radius1, ::Vector2 center2, float radius2) const |
| Check collision between two circles. | |
| bool | CheckCollisionLines (::Vector2 endPos1, ::Vector2 startPos2, ::Vector2 endPos2, ::Vector2 *collisionPoint) const |
| Check the collision between two lines defined by two points each, returns collision point by reference. | |
| bool | CheckCollisionPointLine (::Vector2 p1, ::Vector2 p2, int threshold=1) const |
| Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]. | |
| Vector2 | Clamp (::Vector2 min, ::Vector2 max) const |
| Clamp the components of the vector between. | |
| Vector2 | Clamp (float min, float max) const |
| // Clamp the magnitude of the vector between two min and max values | |
| float | Distance (const ::Vector2 &vector2) const |
| Calculate distance between two vectors. | |
| float | DistanceSqr (::Vector2 v2) const |
| Calculate square distance between two vectors. | |
| Vector2 | Divide (const ::Vector2 &vector2) const |
| Divide vector by vector. | |
| Vector2 | Divide (const float div) const |
| Divide vector by value. | |
| float | DotProduct (const ::Vector2 &vector2) const |
| Calculate two vectors dot product. | |
| void | DrawCircle (float radius, ::Color color={0, 0, 0, 255}) const |
| Draw a color-filled circle (Vector version) | |
| void | DrawLine (::Vector2 endPos, ::Color color={0, 0, 0, 255}) const |
| void | DrawLine (::Vector2 endPos, float thick, ::Color color={0, 0, 0, 255}) const |
| void | DrawLineBezier (::Vector2 endPos, float thick, ::Color color={0, 0, 0, 255}) const |
| void | DrawPixel (::Color color={0, 0, 0, 255}) const |
| void | DrawPoly (int sides, float radius, float rotation, ::Color color={0, 0, 0, 255}) const |
| void | DrawRectangle (::Vector2 size, ::Color color={0, 0, 0, 255}) const |
| int | Equals (::Vector2 q) const |
| Check whether two given vectors are almost equal. | |
| float | GetX () const |
| Retrieves the x value for the object. | |
| float | GetY () const |
| Retrieves the y value for the object. | |
| Vector2 | Invert () const |
| Invert the given vector. | |
| float | Length () const |
| Calculate vector length. | |
| float | LengthSqr () const |
| Calculate vector square length. | |
| Vector2 | Lerp (const ::Vector2 &vector2, float amount) const |
| Calculate linear interpolation between two vectors. | |
| Vector2 | MoveTowards (const ::Vector2 &target, float maxDistance) const |
| Move Vector towards target. | |
| Vector2 | Multiply (const ::Vector2 &vector2) const |
| Multiply vector by vector. | |
| Vector2 | Negate () const |
| Negate vector. | |
| Vector2 | Normalize () const |
| Normalize provided vector. | |
| operator std::string () const | |
| constexpr bool | operator!= (const ::Vector2 &other) const |
| Determines if the vectors are not equal. | |
| Vector2 | operator* (const ::Vector2 &vector2) const |
| Multiply vector by vector. | |
| Vector2 | operator* (const float scale) const |
| Scale vector (multiply by value) | |
| Vector2 & | operator*= (const ::Vector2 &vector2) |
| Multiply vector by vector. | |
| Vector2 & | operator*= (const float scale) |
| Scale vector (multiply by value) | |
| Vector2 | operator+ (const ::Vector2 &vector2) const |
| Add two vectors (v1 + v2) | |
| Vector2 | operator+ (float value) const |
| Add vector and float value. | |
| Vector2 & | operator+= (const ::Vector2 &vector2) |
| Add two vectors (v1 + v2) | |
| Vector2 & | operator+= (float value) |
| Add vector and float value. | |
| Vector2 | operator- () const |
| Negate vector. | |
| Vector2 | operator- (const ::Vector2 &vector2) const |
| Subtract two vectors (v1 - v2) | |
| Vector2 | operator- (float value) const |
| Subtract vector by float value. | |
| Vector2 & | operator-= (const ::Vector2 &vector2) |
| Subtract two vectors (v1 - v2) | |
| Vector2 & | operator-= (float value) |
| Subtract vector by float value. | |
| Vector2 | operator/ (const ::Vector2 &vector2) const |
| Divide vector by vector. | |
| Vector2 | operator/ (const float div) const |
| Divide vector by value. | |
| Vector2 & | operator/= (const ::Vector2 &vector2) |
| Divide vector by vector. | |
| Vector2 & | operator/= (const float div) |
| Divide vector by value. | |
| Vector2 & | operator= (const ::Vector2 &vector2) |
| Set the Vector2 to the same as the given Vector2. | |
| constexpr bool | operator== (const ::Vector2 &other) const |
| Determine whether or not the vectors are equal. | |
| Vector2 | Reflect (const ::Vector2 &normal) const |
| Calculate reflected vector to normal. | |
| Vector2 | Rotate (float angle) const |
| Rotate Vector by float in radians. | |
| Vector2 | Scale (const float scale) const |
| Scale vector (multiply by value) | |
| void | SetX (float value) |
| Sets the x value for the object. | |
| void | SetY (float value) |
| Sets the y value for the object. | |
| Vector2 | Subtract (const ::Vector2 &vector2) const |
| Subtract two vectors (v1 - v2) | |
| Vector2 | Subtract (float value) const |
| Subtract vector by float value. | |
| std::string | ToString () const |
| Vector2 | Transform (::Matrix mat) const |
| Transforms a Vector2 by a given Matrix. | |
Static Public Member Functions | |
| static Vector2 | One () |
| Vector with components value 1.0f. | |
| static Vector2 | Zero () |
| Vector with components value 0.0f. | |
Protected Member Functions | |
| void | set (const ::Vector2 &vec) |
Vector2 type.
Definition at line 18 of file Vector2.hpp.
|
inlineconstexpr |
Definition at line 20 of file Vector2.hpp.
|
inlineconstexpr |
Definition at line 22 of file Vector2.hpp.
|
inlineconstexpr |
Definition at line 23 of file Vector2.hpp.
|
inlineconstexpr |
Definition at line 24 of file Vector2.hpp.
|
inline |
Add two vectors (v1 + v2)
Definition at line 55 of file Vector2.hpp.
|
inline |
Add vector and float value.
Definition at line 74 of file Vector2.hpp.
|
inline |
Calculate angle from two vectors in X-axis.
Definition at line 304 of file Vector2.hpp.
|
inline |
Check if point is inside rectangle.
Definition at line 357 of file Vector2.hpp.
|
inline |
Check if point is inside circle.
Definition at line 362 of file Vector2.hpp.
|
inline |
Check if point is inside a triangle.
Definition at line 369 of file Vector2.hpp.
|
inline |
Check collision between circle and rectangle.
Definition at line 350 of file Vector2.hpp.
|
inline |
Check collision between two circles.
Definition at line 343 of file Vector2.hpp.
|
inline |
Check the collision between two lines defined by two points each, returns collision point by reference.
Definition at line 377 of file Vector2.hpp.
|
inline |
Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold].
Definition at line 384 of file Vector2.hpp.
|
inline |
Clamp the components of the vector between.
Definition at line 264 of file Vector2.hpp.
|
inline |
// Clamp the magnitude of the vector between two min and max values
Definition at line 269 of file Vector2.hpp.
|
inline |
Calculate distance between two vectors.
Definition at line 294 of file Vector2.hpp.
|
inline |
Calculate square distance between two vectors.
Definition at line 299 of file Vector2.hpp.
|
inline |
|
inline |
Divide vector by value.
Definition at line 207 of file Vector2.hpp.
|
inline |
Calculate two vectors dot product.
Definition at line 289 of file Vector2.hpp.
|
inline |
Draw a color-filled circle (Vector version)
Definition at line 332 of file Vector2.hpp.
|
inline |
Definition at line 319 of file Vector2.hpp.
|
inline |
Definition at line 321 of file Vector2.hpp.
|
inline |
Definition at line 325 of file Vector2.hpp.
|
inline |
Definition at line 317 of file Vector2.hpp.
|
inline |
Definition at line 336 of file Vector2.hpp.
|
inline |
Definition at line 334 of file Vector2.hpp.
|
inline |
Check whether two given vectors are almost equal.
Definition at line 274 of file Vector2.hpp.
|
inline |
Retrieves the x value for the object.
Definition at line 26 of file Vector2.hpp.
|
inline |
Retrieves the y value for the object.
Definition at line 27 of file Vector2.hpp.
|
inline |
Invert the given vector.
Definition at line 259 of file Vector2.hpp.
|
inline |
Calculate vector length.
Definition at line 279 of file Vector2.hpp.
|
inline |
Calculate vector square length.
Definition at line 284 of file Vector2.hpp.
|
inline |
Calculate linear interpolation between two vectors.
Definition at line 237 of file Vector2.hpp.
|
inline |
Move Vector towards target.
Definition at line 252 of file Vector2.hpp.
|
inline |
Multiply vector by vector.
Definition at line 149 of file Vector2.hpp.
|
inline |
Negate vector.
Definition at line 139 of file Vector2.hpp.
|
inline |
Normalize provided vector.
Definition at line 227 of file Vector2.hpp.
|
inlinestatic |
Vector with components value 1.0f.
Definition at line 314 of file Vector2.hpp.
|
inline |
Definition at line 49 of file Vector2.hpp.
|
inlineconstexpr |
Determines if the vectors are not equal.
Definition at line 45 of file Vector2.hpp.
|
inline |
Multiply vector by vector.
Definition at line 154 of file Vector2.hpp.
|
inline |
Scale vector (multiply by value)
Definition at line 173 of file Vector2.hpp.
|
inline |
Multiply vector by vector.
Definition at line 159 of file Vector2.hpp.
|
inline |
Scale vector (multiply by value)
Definition at line 178 of file Vector2.hpp.
|
inline |
Add two vectors (v1 + v2)
Definition at line 60 of file Vector2.hpp.
|
inline |
Add vector and float value.
Definition at line 81 of file Vector2.hpp.
|
inline |
Add two vectors (v1 + v2)
Definition at line 65 of file Vector2.hpp.
|
inline |
Add vector and float value.
Definition at line 88 of file Vector2.hpp.
|
inline |
Negate vector.
Definition at line 144 of file Vector2.hpp.
|
inline |
Subtract two vectors (v1 - v2)
Definition at line 102 of file Vector2.hpp.
|
inline |
Subtract vector by float value.
Definition at line 123 of file Vector2.hpp.
|
inline |
Subtract two vectors (v1 - v2)
Definition at line 107 of file Vector2.hpp.
|
inline |
Subtract vector by float value.
Definition at line 130 of file Vector2.hpp.
|
inline |
Divide vector by vector.
Definition at line 193 of file Vector2.hpp.
|
inline |
|
inline |
Divide vector by vector.
Definition at line 198 of file Vector2.hpp.
|
inline |
Divide vector by value.
Definition at line 217 of file Vector2.hpp.
|
inline |
Set the Vector2 to the same as the given Vector2.
Definition at line 32 of file Vector2.hpp.
|
inlineconstexpr |
Determine whether or not the vectors are equal.
Definition at line 40 of file Vector2.hpp.
|
inline |
Calculate reflected vector to normal.
Definition at line 242 of file Vector2.hpp.
|
inline |
Rotate Vector by float in radians.
Definition at line 247 of file Vector2.hpp.
|
inline |
Scale vector (multiply by value)
Definition at line 168 of file Vector2.hpp.
|
inlineprotected |
Definition at line 388 of file Vector2.hpp.
|
inline |
Sets the x value for the object.
| value | The value of which to set x to. |
Definition at line 26 of file Vector2.hpp.
|
inline |
Sets the y value for the object.
| value | The value of which to set y to. |
Definition at line 27 of file Vector2.hpp.
|
inline |
Subtract two vectors (v1 - v2)
Definition at line 97 of file Vector2.hpp.
|
inline |
Subtract vector by float value.
Definition at line 116 of file Vector2.hpp.
|
inline |
Definition at line 47 of file Vector2.hpp.
|
inline |
Transforms a Vector2 by a given Matrix.
Definition at line 232 of file Vector2.hpp.
|
inlinestatic |
Vector with components value 0.0f.
Definition at line 309 of file Vector2.hpp.