-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
728 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,40 @@ | ||
/* | ||
This file is a part of yoyoengine. (https://github.com/yoyoengine) | ||
Copyright (C) 2023-2024 Ryan Zmuda | ||
Licensed under the MIT license. See LICENSE file in the project root for details. | ||
*/ | ||
|
||
#ifndef YE_RIGIDBODY_H | ||
#define YE_RIGIDBODY_H | ||
|
||
#include <stdbool.h> | ||
|
||
#include <yoyoengine/export.h> | ||
|
||
#include <yoyoengine/ecs/ecs.h> | ||
|
||
// TODO: gravity as a vec2 for flexibility (in physics main, not here) | ||
// note: will be applying impulses directly to velocity | ||
|
||
struct ye_component_rigidbody { | ||
bool active; /**< Controls whether system will act upon this component. */ | ||
|
||
// TODO: inverse mass for performance | ||
float mass; /**< The mass of the rigidbody. */ | ||
|
||
float restitution; /**< The "bounciness" of the rigidbody. */ | ||
|
||
float kinematic_friction; /**< The friction of the rigidbody. */ | ||
float rotational_kinematic_friction; /**< The rotational friction of the rigidbody. */ | ||
|
||
struct ye_vec2f velocity; /**< Velocity of entity */ | ||
float rotational_velocity; /**< Rotational velocity of entity */ | ||
}; | ||
|
||
// TODO: freeze axes? | ||
|
||
YE_API void ye_add_rigidbody_component(struct ye_entity *ent, float mass, float restitution, float kinematic_friction, float rotational_kinematic_friction); | ||
YE_API void ye_remove_rigidbody_component(struct ye_entity *ent); | ||
|
||
#endif // YE_RIGIDBODY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,24 @@ | ||
/* | ||
This file is a part of yoyoengine. (https://github.com/yoyoengine) | ||
Copyright (C) 2023-2024 Ryan Zmuda | ||
Licensed under the MIT license. See LICENSE file in the project root for details. | ||
*/ | ||
|
||
#ifndef YE_SOLVER_H | ||
#define YE_SOLVER_H | ||
|
||
#include <stdbool.h> | ||
|
||
#include <yoyoengine/export.h> | ||
|
||
#include <yoyoengine/ecs/ecs.h> | ||
|
||
|
||
YE_API bool ye_detect_circle_circle_collision(struct ye_vec2f pos1, float radius1, struct ye_vec2f pos2, float radius2); | ||
|
||
YE_API bool ye_detect_circle_rect_collision(struct ye_vec2f circle_pos, float circle_radius, struct ye_rectf rect, float rotation); | ||
|
||
YE_API bool ye_detect_rect_rect_collision(struct ye_rectf rect1, float rotation1, struct ye_rectf rect2, float rotation2); | ||
|
||
#endif // YE_SOLVER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,24 @@ | ||
/* | ||
This file is a part of yoyoengine. (https://github.com/yoyoengine) | ||
Copyright (C) 2023-2024 Ryan Zmuda | ||
Licensed under the MIT license. See LICENSE file in the project root for details. | ||
*/ | ||
|
||
/* | ||
PHYSICS SYSTEM V2: | ||
A simple velocity (immediate impulse application) physics system. | ||
FUTURE WISHLIST: | ||
- physics thread | ||
- advanced paramters (drag, static friction, etc) | ||
*/ | ||
|
||
#ifndef YE_TAR_H | ||
#define YE_TAR_H | ||
|
||
#include <yoyoengine/export.h> | ||
|
||
YE_API void ye_physics_tick(float dt); | ||
|
||
#endif // YE_TAR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,25 @@ | ||
/* | ||
This file is a part of yoyoengine. (https://github.com/yoyoengine) | ||
Copyright (C) 2023-2024 Ryan Zmuda | ||
Licensed under the MIT license. See LICENSE file in the project root for details. | ||
*/ | ||
|
||
#ifndef YE_TYPES_H | ||
#define YE_TYPES_H | ||
|
||
/** | ||
* @brief A rectangle made up of floats. | ||
*/ | ||
struct ye_rectf { | ||
float x, y, w, h; | ||
}; | ||
|
||
/** | ||
* @brief A 2D vector made up of floats. | ||
*/ | ||
struct ye_vec2f { | ||
float x, y; | ||
}; | ||
|
||
#endif // YE_TYPES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.