mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-06 03:12:01 +00:00
Merging with develop and reworking all systems
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// Created by cbihan on 01/06/2021.
|
||||
//
|
||||
|
||||
#include "AnimationsComponent.hpp"
|
||||
#include "Entity/Entity.hpp"
|
||||
#include "Model/ModelAnimations.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex, bool play)
|
||||
: WAL::Component(entity),
|
||||
_modelAnimation(std::move(modelAnimation)),
|
||||
_currentAnimIndex(animIndex),
|
||||
_animDisabled(play)
|
||||
{
|
||||
this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(0);
|
||||
}
|
||||
|
||||
WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const
|
||||
{
|
||||
return new AnimationsComponent(entity,
|
||||
RAY::ModelAnimations(this->_modelAnimation.getFilePath()),
|
||||
this->_currentAnimIndex);
|
||||
}
|
||||
|
||||
size_t AnimationsComponent::getCurrentAnimFrameCounter() const
|
||||
{
|
||||
return this->_modelAnimation.at(this->_currentAnimIndex).getFrameCounter();
|
||||
}
|
||||
|
||||
RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim()
|
||||
{
|
||||
return this->_modelAnimation[this->_currentAnimIndex];
|
||||
}
|
||||
|
||||
void AnimationsComponent::setCurrentAnimFrameCounter(size_t animFrameCounter)
|
||||
{
|
||||
this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(animFrameCounter);
|
||||
}
|
||||
|
||||
void AnimationsComponent::resetCurrentAnimFrameCounter()
|
||||
{
|
||||
this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(0);
|
||||
}
|
||||
|
||||
size_t AnimationsComponent::getCurrentAnimIndex() const
|
||||
{
|
||||
return this->_currentAnimIndex;
|
||||
}
|
||||
|
||||
void AnimationsComponent::setAnimIndex(int animIndex)
|
||||
{
|
||||
this->_currentAnimIndex = animIndex % static_cast<int>(this->_modelAnimation.getAnimationsCount());
|
||||
}
|
||||
|
||||
void AnimationsComponent::incCurrentAnimFrameCounter()
|
||||
{
|
||||
this->_modelAnimation[this->_currentAnimIndex].incrementFrameCounter();
|
||||
}
|
||||
|
||||
void AnimationsComponent::setAnimDisabled(bool disable)
|
||||
{
|
||||
this->_animDisabled = disable;
|
||||
}
|
||||
|
||||
bool AnimationsComponent::isAnimDisabled() const
|
||||
{
|
||||
return this->_animDisabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// Created by cbihan on 01/06/2021.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <Model/ModelAnimations.hpp>
|
||||
#include <Component/Component.hpp>
|
||||
#include <Entity/Entity.hpp>
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
class AnimationsComponent : public WAL::Component
|
||||
{
|
||||
private:
|
||||
//! @brief To get the animation data
|
||||
RAY::ModelAnimations _modelAnimation;
|
||||
//! @brief The index of the
|
||||
int _currentAnimIndex;
|
||||
//! @brief Bool allowing to play pause an animation
|
||||
bool _animDisabled;
|
||||
public:
|
||||
//! @inherit
|
||||
WAL::Component *clone(WAL::Entity &entity) const override;
|
||||
|
||||
//! @brief get the current animation index
|
||||
size_t getCurrentAnimIndex() const;
|
||||
|
||||
//! @brief Set the animation index to use
|
||||
void setAnimIndex(int animIndex);
|
||||
|
||||
//! @brief get animation frame counter
|
||||
size_t getCurrentAnimFrameCounter() const;
|
||||
|
||||
//! @brief get the current
|
||||
RAY::ModelAnimation getCurrentModelAnim();
|
||||
|
||||
//! @brief set the anim frame counter
|
||||
void setCurrentAnimFrameCounter(size_t animFrameCounter);
|
||||
|
||||
//! @brief Set the internal anim counter to 0
|
||||
void resetCurrentAnimFrameCounter();
|
||||
|
||||
//! @brief Increment the internal anim counter
|
||||
void incCurrentAnimFrameCounter();
|
||||
|
||||
//! @brief Allow to play pause animations
|
||||
void setAnimDisabled(bool disable);
|
||||
|
||||
//! @brief To know if the animation will be updated or not
|
||||
bool isAnimDisabled() const;
|
||||
|
||||
//! @brief ctor entity and the path of the animation file
|
||||
explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex, bool play = true);
|
||||
//! @brief copy ctor
|
||||
AnimationsComponent(const AnimationsComponent &) = default;
|
||||
//! @brief dtor
|
||||
~AnimationsComponent() override = default;
|
||||
//! @brief assignment operator
|
||||
AnimationsComponent &operator=(const AnimationsComponent &) = delete;
|
||||
};
|
||||
}
|
||||
@@ -4,36 +4,37 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Models/TypeHolder.hpp>
|
||||
#include "Component/Component.hpp"
|
||||
#include "Drawables/ADrawable2D.hpp"
|
||||
#include "Model/Model.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
template <class T>
|
||||
class Drawable2DComponent : public WAL::Component
|
||||
{
|
||||
public:
|
||||
//! @brief The type of the component
|
||||
T member;
|
||||
std::shared_ptr<RAY::Drawables::ADrawable2D> drawable;
|
||||
|
||||
//! ctor
|
||||
Drawable2DComponent(WAL::Entity &entity, T member)
|
||||
//! @brief ctor
|
||||
Drawable2DComponent(WAL::Entity &entity, std::shared_ptr<RAY::Drawables::ADrawable2D> drawable)
|
||||
: WAL::Component(entity),
|
||||
member(std::move(member))
|
||||
drawable(std::move(drawable))
|
||||
{}
|
||||
|
||||
//! ctor
|
||||
template<typename ...Params>
|
||||
explicit Drawable2DComponent(WAL::Entity &entity, Params &&...params)
|
||||
template<typename T, typename ...Params>
|
||||
explicit Drawable2DComponent(WAL::Entity &entity, WAL::TypeHolder<T>, Params &&...params)
|
||||
: WAL::Component(entity),
|
||||
member(std::forward<Params>(params)...)
|
||||
drawable(new T(std::forward<Params>(params)...))
|
||||
{}
|
||||
|
||||
//! @brief Clone a component for another or the same entity.
|
||||
//! @param entity The entity that owns the ne component.
|
||||
WAL::Component *clone(WAL::Entity &entity) const override
|
||||
{
|
||||
return new Drawable2DComponent(entity, this->member);
|
||||
return new Drawable2DComponent(entity, this->drawable);
|
||||
}
|
||||
|
||||
//! @brief Default copy ctor
|
||||
@@ -42,7 +43,5 @@ namespace BBM
|
||||
~Drawable2DComponent() override = default;
|
||||
//! @brief Default assignment operator
|
||||
Drawable2DComponent &operator=(const Drawable2DComponent &) = delete;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
@@ -4,37 +4,37 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Models/TypeHolder.hpp>
|
||||
#include "Component/Component.hpp"
|
||||
#include "Drawables/ADrawable3D.hpp"
|
||||
#include "Model/Model.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
template <class T>
|
||||
class Drawable3DComponent : public WAL::Component
|
||||
{
|
||||
public:
|
||||
//! @brief The type of the component
|
||||
T member;
|
||||
std::shared_ptr<RAY::Drawables::ADrawable3D> drawable;
|
||||
|
||||
//! @brief ctor
|
||||
Drawable3DComponent(WAL::Entity &entity, T member)
|
||||
Drawable3DComponent(WAL::Entity &entity, std::shared_ptr<RAY::Drawables::ADrawable3D> drawable)
|
||||
: WAL::Component(entity),
|
||||
member(std::move(member))
|
||||
drawable(std::move(drawable))
|
||||
{}
|
||||
|
||||
//! ctor
|
||||
template<typename ...Params>
|
||||
explicit Drawable3DComponent(WAL::Entity &entity, Params &&...params)
|
||||
template<typename T, typename ...Params>
|
||||
explicit Drawable3DComponent(WAL::Entity &entity, WAL::TypeHolder<T>, Params &&...params)
|
||||
: WAL::Component(entity),
|
||||
member(std::forward<Params>(params)...)
|
||||
drawable(new T(std::forward<Params>(params)...))
|
||||
{}
|
||||
|
||||
//! @brief Clone a component for another or the same entity.
|
||||
//! @param entity The entity that owns the ne component.
|
||||
WAL::Component *clone(WAL::Entity &entity) const override
|
||||
{
|
||||
return new Drawable3DComponent(entity, this->member);
|
||||
return new Drawable3DComponent(entity, this->drawable);
|
||||
}
|
||||
|
||||
//! @brief Default copy ctor
|
||||
|
||||
+12
-12
@@ -21,7 +21,7 @@ namespace BBM
|
||||
scene->addEntity("Unbreakable Wall")
|
||||
.addComponent<PositionComponent>(i, 0, j)
|
||||
.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,26 +35,26 @@ namespace BBM
|
||||
scene->addEntity("Bottom Wall")
|
||||
.addComponent<PositionComponent>(Vector3f((width + 1) / 2, 0, -1))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj), RAY::Vector3(width + 3, 1, 1));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj), RAY::Vector3(width + 3, 1, 1));
|
||||
scene->addEntity("Upper Wall")
|
||||
.addComponent<PositionComponent>(Vector3f((width + 1) / 2, 0, height + 1))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj), RAY::Vector3(width + 3, 1, 1));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj), RAY::Vector3(width + 3, 1, 1));
|
||||
scene->addEntity("Left Wall")
|
||||
.addComponent<PositionComponent>(Vector3f(width + 1, 0, (height + 1) / 2))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj), RAY::Vector3(1, 1, height + 3));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj), RAY::Vector3(1, 1, height + 3));
|
||||
scene->addEntity("Right Wall")
|
||||
.addComponent<PositionComponent>(Vector3f(-1, 0, (height + 1) / 2))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj), RAY::Vector3(1, 1, height + 3));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>(unbreakableObj, std::make_pair(MAP_DIFFUSE, unbreakablePnj), RAY::Vector3(1, 1, height + 3));
|
||||
}
|
||||
|
||||
void MapGenerator::generateFloor(int width, int height, std::shared_ptr<WAL::Scene> scene)
|
||||
{
|
||||
scene->addEntity("Floor")
|
||||
.addComponent<PositionComponent>(Vector3f(width / 2, -1, height / 2))
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/floor.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/floor.png"), RAY::Vector3(width + 2, 0, height + 2));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/wall/floor.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/floor.png"), RAY::Vector3(width + 2, 0, height + 2));
|
||||
}
|
||||
|
||||
void MapGenerator::createElement(Vector3f coords, std::shared_ptr<WAL::Scene> scene, BlockType blockType)
|
||||
@@ -82,14 +82,14 @@ namespace BBM
|
||||
.addComponent<PositionComponent>(coords)
|
||||
.addComponent<HealthComponent>(1)
|
||||
.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/breakable_wall.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/breakable_wall.png"));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/wall/breakable_wall.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/breakable_wall.png"));
|
||||
}
|
||||
|
||||
void MapGenerator::createFloor(Vector3f coords, std::shared_ptr<WAL::Scene> scene)
|
||||
{
|
||||
scene->addEntity("Floor")
|
||||
.addComponent<PositionComponent>(Vector3f(coords))
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/floor.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/floor.png"));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/wall/floor.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/floor.png"));
|
||||
}
|
||||
|
||||
void MapGenerator::createUnbreakable(Vector3f coords, std::shared_ptr<WAL::Scene> scene)
|
||||
@@ -97,14 +97,14 @@ namespace BBM
|
||||
scene->addEntity("Unbreakable Block")
|
||||
.addComponent<PositionComponent>(coords)
|
||||
.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/unbreakable_wall.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/unbreakable_wall.png"));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/wall/unbreakable_wall.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/unbreakable_wall.png"));
|
||||
}
|
||||
|
||||
void MapGenerator::createHole(Vector3f coords, std::shared_ptr<WAL::Scene> scene)
|
||||
{
|
||||
scene->addEntity("Hole Block")
|
||||
.addComponent<PositionComponent>(Vector3f(coords.x, coords.y - 1, coords.z))
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/hole.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/hole.png"));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/wall/hole.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/hole.png"));
|
||||
/* .addComponent<CollisionComponent>([](const WAL::Entity &entity, WAL::Entity &other) {
|
||||
if (other.hasComponent<HealthComponent>()) {
|
||||
auto &health = other.getComponent<HealthComponent>();
|
||||
@@ -117,7 +117,7 @@ namespace BBM
|
||||
{
|
||||
scene->addEntity("Bumper Block")
|
||||
.addComponent<PositionComponent>(Vector3f(coords.x, coords.y - 1, coords.z))
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/bumper_block.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/bumper_block.png"));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/wall/bumper_block.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/bumper_block.png"));
|
||||
/* .addComponent<CollisionComponent>([](const WAL::Entity &entity, WAL::Entity &other) {
|
||||
if (other.hasComponent<MovableComponent>()) {
|
||||
auto &movable = other.getComponent<MovableComponent>();
|
||||
@@ -131,7 +131,7 @@ namespace BBM
|
||||
scene->addEntity("Stairs Block")
|
||||
.addComponent<PositionComponent>(coords)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/stairs_block.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/stairs_block.png"));
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/wall/stairs_block.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/stairs_block.png"));
|
||||
}
|
||||
|
||||
bool MapGenerator::isCloseToBlockType(std::map<std::tuple<int, int, int>, BlockType> map, int x, int y, int z, BlockType blockType)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
#include <tuple>
|
||||
#include <algorithm>
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "System/Renderer/Renderer3DSystem.hpp"
|
||||
#include "System/Renderer/RenderSystem.hpp"
|
||||
#include "Scene/Scene.hpp"
|
||||
#include "Model/Model.hpp"
|
||||
#include "Component/Component.hpp"
|
||||
|
||||
+20
-22
@@ -4,15 +4,13 @@
|
||||
|
||||
#include <Wal.hpp>
|
||||
#include <iostream>
|
||||
#include <System/Movable/MovableSystem.hpp>
|
||||
#include <System/Renderer/RenderScreenSystem.hpp>
|
||||
#include <System/Renderer/Render2DScreenSystem.hpp>
|
||||
#include <System/Renderer/Renderer2DSystem.hpp>
|
||||
#include "System/Movable/MovableSystem.hpp"
|
||||
#include "System/Renderer/RenderSystem.hpp"
|
||||
#include <Model/Model.hpp>
|
||||
#include <Drawables/3D/Cube.hpp>
|
||||
#include <Drawables/2D/Rectangle.hpp>
|
||||
#include <Drawables/3D/Cube.hpp>
|
||||
#include <TraceLog.hpp>
|
||||
#include <System/Renderer/Renderer3DSystem.hpp>
|
||||
#include <System/Keyboard/KeyboardSystem.hpp>
|
||||
#include <System/Controllable/ControllableSystem.hpp>
|
||||
#include <System/Collision/CollisionSystem.hpp>
|
||||
@@ -23,8 +21,13 @@
|
||||
#include <System/Gamepad/GamepadSystem.hpp>
|
||||
#include "Models/Vector2.hpp"
|
||||
#include "Component/Renderer/CameraComponent.hpp"
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "Runner.hpp"
|
||||
#include "Models/GameState.hpp"
|
||||
#include <Model/ModelAnimations.hpp>
|
||||
#include "Component/Animation/AnimationsComponent.hpp"
|
||||
#include "System/Animation/AnimationsSystem.hpp"
|
||||
#include "Map/Map.hpp"
|
||||
|
||||
namespace RAY2D = RAY::Drawables::Drawables2D;
|
||||
@@ -47,7 +50,7 @@ namespace BBM
|
||||
wal.addSystem<KeyboardSystem>()
|
||||
.addSystem<GamepadSystem>()
|
||||
.addSystem<ControllableSystem>()
|
||||
.addSystem<CollisionSystem>(wal)
|
||||
.addSystem<CollisionSystem>()
|
||||
.addSystem<MovableSystem>();
|
||||
}
|
||||
|
||||
@@ -55,13 +58,7 @@ namespace BBM
|
||||
{
|
||||
RAY::TraceLog::setLevel(LOG_WARNING);
|
||||
RAY::Window &window = RAY::Window::getInstance(600, 400, "Bomberman", FLAG_WINDOW_RESIZABLE);
|
||||
|
||||
wal.addSystem<Renderer3DSystem<RAY3D::Model>>();
|
||||
wal.addSystem<Renderer3DSystem<RAY3D::Cube>>();
|
||||
|
||||
wal.addSystem<Render2DScreenSystem>(window)
|
||||
.addSystem<Renderer2DSystem<RAY2D::Rectangle>>();
|
||||
wal.addSystem<RenderScreenSystem>(window);
|
||||
wal.addSystem<RenderSystem>(window);
|
||||
}
|
||||
|
||||
std::shared_ptr<WAL::Scene> loadGameScene(WAL::Wal &wal)
|
||||
@@ -69,24 +66,25 @@ namespace BBM
|
||||
auto scene = std::make_shared<WAL::Scene>();
|
||||
scene->addEntity("player")
|
||||
.addComponent<PositionComponent>()
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/player/player.iqm", std::make_pair(MAP_DIFFUSE, "assets/player/blue.png"))
|
||||
.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"), 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<Drawable3DComponent, RAY3D::Cube>(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED)
|
||||
.addComponent<ControllableComponent>()
|
||||
.addComponent<KeyboardComponent>()
|
||||
.addComponent<CollisionComponent>([](WAL::Entity &, const WAL::Entity &){},
|
||||
[](WAL::Entity &actual, const WAL::Entity &) {
|
||||
try {
|
||||
auto &mov = actual.getComponent<MovableComponent>();
|
||||
mov.resetVelocity();
|
||||
} catch (std::exception &e) { };
|
||||
}, 3);
|
||||
|
||||
[](WAL::Entity &actual, const WAL::Entity &) {
|
||||
try {
|
||||
auto &mov = actual.getComponent<MovableComponent>();
|
||||
mov.resetVelocity();
|
||||
} catch (std::exception &e) { }
|
||||
}, 3);
|
||||
|
||||
scene->addEntity("camera")
|
||||
.addComponent<PositionComponent>(8, 20, 7)
|
||||
.addComponent<CameraComponent>(Vector3f(8, 0, 8));
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Created by cbihan on 01/06/2021.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include "AnimationsSystem.hpp"
|
||||
#include "Component/Animation/AnimationsComponent.hpp"
|
||||
#include "Model/Model.hpp"
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
|
||||
AnimationsSystem::AnimationsSystem(WAL::Wal &wal)
|
||||
: System(wal)
|
||||
{}
|
||||
|
||||
void AnimationsSystem::onUpdate(WAL::Entity &entity, std::chrono::nanoseconds)
|
||||
{
|
||||
auto &model = entity.getComponent<Drawable3DComponent>();
|
||||
auto &anim = entity.getComponent<AnimationsComponent>();
|
||||
|
||||
if (anim.isDisabled())
|
||||
return;
|
||||
auto modelPtr = std::dynamic_pointer_cast<RAY::Drawables::Drawables3D::Model>(model.drawable);
|
||||
if (modelPtr) {
|
||||
modelPtr->setAnimation(anim.getCurrentModelAnim());
|
||||
anim.incCurrentAnimFrameCounter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Created by cbihan on 01/06/2021.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <System/System.hpp>
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "Component/Animation/AnimationsComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
class AnimationsSystem : public WAL::System<Drawable3DComponent, AnimationsComponent>
|
||||
{
|
||||
public:
|
||||
//! @inherit
|
||||
void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds) override;
|
||||
|
||||
//! @brief A default constructor
|
||||
explicit AnimationsSystem(WAL::Wal &wal);
|
||||
//! @brief A Controllable system is copy constructable
|
||||
AnimationsSystem(const AnimationsSystem &) = default;
|
||||
//! @brief A default destructor
|
||||
~AnimationsSystem() override = default;
|
||||
//! @brief A system is not assignable.
|
||||
AnimationsSystem &operator=(const AnimationsSystem &) = delete;
|
||||
};
|
||||
}
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <algorithm>
|
||||
#include "Wal.hpp"
|
||||
#include "System/System.hpp"
|
||||
#include "Models/Vector3.hpp"
|
||||
#include "Component/Collision/CollisionComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
float ControllableSystem::speed = .25f;
|
||||
|
||||
ControllableSystem::ControllableSystem(WAL::Wal &wal)
|
||||
: System(wal)
|
||||
{}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace BBM
|
||||
{
|
||||
public:
|
||||
//! @brief The speed applied to every controllable entities.
|
||||
static float speed;
|
||||
static constexpr const float speed = .25f;
|
||||
|
||||
//! @inherit
|
||||
void onFixedUpdate(WAL::Entity &entity) override;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Component/Movable/MovableComponent.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
#include "System/System.hpp"
|
||||
#include "Entity/Entity.hpp"
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// Created by Zoe Roux on 5/27/21.
|
||||
//
|
||||
|
||||
#include "Render2DScreenSystem.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
Render2DScreenSystem::Render2DScreenSystem(RAY::Window &window)
|
||||
: WAL::System({}),
|
||||
_window(window),
|
||||
_camera(RAY::Vector2(10, 10), RAY::Vector2(), 0)
|
||||
{}
|
||||
|
||||
void Render2DScreenSystem::onSelfUpdate()
|
||||
{
|
||||
this->_window.useCamera(this->_camera);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// Created by Zoe Roux on 5/27/21.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <System/System.hpp>
|
||||
#include <Window.hpp>
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
class Render2DScreenSystem : public WAL::System
|
||||
{
|
||||
//! @brief The window to render on
|
||||
RAY::Window &_window;
|
||||
|
||||
//! @brief The camera used to render.
|
||||
RAY::Camera::Camera2D _camera;
|
||||
public:
|
||||
//! @brief A method called after all entities that this system manage has been updated.
|
||||
//! @note render on screen here
|
||||
void onSelfUpdate() override;
|
||||
|
||||
//! @brief ctor
|
||||
explicit Render2DScreenSystem(RAY::Window &window);
|
||||
//! @brief Default copy ctor
|
||||
Render2DScreenSystem(const Render2DScreenSystem &) = default;
|
||||
//! @brief Default dtor
|
||||
~Render2DScreenSystem() override = default;
|
||||
//! @brief A render screen system can't be assigned.
|
||||
Render2DScreenSystem &operator=(const Render2DScreenSystem &) = delete;
|
||||
};
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
//
|
||||
// Created by Zoe Roux on 5/27/21.
|
||||
//
|
||||
|
||||
#include "RenderScreenSystem.hpp"
|
||||
#include "Component/Renderer/CameraComponent.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
RenderScreenSystem::RenderScreenSystem(RAY::Window &window)
|
||||
: WAL::System({
|
||||
typeid(CameraComponent),
|
||||
typeid(PositionComponent)
|
||||
}),
|
||||
_window(window),
|
||||
_camera(Vector3f(), Vector3f(), Vector3f(0, 1, 0), 50, CAMERA_PERSPECTIVE)
|
||||
{
|
||||
this->_window.setFPS(60);
|
||||
}
|
||||
|
||||
void RenderScreenSystem::onSelfUpdate()
|
||||
{
|
||||
this->_window.draw();
|
||||
this->_window.clear();
|
||||
this->_window.useCamera(this->_camera);
|
||||
}
|
||||
|
||||
void RenderScreenSystem::onUpdate(WAL::Entity &entity, std::chrono::nanoseconds dtime)
|
||||
{
|
||||
const auto &pos = entity.getComponent<PositionComponent>();
|
||||
const auto &cam = entity.getComponent<CameraComponent>();
|
||||
_camera.setPosition(pos.position);
|
||||
_camera.setTarget(cam.target);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// Created by Zoe Roux on 5/27/21.
|
||||
//
|
||||
|
||||
#include <Component/Renderer/Drawable3DComponent.hpp>
|
||||
#include "Models/Vector2.hpp"
|
||||
#include "RenderSystem.hpp"
|
||||
#include "Component/Renderer/CameraComponent.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include "Drawables/ADrawable2D.hpp"
|
||||
#include "Drawables/ADrawable3D.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
RenderSystem::RenderSystem(WAL::Wal &wal, RAY::Window &window)
|
||||
: System(wal),
|
||||
_window(window),
|
||||
_camera(Vector3f(), Vector3f(), Vector3f(0, 1, 0), 50, CAMERA_PERSPECTIVE)
|
||||
{}
|
||||
|
||||
void RenderSystem::onSelfUpdate()
|
||||
{
|
||||
this->_camera.update();
|
||||
this->_window.beginDrawing();
|
||||
this->_window.clear();
|
||||
|
||||
this->_window.useCamera(this->_camera);
|
||||
for (auto &entity : this->_wal.scene->getEntities()) {
|
||||
if (!entity.hasComponent<Drawable3DComponent>()
|
||||
|| !entity.hasComponent<PositionComponent>())
|
||||
continue;
|
||||
auto &drawable = entity.getComponent<Drawable3DComponent>();
|
||||
auto &pos = entity.getComponent<PositionComponent>();
|
||||
|
||||
drawable.drawable->setPosition(pos.position);
|
||||
drawable.drawable->drawOn(this->_window);
|
||||
}
|
||||
this->_window.unuseCamera();
|
||||
|
||||
// TODO sort entities based on the Z axis
|
||||
for (auto &entity : this->_wal.scene->getEntities()) {
|
||||
if (!entity.hasComponent<Drawable2DComponent>()
|
||||
|| !entity.hasComponent<PositionComponent>())
|
||||
continue;
|
||||
auto &drawable = entity.getComponent<Drawable2DComponent>();
|
||||
auto &pos = entity.getComponent<PositionComponent>();
|
||||
|
||||
drawable.drawable->setPosition(Vector2f(pos.position.x, pos.position.y));
|
||||
drawable.drawable->drawOn(this->_window);
|
||||
}
|
||||
this->_window.endDrawing();
|
||||
}
|
||||
|
||||
void RenderSystem::onUpdate(WAL::Entity &entity, std::chrono::nanoseconds dtime)
|
||||
{
|
||||
const auto &pos = entity.getComponent<PositionComponent>();
|
||||
const auto &cam = entity.getComponent<CameraComponent>();
|
||||
_camera.setPosition(pos.position);
|
||||
_camera.setTarget(cam.target);
|
||||
}
|
||||
}
|
||||
+9
-5
@@ -4,14 +4,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Component/Renderer/CameraComponent.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
#include "System/System.hpp"
|
||||
#include "Camera/Camera2D.hpp"
|
||||
#include "Window.hpp"
|
||||
#include "Wal.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
class RenderScreenSystem : public WAL::System
|
||||
class RenderSystem : public WAL::System<CameraComponent, PositionComponent>
|
||||
{
|
||||
|
||||
//! @brief The window to render on
|
||||
RAY::Window &_window;
|
||||
|
||||
@@ -26,12 +30,12 @@ namespace BBM
|
||||
void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds dtime) override;
|
||||
|
||||
//! @brief ctor
|
||||
explicit RenderScreenSystem(RAY::Window &window);
|
||||
RenderSystem(WAL::Wal &wal, RAY::Window &window);
|
||||
//! @brief Default copy ctor
|
||||
RenderScreenSystem(const RenderScreenSystem &) = default;
|
||||
RenderSystem(const RenderSystem &) = default;
|
||||
//! @brief Default dtor
|
||||
~RenderScreenSystem() override = default;
|
||||
~RenderSystem() override = default;
|
||||
//! @brief A render screen system can't be assigned.
|
||||
RenderScreenSystem &operator=(const RenderScreenSystem &) = delete;
|
||||
RenderSystem &operator=(const RenderSystem &) = delete;
|
||||
};
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// Created by cbihan on 24/05/2021.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include "System/System.hpp"
|
||||
#include "Entity/Entity.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include "Window.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
template <class T>
|
||||
class Renderer2DSystem : public WAL::System
|
||||
{
|
||||
private:
|
||||
//! @brief The class to render
|
||||
RAY::Window &_window;
|
||||
public:
|
||||
explicit Renderer2DSystem()
|
||||
: WAL::System({typeid(PositionComponent), typeid(Drawable2DComponent<T>)}),
|
||||
_window(RAY::Window::getInstance())
|
||||
{
|
||||
}
|
||||
|
||||
//! @brief Update the corresponding component of the given entity
|
||||
//! @param entity The entity to update.
|
||||
//! @param dtime The delta time.
|
||||
void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds) override
|
||||
{
|
||||
auto &comp = entity.getComponent<Drawable2DComponent<T>>();
|
||||
auto &pos = entity.getComponent<PositionComponent>();
|
||||
|
||||
comp.member.setPosition({pos.getX(), pos.getY()});
|
||||
comp.member.drawOn(this->_window);
|
||||
}
|
||||
|
||||
//! @brief default copy ctor
|
||||
Renderer2DSystem(const Renderer2DSystem &) = default;
|
||||
//! @brief default dtor
|
||||
~Renderer2DSystem() override = default;
|
||||
//! @brief Default assignment operator
|
||||
Renderer2DSystem &operator=(const Renderer2DSystem &) = delete;
|
||||
};
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// Created by cbihan on 24/05/2021.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include "System/System.hpp"
|
||||
#include "Entity/Entity.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "Window.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
template <class T>
|
||||
class Renderer3DSystem : public WAL::System
|
||||
{
|
||||
private:
|
||||
//! @brief The class to render
|
||||
RAY::Window &_window;
|
||||
public:
|
||||
//! @brief ctor
|
||||
explicit Renderer3DSystem()
|
||||
: WAL::System({typeid(PositionComponent), typeid(Drawable3DComponent<T>)}),
|
||||
_window(RAY::Window::getInstance())
|
||||
{}
|
||||
|
||||
//! @brief Update the corresponding component of the given entity
|
||||
//! @param entity The entity to update.
|
||||
//! @param dtime The delta time.
|
||||
void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds) override
|
||||
{
|
||||
auto &comp = entity.getComponent<Drawable3DComponent<T>>();
|
||||
auto &pos = entity.getComponent<PositionComponent>();
|
||||
|
||||
comp.member.setPosition(static_cast<RAY::Vector3>(pos.position));
|
||||
comp.member.drawOn(this->_window);
|
||||
}
|
||||
|
||||
//! @brief Default copy ctor
|
||||
Renderer3DSystem(const Renderer3DSystem &) = default;
|
||||
//! @brief Default dtor
|
||||
~Renderer3DSystem() override = default;
|
||||
//! @brief Default assignment operator
|
||||
Renderer3DSystem &operator=(const Renderer3DSystem &) = delete;
|
||||
};
|
||||
}
|
||||
@@ -9,50 +9,6 @@
|
||||
#include <iostream>
|
||||
#include "Runner/Runner.hpp"
|
||||
|
||||
// Dependencies of the demo
|
||||
#include "Camera/Camera3D.hpp"
|
||||
#include "Controllers/Keyboard.hpp"
|
||||
#include "Drawables/2D/Text.hpp"
|
||||
#include "Drawables/Image.hpp"
|
||||
#include "Drawables/3D/Grid.hpp"
|
||||
#include "Drawables/Texture.hpp"
|
||||
#include "Drawables/3D/Circle.hpp"
|
||||
#include "Drawables/2D/Circle.hpp"
|
||||
#include "Drawables/3D/Cube.hpp"
|
||||
#include "Drawables/3D/Sphere.hpp"
|
||||
#include "Model/Model.hpp"
|
||||
#include "Model/ModelAnimations.hpp"
|
||||
#include <System/Renderer/RenderScreenSystem.hpp>
|
||||
#include <System/Renderer/Render2DScreenSystem.hpp>
|
||||
#include <System/Renderer/Renderer2DSystem.hpp>
|
||||
#include <System/Renderer/Renderer3DSystem.hpp>
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include "System/Renderer/RenderScreenSystem.hpp"
|
||||
#include "Vector/Vector3.hpp"
|
||||
#include "Window.hpp"
|
||||
#include "TraceLog.hpp"
|
||||
#include "Wal.hpp"
|
||||
|
||||
const std::vector<std::string>textures = {
|
||||
"blue", "cyan", "green", "purple", "red", "yellow"
|
||||
};
|
||||
|
||||
std::string get_full_path(const std::string &color)
|
||||
{
|
||||
std::string path = "assets/player/";
|
||||
|
||||
path += color;
|
||||
path += ".png";
|
||||
return path;
|
||||
}
|
||||
|
||||
int demo(void)
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void usage(const std::string &bin)
|
||||
{
|
||||
std::cout << "Bomberman." << std::endl
|
||||
@@ -67,6 +23,5 @@ int main(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
//return demo();
|
||||
return BBM::run();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Emscripten-Generated Code</title>
|
||||
<style>
|
||||
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
|
||||
textarea.emscripten { font-family: monospace; width: 80%; }
|
||||
div.emscripten { text-align: center; }
|
||||
div.emscripten_border { border: 1px solid black; }
|
||||
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||
canvas.emscripten { border: 0px none; background-color: black; }
|
||||
|
||||
.spinner {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin: 0px auto;
|
||||
-webkit-animation: rotation .8s linear infinite;
|
||||
-moz-animation: rotation .8s linear infinite;
|
||||
-o-animation: rotation .8s linear infinite;
|
||||
animation: rotation 0.8s linear infinite;
|
||||
border-left: 10px solid rgb(0,150,240);
|
||||
border-right: 10px solid rgb(0,150,240);
|
||||
border-bottom: 10px solid rgb(0,150,240);
|
||||
border-top: 10px solid rgb(100,0,200);
|
||||
border-radius: 100%;
|
||||
background-color: rgb(200,100,250);
|
||||
}
|
||||
@-webkit-keyframes rotation {
|
||||
from {-webkit-transform: rotate(0deg);}
|
||||
to {-webkit-transform: rotate(360deg);}
|
||||
}
|
||||
@-moz-keyframes rotation {
|
||||
from {-moz-transform: rotate(0deg);}
|
||||
to {-moz-transform: rotate(360deg);}
|
||||
}
|
||||
@-o-keyframes rotation {
|
||||
from {-o-transform: rotate(0deg);}
|
||||
to {-o-transform: rotate(360deg);}
|
||||
}
|
||||
@keyframes rotation {
|
||||
from {transform: rotate(0deg);}
|
||||
to {transform: rotate(360deg);}
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<hr/>
|
||||
<figure style="overflow:visible;" id="spinner"><div class="spinner"></div><center style="margin-top:0.5em"><strong>emscripten</strong></center></figure>
|
||||
<div class="emscripten" id="status">Downloading...</div>
|
||||
<div class="emscripten">
|
||||
<progress value="0" max="100" id="progress" hidden=1></progress>
|
||||
</div>
|
||||
<div class="emscripten">
|
||||
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="emscripten">
|
||||
<input type="checkbox" id="resize">Resize canvas
|
||||
<input type="checkbox" id="pointerLock" checked>Lock/hide mouse pointer
|
||||
|
||||
<input type="button" value="Fullscreen" onclick="Module.requestFullscreen(document.getElementById('pointerLock').checked,
|
||||
document.getElementById('resize').checked)">
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<script type='text/javascript'>
|
||||
var statusElement = document.getElementById('status');
|
||||
var progressElement = document.getElementById('progress');
|
||||
var spinnerElement = document.getElementById('spinner');
|
||||
|
||||
var Module = {
|
||||
preRun: [],
|
||||
postRun: [],
|
||||
print: (function() {
|
||||
var element = document.getElementById('output');
|
||||
if (element) element.value = ''; // clear browser cache
|
||||
return function(text) {
|
||||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||
// These replacements are necessary if you render to raw HTML
|
||||
//text = text.replace(/&/g, "&");
|
||||
//text = text.replace(/</g, "<");
|
||||
//text = text.replace(/>/g, ">");
|
||||
//text = text.replace('\n', '<br>', 'g');
|
||||
console.log(text);
|
||||
if (element) {
|
||||
element.value += text + "\n";
|
||||
element.scrollTop = element.scrollHeight; // focus on bottom
|
||||
}
|
||||
};
|
||||
})(),
|
||||
printErr: function(text) {
|
||||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||
console.error(text);
|
||||
},
|
||||
canvas: (function() {
|
||||
var canvas = document.getElementById('canvas');
|
||||
|
||||
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
|
||||
// application robust, you may want to override this behavior before shipping!
|
||||
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
|
||||
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
|
||||
|
||||
return canvas;
|
||||
})(),
|
||||
setStatus: function(text) {
|
||||
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
|
||||
if (text === Module.setStatus.last.text) return;
|
||||
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
|
||||
var now = Date.now();
|
||||
if (m && now - Module.setStatus.last.time < 30) return; // if this is a progress update, skip it if too soon
|
||||
Module.setStatus.last.time = now;
|
||||
Module.setStatus.last.text = text;
|
||||
if (m) {
|
||||
text = m[1];
|
||||
progressElement.value = parseInt(m[2])*100;
|
||||
progressElement.max = parseInt(m[4])*100;
|
||||
progressElement.hidden = false;
|
||||
spinnerElement.hidden = false;
|
||||
} else {
|
||||
progressElement.value = null;
|
||||
progressElement.max = null;
|
||||
progressElement.hidden = true;
|
||||
if (!text) spinnerElement.hidden = true;
|
||||
}
|
||||
statusElement.innerHTML = text;
|
||||
},
|
||||
totalDependencies: 0,
|
||||
monitorRunDependencies: function(left) {
|
||||
this.totalDependencies = Math.max(this.totalDependencies, left);
|
||||
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
|
||||
}
|
||||
};
|
||||
Module.setStatus('Downloading...');
|
||||
window.onerror = function() {
|
||||
Module.setStatus('Exception thrown, see JavaScript console');
|
||||
spinnerElement.style.display = 'none';
|
||||
Module.setStatus = function(text) {
|
||||
if (text) Module.printErr('[post-exception status] ' + text);
|
||||
};
|
||||
};
|
||||
</script>
|
||||
{{{ SCRIPT }}}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user