mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-02 02:05:25 +00:00
still some issues with drawable3D component
This commit is contained in:
@@ -19,7 +19,7 @@ namespace BBM
|
||||
T &_camera;
|
||||
public:
|
||||
//! @brief ctor
|
||||
explicit RenderScreenSystem(RAY::Window &window, T camera)
|
||||
explicit RenderScreenSystem(RAY::Window &window, T &camera)
|
||||
: WAL::System({typeid(RenderScreenSystem)}),
|
||||
_window(window),
|
||||
_camera(camera)
|
||||
@@ -39,11 +39,11 @@ namespace BBM
|
||||
}
|
||||
|
||||
//! @brief Default copy ctor
|
||||
RenderScreenSystem(const RenderScreenSystem &) = delete;
|
||||
RenderScreenSystem(const RenderScreenSystem &) = default;
|
||||
//! @brief Default dtor
|
||||
~RenderScreenSystem() override = default;
|
||||
//! @brief Default assignment operator
|
||||
RenderScreenSystem &operator=(const RenderScreenSystem &) = delete;
|
||||
RenderScreenSystem &operator=(const RenderScreenSystem &) = default;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@ namespace BBM
|
||||
//! @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 dtime) override
|
||||
void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds) override
|
||||
{
|
||||
std::cout << "Drawing: " << typeid(T).name() << std::endl;
|
||||
auto &comp = entity.getComponent<Drawable3DComponent<T>>();
|
||||
auto &pos = entity.getComponent<PositionComponent>();
|
||||
|
||||
|
||||
+4
-13
@@ -45,15 +45,11 @@ int demo()
|
||||
WAL::Wal wal;
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
auto iterator = textures.begin();
|
||||
const std::string modelPath = "assets/player/player.obj";
|
||||
const std::string texturePath = "assets/player/blue.png";
|
||||
//const std::string animationPath = "assets/guy.iqm";
|
||||
|
||||
RAY::TraceLog::setLevel(LOG_WARNING);
|
||||
RAY::Window &window = RAY::Window::getInstance(screenWidth, screenHeight, "Bidibidibop", FLAG_WINDOW_RESIZABLE);
|
||||
RAY::Image icon("assets/icon.png");
|
||||
window.setIcon(icon);
|
||||
RAY::Model model(modelPath);
|
||||
RAY::Camera::Camera3D camera(RAY::Vector3(10.0f, 10.0f, 10.0f),
|
||||
RAY::Vector3(0.0f, 0.0f, 0.0f),
|
||||
RAY::Vector3(0.0f, 1.0f, 0.0f),
|
||||
@@ -62,21 +58,16 @@ int demo()
|
||||
WAL::Entity entityPlayer("roger");
|
||||
RAY::Drawables::Drawables3D::Circle circle({30, 30, 30}, 50, 0XFFFFFFF, {0, 0, 0}, 0);
|
||||
BBM::Drawable3DComponent<RAY::Drawables::Drawables3D::Circle> circleComponent(entityPlayer, circle);
|
||||
BBM::PositionComponent posComponent(entityPlayer, {20, 20, 20});
|
||||
|
||||
BBM::Renderer3DSystem<RAY::Drawables::Drawables3D::Circle> circleSystem(window);
|
||||
|
||||
BBM::RenderScreenSystem<RAY::Camera::Camera3D> renderSystem(window, camera);
|
||||
|
||||
wal.addSystem(circleSystem);
|
||||
wal.addSystem(renderSystem);
|
||||
entityPlayer.addComponent(circleComponent);
|
||||
|
||||
RAY::Texture texture(get_full_path(*iterator));
|
||||
//RAY::ModelAnimations animations(modelPath);
|
||||
RAY::Drawables::Drawables3D::Grid grid(10, 1.0f);
|
||||
RAY::Drawables::Drawables2D::Text instructionText("PRESS SPACE to PLAY MODEL ANIMATION", 10, {10, 20} , MAROON);
|
||||
model.setTextureToMaterial(MAP_DIFFUSE, texture);
|
||||
|
||||
RAY::Vector3 position(0.0f, 0.0f, 0.0f); // Set model position
|
||||
entityPlayer.addComponent(posComponent);
|
||||
|
||||
camera.setMode(CAMERA_FREE); // Set free camera mode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user