diff --git a/SDK/include/NDK/BaseWidget.inl b/SDK/include/NDK/BaseWidget.inl index 63b71a942..17592241f 100644 --- a/SDK/include/NDK/BaseWidget.inl +++ b/SDK/include/NDK/BaseWidget.inl @@ -10,8 +10,8 @@ namespace Ndk { inline BaseWidget::BaseWidget() : m_canvasIndex(InvalidCanvasIndex), - m_backgroundColor(Nz::Color(230, 230, 230, 255)), m_canvas(nullptr), + m_backgroundColor(Nz::Color(230, 230, 230, 255)), m_cursor(Nz::SystemCursor_Default), m_contentSize(50.f, 50.f), m_widgetParent(nullptr), diff --git a/SDK/include/NDK/Components/CameraComponent.inl b/SDK/include/NDK/Components/CameraComponent.inl index 0b445f1f3..33c63bfe3 100644 --- a/SDK/include/NDK/Components/CameraComponent.inl +++ b/SDK/include/NDK/Components/CameraComponent.inl @@ -39,6 +39,7 @@ namespace Ndk inline CameraComponent::CameraComponent(const CameraComponent& camera) : Component(camera), AbstractViewer(camera), + HandledObject(camera), m_visibilityHash(camera.m_visibilityHash), m_projectionType(camera.m_projectionType), m_targetRegion(camera.m_targetRegion), diff --git a/SDK/include/NDK/Widgets/ButtonWidget.hpp b/SDK/include/NDK/Widgets/ButtonWidget.hpp index d1f940e3f..8f2231501 100644 --- a/SDK/include/NDK/Widgets/ButtonWidget.hpp +++ b/SDK/include/NDK/Widgets/ButtonWidget.hpp @@ -27,7 +27,7 @@ namespace Ndk //virtual ButtonWidget* Clone() const = 0; - void ResizeToContent(); + void ResizeToContent() override; inline void UpdateText(const Nz::AbstractTextDrawer& drawer); @@ -40,7 +40,6 @@ namespace Ndk void Layout() override; void OnMouseEnter() override; - void OnMouseMoved(int x, int y, int deltaX, int deltaY) override; void OnMouseButtonRelease(int x, int y, Nz::Mouse::Button button) override; void OnMouseExit() override; diff --git a/SDK/src/NDK/Console.cpp b/SDK/src/NDK/Console.cpp index 9719e4b62..3843978ad 100644 --- a/SDK/src/NDK/Console.cpp +++ b/SDK/src/NDK/Console.cpp @@ -300,7 +300,7 @@ namespace Ndk void Console::ExecuteInput() { Nz::String input = m_inputDrawer.GetText(); - Nz::String inputCmd = input.SubString(s_inputPrefixSize);; + Nz::String inputCmd = input.SubString(s_inputPrefixSize); m_inputDrawer.SetText(s_inputPrefix); if (m_commandHistory.empty() || m_commandHistory.back() != inputCmd) diff --git a/SDK/src/NDK/Lua/LuaBinding_SDK.cpp b/SDK/src/NDK/Lua/LuaBinding_SDK.cpp index 0de791f85..4d8408282 100644 --- a/SDK/src/NDK/Lua/LuaBinding_SDK.cpp +++ b/SDK/src/NDK/Lua/LuaBinding_SDK.cpp @@ -96,23 +96,23 @@ namespace Ndk entity.BindMethod("AddComponent", [this] (Nz::LuaInstance& instance, EntityHandle& handle, std::size_t /*argumentCount*/) -> int { - LuaBinding::ComponentBinding* binding = m_binding.QueryComponentIndex(instance); + LuaBinding::ComponentBinding* bindingComponent = m_binding.QueryComponentIndex(instance); - return binding->adder(instance, handle); + return bindingComponent->adder(instance, handle); }); entity.BindMethod("GetComponent", [this] (Nz::LuaInstance& instance, EntityHandle& handle, std::size_t /*argumentCount*/) -> int { - LuaBinding::ComponentBinding* binding = m_binding.QueryComponentIndex(instance); + LuaBinding::ComponentBinding* bindingComponent = m_binding.QueryComponentIndex(instance); - return binding->getter(instance, handle->GetComponent(binding->index)); + return bindingComponent->getter(instance, handle->GetComponent(bindingComponent->index)); }); entity.BindMethod("RemoveComponent", [this] (Nz::LuaInstance& instance, EntityHandle& handle, std::size_t /*argumentCount*/) -> int { - LuaBinding::ComponentBinding* binding = m_binding.QueryComponentIndex(instance); + LuaBinding::ComponentBinding* bindingComponent = m_binding.QueryComponentIndex(instance); - handle->RemoveComponent(binding->index); + handle->RemoveComponent(bindingComponent->index); return 0; }); } diff --git a/SDK/src/NDK/Widgets/ButtonWidget.cpp b/SDK/src/NDK/Widgets/ButtonWidget.cpp index 8d3a69e33..29c04c98f 100644 --- a/SDK/src/NDK/Widgets/ButtonWidget.cpp +++ b/SDK/src/NDK/Widgets/ButtonWidget.cpp @@ -61,10 +61,7 @@ namespace Ndk m_gradientSprite->SetColor(Nz::Color(128, 128, 128)); } - void ButtonWidget::OnMouseMoved(int x, int y, int deltaX, int deltaY) - { - } - + void ButtonWidget::OnMouseExit() { m_gradientSprite->SetColor(Nz::Color(74, 74, 74)); diff --git a/include/Nazara/Audio/Music.hpp b/include/Nazara/Audio/Music.hpp index 74d315d19..86ccc6906 100644 --- a/include/Nazara/Audio/Music.hpp +++ b/include/Nazara/Audio/Music.hpp @@ -43,27 +43,27 @@ namespace Nz bool Create(SoundStream* soundStream); void Destroy(); - void EnableLooping(bool loop); + void EnableLooping(bool loop) override; - UInt32 GetDuration() const; + UInt32 GetDuration() const override; AudioFormat GetFormat() const; - UInt32 GetPlayingOffset() const; + UInt32 GetPlayingOffset() const override; UInt64 GetSampleCount() const; UInt32 GetSampleRate() const; - SoundStatus GetStatus() const; + SoundStatus GetStatus() const override; - bool IsLooping() const; + bool IsLooping() const override; bool OpenFromFile(const String& filePath, const MusicParams& params = MusicParams()); bool OpenFromMemory(const void* data, std::size_t size, const MusicParams& params = MusicParams()); bool OpenFromStream(Stream& stream, const MusicParams& params = MusicParams()); - void Pause(); - void Play(); + void Pause() override; + void Play() override; void SetPlayingOffset(UInt32 offset); - void Stop(); + void Stop() override; Music& operator=(const Music&) = delete; Music& operator=(Music&&) = delete; ///TODO diff --git a/include/Nazara/Audio/Sound.hpp b/include/Nazara/Audio/Sound.hpp index c5083387f..114b177ab 100644 --- a/include/Nazara/Audio/Sound.hpp +++ b/include/Nazara/Audio/Sound.hpp @@ -23,14 +23,14 @@ namespace Nz Sound(Sound&&) = default; ~Sound(); - void EnableLooping(bool loop); + void EnableLooping(bool loop) override; const SoundBuffer* GetBuffer() const; - UInt32 GetDuration() const; - UInt32 GetPlayingOffset() const; - SoundStatus GetStatus() const; + UInt32 GetDuration() const override; + UInt32 GetPlayingOffset() const override; + SoundStatus GetStatus() const override; - bool IsLooping() const; + bool IsLooping() const override; bool IsPlayable() const; bool IsPlaying() const; @@ -38,13 +38,13 @@ namespace Nz bool LoadFromMemory(const void* data, std::size_t size, const SoundBufferParams& params = SoundBufferParams()); bool LoadFromStream(Stream& stream, const SoundBufferParams& params = SoundBufferParams()); - void Pause(); - void Play(); + void Pause() override; + void Play() override; void SetBuffer(const SoundBuffer* buffer); void SetPlayingOffset(UInt32 offset); - void Stop(); + void Stop() override; Sound& operator=(const Sound&) = delete; ///TODO? Sound& operator=(Sound&&) = default; diff --git a/include/Nazara/Core/ByteStream.hpp b/include/Nazara/Core/ByteStream.hpp index a49b08eff..eed461205 100644 --- a/include/Nazara/Core/ByteStream.hpp +++ b/include/Nazara/Core/ByteStream.hpp @@ -24,7 +24,7 @@ namespace Nz ByteStream(const void* ptr, Nz::UInt64 size); ByteStream(const ByteStream&) = delete; inline ByteStream(ByteStream&& stream); - ~ByteStream(); + virtual ~ByteStream(); inline Endianness GetDataEndianness() const; inline Nz::UInt64 GetSize() const; diff --git a/include/Nazara/Core/Functor.hpp b/include/Nazara/Core/Functor.hpp index b392cc591..17578474c 100644 --- a/include/Nazara/Core/Functor.hpp +++ b/include/Nazara/Core/Functor.hpp @@ -25,7 +25,7 @@ namespace Nz { FunctorWithoutArgs(F func); - void Run(); + void Run() override; private: F m_func; @@ -36,7 +36,7 @@ namespace Nz { FunctorWithArgs(F func, Args&&... args); - void Run(); + void Run() override; private: F m_func; @@ -48,7 +48,7 @@ namespace Nz { MemberWithoutArgs(void (C::*func)(), C* object); - void Run(); + void Run() override; private: void (C::*m_func)(); diff --git a/include/Nazara/Graphics/ColorBackground.hpp b/include/Nazara/Graphics/ColorBackground.hpp index 57de236f9..d76a92977 100644 --- a/include/Nazara/Graphics/ColorBackground.hpp +++ b/include/Nazara/Graphics/ColorBackground.hpp @@ -26,9 +26,9 @@ namespace Nz ColorBackground(const ColorBackground&) = default; ColorBackground(ColorBackground&&) = delete; - void Draw(const AbstractViewer* viewer) const; + void Draw(const AbstractViewer* viewer) const override; - BackgroundType GetBackgroundType() const; + BackgroundType GetBackgroundType() const override; Color GetColor() const; void SetColor(const Color& color); diff --git a/include/Nazara/Graphics/DeferredBloomPass.hpp b/include/Nazara/Graphics/DeferredBloomPass.hpp index 5246f45c2..c00cc3c4c 100644 --- a/include/Nazara/Graphics/DeferredBloomPass.hpp +++ b/include/Nazara/Graphics/DeferredBloomPass.hpp @@ -29,8 +29,8 @@ namespace Nz float GetBrightThreshold() const; Texture* GetTexture(unsigned int i) const; - bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const; - bool Resize(const Vector2ui& dimensions); + bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const override; + bool Resize(const Vector2ui& dimensions) override; void SetBlurPassCount(unsigned int passCount); void SetBrightLuminance(float luminance); diff --git a/include/Nazara/Graphics/DeferredDOFPass.hpp b/include/Nazara/Graphics/DeferredDOFPass.hpp index 6a0b213da..b4025be7d 100644 --- a/include/Nazara/Graphics/DeferredDOFPass.hpp +++ b/include/Nazara/Graphics/DeferredDOFPass.hpp @@ -23,8 +23,8 @@ namespace Nz DeferredDOFPass(); virtual ~DeferredDOFPass(); - bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const; - bool Resize(const Vector2ui& dimensions); + bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const override; + bool Resize(const Vector2ui& dimensions) override; protected: RenderTexture m_dofRTT; diff --git a/include/Nazara/Graphics/DeferredFXAAPass.hpp b/include/Nazara/Graphics/DeferredFXAAPass.hpp index 696450796..e8179f46d 100644 --- a/include/Nazara/Graphics/DeferredFXAAPass.hpp +++ b/include/Nazara/Graphics/DeferredFXAAPass.hpp @@ -21,7 +21,7 @@ namespace Nz DeferredFXAAPass(); virtual ~DeferredFXAAPass(); - bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const; + bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const override; protected: RenderStates m_states; diff --git a/include/Nazara/Graphics/DeferredFinalPass.hpp b/include/Nazara/Graphics/DeferredFinalPass.hpp index 52c7e8233..d99c8ed30 100644 --- a/include/Nazara/Graphics/DeferredFinalPass.hpp +++ b/include/Nazara/Graphics/DeferredFinalPass.hpp @@ -21,7 +21,7 @@ namespace Nz DeferredFinalPass(); virtual ~DeferredFinalPass(); - bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const; + bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const override; protected: RenderStates m_states; diff --git a/include/Nazara/Graphics/DeferredFogPass.hpp b/include/Nazara/Graphics/DeferredFogPass.hpp index 807f0752d..c1ccbdc88 100644 --- a/include/Nazara/Graphics/DeferredFogPass.hpp +++ b/include/Nazara/Graphics/DeferredFogPass.hpp @@ -21,7 +21,7 @@ namespace Nz DeferredFogPass(); virtual ~DeferredFogPass(); - bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const; + bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const override; protected: RenderStates m_states; diff --git a/include/Nazara/Graphics/DeferredForwardPass.hpp b/include/Nazara/Graphics/DeferredForwardPass.hpp index 5bf53f107..7fc619da2 100644 --- a/include/Nazara/Graphics/DeferredForwardPass.hpp +++ b/include/Nazara/Graphics/DeferredForwardPass.hpp @@ -20,8 +20,8 @@ namespace Nz DeferredForwardPass(); virtual ~DeferredForwardPass(); - void Initialize(DeferredRenderTechnique* technique); - bool Process(const SceneData& sceneData, unsigned int workTexture, unsigned int sceneTexture) const; + void Initialize(DeferredRenderTechnique* technique) override; + bool Process(const SceneData& sceneData, unsigned int workTexture, unsigned int sceneTexture) const override; protected: const ForwardRenderTechnique* m_forwardTechnique; diff --git a/include/Nazara/Graphics/DeferredGeometryPass.hpp b/include/Nazara/Graphics/DeferredGeometryPass.hpp index dcfa47f90..b390263b6 100644 --- a/include/Nazara/Graphics/DeferredGeometryPass.hpp +++ b/include/Nazara/Graphics/DeferredGeometryPass.hpp @@ -21,8 +21,8 @@ namespace Nz DeferredGeometryPass(); virtual ~DeferredGeometryPass(); - bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const; - bool Resize(const Vector2ui& dimensions); + bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const override; + bool Resize(const Vector2ui& dimensions) override; protected: struct ShaderUniforms; diff --git a/include/Nazara/Graphics/DeferredPhongLightingPass.hpp b/include/Nazara/Graphics/DeferredPhongLightingPass.hpp index 4b14900d7..cbff41041 100644 --- a/include/Nazara/Graphics/DeferredPhongLightingPass.hpp +++ b/include/Nazara/Graphics/DeferredPhongLightingPass.hpp @@ -28,7 +28,7 @@ namespace Nz bool IsLightMeshesDrawingEnabled() const; - bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const; + bool Process(const SceneData& sceneData, unsigned int firstWorkTexture, unsigned int secondWorkTexture) const override; protected: LightUniforms m_directionalLightUniforms; diff --git a/include/Nazara/Graphics/TextureBackground.hpp b/include/Nazara/Graphics/TextureBackground.hpp index 272bcc63f..bdb088812 100644 --- a/include/Nazara/Graphics/TextureBackground.hpp +++ b/include/Nazara/Graphics/TextureBackground.hpp @@ -24,9 +24,9 @@ namespace Nz public: TextureBackground(TextureRef texture = TextureRef()); - void Draw(const AbstractViewer* viewer) const; + void Draw(const AbstractViewer* viewer) const override; - BackgroundType GetBackgroundType() const; + BackgroundType GetBackgroundType() const override; inline const TextureRef& GetTexture() const; inline void SetTexture(TextureRef texture); diff --git a/include/Nazara/Noise/MixerBase.hpp b/include/Nazara/Noise/MixerBase.hpp index 61df26543..954932114 100644 --- a/include/Nazara/Noise/MixerBase.hpp +++ b/include/Nazara/Noise/MixerBase.hpp @@ -15,7 +15,7 @@ namespace Nz { public: MixerBase(); - ~MixerBase() = default; + virtual ~MixerBase() = default; virtual float Get(float x, float y, float scale) const = 0; virtual float Get(float x, float y, float z, float scale) const = 0; diff --git a/include/Nazara/Noise/NoiseBase.hpp b/include/Nazara/Noise/NoiseBase.hpp index cdf068083..dc57a6e40 100644 --- a/include/Nazara/Noise/NoiseBase.hpp +++ b/include/Nazara/Noise/NoiseBase.hpp @@ -19,7 +19,7 @@ namespace Nz { public: NoiseBase(unsigned int seed = 0); - ~NoiseBase() = default; + virtual ~NoiseBase() = default; virtual float Get(float x, float y, float scale) const = 0; virtual float Get(float x, float y, float z, float scale) const = 0; diff --git a/include/Nazara/Physics2D/Collider2D.hpp b/include/Nazara/Physics2D/Collider2D.hpp index 610d1a00f..e5b988756 100644 --- a/include/Nazara/Physics2D/Collider2D.hpp +++ b/include/Nazara/Physics2D/Collider2D.hpp @@ -35,15 +35,22 @@ namespace Nz friend RigidBody2D; public: - Collider2D() = default; + inline Collider2D(); Collider2D(const Collider2D&) = delete; Collider2D(Collider2D&&) = delete; virtual ~Collider2D(); virtual float ComputeInertialMatrix(float mass) const = 0; + inline unsigned int GetCollisionId() const; + virtual ColliderType2D GetType() const = 0; + inline bool IsTrigger() const; + + inline void SetCollisionId(unsigned long typeId); + inline void SetTrigger(bool trigger); + Collider2D& operator=(const Collider2D&) = delete; Collider2D& operator=(Collider2D&&) = delete; @@ -53,6 +60,12 @@ namespace Nz protected: virtual std::vector CreateShapes(RigidBody2D* body) const = 0; + bool m_trigger; + unsigned int m_collisionId; + + private: + virtual std::vector GenerateShapes(RigidBody2D* body) const; + static Collider2DLibrary::LibraryMap s_library; }; diff --git a/include/Nazara/Physics2D/Collider2D.inl b/include/Nazara/Physics2D/Collider2D.inl index f5b222875..71b909a2c 100644 --- a/include/Nazara/Physics2D/Collider2D.inl +++ b/include/Nazara/Physics2D/Collider2D.inl @@ -7,6 +7,32 @@ namespace Nz { + inline Collider2D::Collider2D() : + m_collisionId(0), + m_trigger(false) + { + } + + inline unsigned int Collider2D::GetCollisionId() const + { + return m_collisionId; + } + + inline bool Collider2D::IsTrigger() const + { + return m_trigger; + } + + inline void Collider2D::SetCollisionId(unsigned long typeId) + { + m_collisionId = typeId; + } + + inline void Collider2D::SetTrigger(bool trigger) + { + m_trigger = trigger; + } + inline const Rectf& BoxCollider2D::GetRect() const { return m_rect; @@ -82,3 +108,4 @@ namespace Nz } #include +#include "Collider2D.hpp" diff --git a/include/Nazara/Physics2D/PhysWorld2D.hpp b/include/Nazara/Physics2D/PhysWorld2D.hpp index c2ffb437c..760773c7d 100644 --- a/include/Nazara/Physics2D/PhysWorld2D.hpp +++ b/include/Nazara/Physics2D/PhysWorld2D.hpp @@ -10,14 +10,26 @@ #include #include #include +#include +#include +struct cpCollisionHandler; struct cpSpace; namespace Nz { + class RigidBody2D; + class NAZARA_PHYSICS2D_API PhysWorld2D { + using ContactEndCallback = void(*)(PhysWorld2D& world, RigidBody2D& bodyA, RigidBody2D& bodyB, void* userdata); + using ContactPreSolveCallback = bool(*)(PhysWorld2D& world, RigidBody2D& bodyA, RigidBody2D& bodyB, void* userdata); + using ContactPostSolveCallback = void(*)(PhysWorld2D& world, RigidBody2D& bodyA, RigidBody2D& bodyB, void* userdata); + using ContactStartCallback = bool(*)(PhysWorld2D& world, RigidBody2D& bodyA, RigidBody2D& bodyB, void* userdata); + public: + struct Callback; + PhysWorld2D(); PhysWorld2D(const PhysWorld2D&) = delete; PhysWorld2D(PhysWorld2D&&) = delete; ///TODO @@ -27,8 +39,10 @@ namespace Nz cpSpace* GetHandle() const; float GetStepSize() const; + void RegisterCallbacks(unsigned int collisionId, const Callback& callbacks); + void RegisterCallbacks(unsigned int collisionIdA, unsigned int collisionIdB, const Callback& callbacks); + void SetGravity(const Vector2f& gravity); - void SetSolverModel(unsigned int model); void SetStepSize(float stepSize); void Step(float timestep); @@ -36,7 +50,19 @@ namespace Nz PhysWorld2D& operator=(const PhysWorld2D&) = delete; PhysWorld2D& operator=(PhysWorld2D&&) = delete; ///TODO + struct Callback + { + ContactEndCallback endCallback; + ContactPreSolveCallback preSolveCallback; + ContactPostSolveCallback postSolveCallback; + ContactStartCallback startCallback; + void* userdata; + }; + private: + void InitCallbacks(cpCollisionHandler* handler, const Callback& callbacks); + + std::unordered_map> m_callbacks; cpSpace* m_handle; float m_stepSize; float m_timestepAccumulator; diff --git a/include/Nazara/Physics2D/RigidBody2D.hpp b/include/Nazara/Physics2D/RigidBody2D.hpp index 5f14d8ff9..f57ce6a48 100644 --- a/include/Nazara/Physics2D/RigidBody2D.hpp +++ b/include/Nazara/Physics2D/RigidBody2D.hpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -43,6 +44,7 @@ namespace Nz float GetMass() const; Vector2f GetPosition() const; float GetRotation() const; + void* GetUserdata() const; Vector2f GetVelocity() const; bool IsMoveable() const; @@ -54,11 +56,15 @@ namespace Nz void SetMassCenter(const Vector2f& center); void SetPosition(const Vector2f& position); void SetRotation(float rotation); + void SetUserdata(void* ud); void SetVelocity(const Vector2f& velocity); RigidBody2D& operator=(const RigidBody2D& object); RigidBody2D& operator=(RigidBody2D&& object); + NazaraSignal(OnRigidBody2DMove, RigidBody2D* /*oldPointer*/, RigidBody2D* /*newPointer*/); + NazaraSignal(OnRigidBody2DRelease, RigidBody2D* /*rigidBody*/); + private: void Create(float mass = 1.f, float moment = 1.f); void Destroy(); @@ -66,6 +72,7 @@ namespace Nz std::vector m_shapes; Collider2DRef m_geom; cpBody* m_handle; + void* m_userData; PhysWorld2D* m_world; float m_gravityFactor; float m_mass; diff --git a/include/Nazara/Renderer/UberShaderInstancePreprocessor.hpp b/include/Nazara/Renderer/UberShaderInstancePreprocessor.hpp index 5f0a16900..ee44950a0 100644 --- a/include/Nazara/Renderer/UberShaderInstancePreprocessor.hpp +++ b/include/Nazara/Renderer/UberShaderInstancePreprocessor.hpp @@ -18,7 +18,7 @@ namespace Nz UberShaderInstancePreprocessor(const Shader* shader); virtual ~UberShaderInstancePreprocessor(); - bool Activate() const; + bool Activate() const override; }; } diff --git a/include/Nazara/Renderer/UberShaderPreprocessor.hpp b/include/Nazara/Renderer/UberShaderPreprocessor.hpp index 6732fab23..710835ec2 100644 --- a/include/Nazara/Renderer/UberShaderPreprocessor.hpp +++ b/include/Nazara/Renderer/UberShaderPreprocessor.hpp @@ -29,7 +29,7 @@ namespace Nz UberShaderPreprocessor() = default; ~UberShaderPreprocessor(); - UberShaderInstance* Get(const ParameterList& parameters) const; + UberShaderInstance* Get(const ParameterList& parameters) const override; void SetShader(ShaderStageType stage, const String& source, const String& shaderFlags, const String& requiredFlags = String()); bool SetShaderFromFile(ShaderStageType stage, const String& filePath, const String& shaderFlags, const String& requiredFlags = String()); diff --git a/include/Nazara/Utility/EventHandler.inl b/include/Nazara/Utility/EventHandler.inl index 4ba3f49bd..39191300d 100644 --- a/include/Nazara/Utility/EventHandler.inl +++ b/include/Nazara/Utility/EventHandler.inl @@ -8,7 +8,8 @@ namespace Nz { - inline EventHandler::EventHandler(const EventHandler&) + inline EventHandler::EventHandler(const EventHandler& other) : + HandledObject(other) { } diff --git a/include/Nazara/Utility/Image.hpp b/include/Nazara/Utility/Image.hpp index 4e5b094cc..cbae97f9a 100644 --- a/include/Nazara/Utility/Image.hpp +++ b/include/Nazara/Utility/Image.hpp @@ -78,18 +78,18 @@ namespace Nz bool FlipVertically(); const UInt8* GetConstPixels(unsigned int x = 0, unsigned int y = 0, unsigned int z = 0, UInt8 level = 0) const; - unsigned int GetDepth(UInt8 level = 0) const; - PixelFormatType GetFormat() const; - unsigned int GetHeight(UInt8 level = 0) const; - UInt8 GetLevelCount() const; - UInt8 GetMaxLevel() const; - std::size_t GetMemoryUsage() const; - std::size_t GetMemoryUsage(UInt8 level) const; + unsigned int GetDepth(UInt8 level = 0) const override; + PixelFormatType GetFormat() const override; + unsigned int GetHeight(UInt8 level = 0) const override; + UInt8 GetLevelCount() const override; + UInt8 GetMaxLevel() const override; + std::size_t GetMemoryUsage() const override; + std::size_t GetMemoryUsage(UInt8 level) const override; Color GetPixelColor(unsigned int x, unsigned int y = 0, unsigned int z = 0) const; UInt8* GetPixels(unsigned int x = 0, unsigned int y = 0, unsigned int z = 0, UInt8 level = 0); - Vector3ui GetSize(UInt8 level = 0) const; - ImageType GetType() const; - unsigned int GetWidth(UInt8 level = 0) const; + Vector3ui GetSize(UInt8 level = 0) const override; + ImageType GetType() const override; + unsigned int GetWidth(UInt8 level = 0) const override; bool HasAlpha() const; @@ -126,9 +126,9 @@ namespace Nz void SetLevelCount(UInt8 levelCount); bool SetPixelColor(const Color& color, unsigned int x, unsigned int y = 0, unsigned int z = 0); - bool Update(const UInt8* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0); - bool Update(const UInt8* pixels, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0); - bool Update(const UInt8* pixels, const Rectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0); + bool Update(const UInt8* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override; + bool Update(const UInt8* pixels, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override; + bool Update(const UInt8* pixels, const Rectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override; Image& operator=(const Image& image); diff --git a/include/Nazara/Utility/Joint.hpp b/include/Nazara/Utility/Joint.hpp index f82668986..fad4b3d22 100644 --- a/include/Nazara/Utility/Joint.hpp +++ b/include/Nazara/Utility/Joint.hpp @@ -35,7 +35,7 @@ namespace Nz void SetName(const String& name); private: - void InvalidateNode(); + void InvalidateNode() override; void UpdateSkinningMatrix() const; Matrix4f m_inverseBindMatrix; diff --git a/include/Nazara/Utility/SkeletalMesh.hpp b/include/Nazara/Utility/SkeletalMesh.hpp index 3efe704da..d67210c74 100644 --- a/include/Nazara/Utility/SkeletalMesh.hpp +++ b/include/Nazara/Utility/SkeletalMesh.hpp @@ -29,13 +29,13 @@ namespace Nz void Destroy(); const Boxf& GetAABB() const override; - AnimationType GetAnimationType() const final; + AnimationType GetAnimationType() const final override; const IndexBuffer* GetIndexBuffer() const override; VertexBuffer* GetVertexBuffer(); const VertexBuffer* GetVertexBuffer() const; unsigned int GetVertexCount() const override; - bool IsAnimated() const final; + bool IsAnimated() const final override; bool IsValid() const; void SetAABB(const Boxf& aabb); diff --git a/include/Nazara/Utility/StaticMesh.hpp b/include/Nazara/Utility/StaticMesh.hpp index 066bcee45..125af6301 100644 --- a/include/Nazara/Utility/StaticMesh.hpp +++ b/include/Nazara/Utility/StaticMesh.hpp @@ -32,13 +32,13 @@ namespace Nz bool GenerateAABB(); const Boxf& GetAABB() const override; - AnimationType GetAnimationType() const final; + AnimationType GetAnimationType() const final override; const IndexBuffer* GetIndexBuffer() const override; VertexBuffer* GetVertexBuffer(); const VertexBuffer* GetVertexBuffer() const; unsigned int GetVertexCount() const override; - bool IsAnimated() const final; + bool IsAnimated() const final override; bool IsValid() const; void SetAABB(const Boxf& aabb); diff --git a/plugins/Assimp/Plugin.cpp b/plugins/Assimp/Plugin.cpp index e65d460db..a5cdf3cbf 100644 --- a/plugins/Assimp/Plugin.cpp +++ b/plugins/Assimp/Plugin.cpp @@ -141,12 +141,12 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters) { for (unsigned int i = 0; i < scene->mNumMeshes; ++i) { - aiMesh* mesh = scene->mMeshes[i]; - if (mesh->HasBones()) // Inline functions can be safely called + aiMesh* currentMesh = scene->mMeshes[i]; + if (currentMesh->HasBones()) // Inline functions can be safely called { animatedMesh = true; - for (unsigned int j = 0; j < mesh->mNumBones; ++j) - joints.insert(mesh->mBones[j]->mName.C_Str()); + for (unsigned int j = 0; j < currentMesh->mNumBones; ++j) + joints.insert(currentMesh->mBones[j]->mName.C_Str()); } } } diff --git a/src/Nazara/Core/GuillotineBinPack.cpp b/src/Nazara/Core/GuillotineBinPack.cpp index 0f74bab5b..85270a562 100644 --- a/src/Nazara/Core/GuillotineBinPack.cpp +++ b/src/Nazara/Core/GuillotineBinPack.cpp @@ -312,9 +312,9 @@ namespace Nz while (!remainingRects.empty()) { // Stores the penalty score of the best rectangle placement - bigger=worse, smaller=better. - bool bestFlipped; - std::size_t bestFreeRect; - std::size_t bestRect; + bool bestFlipped = false; + std::size_t bestFreeRect = m_freeRectangles.size(); + std::size_t bestRect = std::numeric_limits::min(); int bestScore = std::numeric_limits::max(); for (std::size_t i = 0; i < m_freeRectangles.size(); ++i) diff --git a/src/Nazara/Core/MemoryManager.cpp b/src/Nazara/Core/MemoryManager.cpp index 2c4034623..aaf6bc520 100644 --- a/src/Nazara/Core/MemoryManager.cpp +++ b/src/Nazara/Core/MemoryManager.cpp @@ -413,9 +413,9 @@ namespace Nz while (ptr != &s_list) { if (ptr->file) - std::fprintf(log, "-0x%p -> %zu bytes allocated at %s:%u\n", reinterpret_cast(ptr) + sizeof(Block), ptr->size, ptr->file, ptr->line); + std::fprintf(log, "-0x%s -> %zu bytes allocated at %s:%u\n", reinterpret_cast(ptr) + sizeof(Block), ptr->size, ptr->file, ptr->line); else - std::fprintf(log, "-0x%p -> %zu bytes allocated at unknown position\n", reinterpret_cast(ptr) + sizeof(Block), ptr->size); + std::fprintf(log, "-0x%s -> %zu bytes allocated at unknown position\n", reinterpret_cast(ptr) + sizeof(Block), ptr->size); void* pointer = ptr; ptr = ptr->next; diff --git a/src/Nazara/Graphics/ParticleGroup.cpp b/src/Nazara/Graphics/ParticleGroup.cpp index ab9f6568c..34a46089b 100644 --- a/src/Nazara/Graphics/ParticleGroup.cpp +++ b/src/Nazara/Graphics/ParticleGroup.cpp @@ -39,9 +39,9 @@ namespace Nz */ ParticleGroup::ParticleGroup(unsigned int maxParticleCount, ParticleDeclarationConstRef declaration) : - m_declaration(std::move(declaration)), m_maxParticleCount(maxParticleCount), m_particleCount(0), + m_declaration(std::move(declaration)), m_processing(false) { // In case of error, the constructor can only throw an exception @@ -60,13 +60,13 @@ namespace Nz ParticleGroup::ParticleGroup(const ParticleGroup& system) : Renderable(system), + m_maxParticleCount(system.m_maxParticleCount), + m_particleCount(system.m_particleCount), + m_particleSize(system.m_particleSize), m_controllers(system.m_controllers), m_generators(system.m_generators), m_declaration(system.m_declaration), m_renderer(system.m_renderer), - m_maxParticleCount(system.m_maxParticleCount), - m_particleCount(system.m_particleCount), - m_particleSize(system.m_particleSize), m_processing(false) { ErrorFlags flags(ErrorFlag_ThrowException, true); diff --git a/src/Nazara/Physics2D/Collider2D.cpp b/src/Nazara/Physics2D/Collider2D.cpp index 928ea3974..cce3301aa 100644 --- a/src/Nazara/Physics2D/Collider2D.cpp +++ b/src/Nazara/Physics2D/Collider2D.cpp @@ -11,6 +11,18 @@ namespace Nz { Collider2D::~Collider2D() = default; + std::vector Collider2D::GenerateShapes(RigidBody2D* body) const + { + std::vector shapes = CreateShapes(body); + for (cpShape* shape : shapes) + { + cpShapeSetCollisionType(shape, m_collisionId); + cpShapeSetSensor(shape, (m_trigger) ? cpTrue : cpFalse); + } + + return shapes; + } + /******************************** BoxCollider2D *********************************/ BoxCollider2D::BoxCollider2D(const Vector2f& size, float radius) : diff --git a/src/Nazara/Physics2D/PhysWorld2D.cpp b/src/Nazara/Physics2D/PhysWorld2D.cpp index 62d194e9b..7c15beee3 100644 --- a/src/Nazara/Physics2D/PhysWorld2D.cpp +++ b/src/Nazara/Physics2D/PhysWorld2D.cpp @@ -37,6 +37,16 @@ namespace Nz return m_stepSize; } + void PhysWorld2D::RegisterCallbacks(unsigned int collisionId, const Callback& callbacks) + { + InitCallbacks(cpSpaceAddWildcardHandler(m_handle, collisionId), callbacks); + } + + void PhysWorld2D::RegisterCallbacks(unsigned int collisionIdA, unsigned int collisionIdB, const Callback& callbacks) + { + InitCallbacks(cpSpaceAddCollisionHandler(m_handle, collisionIdA, collisionIdB), callbacks); + } + void PhysWorld2D::SetGravity(const Vector2f& gravity) { cpSpaceSetGravity(m_handle, cpv(gravity.x, gravity.y)); @@ -57,4 +67,99 @@ namespace Nz m_timestepAccumulator -= m_stepSize; } } + + void PhysWorld2D::InitCallbacks(cpCollisionHandler* handler, const Callback& callbacks) + { + auto it = m_callbacks.emplace(handler, std::make_unique(callbacks)).first; + + handler->userData = it->second.get(); + + if (callbacks.startCallback) + { + handler->beginFunc = [](cpArbiter* arb, cpSpace* space, void *data) -> cpBool + { + cpBody* firstBody; + cpBody* secondBody; + cpArbiterGetBodies(arb, &firstBody, &secondBody); + + PhysWorld2D* world = static_cast(cpSpaceGetUserData(space)); + RigidBody2D* firstRigidBody = static_cast(cpBodyGetUserData(firstBody)); + RigidBody2D* secondRigidBody = static_cast(cpBodyGetUserData(secondBody)); + + const Callback* customCallbacks = static_cast(data); + if (customCallbacks->startCallback(*world, *firstRigidBody, *secondRigidBody, customCallbacks->userdata)) + { + cpBool retA = cpArbiterCallWildcardBeginA(arb, space); + cpBool retB = cpArbiterCallWildcardBeginB(arb, space); + return retA && retB; + } + else + return cpFalse; + }; + } + + if (callbacks.endCallback) + { + handler->separateFunc = [](cpArbiter* arb, cpSpace* space, void *data) + { + cpBody* firstBody; + cpBody* secondBody; + cpArbiterGetBodies(arb, &firstBody, &secondBody); + + PhysWorld2D* world = static_cast(cpSpaceGetUserData(space)); + RigidBody2D* firstRigidBody = static_cast(cpBodyGetUserData(firstBody)); + RigidBody2D* secondRigidBody = static_cast(cpBodyGetUserData(secondBody)); + + const Callback* customCallbacks = static_cast(data); + customCallbacks->endCallback(*world, *firstRigidBody, *secondRigidBody, customCallbacks->userdata); + + cpArbiterCallWildcardSeparateA(arb, space); + cpArbiterCallWildcardSeparateB(arb, space); + }; + } + + if (callbacks.preSolveCallback) + { + handler->preSolveFunc = [](cpArbiter* arb, cpSpace* space, void *data) -> cpBool + { + cpBody* firstBody; + cpBody* secondBody; + cpArbiterGetBodies(arb, &firstBody, &secondBody); + + PhysWorld2D* world = static_cast(cpSpaceGetUserData(space)); + RigidBody2D* firstRigidBody = static_cast(cpBodyGetUserData(firstBody)); + RigidBody2D* secondRigidBody = static_cast(cpBodyGetUserData(secondBody)); + + const Callback* customCallbacks = static_cast(data); + if (customCallbacks->preSolveCallback(*world, *firstRigidBody, *secondRigidBody, customCallbacks->userdata)) + { + cpBool retA = cpArbiterCallWildcardPreSolveA(arb, space); + cpBool retB = cpArbiterCallWildcardPreSolveB(arb, space); + return retA && retB; + } + else + return cpFalse; + }; + } + + if (callbacks.postSolveCallback) + { + handler->postSolveFunc = [](cpArbiter* arb, cpSpace* space, void *data) + { + cpBody* firstBody; + cpBody* secondBody; + cpArbiterGetBodies(arb, &firstBody, &secondBody); + + PhysWorld2D* world = static_cast(cpSpaceGetUserData(space)); + RigidBody2D* firstRigidBody = static_cast(cpBodyGetUserData(firstBody)); + RigidBody2D* secondRigidBody = static_cast(cpBodyGetUserData(secondBody)); + + const Callback* customCallbacks = static_cast(data); + customCallbacks->postSolveCallback(*world, *firstRigidBody, *secondRigidBody, customCallbacks->userdata); + + cpArbiterCallWildcardPostSolveA(arb, space); + cpArbiterCallWildcardPostSolveB(arb, space); + }; + } + } } diff --git a/src/Nazara/Physics2D/RigidBody2D.cpp b/src/Nazara/Physics2D/RigidBody2D.cpp index 9078749b3..8993fe398 100644 --- a/src/Nazara/Physics2D/RigidBody2D.cpp +++ b/src/Nazara/Physics2D/RigidBody2D.cpp @@ -20,6 +20,7 @@ namespace Nz RigidBody2D::RigidBody2D(PhysWorld2D* world, float mass, Collider2DRef geom) : m_geom(), + m_userData(nullptr), m_world(world), m_gravityFactor(1.f), m_mass(1.f) @@ -34,6 +35,7 @@ namespace Nz RigidBody2D::RigidBody2D(const RigidBody2D& object) : m_geom(object.m_geom), + m_userData(object.m_userData), m_world(object.m_world), m_gravityFactor(object.m_gravityFactor), m_mass(0.f) @@ -48,18 +50,27 @@ namespace Nz } RigidBody2D::RigidBody2D(RigidBody2D&& object) : + OnRigidBody2DMove(std::move(object.OnRigidBody2DMove)), + OnRigidBody2DRelease(std::move(object.OnRigidBody2DRelease)), m_shapes(std::move(object.m_shapes)), m_geom(std::move(object.m_geom)), + m_userData(object.m_userData), m_handle(object.m_handle), m_world(object.m_world), m_gravityFactor(object.m_gravityFactor), m_mass(object.m_mass) { + cpBodySetUserData(m_handle, this); + object.m_handle = nullptr; + + OnRigidBody2DMove(&object, this); } RigidBody2D::~RigidBody2D() { + OnRigidBody2DRelease(this); + Destroy(); } @@ -144,6 +155,11 @@ namespace Nz return static_cast(cpBodyGetAngle(m_handle)); } + void* RigidBody2D::GetUserdata() const + { + return m_userData; + } + Vector2f RigidBody2D::GetVelocity() const { cpVect vel = cpBodyGetVelocity(m_handle); @@ -190,7 +206,7 @@ namespace Nz else m_geom = NullCollider2D::New(); - m_shapes = m_geom->CreateShapes(this); + m_shapes = m_geom->GenerateShapes(this); cpSpace* space = m_world->GetHandle(); for (cpShape* shape : m_shapes) @@ -242,6 +258,11 @@ namespace Nz cpBodySetAngle(m_handle, rotation); } + void RigidBody2D::SetUserdata(void* ud) + { + m_userData = ud; + } + void RigidBody2D::SetVelocity(const Vector2f& velocity) { cpBodySetVelocity(m_handle, cpv(velocity.x, velocity.y)); @@ -257,15 +278,23 @@ namespace Nz { Destroy(); + OnRigidBody2DMove = std::move(object.OnRigidBody2DMove); + OnRigidBody2DRelease = std::move(object.OnRigidBody2DRelease); + m_handle = object.m_handle; m_geom = std::move(object.m_geom); m_gravityFactor = object.m_gravityFactor; m_mass = object.m_mass; m_shapes = std::move(object.m_shapes); + m_userData = object.m_userData; m_world = object.m_world; + cpBodySetUserData(m_handle, this); + object.m_handle = nullptr; + OnRigidBody2DMove(&object, this); + return *this; } diff --git a/src/Nazara/Renderer/ContextParameters.cpp b/src/Nazara/Renderer/ContextParameters.cpp index cdb087561..1af405b2e 100644 --- a/src/Nazara/Renderer/ContextParameters.cpp +++ b/src/Nazara/Renderer/ContextParameters.cpp @@ -8,28 +8,28 @@ namespace Nz { - // Version majeure d'OpenGL, initialisé par OpenGL::Initialize() + // Major version of OpenGL, initialised by OpenGL::Initialize() UInt8 ContextParameters::defaultMajorVersion; - // Version majeure d'OpenGL, initialisé par OpenGL::Initialize() + // Minor version of OpenGL, initialised by OpenGL::Initialize() UInt8 ContextParameters::defaultMinorVersion; - // Contexte de partage par défaut, initialisé par OpenGL::Initialize() + // Context of default sharing, initialised by OpenGL::Initialize() const Context* ContextParameters::defaultShareContext = nullptr; - // Si possible, garder la compatibilité avec les fonctionnalités dépréciées + // If it's possible, keep the compatibility with deprecated functionalities bool ContextParameters::defaultCompatibilityProfile = false; - // Mode debug d'OpenGL par défaut + // Default debug mode of OpenGL #if NAZARA_RENDERER_OPENGL_DEBUG || defined(NAZARA_DEBUG) bool ContextParameters::defaultDebugMode = true; #else bool ContextParameters::defaultDebugMode = false; #endif - // Active le double-buffering sur les contextes + // Enables double-buffering on contexts Active le double-buffering sur les contextes bool ContextParameters::defaultDoubleBuffered = false; - // Active le partage des ressources entre contextes (Via le defaultShareContext) + // Enables ressource sharing on contexts (via defaultShareContext) bool ContextParameters::defaultShared = true; } diff --git a/src/Nazara/Renderer/TextureSampler.cpp b/src/Nazara/Renderer/TextureSampler.cpp index ec3b25dd7..4f1f9233f 100644 --- a/src/Nazara/Renderer/TextureSampler.cpp +++ b/src/Nazara/Renderer/TextureSampler.cpp @@ -129,7 +129,7 @@ namespace Nz if (s_useAnisotropicFilter) { - for (const std::pair& pair : s_samplers) + for (const std::pair& pair : s_samplers) { if (((pair.first >> 5) & 0xFF) == 0) glSamplerParameterf(pair.second, GL_TEXTURE_MAX_ANISOTROPY_EXT, static_cast(anisotropyLevel)); @@ -149,7 +149,7 @@ namespace Nz s_defaultFilterMode = filterMode; - for (const std::pair& pair : s_samplers) + for (const std::pair& pair : s_samplers) { if (((pair.first >> 1) & 0x3) == SamplerFilter_Default) { @@ -204,7 +204,7 @@ namespace Nz s_defaultWrapMode = wrapMode; GLenum wrapEnum = OpenGL::SamplerWrapMode[wrapMode]; - for (const std::pair& pair : s_samplers) + for (const std::pair& pair : s_samplers) { if (((pair.first >> 3) & 0x3) == SamplerWrap_Default) { @@ -380,7 +380,7 @@ namespace Nz if (!s_samplers.empty()) { Context::EnsureContext(); - for (const std::pair& pair : s_samplers) + for (const std::pair& pair : s_samplers) OpenGL::DeleteSampler(pair.second); s_samplers.clear(); diff --git a/src/Nazara/Utility/SimpleTextDrawer.cpp b/src/Nazara/Utility/SimpleTextDrawer.cpp index fb153185c..d7a1bc713 100644 --- a/src/Nazara/Utility/SimpleTextDrawer.cpp +++ b/src/Nazara/Utility/SimpleTextDrawer.cpp @@ -369,7 +369,7 @@ namespace Nz if (!m_glyphs.empty()) { Glyph& lastGlyph = m_glyphs.back(); - m_lines.back().bounds.ExtendTo(glyph.bounds); + m_lines.back().bounds.ExtendTo(lastGlyph.bounds); } // Reset cursor diff --git a/tests/Engine/Utility/EventHandler/EventState.cpp b/tests/Engine/Utility/EventHandler/EventState.cpp index 4f74e3000..9fa5ea244 100644 --- a/tests/Engine/Utility/EventHandler/EventState.cpp +++ b/tests/Engine/Utility/EventHandler/EventState.cpp @@ -53,9 +53,9 @@ void EventState::AddEvent(const Nz::WindowEvent& event) m_events.push_back(Nz::String::Number(m_count) + " - " + ToString(event)); Nz::String content; - for (auto&& event : m_events) + for (auto&& currentEvent : m_events) { - content += event + "\n"; + content += currentEvent + "\n"; } content += "\nM for Menu"; m_text.SetContent(content, 36); diff --git a/tests/Engine/Utility/EventHandler/KeyState.cpp b/tests/Engine/Utility/EventHandler/KeyState.cpp index 043dc5837..6244e8ed6 100644 --- a/tests/Engine/Utility/EventHandler/KeyState.cpp +++ b/tests/Engine/Utility/EventHandler/KeyState.cpp @@ -46,7 +46,7 @@ void KeyState::DrawMenu() m_text.SetContent("Clic on a key, this text should change !\nN for alternating event\nM for Menu"); } -void KeyState::ManageInput(KeyStatus isKeyPressed, const Nz::WindowEvent::KeyEvent& key, Ndk::StateMachine& fsm) +void KeyState::ManageInput(KeyStatus /*isKeyPressed*/, const Nz::WindowEvent::KeyEvent& key, Ndk::StateMachine& fsm) { if (key.code == Nz::Keyboard::Key::M && key.shift) fsm.ChangeState(StateFactory::Get(EventStatus::Menu)); diff --git a/tests/Engine/Utility/EventHandler/MouseClickState.cpp b/tests/Engine/Utility/EventHandler/MouseClickState.cpp index 1de923bd4..bc2627195 100644 --- a/tests/Engine/Utility/EventHandler/MouseClickState.cpp +++ b/tests/Engine/Utility/EventHandler/MouseClickState.cpp @@ -58,7 +58,7 @@ void MouseClickState::DrawMenu() m_text.SetContent("Click in the windows, this text should change !\nM for Menu"); } -void MouseClickState::ManageInput(MouseStatus mouseStatus, const Nz::WindowEvent::MouseButtonEvent& mouse, Ndk::StateMachine& fsm) +void MouseClickState::ManageInput(MouseStatus mouseStatus, const Nz::WindowEvent::MouseButtonEvent& mouse, Ndk::StateMachine& /*fsm*/) { Nz::String content; if (mouseStatus == MouseStatus::Pressed) diff --git a/tests/Engine/Utility/EventHandler/Text.cpp b/tests/Engine/Utility/EventHandler/Text.cpp index 75cece5b9..98637b276 100644 --- a/tests/Engine/Utility/EventHandler/Text.cpp +++ b/tests/Engine/Utility/EventHandler/Text.cpp @@ -11,7 +11,7 @@ Text::Text(StateContext& stateContext) : m_context(stateContext) { m_text = m_context.world.CreateEntity(); - Ndk::NodeComponent& nodeComponent = m_text->AddComponent(); + m_text->AddComponent(); Ndk::GraphicsComponent& graphicsComponent = m_text->AddComponent(); m_textSprite = Nz::TextSprite::New(); diff --git a/tests/SDK/NDK/EntityList.cpp b/tests/SDK/NDK/EntityList.cpp index 4b76766d5..30a57573d 100644 --- a/tests/SDK/NDK/EntityList.cpp +++ b/tests/SDK/NDK/EntityList.cpp @@ -16,8 +16,8 @@ SCENARIO("EntityList", "[NDK][ENTITYLIST]") THEN("These results are expected") { REQUIRE(entityList.Has(entity->GetId())); - const Ndk::EntityHandle& entity = world.CreateEntity(); - REQUIRE(!entityList.Has(entity->GetId())); + const Ndk::EntityHandle& newEntity = world.CreateEntity(); + REQUIRE(!entityList.Has(newEntity->GetId())); } }