-
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.
* Add path-planning as submodule * Add modules - Walk animation and tbs animation - navigation_manager and use path-planning inside - Render animation 2d and move enemy with planned path * Lint
- Loading branch information
Showing
54 changed files
with
605 additions
and
163 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "third-party/uuid_v4"] | ||
path = third-party/uuid_v4 | ||
url = https://github.com/crashoz/uuid_v4.git | ||
[submodule "third-party/path-planning"] | ||
path = third-party/path-planning | ||
url = https://github.com/bilalkah/path-planning.git |
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* @author Bilal Kahraman ([email protected]) | ||
* @brief | ||
* @version 0.1 | ||
* @date 2024-08-18 | ||
* @date 2024-08-19 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
|
@@ -12,27 +12,18 @@ | |
#ifndef ANIMATION_INCLUDE_ANIMATION_ANIMATION_H_ | ||
#define ANIMATION_INCLUDE_ANIMATION_ANIMATION_H_ | ||
|
||
#include <vector> | ||
|
||
namespace wolfenstein { | ||
|
||
class Animation | ||
class IAnimation | ||
{ | ||
public: | ||
Animation(const std::vector<int>& tex_ids, const double animation_speed); | ||
~Animation() = default; | ||
|
||
void Update(const double& delta_time); | ||
void Reset(); | ||
virtual ~IAnimation() = default; | ||
|
||
int GetCurrentFrame() const; | ||
|
||
private: | ||
std::vector<int> tex_ids; | ||
int current_frame; | ||
double animation_speed; | ||
double counter; | ||
virtual void Update(const double& delta_time) = 0; | ||
virtual void Reset() = 0; | ||
virtual int GetCurrentFrame() const = 0; | ||
}; | ||
|
||
} // namespace wolfenstein | ||
|
||
#endif // ANIMATION_INCLUDE_ANIMATION_ANIMATION_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,38 @@ | ||
/** | ||
* @file animator.h | ||
* @author Bilal Kahraman ([email protected]) | ||
* @brief | ||
* @version 0.1 | ||
* @date 2024-08-26 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
|
||
#ifndef ANIMATION_INCLUDE_ANIMATION_ANIMATOR_H_ | ||
#define ANIMATION_INCLUDE_ANIMATION_ANIMATOR_H_ | ||
|
||
#include "Animation/animation.h" | ||
#include <memory> | ||
#include <vector> | ||
|
||
namespace wolfenstein { | ||
|
||
class Animator | ||
{ | ||
public: | ||
Animator(); | ||
~Animator() = default; | ||
|
||
void AddAnimation(std::shared_ptr<IAnimation> animation); | ||
void Update(const double& delta_time); | ||
void Reset(); | ||
int GetCurrentFrame() const; | ||
|
||
private: | ||
std::vector<std::shared_ptr<IAnimation>> animations; | ||
}; | ||
|
||
} // namespace wolfenstein | ||
|
||
#endif // ANIMATION_INCLUDE_ANIMATION_ANIMATOR_H_ |
39 changes: 39 additions & 0 deletions
39
src/Animation/include/Animation/time_based_single_animation.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,39 @@ | ||
/** | ||
* @file animation.h | ||
* @author Bilal Kahraman ([email protected]) | ||
* @brief | ||
* @version 0.1 | ||
* @date 2024-08-18 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
|
||
#ifndef ANIMATION_INCLUDE_ANIMATION_TIME_BASED_SINGLE_ANIMATION_H_ | ||
#define ANIMATION_INCLUDE_ANIMATION_TIME_BASED_SINGLE_ANIMATION_H_ | ||
|
||
#include "Animation/animation.h" | ||
#include <vector> | ||
|
||
namespace wolfenstein { | ||
|
||
class TBSAnimation : public IAnimation | ||
{ | ||
public: | ||
TBSAnimation(const std::vector<int>& tex_ids, const double animation_speed); | ||
~TBSAnimation() = default; | ||
|
||
void Update(const double& delta_time) override; | ||
void Reset() override; | ||
|
||
int GetCurrentFrame() const override; | ||
|
||
private: | ||
std::vector<int> tex_ids; | ||
int current_frame; | ||
double animation_speed; | ||
double counter; | ||
}; | ||
|
||
} // namespace wolfenstein | ||
#endif // ANIMATION_INCLUDE_ANIMATION_TIME_BASED_SINGLE_ANIMATION_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,40 @@ | ||
/** | ||
* @file state_based_animation.h | ||
* @author Bilal Kahraman ([email protected]) | ||
* @brief | ||
* @version 0.1 | ||
* @date 2024-08-26 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
|
||
#ifndef ANIMATION_INCLUDE_ANIMATION_STATE_BASED_ANIMATION_H_ | ||
#define ANIMATION_INCLUDE_ANIMATION_STATE_BASED_ANIMATION_H_ | ||
|
||
#include "Animation/animation.h" | ||
#include <vector> | ||
|
||
namespace wolfenstein { | ||
|
||
class WalkAnimation : public IAnimation | ||
{ | ||
public: | ||
WalkAnimation(const std::vector<int>& tex_ids, const double step_size); | ||
~WalkAnimation() = default; | ||
|
||
void Update(const double& delta_time) override; | ||
void Reset() override; | ||
|
||
int GetCurrentFrame() const override; | ||
|
||
private: | ||
std::vector<int> tex_ids; | ||
int current_frame; | ||
double step_size; | ||
double counter; | ||
}; | ||
|
||
} // namespace wolfenstein | ||
|
||
#endif // ANIMATION_INCLUDE_ANIMATION_STATE_BASED_ANIMATION_H_ |
Empty file.
12 changes: 6 additions & 6 deletions
12
src/Animation/src/animation.cpp → ...ation/src/time_based_single_animation.cpp
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,26 @@ | ||
#include "Animation/walk_animation.h" | ||
|
||
namespace wolfenstein { | ||
|
||
WalkAnimation::WalkAnimation(const std::vector<int>& tex_ids, | ||
const double step_size) | ||
: tex_ids(tex_ids), current_frame(1), step_size(step_size), counter(0) {} | ||
|
||
void WalkAnimation::Update(const double& delta_time) { | ||
counter += delta_time; | ||
if (counter > step_size) { | ||
current_frame = (current_frame + 1) % tex_ids.size(); | ||
counter = 0; | ||
} | ||
} | ||
|
||
void WalkAnimation::Reset() { | ||
current_frame = 1; | ||
counter = 0; | ||
} | ||
|
||
int WalkAnimation::GetCurrentFrame() const { | ||
return tex_ids[current_frame]; | ||
} | ||
|
||
} // namespace wolfenstein |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include <Camera/ray.h> | ||
#include "Camera/ray.h" | ||
|
||
#include <cmath> | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include <Camera/raycaster.h> | ||
#include "Camera/raycaster.h" | ||
|
||
#include <cmath> | ||
#include <vector> | ||
|
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.