aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/system')
-rw-r--r--src/crepe/system/AISystem.cpp21
-rw-r--r--src/crepe/system/CollisionSystem.cpp81
-rw-r--r--src/crepe/system/CollisionSystem.h40
-rw-r--r--src/crepe/system/InputSystem.cpp36
-rw-r--r--src/crepe/system/InputSystem.h21
-rw-r--r--src/crepe/system/ParticleSystem.cpp17
-rw-r--r--src/crepe/system/RenderSystem.cpp6
-rw-r--r--src/crepe/system/ScriptSystem.cpp5
8 files changed, 132 insertions, 95 deletions
diff --git a/src/crepe/system/AISystem.cpp b/src/crepe/system/AISystem.cpp
index 0f35010..94445c7 100644
--- a/src/crepe/system/AISystem.cpp
+++ b/src/crepe/system/AISystem.cpp
@@ -28,7 +28,8 @@ void AISystem::fixed_update() {
= mgr.get_components_by_id<Rigidbody>(ai.game_object_id);
if (rigidbodies.empty()) {
throw std::runtime_error(
- "AI component must be attached to a GameObject with a Rigidbody component");
+ "AI component must be attached to a GameObject with a Rigidbody component"
+ );
}
Rigidbody & rigidbody = rigidbodies.front().get();
if (!rigidbody.active) {
@@ -110,8 +111,8 @@ bool AISystem::accumulate_force(const AI & ai, vec2 & running_total, vec2 & forc
return true;
}
-vec2 AISystem::seek(const AI & ai, const Rigidbody & rigidbody,
- const Transform & transform) const {
+vec2 AISystem::seek(const AI & ai, const Rigidbody & rigidbody, const Transform & transform)
+ const {
// Calculate the desired velocity
vec2 desired_velocity = ai.seek_target - transform.position;
desired_velocity.normalize();
@@ -120,12 +121,12 @@ vec2 AISystem::seek(const AI & ai, const Rigidbody & rigidbody,
return desired_velocity - rigidbody.data.linear_velocity;
}
-vec2 AISystem::flee(const AI & ai, const Rigidbody & rigidbody,
- const Transform & transform) const {
+vec2 AISystem::flee(const AI & ai, const Rigidbody & rigidbody, const Transform & transform)
+ const {
// Calculate the desired velocity if the entity is within the panic distance
vec2 desired_velocity = transform.position - ai.flee_target;
if (desired_velocity.length_squared() > ai.square_flee_panic_distance) {
- return vec2{0, 0};
+ return vec2 {0, 0};
}
desired_velocity.normalize();
desired_velocity *= rigidbody.data.max_linear_velocity;
@@ -133,8 +134,8 @@ vec2 AISystem::flee(const AI & ai, const Rigidbody & rigidbody,
return desired_velocity - rigidbody.data.linear_velocity;
}
-vec2 AISystem::arrive(const AI & ai, const Rigidbody & rigidbody,
- const Transform & transform) const {
+vec2 AISystem::arrive(const AI & ai, const Rigidbody & rigidbody, const Transform & transform)
+ const {
// Calculate the desired velocity (taking into account the deceleration rate)
vec2 to_target = ai.arrive_target - transform.position;
float distance = to_target.length();
@@ -150,12 +151,12 @@ vec2 AISystem::arrive(const AI & ai, const Rigidbody & rigidbody,
return desired_velocity - rigidbody.data.linear_velocity;
}
- return vec2{0, 0};
+ return vec2 {0, 0};
}
vec2 AISystem::path_follow(AI & ai, const Rigidbody & rigidbody, const Transform & transform) {
if (ai.path.empty()) {
- return vec2{0, 0};
+ return vec2 {0, 0};
}
// Get the target node
diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp
index 654d4c6..571ac70 100644
--- a/src/crepe/system/CollisionSystem.cpp
+++ b/src/crepe/system/CollisionSystem.cpp
@@ -50,9 +50,11 @@ void CollisionSystem::fixed_update() {
for (BoxCollider & boxcollider : boxcolliders) {
if (boxcollider.game_object_id != id) continue;
if (!boxcollider.active) continue;
- all_colliders.push_back({.id = id,
- .collider = collider_variant{boxcollider},
- .info = {transform, rigidbody, metadata}});
+ all_colliders.push_back(
+ {.id = id,
+ .collider = collider_variant {boxcollider},
+ .info = {transform, rigidbody, metadata}}
+ );
}
// Check if the circlecollider is active and has the same id as the rigidbody.
RefVector<CircleCollider> circlecolliders
@@ -60,9 +62,11 @@ void CollisionSystem::fixed_update() {
for (CircleCollider & circlecollider : circlecolliders) {
if (circlecollider.game_object_id != id) continue;
if (!circlecollider.active) continue;
- all_colliders.push_back({.id = id,
- .collider = collider_variant{circlecollider},
- .info = {transform, rigidbody, metadata}});
+ all_colliders.push_back(
+ {.id = id,
+ .collider = collider_variant {circlecollider},
+ .info = {transform, rigidbody, metadata}}
+ );
}
}
@@ -110,8 +114,9 @@ CollisionSystem::gather_collisions(std::vector<CollisionInternal> & colliders) {
return collisions_ret;
}
-bool CollisionSystem::should_collide(const CollisionInternal & self,
- const CollisionInternal & other) const {
+bool CollisionSystem::should_collide(
+ const CollisionInternal & self, const CollisionInternal & other
+) const {
const Rigidbody::Data & self_rigidbody = self.info.rigidbody.data;
const Rigidbody::Data & other_rigidbody = other.info.rigidbody.data;
@@ -133,9 +138,9 @@ bool CollisionSystem::should_collide(const CollisionInternal & self,
return false;
}
-CollisionSystem::CollisionInternalType
-CollisionSystem::get_collider_type(const collider_variant & collider1,
- const collider_variant & collider2) const {
+CollisionSystem::CollisionInternalType CollisionSystem::get_collider_type(
+ const collider_variant & collider1, const collider_variant & collider2
+) const {
if (std::holds_alternative<std::reference_wrapper<CircleCollider>>(collider1)) {
if (std::holds_alternative<std::reference_wrapper<CircleCollider>>(collider2)) {
return CollisionInternalType::CIRCLE_CIRCLE;
@@ -151,8 +156,9 @@ CollisionSystem::get_collider_type(const collider_variant & collider1,
}
}
-bool CollisionSystem::detect_collision(CollisionInternal & self, CollisionInternal & other,
- const CollisionInternalType & type) {
+bool CollisionSystem::detect_collision(
+ CollisionInternal & self, CollisionInternal & other, const CollisionInternalType & type
+) {
vec2 resolution;
switch (type) {
case CollisionInternalType::BOX_BOX: {
@@ -177,10 +183,11 @@ bool CollisionSystem::detect_collision(CollisionInternal & self, CollisionIntern
= {.collider = std::get<std::reference_wrapper<BoxCollider>>(self.collider),
.transform = self.info.transform,
.rigidbody = self.info.rigidbody};
- const CircleColliderInternal CIRCLE2 = {
- .collider = std::get<std::reference_wrapper<CircleCollider>>(other.collider),
- .transform = other.info.transform,
- .rigidbody = other.info.rigidbody};
+ const CircleColliderInternal CIRCLE2
+ = {.collider
+ = std::get<std::reference_wrapper<CircleCollider>>(other.collider),
+ .transform = other.info.transform,
+ .rigidbody = other.info.rigidbody};
// Get resolution vector from box-circle collision detection
resolution = this->get_box_circle_detection(BOX1, CIRCLE2);
// If no collision (NaN values), return false
@@ -195,10 +202,11 @@ bool CollisionSystem::detect_collision(CollisionInternal & self, CollisionIntern
= {.collider = std::get<std::reference_wrapper<CircleCollider>>(self.collider),
.transform = self.info.transform,
.rigidbody = self.info.rigidbody};
- const CircleColliderInternal CIRCLE2 = {
- .collider = std::get<std::reference_wrapper<CircleCollider>>(other.collider),
- .transform = other.info.transform,
- .rigidbody = other.info.rigidbody};
+ const CircleColliderInternal CIRCLE2
+ = {.collider
+ = std::get<std::reference_wrapper<CircleCollider>>(other.collider),
+ .transform = other.info.transform,
+ .rigidbody = other.info.rigidbody};
// Get resolution vector from circle-circle collision detection
resolution = this->get_circle_circle_detection(CIRCLE1, CIRCLE2);
// If no collision (NaN values), return false
@@ -239,9 +247,10 @@ bool CollisionSystem::detect_collision(CollisionInternal & self, CollisionIntern
return true;
}
-vec2 CollisionSystem::get_box_box_detection(const BoxColliderInternal & box1,
- const BoxColliderInternal & box2) const {
- vec2 resolution{NAN, NAN};
+vec2 CollisionSystem::get_box_box_detection(
+ const BoxColliderInternal & box1, const BoxColliderInternal & box2
+) const {
+ vec2 resolution {NAN, NAN};
// Get current positions of colliders
vec2 pos1 = AbsolutePosition::get_position(box1.transform, box1.collider.offset);
vec2 pos2 = AbsolutePosition::get_position(box2.transform, box2.collider.offset);
@@ -282,8 +291,9 @@ vec2 CollisionSystem::get_box_box_detection(const BoxColliderInternal & box1,
return resolution;
}
-vec2 CollisionSystem::get_box_circle_detection(const BoxColliderInternal & box,
- const CircleColliderInternal & circle) const {
+vec2 CollisionSystem::get_box_circle_detection(
+ const BoxColliderInternal & box, const CircleColliderInternal & circle
+) const {
/// Get current positions of colliders
vec2 box_pos = AbsolutePosition::get_position(box.transform, box.collider.offset);
vec2 circle_pos = AbsolutePosition::get_position(circle.transform, circle.collider.offset);
@@ -324,14 +334,15 @@ vec2 CollisionSystem::get_box_circle_detection(const BoxColliderInternal & box,
float penetration_depth = scaled_circle_radius - distance;
// Compute the resolution vector
- return vec2{collision_normal * penetration_depth};
+ return vec2 {collision_normal * penetration_depth};
}
// No collision
- return vec2{NAN, NAN};
+ return vec2 {NAN, NAN};
}
vec2 CollisionSystem::get_circle_circle_detection(
- const CircleColliderInternal & circle1, const CircleColliderInternal & circle2) const {
+ const CircleColliderInternal & circle1, const CircleColliderInternal & circle2
+) const {
// Get current positions of colliders
vec2 final_position1
= AbsolutePosition::get_position(circle1.transform, circle1.collider.offset);
@@ -371,7 +382,7 @@ vec2 CollisionSystem::get_circle_circle_detection(
return resolution;
}
// No collision
- return vec2{NAN, NAN};
+ return vec2 {NAN, NAN};
;
}
@@ -402,17 +413,17 @@ CollisionSystem::resolution_correction(vec2 & resolution, const Rigidbody::Data
return resolution_direction;
}
-CollisionSystem::CollisionInfo
-CollisionSystem::get_collision_info(const CollisionInternal & in_self,
- const CollisionInternal & in_other) const {
+CollisionSystem::CollisionInfo CollisionSystem::get_collision_info(
+ const CollisionInternal & in_self, const CollisionInternal & in_other
+) const {
- crepe::CollisionSystem::ColliderInfo self{
+ crepe::CollisionSystem::ColliderInfo self {
.transform = in_self.info.transform,
.rigidbody = in_self.info.rigidbody,
.metadata = in_self.info.metadata,
};
- crepe::CollisionSystem::ColliderInfo other{
+ crepe::CollisionSystem::ColliderInfo other {
.transform = in_other.info.transform,
.rigidbody = in_other.info.rigidbody,
.metadata = in_other.info.metadata,
diff --git a/src/crepe/system/CollisionSystem.h b/src/crepe/system/CollisionSystem.h
index 3fb9723..ff2d35f 100644
--- a/src/crepe/system/CollisionSystem.h
+++ b/src/crepe/system/CollisionSystem.h
@@ -60,8 +60,8 @@ public:
private:
//! A variant type that can hold either a BoxCollider or a CircleCollider.
- using collider_variant = std::variant<std::reference_wrapper<BoxCollider>,
- std::reference_wrapper<CircleCollider>>;
+ using collider_variant = std::variant<
+ std::reference_wrapper<BoxCollider>, std::reference_wrapper<CircleCollider>>;
//! Enum representing the types of collider pairs for collision detection.
enum class CollisionInternalType {
@@ -114,8 +114,9 @@ private:
* \param collider2 Second collider variant (BoxCollider or CircleCollider).
* \return The combined type of the two colliders.
*/
- CollisionInternalType get_collider_type(const collider_variant & collider1,
- const collider_variant & collider2) const;
+ CollisionInternalType get_collider_type(
+ const collider_variant & collider1, const collider_variant & collider2
+ ) const;
private:
/**
@@ -128,8 +129,8 @@ private:
* \param data1 Collision data for the first collider.
* \param data2 Collision data for the second collider.
*/
- CollisionInfo get_collision_info(const CollisionInternal & data1,
- const CollisionInternal & data2) const;
+ CollisionInfo
+ get_collision_info(const CollisionInternal & data1, const CollisionInternal & data2) const;
/**
* \brief Corrects the collision resolution vector and determines its direction.
@@ -221,8 +222,10 @@ private:
* \param other_metadata Rigidbody of second object
* \return Returns true if there is at least one comparison found.
*/
- bool should_collide(const CollisionInternal & self,
- const CollisionInternal & other) const; //done
+ bool should_collide(
+ const CollisionInternal & self,
+ const CollisionInternal & other
+ ) const; //done
/**
* \brief Checks for collision between two colliders.
@@ -236,8 +239,10 @@ private:
* \param type The type of collider pair.
* \return True if a collision is detected, otherwise false.
*/
- bool detect_collision(CollisionInternal & first_info, CollisionInternal & second_info,
- const CollisionInternalType & type);
+ bool detect_collision(
+ CollisionInternal & first_info, CollisionInternal & second_info,
+ const CollisionInternalType & type
+ );
/**
* \brief Detects collisions between two BoxColliders.
@@ -250,8 +255,9 @@ private:
* \param box2 Information about the second BoxCollider.
* \return If colliding, returns the resolution vector; otherwise, returns {NaN, NaN}.
*/
- vec2 get_box_box_detection(const BoxColliderInternal & box1,
- const BoxColliderInternal & box2) const;
+ vec2 get_box_box_detection(
+ const BoxColliderInternal & box1, const BoxColliderInternal & box2
+ ) const;
/**
* \brief Check collision for box on circle collider
@@ -264,8 +270,9 @@ private:
* \param circle2 Information about the circleCollider.
* \return If colliding, returns the resolution vector; otherwise, returns {NaN, NaN}.
*/
- vec2 get_box_circle_detection(const BoxColliderInternal & box1,
- const CircleColliderInternal & circle2) const;
+ vec2 get_box_circle_detection(
+ const BoxColliderInternal & box1, const CircleColliderInternal & circle2
+ ) const;
/**
* \brief Check collision for circle on circle collider
@@ -278,8 +285,9 @@ private:
* \param circle2 Information about the second circleCollider.
* \return If colliding, returns the resolution vector; otherwise, returns {NaN, NaN}.
*/
- vec2 get_circle_circle_detection(const CircleColliderInternal & circle1,
- const CircleColliderInternal & circle2) const;
+ vec2 get_circle_circle_detection(
+ const CircleColliderInternal & circle1, const CircleColliderInternal & circle2
+ ) const;
};
/**
diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp
index 8e9f763..b4a0633 100644
--- a/src/crepe/system/InputSystem.cpp
+++ b/src/crepe/system/InputSystem.cpp
@@ -44,8 +44,9 @@ void InputSystem::fixed_update() {
}
}
-void InputSystem::handle_mouse_event(const EventData & event, const vec2 & camera_origin,
- const Camera & current_cam) {
+void InputSystem::handle_mouse_event(
+ const EventData & event, const vec2 & camera_origin, const Camera & current_cam
+) {
EventManager & event_mgr = this->mediator.event_manager;
vec2 adjusted_mouse;
adjusted_mouse.x = event.data.mouse_data.mouse_position.x + camera_origin.x;
@@ -82,8 +83,9 @@ void InputSystem::handle_mouse_event(const EventData & event, const vec2 & camer
.mouse_pos = adjusted_mouse,
.button = event.data.mouse_data.mouse_button,
});
- this->handle_click(event.data.mouse_data.mouse_button, adjusted_mouse,
- current_cam);
+ this->handle_click(
+ event.data.mouse_data.mouse_button, adjusted_mouse, current_cam
+ );
}
break;
}
@@ -115,7 +117,8 @@ void InputSystem::handle_non_mouse_event(const EventData & event) {
case EventType::KEY_DOWN:
event_mgr.queue_event<KeyPressEvent>(
- {.repeat = event.data.key_data.key_repeat, .key = event.data.key_data.key});
+ {.repeat = event.data.key_data.key_repeat, .key = event.data.key_data.key}
+ );
break;
case EventType::KEY_UP:
event_mgr.queue_event<KeyReleaseEvent>({.key = event.data.key_data.key});
@@ -128,11 +131,13 @@ void InputSystem::handle_non_mouse_event(const EventData & event) {
break;
case EventType::WINDOW_RESIZE:
event_mgr.queue_event<WindowResizeEvent>(
- WindowResizeEvent{.dimensions = event.data.window_data.resize_dimension});
+ WindowResizeEvent {.dimensions = event.data.window_data.resize_dimension}
+ );
break;
case EventType::WINDOW_MOVE:
event_mgr.queue_event<WindowMoveEvent>(
- {.delta_move = event.data.window_data.move_delta});
+ {.delta_move = event.data.window_data.move_delta}
+ );
break;
case EventType::WINDOW_MINIMIZE:
event_mgr.queue_event<WindowMinimizeEvent>({});
@@ -151,8 +156,9 @@ void InputSystem::handle_non_mouse_event(const EventData & event) {
}
}
-void InputSystem::handle_move(const EventData & event_data, const vec2 & mouse_pos,
- const Camera & current_cam) {
+void InputSystem::handle_move(
+ const EventData & event_data, const vec2 & mouse_pos, const Camera & current_cam
+) {
ComponentManager & mgr = this->mediator.component_manager;
EventManager & event_mgr = this->mediator.event_manager;
const RefVector<Button> buttons = mgr.get_components_by_type<Button>();
@@ -182,8 +188,9 @@ void InputSystem::handle_move(const EventData & event_data, const vec2 & mouse_p
}
}
-void InputSystem::handle_click(const MouseButton & mouse_button, const vec2 & mouse_pos,
- const Camera & current_cam) {
+void InputSystem::handle_click(
+ const MouseButton & mouse_button, const vec2 & mouse_pos, const Camera & current_cam
+) {
ComponentManager & mgr = this->mediator.component_manager;
EventManager & event_mgr = this->mediator.event_manager;
const RefVector<Button> buttons = mgr.get_components_by_type<Button>();
@@ -201,9 +208,10 @@ void InputSystem::handle_click(const MouseButton & mouse_button, const vec2 & mo
}
}
-bool InputSystem::is_mouse_inside_button(const vec2 & mouse_pos, const Button & button,
- const Transform & transform,
- const Transform & cam_transform) {
+bool InputSystem::is_mouse_inside_button(
+ const vec2 & mouse_pos, const Button & button, const Transform & transform,
+ const Transform & cam_transform
+) {
vec2 actual_pos = transform.position + button.offset;
if (!button.world_space) {
actual_pos += cam_transform.position;
diff --git a/src/crepe/system/InputSystem.h b/src/crepe/system/InputSystem.h
index 45b238b..37311cc 100644
--- a/src/crepe/system/InputSystem.h
+++ b/src/crepe/system/InputSystem.h
@@ -79,8 +79,9 @@ private:
* This method processes mouse events, adjusts the mouse position to world coordinates,
* and triggers the appropriate mouse-specific event handling logic.
*/
- void handle_mouse_event(const EventData & event, const vec2 & camera_origin,
- const Camera & current_cam);
+ void handle_mouse_event(
+ const EventData & event, const vec2 & camera_origin, const Camera & current_cam
+ );
/**
* \brief Handles non-mouse-related events.
* \param event The event data for the non-mouse event.
@@ -98,8 +99,9 @@ private:
*
* This method processes the mouse click event and triggers the corresponding button action.
*/
- void handle_click(const MouseButton & mouse_button, const vec2 & mouse_pos,
- const Camera & current_cam);
+ void handle_click(
+ const MouseButton & mouse_button, const vec2 & mouse_pos, const Camera & current_cam
+ );
/**
* \brief Handles the mouse movement event.
@@ -110,8 +112,9 @@ private:
*
* This method processes the mouse movement event and updates the button hover state.
*/
- void handle_move(const EventData & event_data, const vec2 & mouse_pos,
- const Camera & current_cam);
+ void handle_move(
+ const EventData & event_data, const vec2 & mouse_pos, const Camera & current_cam
+ );
/**
* \brief Checks if the mouse position is inside the bounds of the button.
@@ -122,8 +125,10 @@ private:
* \param cam_transform the transform of the current active camera
* \return True if the mouse is inside the button, false otherwise.
*/
- bool is_mouse_inside_button(const vec2 & mouse_pos, const Button & button,
- const Transform & transform, const Transform & cam_transform);
+ bool is_mouse_inside_button(
+ const vec2 & mouse_pos, const Button & button, const Transform & transform,
+ const Transform & cam_transform
+ );
/**
* \brief Handles the button press event, calling the on_click callback if necessary.
diff --git a/src/crepe/system/ParticleSystem.cpp b/src/crepe/system/ParticleSystem.cpp
index 5e575e4..f026390 100644
--- a/src/crepe/system/ParticleSystem.cpp
+++ b/src/crepe/system/ParticleSystem.cpp
@@ -50,9 +50,10 @@ void ParticleSystem::emit_particle(ParticleEmitter & emitter, const Transform &
constexpr float DEG_TO_RAD = M_PI / 180.0;
vec2 initial_position = AbsolutePosition::get_position(transform, emitter.data.offset);
- float random_angle
- = this->generate_random_angle(emitter.data.min_angle + transform.rotation,
- emitter.data.max_angle + transform.rotation);
+ float random_angle = this->generate_random_angle(
+ emitter.data.min_angle + transform.rotation,
+ emitter.data.max_angle + transform.rotation
+ );
float random_speed
= this->generate_random_speed(emitter.data.min_speed, emitter.data.max_speed);
@@ -63,8 +64,9 @@ void ParticleSystem::emit_particle(ParticleEmitter & emitter, const Transform &
for (Particle & particle : emitter.particles) {
if (!particle.active) {
- particle.reset(emitter.data.end_lifespan, initial_position, velocity,
- random_angle);
+ particle.reset(
+ emitter.data.end_lifespan, initial_position, velocity, random_angle
+ );
break;
}
}
@@ -82,8 +84,9 @@ void ParticleSystem::check_bounds(ParticleEmitter & emitter, const Transform & t
for (Particle & particle : emitter.particles) {
const vec2 & position = particle.position;
- bool within_bounds = (position.x >= left && position.x <= right && position.y >= top
- && position.y <= bottom);
+ bool within_bounds
+ = (position.x >= left && position.x <= right && position.y >= top
+ && position.y <= bottom);
//if not within bounds do a reset or stop velocity
if (!within_bounds) {
if (emitter.data.boundary.reset_on_exit) {
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index 698301e..30bb422 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -92,7 +92,7 @@ void RenderSystem::render_text() {
const Font & font = resource_manager.get<Font>(text.font.value());
const auto & transform
= mgr.get_components_by_id<Transform>(text.game_object_id).front().get();
- ctx.draw_text(SDLContext::RenderText{
+ ctx.draw_text(SDLContext::RenderText {
.text = text,
.font = font,
.transform = transform,
@@ -120,7 +120,7 @@ bool RenderSystem::render_particle(const Sprite & sprite, const Transform & tran
if (!p.active) continue;
if (p.time_in_life < em.data.begin_lifespan) continue;
- ctx.draw(SDLContext::RenderContext{
+ ctx.draw(SDLContext::RenderContext {
.sprite = sprite,
.texture = res,
.pos = p.position,
@@ -136,7 +136,7 @@ void RenderSystem::render_normal(const Sprite & sprite, const Transform & transf
ResourceManager & resource_manager = this->mediator.resource_manager;
const Texture & res = resource_manager.get<Texture>(sprite.source);
vec2 pos = AbsolutePosition::get_position(transform, sprite.data.position_offset);
- ctx.draw(SDLContext::RenderContext{
+ ctx.draw(SDLContext::RenderContext {
.sprite = sprite,
.texture = res,
.pos = pos,
diff --git a/src/crepe/system/ScriptSystem.cpp b/src/crepe/system/ScriptSystem.cpp
index 93b4853..ed0c7cc 100644
--- a/src/crepe/system/ScriptSystem.cpp
+++ b/src/crepe/system/ScriptSystem.cpp
@@ -19,8 +19,9 @@ void ScriptSystem::frame_update() {
this->update(&Script::frame_update, delta_time);
}
-void ScriptSystem::update(void (Script::*update_function)(duration_t),
- const duration_t & delta_time) {
+void ScriptSystem::update(
+ void (Script::*update_function)(duration_t), const duration_t & delta_time
+) {
ComponentManager & mgr = this->mediator.component_manager;
RefVector<BehaviorScript> behavior_scripts = mgr.get_components_by_type<BehaviorScript>();