Skip to content

Commit 3367b1a

Browse files
committed
chore: format
1 parent 7b84149 commit 3367b1a

5 files changed

Lines changed: 14 additions & 18 deletions

File tree

src/common/systems/forward-renderer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "forward-renderer.hpp"
22

33
#include "../../game/components/post-process-effects.hpp"
4-
54
#include "../mesh/mesh-utils.hpp"
65
#include "../texture/texture-utils.hpp"
76

src/game/components/player-movement.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#pragma once
22

3-
#include <glm/glm.hpp>
4-
53
#include <ecs/component.hpp>
4+
#include <glm/glm.hpp>
65

76
namespace gameplay {
87

@@ -25,7 +24,7 @@ namespace gameplay {
2524
float dashCooldown = 1.5f;
2625

2726
float jumpForce = 8.0f;
28-
float gravity = 20.0f; // decrease for floatiness, can be a powerup easily
27+
float gravity = 20.0f; // decrease for floatiness, can be a powerup easily
2928

3029
glm::vec3 velocity = {0, 0, 0};
3130
bool isSprinting = false;

src/game/components/post-process-effects.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#pragma once
22

3+
#include <ecs/component.hpp>
34
#include <string>
45
#include <unordered_map>
56

6-
#include <ecs/component.hpp>
7-
87
namespace gameplay {
98

109
// values set in gameplay and renderer sets them for the current postprocess shader

src/game/systems/player-movement-system.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#pragma once
22

3-
#include <glm/glm.hpp>
4-
#include <glm/gtc/constants.hpp>
5-
#include <glm/trigonometric.hpp>
6-
73
#include <application.hpp>
84
#include <components/camera.hpp>
95
#include <ecs/world.hpp>
6+
#include <glm/glm.hpp>
7+
#include <glm/gtc/constants.hpp>
8+
#include <glm/trigonometric.hpp>
109

1110
#include "GLFW/glfw3.h"
1211
#include "components/player-movement.hpp"
@@ -21,6 +20,7 @@ namespace gameplay {
2120
class PlayerMovementSystem {
2221
float dashEffectTimer = 0.0f;
2322
static constexpr float DASH_EFFECT_DURATION = 0.3f;
23+
2424
public:
2525
void update(our::World* world, float deltaTime, our::Application* app) {
2626
PlayerMovementComponent* movement = nullptr;
@@ -75,7 +75,8 @@ namespace gameplay {
7575
if (movement->isSprinting && glm::length(moveDir) > 0.001f && movement->slideCooldownTimer <= 0) {
7676
movement->isSliding = true;
7777
movement->slideTimer = movement->slideDuration;
78-
movement->velocity = moveDir * slideStartSpeed; // preserves momentum when sliding and keys are released
78+
movement->velocity =
79+
moveDir * slideStartSpeed; // preserves momentum when sliding and keys are released
7980
movement->isCrouching = false;
8081
} else {
8182
movement->isCrouching = !movement->isCrouching;
@@ -94,8 +95,7 @@ namespace gameplay {
9495
} else {
9596
// acts like friction so stopping after key release is not so stiff
9697
movement->velocity *= glm::max(0.0f, 1.0f - 10.0f * deltaTime);
97-
if (glm::length(movement->velocity) < 0.1f)
98-
movement->velocity = glm::vec3(0);
98+
if (glm::length(movement->velocity) < 0.1f) movement->velocity = glm::vec3(0);
9999
}
100100
}
101101

@@ -131,7 +131,8 @@ namespace gameplay {
131131
playerPosition.y += movement->verticalVelocity * deltaTime;
132132

133133
// jumping always goes back to standing height
134-
float minY = movement->verticalVelocity < 0 ? movement->groundLevel + movement->playerHeight : movement->groundLevel + movement->crouchHeight;
134+
float minY = movement->verticalVelocity < 0 ? movement->groundLevel + movement->playerHeight
135+
: movement->groundLevel + movement->crouchHeight;
135136
if (playerPosition.y <= minY) {
136137
playerPosition.y = minY;
137138
movement->verticalVelocity = 0.0f;
@@ -140,9 +141,8 @@ namespace gameplay {
140141
}
141142

142143
if (movement->isGrounded) {
143-
float targetHeight = (movement->isCrouching || movement->isSliding)
144-
? movement->crouchHeight
145-
: movement->playerHeight;
144+
float targetHeight =
145+
(movement->isCrouching || movement->isSliding) ? movement->crouchHeight : movement->playerHeight;
146146
float currentHeight = playerPosition.y - movement->groundLevel;
147147
float lerpedHeight = currentHeight + (targetHeight - currentHeight) * glm::min(1.0f, 10.0f * deltaTime);
148148
playerPosition.y = movement->groundLevel + lerpedHeight;

src/states/play-state.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <systems/forward-renderer.hpp>
77
#include <systems/free-camera-controller.hpp>
88
#include <systems/movement.hpp>
9-
109
#include <systems/player-movement-system.hpp>
1110

1211
// This state shows how to use the ECS framework and deserialization.

0 commit comments

Comments
 (0)