Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/GameBall/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
file(GLOB_RECURSE SOURCES *.cpp *.h)

add_executable(GameBall ${SOURCES})
add_executable(GameBall ${SOURCES}
core/p2pnode.cpp
core/p2pnode.h)
target_link_libraries(GameBall PRIVATE GameX absl::flags absl::flags_parse)

# Delete main.cpp from sources
Expand Down
8 changes: 8 additions & 0 deletions src/GameBall/core/camera_third_person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,12 @@ void CameraControllerThirdPerson::CursorMove(float x, float y) {
dst_pitch_ += y * 0.1f;
dst_pitch_ = glm::clamp(dst_pitch_, -89.0f, 89.0f);
}

void CameraControllerThirdPerson::CursorScroll(float x, float y) {
float target_diatance_ = dst_distance_ + y;
target_diatance_ = glm::clamp(target_diatance_, 5.0f, 35.0f);

dst_distance_ += (target_diatance_ - dst_distance_) * 0.3f;
}

} // namespace GameBall
2 changes: 2 additions & 0 deletions src/GameBall/core/camera_third_person.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class CameraControllerThirdPerson {

void CursorMove(float x, float y);

void CursorScroll(float x,float y);

private:
GameX::Graphics::PCamera camera_;
float dst_distance_{10.0f};
Expand Down
Loading