mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-27 08:13:18 +00:00
first pr fixes from reviews
This commit is contained in:
+3
-1
@@ -80,7 +80,9 @@ add_executable(unit_tests EXCLUDE_FROM_ALL
|
||||
tests/MainTest.cpp
|
||||
tests/EngineTests.cpp
|
||||
tests/CallbackTest.cpp
|
||||
tests/MoveTests.cpp)
|
||||
tests/MoveTests.cpp
|
||||
tests/CollisionTest.cpp
|
||||
)
|
||||
target_include_directories(unit_tests PUBLIC sources)
|
||||
target_link_libraries(unit_tests PUBLIC wal ray)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ RAY::ModelAnimations::ModelAnimations(const std::string &filePath):
|
||||
::ModelAnimation *ptr = this->_animationsPtr.get();
|
||||
|
||||
for (int i = 0; i < this->_animationCount; i++)
|
||||
this->_animations.emplace_back(RAY::ModelAnimation(ptr[i]));
|
||||
this->_animations.emplace_back(ptr[i]);
|
||||
}
|
||||
|
||||
RAY::ModelAnimation &RAY::ModelAnimations::operator[](int index)
|
||||
|
||||
@@ -60,15 +60,17 @@ namespace RAY {
|
||||
{};
|
||||
std::shared_ptr<::ModelAnimation> fetch(const std::string &path, int *counter)
|
||||
{
|
||||
if (this->_cache.find(path) != this->_cache.end())
|
||||
return this->_cache[path];
|
||||
|
||||
::ModelAnimation *animations = this->_dataLoader(path.c_str(), counter);
|
||||
unsigned int animCount = *counter;
|
||||
|
||||
if (this->_cache.find(path) == this->_cache.end())
|
||||
this->_cache.emplace(path, std::shared_ptr<::ModelAnimation>(
|
||||
animations, [this, animCount](::ModelAnimation *p) {
|
||||
this->_dataUnloader(p, animCount);
|
||||
}));
|
||||
return _cache[path];
|
||||
this->_cache.emplace(path, std::shared_ptr<::ModelAnimation>(
|
||||
animations, [this, animCount](::ModelAnimation *p) {
|
||||
this->_dataUnloader(p, animCount);
|
||||
}));
|
||||
return this->_cache[path];
|
||||
};
|
||||
private:
|
||||
//! @brief function to call to load data
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace BBM
|
||||
WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const
|
||||
{
|
||||
return new AnimationsComponent(entity,
|
||||
RAY::ModelAnimations(this->_modelAnimation.getFilePath()),
|
||||
this->_currentAnimIndex);
|
||||
RAY::ModelAnimations(this->_modelAnimation.getFilePath()),
|
||||
this->_currentAnimIndex);
|
||||
}
|
||||
|
||||
size_t AnimationsComponent::getCurrentAnimFrameCounter() const
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace BBM
|
||||
RAY::Window &window = RAY::Window::getInstance(600, 400, "Bomberman", FLAG_WINDOW_RESIZABLE);
|
||||
|
||||
wal.addSystem<Renderer3DSystem<RAY3D::Model>>();
|
||||
wal.addSystem<AnimationsSystem>();
|
||||
wal.addSystem<Renderer3DSystem<RAY3D::Cube>>();
|
||||
wal.addSystem<AnimationsSystem>();
|
||||
|
||||
wal.addSystem<Render2DScreenSystem>(window)
|
||||
.addSystem<Renderer2DSystem<RAY2D::Rectangle>>();
|
||||
@@ -76,12 +76,12 @@ namespace BBM
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/player/player.iqm", std::make_pair(MAP_DIFFUSE, "assets/player/blue.png"))
|
||||
.addComponent<ControllableComponent>()
|
||||
.addComponent<KeyboardComponent>()
|
||||
.addComponent<AnimationsComponent>(RAY::ModelAnimations("assets/player/player.iqm"), 3)
|
||||
.addComponent<AnimationsComponent>(RAY::ModelAnimations("assets/player/player.iqm"), 1)
|
||||
.addComponent<CollisionComponent>(2)
|
||||
.addComponent<MovableComponent>();
|
||||
scene->addEntity("cube")
|
||||
.addComponent<PositionComponent>(-5, 0, -5)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Cube>>(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED)
|
||||
.addComponent<PositionComponent>(5, 0, 5)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Cube>>(Vector3f(5, 0, 5), Vector3f(3, 3, 3), RED)
|
||||
.addComponent<ControllableComponent>()
|
||||
.addComponent<KeyboardComponent>()
|
||||
.addComponent<CollisionComponent>([](WAL::Entity &, const WAL::Entity &){},
|
||||
@@ -96,7 +96,7 @@ namespace BBM
|
||||
.addComponent<PositionComponent>(8, 20, 7)
|
||||
.addComponent<CameraComponent>(Vector3f(8, 0, 8));
|
||||
std::srand(std::time(NULL));
|
||||
MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene);
|
||||
//MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene);
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace BBM
|
||||
|
||||
AnimationsSystem::AnimationsSystem()
|
||||
: WAL::System({
|
||||
typeid(Drawable3DComponent<RAY::Drawables::Drawables3D::Model>),
|
||||
typeid(Drawable3DComponent<RAY::Drawables::Drawables3D::Model>),
|
||||
typeid(AnimationsComponent)
|
||||
})
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user