Skip to content

Commit

Permalink
Fixes for latest Nazara version (and C++20)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirLynix committed Dec 26, 2023
1 parent 2938938 commit df4b592
Show file tree
Hide file tree
Showing 76 changed files with 434 additions and 354 deletions.
4 changes: 2 additions & 2 deletions include/ClientLib/Camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

#include <ClientLib/Export.hpp>
#include <Nazara/Core/HandledObject.hpp>
#include <Nazara/Graphics/RenderTarget.hpp>
#include <Nazara/Math/Rect.hpp>
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Math/Vector3.hpp>
#include <Nazara/Renderer/RenderTarget.hpp>
#include <CoreLib/EntityOwner.hpp>

namespace Nz
Expand All @@ -29,7 +29,7 @@ namespace bw
class BURGWAR_CLIENTLIB_API Camera : public Nz::HandledObject<Camera>
{
public:
Camera(Nz::EnttWorld& world, Nz::RenderTarget* renderTarget, bool perspective);
Camera(Nz::EnttWorld& world, std::shared_ptr<const Nz::RenderTarget> renderTarget, bool perspective);
Camera(const Camera&) = delete;
Camera(Camera&&) = delete;
~Camera() = default;
Expand Down
4 changes: 2 additions & 2 deletions include/ClientLib/Chatbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <ClientLib/Export.hpp>
#include <NazaraUtils/Signal.hpp>
#include <Nazara/Renderer/RenderTarget.hpp>
#include <Nazara/Graphics/RenderTarget.hpp>
#include <Nazara/Widgets/Canvas.hpp>
#include <CoreLib/EntityOwner.hpp>
#include <Nazara/Widgets/RichTextAreaWidget.hpp>
Expand All @@ -36,7 +36,7 @@ namespace bw

using Item = std::variant<ColorItem, TextItem>;

Chatbox(const Logger& logger, Nz::RenderTarget* rt, Nz::Canvas* canvas);
Chatbox(const Logger& logger, const Nz::RenderTarget& renderTarget, Nz::Canvas* canvas);
Chatbox(const Chatbox&) = delete;
Chatbox(Chatbox&&) = delete;
~Chatbox();
Expand Down
2 changes: 1 addition & 1 deletion include/ClientLib/ClientConsole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace bw
class BURGWAR_CLIENTLIB_API ClientConsole : public Console
{
public:
ClientConsole(const Logger& logger, Nz::RenderTarget* window, Nz::Canvas* canvas, std::shared_ptr<AbstractScriptingLibrary> scriptingLibrary, const std::shared_ptr<Nz::VirtualDirectory>& scriptDir);
ClientConsole(const Logger& logger, const Nz::RenderTarget& renderTarget, Nz::Canvas* canvas, std::shared_ptr<AbstractScriptingLibrary> scriptingLibrary, const std::shared_ptr<Nz::VirtualDirectory>& scriptDir);
ClientConsole(const ClientConsole&) = delete;
ClientConsole(ClientConsole&&) = delete;
~ClientConsole() = default;
Expand Down
4 changes: 2 additions & 2 deletions include/ClientLib/ClientMatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace bw
friend ClientSession;

public:
ClientMatch(ClientEditorAppComponent& burgApp, Nz::Window* window, Nz::RenderTarget* renderTarget, Nz::Canvas* canvas, Nz::EnttWorld& renderWorld, ClientSession& session, const Packets::AuthSuccess& authSuccess, const Packets::MatchData& matchData);
ClientMatch(ClientEditorAppComponent& burgApp, Nz::Window* window, std::shared_ptr<const Nz::RenderTarget> renderTarget, Nz::Canvas* canvas, Nz::EnttWorld& renderWorld, ClientSession& session, const Packets::AuthSuccess& authSuccess, const Packets::MatchData& matchData);
ClientMatch(const ClientMatch&) = delete;
ClientMatch(ClientMatch&&) = delete;
~ClientMatch();
Expand Down Expand Up @@ -268,6 +268,7 @@ namespace bw

typename Nz::Signal<const std::string&>::ConnectionGuard m_nicknameUpdateSlot;

std::shared_ptr<const Nz::RenderTarget> m_renderTarget;
std::optional<ClientAssetStore> m_assetStore;
std::optional<ClientEntityStore> m_entityStore;
std::optional<ClientWeaponStore> m_weaponStore;
Expand All @@ -289,7 +290,6 @@ namespace bw
entt::handle m_currentLayer;
EntityId m_freeClientId;
Nz::EnttWorld& m_renderWorld;
Nz::RenderTarget* m_renderTarget;
Nz::Window* m_window;
Nz::UInt16 m_activeLayerIndex;
tsl::hopscotch_map<EntityId, ClientLayerEntityHandle> m_entitiesByUniqueId;
Expand Down
4 changes: 2 additions & 2 deletions include/ClientLib/Console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <ClientLib/Export.hpp>
#include <NazaraUtils/Signal.hpp>
#include <Nazara/Renderer/RenderTarget.hpp>
#include <Nazara/Graphics/RenderTarget.hpp>
#include <Nazara/Widgets/Canvas.hpp>
#include <functional>
#include <memory>
Expand All @@ -21,7 +21,7 @@ namespace bw
public:
using ExecuteCallback = std::function<bool(const std::string& command)>;

Console(Nz::RenderTarget* window, Nz::Canvas* canvas);
Console(const Nz::RenderTarget& window, Nz::Canvas* canvas);
Console(const Console&) = delete;
Console(Console&&) = delete;
~Console();
Expand Down
1 change: 0 additions & 1 deletion include/ClientLib/EscapeMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <ClientLib/Export.hpp>
#include <NazaraUtils/Signal.hpp>
#include <Nazara/Renderer/RenderTarget.hpp>
#include <CoreLib/EntityOwner.hpp>
#include <Nazara/Widgets/ButtonWidget.hpp>
#include <Nazara/Widgets/Canvas.hpp>
Expand Down
12 changes: 6 additions & 6 deletions include/ClientLib/LayerVisualEntity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace bw
LayerVisualEntity(LayerVisualEntity&& entity) noexcept;
virtual ~LayerVisualEntity();

void AttachHoveringRenderable(std::shared_ptr<Nz::InstancedRenderable> renderable, const Nz::Matrix4f& offsetMatrix, int renderOrder, float hoveringHeight);
void AttachRenderable(std::shared_ptr<Nz::InstancedRenderable> renderable, const Nz::Matrix4f& offsetMatrix, int renderOrder);
void AttachHoveringRenderable(std::shared_ptr<Nz::InstancedRenderable> renderable, const Nz::Vector3f& offset, const Nz::Quaternionf& rotation, float hoveringHeight);
void AttachRenderable(std::shared_ptr<Nz::InstancedRenderable> renderable, const Nz::Vector3f& offset, const Nz::Quaternionf& rotation);
void DetachHoveringRenderable(const std::shared_ptr<Nz::InstancedRenderable>& renderable);
void DetachRenderable(const std::shared_ptr<Nz::InstancedRenderable>& renderable);

Expand All @@ -59,8 +59,8 @@ namespace bw
void SyncVisuals();

void UpdateHoveringRenderableHoveringHeight(const std::shared_ptr<Nz::InstancedRenderable>& renderable, float newHoveringHeight);
void UpdateHoveringRenderableMatrix(const std::shared_ptr<Nz::InstancedRenderable>& renderable, const Nz::Matrix4f& offsetMatrix);
void UpdateRenderableMatrix(const std::shared_ptr<Nz::InstancedRenderable>& renderable, const Nz::Matrix4f& offsetMatrix);
void UpdateHoveringRenderableTransform(const std::shared_ptr<Nz::InstancedRenderable>& renderable, const Nz::Vector3f& offset, const Nz::Quaternionf& rotation);
void UpdateRenderableTransform(const std::shared_ptr<Nz::InstancedRenderable>& renderable, const Nz::Vector3f& offset, const Nz::Quaternionf& rotation);
void UpdateScale(float newScale);
void UpdateState(const Nz::Vector2f& position, const Nz::RadianAnglef& rotation);
void UpdateState(const Nz::Vector2f& position, const Nz::RadianAnglef& rotation, const Nz::Vector2f& linearVel, const Nz::RadianAnglef& angularVel);
Expand All @@ -76,8 +76,8 @@ namespace bw
struct RenderableData
{
std::shared_ptr<Nz::InstancedRenderable> renderable;
Nz::Matrix4f offsetMatrix;
int renderOrder;
Nz::Quaternionf rotation;
Nz::Vector3f offset;
};

struct HoveringRenderableData
Expand Down
2 changes: 1 addition & 1 deletion include/ClientLib/LayerVisualEntity.inl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace bw
void LayerVisualEntity::ForEachRenderable(Func&& func) const
{
for (const auto& renderableData : m_attachedRenderables)
func(std::as_const(renderableData.renderable), std::as_const(renderableData.offsetMatrix), std::as_const(renderableData.renderOrder));
func(std::as_const(renderableData.renderable), std::as_const(renderableData.offset), std::as_const(renderableData.rotation));
}

inline entt::handle LayerVisualEntity::GetEntity() const
Expand Down
12 changes: 6 additions & 6 deletions include/ClientLib/Scripting/Sprite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace bw
class BURGWAR_CLIENTLIB_API Sprite
{
public:
inline Sprite(LayerVisualEntityHandle visualEntity, std::shared_ptr<Nz::Sprite> sprite, const Nz::Matrix4f& transformMatrix, int renderOrder);
inline Sprite(LayerVisualEntityHandle visualEntity, std::shared_ptr<Nz::Sprite> sprite, const Nz::Vector2f& offset, const Nz::DegreeAnglef& rotation);
Sprite(const Sprite&) = delete;
Sprite(Sprite&&) noexcept = default;
~Sprite() = default;
Expand All @@ -32,8 +32,8 @@ namespace bw
inline bool IsValid() const;
inline bool IsVisible() const;

void SetColor(Nz::Color color);
void SetCornerColor(const std::string_view& corner, Nz::Color cornerColor);
void SetColor(const Nz::Color& color);
void SetCornerColor(const std::string_view& corner, const Nz::Color& cornerColor);
void SetCornerColors(const sol::table& cornerTable);
inline void SetOffset(const Nz::Vector2f& newOffset);
inline void SetRotation(const Nz::DegreeAnglef& newRotation);
Expand All @@ -44,12 +44,12 @@ namespace bw
Sprite& operator=(Sprite&&) noexcept = default;

private:
void UpdateTransformMatrix();
void UpdateTransform();

LayerVisualEntityHandle m_visualEntity;
Nz::Matrix4f m_transformMatrix;
Nz::DegreeAnglef m_rotation;
Nz::Vector2f m_offset;
std::shared_ptr<Nz::Sprite> m_sprite;
int m_renderOrder;
bool m_isVisible;
};
}
Expand Down
14 changes: 7 additions & 7 deletions include/ClientLib/Scripting/Sprite.inl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace bw
{
inline Sprite::Sprite(LayerVisualEntityHandle visualEntity, std::shared_ptr<Nz::Sprite> sprite, const Nz::Matrix4f& transformMatrix, int renderOrder) :
inline Sprite::Sprite(LayerVisualEntityHandle visualEntity, std::shared_ptr<Nz::Sprite> sprite, const Nz::Vector2f& offset, const Nz::DegreeAnglef& rotation) :
m_visualEntity(std::move(visualEntity)),
m_transformMatrix(transformMatrix),
m_rotation(rotation),
m_offset(offset),
m_sprite(std::move(sprite)),
m_renderOrder(renderOrder),
m_isVisible(false)
{
}
Expand Down Expand Up @@ -42,16 +42,16 @@ namespace bw

inline void Sprite::SetOffset(const Nz::Vector2f& newOffset)
{
m_transformMatrix.SetTranslation(newOffset);
m_offset = newOffset;

UpdateTransformMatrix();
UpdateTransform();
}

inline void Sprite::SetRotation(const Nz::DegreeAnglef& newRotation)
{
m_transformMatrix.SetRotation(newRotation);
m_rotation = newRotation;

UpdateTransformMatrix();
UpdateTransform();
}

inline void Sprite::SetSize(const Nz::Vector2f& newSize)
Expand Down
8 changes: 4 additions & 4 deletions include/ClientLib/Scripting/Text.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace bw
class Text
{
public:
inline Text(LayerVisualEntityHandle visualEntity, Nz::SimpleTextDrawer drawer, std::shared_ptr<Nz::TextSprite> textSprite, const Nz::Matrix4f& transformMatrix, int renderOrder, bool isHovering);
inline Text(LayerVisualEntityHandle visualEntity, Nz::SimpleTextDrawer drawer, std::shared_ptr<Nz::TextSprite> textSprite, const Nz::Vector2f& offset, const Nz::DegreeAnglef& rotation, bool isHovering);
Text(const Text&) = delete;
Text(Text&&) = default;
~Text() = default;
Expand All @@ -45,16 +45,16 @@ namespace bw

private:
void UpdateTextSprite();
void UpdateTransformMatrix();
void UpdateTransform();

LayerVisualEntityHandle m_visualEntity;
Nz::Matrix4f m_transformMatrix;
Nz::DegreeAnglef m_rotation;
Nz::Vector2f m_offset;
Nz::SimpleTextDrawer m_drawer;
std::shared_ptr<Nz::TextSprite> m_textSprite;
bool m_isHovering;
bool m_isVisible;
float m_hoveringHeight;
int m_renderOrder;
};
}

Expand Down
16 changes: 8 additions & 8 deletions include/ClientLib/Scripting/Text.inl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

namespace bw
{
inline Text::Text(LayerVisualEntityHandle visualEntity, Nz::SimpleTextDrawer drawer, std::shared_ptr<Nz::TextSprite> textSprite, const Nz::Matrix4f& transformMatrix, int renderOrder, bool isHovering) :
inline Text::Text(LayerVisualEntityHandle visualEntity, Nz::SimpleTextDrawer drawer, std::shared_ptr<Nz::TextSprite> textSprite, const Nz::Vector2f& offset, const Nz::DegreeAnglef& rotation, bool isHovering) :
m_visualEntity(std::move(visualEntity)),
m_transformMatrix(transformMatrix),
m_rotation(rotation),
m_offset(offset),
m_drawer(std::move(drawer)),
m_textSprite(std::move(textSprite)),
m_isHovering(isHovering),
m_isVisible(false),
m_hoveringHeight(0.f),
m_renderOrder(renderOrder)
m_hoveringHeight(0.f)
{
}

Expand Down Expand Up @@ -46,16 +46,16 @@ namespace bw

inline void Text::SetOffset(const Nz::Vector2f& newOffset)
{
m_transformMatrix.SetTranslation(newOffset);
m_offset = newOffset;

UpdateTransformMatrix();
UpdateTransform();
}

inline void Text::SetRotation(const Nz::DegreeAnglef& newRotation)
{
m_transformMatrix.SetRotation(newRotation);
m_rotation = newRotation;

UpdateTransformMatrix();
UpdateTransform();
}

inline void Text::SetText(const std::string& text)
Expand Down
8 changes: 4 additions & 4 deletions include/ClientLib/Scripting/Tilemap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace bw
class BURGWAR_CLIENTLIB_API Tilemap
{
public:
inline Tilemap(LayerVisualEntityHandle visualEntity, std::shared_ptr<Nz::Tilemap> tilemap, const Nz::Matrix4f& transformMatrix, int renderOrder);
inline Tilemap(LayerVisualEntityHandle visualEntity, std::shared_ptr<Nz::Tilemap> tilemap, const Nz::Vector2f& offset, const Nz::DegreeAnglef& rotation);
Tilemap(const Tilemap&) = delete;
Tilemap(Tilemap&&) noexcept = default;
~Tilemap() = default;
Expand All @@ -43,12 +43,12 @@ namespace bw
Tilemap& operator=(Tilemap&&) noexcept = default;

private:
void UpdateTransformMatrix();
void UpdateTransform();

LayerVisualEntityHandle m_visualEntity;
Nz::Matrix4f m_transformMatrix;
Nz::DegreeAnglef m_rotation;
Nz::Vector2f m_offset;
std::shared_ptr<Nz::Tilemap> m_tilemap;
int m_renderOrder;
bool m_isVisible;
};
}
Expand Down
14 changes: 7 additions & 7 deletions include/ClientLib/Scripting/Tilemap.inl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace bw
{
inline Tilemap::Tilemap(LayerVisualEntityHandle visualEntity, std::shared_ptr<Nz::Tilemap> tilemap, const Nz::Matrix4f& transformMatrix, int renderOrder) :
inline Tilemap::Tilemap(LayerVisualEntityHandle visualEntity, std::shared_ptr<Nz::Tilemap> tilemap, const Nz::Vector2f& offset, const Nz::DegreeAnglef& rotation) :
m_visualEntity(std::move(visualEntity)),
m_transformMatrix(transformMatrix),
m_rotation(rotation),
m_offset(offset),
m_tilemap(std::move(tilemap)),
m_renderOrder(renderOrder),
m_isVisible(false)
{
}
Expand Down Expand Up @@ -47,15 +47,15 @@ namespace bw

inline void Tilemap::SetOffset(const Nz::Vector2f& newOffset)
{
m_transformMatrix.SetTranslation(newOffset);
m_offset = newOffset;

UpdateTransformMatrix();
UpdateTransform();
}

inline void Tilemap::SetRotation(const Nz::DegreeAnglef& newRotation)
{
m_transformMatrix.SetRotation(newRotation);
m_rotation = newRotation;

UpdateTransformMatrix();
UpdateTransform();
}
}
10 changes: 4 additions & 6 deletions include/ClientLib/VisualEntity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,17 @@ namespace bw
VisualEntity& operator=(VisualEntity&& entity) = delete;

private:
void AttachHoveringRenderable(std::shared_ptr<Nz::InstancedRenderable> renderable, const Nz::Matrix4f& offsetMatrix, int renderOrder, float hoverOffset);
void AttachRenderable(std::shared_ptr<Nz::InstancedRenderable> renderable, const Nz::Matrix4f& offsetMatrix, int renderOrder);
void AttachHoveringRenderable(std::shared_ptr<Nz::InstancedRenderable> renderable, const Nz::Vector3f& offset, const Nz::Quaternionf& rotation, float hoverOffset);
void AttachRenderable(std::shared_ptr<Nz::InstancedRenderable> renderable, const Nz::Vector3f& offset, const Nz::Quaternionf& rotation);
void DetachHoveringRenderable(const std::shared_ptr<Nz::InstancedRenderable>& renderable);
void DetachRenderable(const std::shared_ptr<Nz::InstancedRenderable>& renderable);

inline void Enable(bool enable);

void UpdateHoveringRenderableHoveringHeight(const std::shared_ptr<Nz::InstancedRenderable>& renderable, float newHoveringHeight);
void UpdateHoveringRenderableMatrix(const std::shared_ptr<Nz::InstancedRenderable>& renderable, const Nz::Matrix4f& offsetMatrix);
void UpdateHoveringRenderableRenderOrder(const std::shared_ptr<Nz::InstancedRenderable>& renderable, int renderOrder);
void UpdateHoveringRenderableTransform(const std::shared_ptr<Nz::InstancedRenderable>& renderable, const Nz::Vector3f& offset, const Nz::Quaternionf& rotation);

void UpdateRenderableMatrix(const std::shared_ptr<Nz::InstancedRenderable>& renderable, const Nz::Matrix4f& offsetMatrix);
void UpdateRenderableRenderOrder(const std::shared_ptr<Nz::InstancedRenderable>& renderable, int renderOrder);
void UpdateRenderableTransform(const std::shared_ptr<Nz::InstancedRenderable>& renderable, const Nz::Vector3f& offset, const Nz::Quaternionf& rotation);

struct HoveringRenderable
{
Expand Down
21 changes: 13 additions & 8 deletions include/ClientLib/VisualEntity.inl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ namespace bw

inline void VisualEntity::Enable(bool enable)
{
if (enable)
m_entity->remove<Nz::DisabledComponent>();
else
m_entity->emplace_or_replace<Nz::DisabledComponent>();
// TODO
/*
auto EnableEntity = [enable](const entt::handle& entity)
{
if (enable)
entity.remove<Nz::DisabledComponent>();
else
entity.emplace_or_replace<Nz::DisabledComponent>();
};

EnableEntity(m_entity);
for (auto& renderable : m_renderables)
EnableEntity(renderable.entity);

for (auto& hoveringRenderable : m_hoveringRenderables)
hoveringRenderable.entity->Enable(enable);
*/
EnableEntity(hoveringRenderable.entity);
}
}
Loading

0 comments on commit df4b592

Please sign in to comment.