diff --git a/include/Nazara/Core/ApplicationBase.inl b/include/Nazara/Core/ApplicationBase.inl index 98de4c57d..bc003a5c1 100644 --- a/include/Nazara/Core/ApplicationBase.inl +++ b/include/Nazara/Core/ApplicationBase.inl @@ -146,4 +146,3 @@ namespace Nz } #include -#include "ApplicationBase.hpp" diff --git a/include/Nazara/Core/ModuleBase.inl b/include/Nazara/Core/ModuleBase.inl index 070672ecd..3649d40d4 100644 --- a/include/Nazara/Core/ModuleBase.inl +++ b/include/Nazara/Core/ModuleBase.inl @@ -18,7 +18,7 @@ namespace Nz ModuleBase::ModuleBase(std::string moduleName, T* pointer, NoLog) : m_moduleName(std::move(moduleName)) { - NazaraAssert(T::s_instance == nullptr, "only one instance of " + m_moduleName + " can exist at a given time"); + NazaraAssertFmt(T::s_instance == nullptr, "only one instance of {} can exist at a given time", m_moduleName); T::s_instance = pointer; } diff --git a/include/Nazara/Core/ResourceSaver.inl b/include/Nazara/Core/ResourceSaver.inl index c25f755b3..8f783feb7 100644 --- a/include/Nazara/Core/ResourceSaver.inl +++ b/include/Nazara/Core/ResourceSaver.inl @@ -37,7 +37,7 @@ namespace Nz template bool ResourceSaver::IsExtensionSupported(std::string_view extension) const { - NazaraAssert(extension.size() >= 2 || extension.front() != '.', "extension should start with a ."); + NazaraAssertFmt(extension.size() >= 2 || extension.front() != '.', "extension should start with a . (got {})", extension); for (const auto& saverPtr : m_savers) { diff --git a/include/Nazara/Graphics/InstancedRenderable.hpp b/include/Nazara/Graphics/InstancedRenderable.hpp index d334c0118..66cf647a7 100644 --- a/include/Nazara/Graphics/InstancedRenderable.hpp +++ b/include/Nazara/Graphics/InstancedRenderable.hpp @@ -36,7 +36,7 @@ namespace Nz virtual void BuildElement(ElementRendererRegistry& registry, const ElementData& elementData, std::size_t passIndex, std::vector& elements) const = 0; inline const Boxf& GetAABB() const; - virtual const std::shared_ptr& GetMaterial(std::size_t i) const = 0; + virtual const std::shared_ptr& GetMaterial(std::size_t materialIndex) const = 0; virtual std::size_t GetMaterialCount() const = 0; inline int GetRenderLayer() const; diff --git a/include/Nazara/Graphics/LinearSlicedSprite.hpp b/include/Nazara/Graphics/LinearSlicedSprite.hpp index ba372d106..2fc91f2b2 100644 --- a/include/Nazara/Graphics/LinearSlicedSprite.hpp +++ b/include/Nazara/Graphics/LinearSlicedSprite.hpp @@ -35,7 +35,7 @@ namespace Nz inline void Clear(); inline const Color& GetColor() const; - const std::shared_ptr& GetMaterial(std::size_t i = 0) const override; + const std::shared_ptr& GetMaterial(std::size_t materialIndex = 0) const override; std::size_t GetMaterialCount() const override; inline Orientation GetOrientation() const; inline const Vector2f& GetOrigin() const; diff --git a/include/Nazara/Graphics/LinearSlicedSprite.inl b/include/Nazara/Graphics/LinearSlicedSprite.inl index adfa4e91a..64fca4ead 100644 --- a/include/Nazara/Graphics/LinearSlicedSprite.inl +++ b/include/Nazara/Graphics/LinearSlicedSprite.inl @@ -43,7 +43,7 @@ namespace Nz inline auto LinearSlicedSprite::GetSection(std::size_t sectionIndex) const -> const Section& { - NazaraAssert(sectionIndex < m_sectionCount, "out of range section"); + NazaraAssertFmt(sectionIndex < m_sectionCount, "section index ouf of range ({0} >= {1})", sectionIndex, m_sectionCount); return m_sections[sectionIndex]; } @@ -71,7 +71,7 @@ namespace Nz inline void LinearSlicedSprite::RemoveSection(std::size_t sectionIndex) { - NazaraAssert(sectionIndex < m_sectionCount, "out of range section"); + NazaraAssertFmt(sectionIndex < m_sectionCount, "section index ouf of range ({0} >= {1})", sectionIndex, m_sectionCount); if (m_sectionCount >= sectionIndex + 1) std::move(m_sections.begin() + sectionIndex + 1, m_sections.begin() + m_sectionCount, m_sections.begin() + sectionIndex); @@ -102,7 +102,7 @@ namespace Nz inline void LinearSlicedSprite::SetSection(std::size_t sectionIndex, float size, float textureCoord) { - NazaraAssert(sectionIndex < m_sectionCount, "out of range section"); + NazaraAssertFmt(sectionIndex < m_sectionCount, "section index ouf of range ({0} >= {1})", sectionIndex, m_sectionCount); auto& section = m_sections[sectionIndex]; section.size = size; @@ -113,7 +113,7 @@ namespace Nz inline void LinearSlicedSprite::SetSectionSize(std::size_t sectionIndex, float size) { - NazaraAssert(sectionIndex < m_sectionCount, "out of range section"); + NazaraAssertFmt(sectionIndex < m_sectionCount, "section index ouf of range ({0} >= {1})", sectionIndex, m_sectionCount); auto& section = m_sections[sectionIndex]; section.size = size; @@ -123,7 +123,7 @@ namespace Nz inline void LinearSlicedSprite::SetSectionTextureCoord(std::size_t sectionIndex, float textureCoord) { - NazaraAssert(sectionIndex < m_sectionCount, "out of range section"); + NazaraAssertFmt(sectionIndex < m_sectionCount, "section index ouf of range ({0} >= {1})", sectionIndex, m_sectionCount); auto& section = m_sections[sectionIndex]; section.textureCoord = textureCoord; @@ -133,7 +133,7 @@ namespace Nz inline void LinearSlicedSprite::SetSize(float size) { - NazaraAssert(size >= 0.f, "size must be positive"); + NazaraAssertFmt(size >= 0.f, "size must be positive (got {0})", size); m_size = size; diff --git a/include/Nazara/Graphics/Model.inl b/include/Nazara/Graphics/Model.inl index f0864b1d9..e011b36d6 100644 --- a/include/Nazara/Graphics/Model.inl +++ b/include/Nazara/Graphics/Model.inl @@ -2,7 +2,7 @@ // This file is part of the "Nazara Engine - Graphics module" // For conditions of distribution and use, see copyright notice in Config.hpp -#include +#include #include namespace Nz @@ -14,8 +14,8 @@ namespace Nz inline void Model::SetMaterial(std::size_t subMeshIndex, std::shared_ptr material) { - assert(subMeshIndex < m_submeshes.size()); - assert(material); + NazaraAssertFmt(subMeshIndex < m_submeshes.size(), "submesh index out of range ({0} >= {1})", subMeshIndex, m_submeshes.size()); + NazaraAssert(material, "invalid material"); if (m_submeshes[subMeshIndex].material != material) { diff --git a/include/Nazara/Graphics/SlicedSprite.hpp b/include/Nazara/Graphics/SlicedSprite.hpp index 44cffd1c1..33e5bb05c 100644 --- a/include/Nazara/Graphics/SlicedSprite.hpp +++ b/include/Nazara/Graphics/SlicedSprite.hpp @@ -31,7 +31,7 @@ namespace Nz inline const Color& GetColor() const; inline const Corner& GetBottomRightCorner() const; - const std::shared_ptr& GetMaterial(std::size_t i = 0) const override; + const std::shared_ptr& GetMaterial(std::size_t materialIndex = 0) const override; std::size_t GetMaterialCount() const override; inline const Vector2f& GetOrigin() const; inline const Vector2f& GetSize() const; diff --git a/include/Nazara/Graphics/SlicedSprite.inl b/include/Nazara/Graphics/SlicedSprite.inl index da501446a..f271e0930 100644 --- a/include/Nazara/Graphics/SlicedSprite.inl +++ b/include/Nazara/Graphics/SlicedSprite.inl @@ -2,7 +2,7 @@ // This file is part of the "Nazara Engine - Graphics module" // For conditions of distribution and use, see copyright notice in Config.hpp -#include +#include #include namespace Nz @@ -70,7 +70,7 @@ namespace Nz inline void SlicedSprite::SetMaterial(std::shared_ptr material) { - assert(material); + NazaraAssert(material, "invalid material"); if (m_material != material) { diff --git a/include/Nazara/Graphics/Tilemap.inl b/include/Nazara/Graphics/Tilemap.inl index e527d8658..08070b15c 100644 --- a/include/Nazara/Graphics/Tilemap.inl +++ b/include/Nazara/Graphics/Tilemap.inl @@ -120,7 +120,7 @@ namespace Nz inline void Tilemap::EnableTile(const Vector2ui& tilePos, const Rectf& coords, const Color& color, std::size_t materialIndex) { NazaraAssert(tilePos.x < m_mapSize.x&& tilePos.y < m_mapSize.y, "Tile position is out of bounds"); - NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds"); + NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size()); std::size_t tileIndex = tilePos.y * m_mapSize.x + tilePos.x; Tile& tile = m_tiles[tilePos.y * m_mapSize.x + tilePos.x]; @@ -168,7 +168,7 @@ namespace Nz */ inline void Tilemap::EnableTile(const Vector2ui& tilePos, const Rectui& rect, const Color& color, std::size_t materialIndex) { - NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds"); + NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size()); Vector2ui textureSize(GetTextureSize(materialIndex)); float invWidth = 1.f / textureSize.x; @@ -194,7 +194,7 @@ namespace Nz */ inline void Tilemap::EnableTiles(const Rectf& coords, const Color& color, std::size_t materialIndex) { - NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds"); + NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size()); for (Layer& layer : m_layers) layer.enabledTiles.Reset(); @@ -231,7 +231,7 @@ namespace Nz */ inline void Tilemap::EnableTiles(const Rectui& rect, const Color& color, std::size_t materialIndex) { - NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds"); + NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size()); Vector2ui textureSize(GetTextureSize(materialIndex)); float invWidth = 1.f / textureSize.x; @@ -257,7 +257,7 @@ namespace Nz inline void Tilemap::EnableTiles(const Vector2ui* tilesPos, std::size_t tileCount, const Rectf& coords, const Color& color, std::size_t materialIndex) { NazaraAssert(tilesPos || tileCount == 0, "Invalid tile position array with a non-zero tileCount"); - NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds"); + NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size()); for (std::size_t i = 0; i < tileCount; ++i) { @@ -316,7 +316,7 @@ namespace Nz */ inline void Tilemap::EnableTiles(const Vector2ui* tilesPos, std::size_t tileCount, const Rectui& rect, const Color& color, std::size_t materialIndex) { - NazaraAssert(materialIndex < m_layers.size(), "Material out of bounds"); + NazaraAssertFmt(materialIndex < m_layers.size(), "material index out of bounds ({0} >= {1})", materialIndex, m_layers.size()); Vector2ui textureSize(GetTextureSize(materialIndex)); float invWidth = 1.f / textureSize.x; diff --git a/include/Nazara/Math/Box.inl b/include/Nazara/Math/Box.inl index e3cb63baf..98fa1f0d1 100644 --- a/include/Nazara/Math/Box.inl +++ b/include/Nazara/Math/Box.inl @@ -640,7 +640,7 @@ namespace Nz template constexpr T& Box::operator[](std::size_t i) { - NazaraAssert(i < 6, "Index out of range"); + NazaraAssertFmt(i < 6, "index out of range ({0} >= 6)", i); return *(&x+i); } @@ -656,7 +656,7 @@ namespace Nz template constexpr const T& Box::operator[](std::size_t i) const { - NazaraAssert(i < 6, "Index out of range"); + NazaraAssertFmt(i < 6, "index out of range ({0} >= 6)", i); return *(&x+i); } diff --git a/include/Nazara/Widgets/AbstractTextAreaWidget.inl b/include/Nazara/Widgets/AbstractTextAreaWidget.inl index 1c2e09f4b..3bd1bff76 100644 --- a/include/Nazara/Widgets/AbstractTextAreaWidget.inl +++ b/include/Nazara/Widgets/AbstractTextAreaWidget.inl @@ -262,4 +262,3 @@ namespace Nz } #include -#include "AbstractTextAreaWidget.hpp" diff --git a/src/Nazara/Core/Stream.cpp b/src/Nazara/Core/Stream.cpp index 47da32b4a..640bdb420 100644 --- a/src/Nazara/Core/Stream.cpp +++ b/src/Nazara/Core/Stream.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/src/Nazara/Core/ThreadExt.cpp b/src/Nazara/Core/ThreadExt.cpp index 955450b7b..72467d7c1 100644 --- a/src/Nazara/Core/ThreadExt.cpp +++ b/src/Nazara/Core/ThreadExt.cpp @@ -39,7 +39,6 @@ namespace Nz { NAZARA_USE_ANONYMOUS_NAMESPACE - // std::thread::native_handle returns a void* with MSVC instead of a HANDLE return PlatformImpl::GetThreadName(GetHandle(thread)); } @@ -52,7 +51,6 @@ namespace Nz { NAZARA_USE_ANONYMOUS_NAMESPACE - // std::thread::native_handle returns a void* with MSVC instead of a HANDLE PlatformImpl::SetThreadName(GetHandle(thread), name); } } diff --git a/src/Nazara/Graphics/LinearSlicedSprite.cpp b/src/Nazara/Graphics/LinearSlicedSprite.cpp index b330ee724..df6b3aed4 100644 --- a/src/Nazara/Graphics/LinearSlicedSprite.cpp +++ b/src/Nazara/Graphics/LinearSlicedSprite.cpp @@ -47,11 +47,9 @@ namespace Nz elements.emplace_back(registry.AllocateElement(GetRenderLayer(), m_material, passFlags, renderPipeline, *elementData.worldInstance, vertexDeclaration, whiteTexture, m_spriteCount, m_vertices.data(), *elementData.scissorBox)); } - const std::shared_ptr& LinearSlicedSprite::GetMaterial(std::size_t i) const + const std::shared_ptr& LinearSlicedSprite::GetMaterial(std::size_t materialIndex) const { - assert(i == 0); - NazaraUnused(i); - + NazaraAssertFmt(materialIndex == 0, "material index out of range ({0} >= 1)", materialIndex); return m_material; } diff --git a/src/Nazara/Graphics/Model.cpp b/src/Nazara/Graphics/Model.cpp index 4fa6eb033..e7775218e 100644 --- a/src/Nazara/Graphics/Model.cpp +++ b/src/Nazara/Graphics/Model.cpp @@ -79,7 +79,7 @@ namespace Nz const std::shared_ptr& Model::GetMaterial(std::size_t subMeshIndex) const { - assert(subMeshIndex < m_submeshes.size()); + NazaraAssertFmt(subMeshIndex < m_submeshes.size(), "material index out of range ({0} >= {1})", subMeshIndex, m_submeshes.size()); const auto& subMeshData = m_submeshes[subMeshIndex]; return subMeshData.material; } @@ -91,7 +91,7 @@ namespace Nz const std::vector& Model::GetVertexBufferData(std::size_t subMeshIndex) const { - assert(subMeshIndex < m_submeshes.size()); + NazaraAssertFmt(subMeshIndex < m_submeshes.size(), "submesh index out of range ({0} >= {1})", subMeshIndex, m_submeshes.size()); const auto& subMeshData = m_submeshes[subMeshIndex]; return subMeshData.vertexBufferData; } diff --git a/src/Nazara/Graphics/SlicedSprite.cpp b/src/Nazara/Graphics/SlicedSprite.cpp index 1a496289b..7bd77c385 100644 --- a/src/Nazara/Graphics/SlicedSprite.cpp +++ b/src/Nazara/Graphics/SlicedSprite.cpp @@ -42,11 +42,9 @@ namespace Nz elements.emplace_back(registry.AllocateElement(GetRenderLayer(), m_material, passFlags, renderPipeline, *elementData.worldInstance, vertexDeclaration, whiteTexture, m_spriteCount, m_vertices.data(), *elementData.scissorBox)); } - const std::shared_ptr& SlicedSprite::GetMaterial(std::size_t i) const + const std::shared_ptr& SlicedSprite::GetMaterial(std::size_t materialIndex) const { - assert(i == 0); - NazaraUnused(i); - + NazaraAssertFmt(materialIndex == 0, "material index out of range ({0} >= 1)", materialIndex); return m_material; } diff --git a/src/Nazara/Graphics/Tilemap.cpp b/src/Nazara/Graphics/Tilemap.cpp index 1d99e908e..12fb37153 100644 --- a/src/Nazara/Graphics/Tilemap.cpp +++ b/src/Nazara/Graphics/Tilemap.cpp @@ -25,14 +25,14 @@ namespace Nz */ Tilemap::Tilemap(const Vector2ui& mapSize, const Vector2f& tileSize, std::size_t materialCount) : m_layers(materialCount), - m_tiles(mapSize.x* mapSize.y), + m_tiles(mapSize.x * mapSize.y), m_origin(0.f, 0.f), m_tileSize(tileSize), m_mapSize(mapSize), m_isometricModeEnabled(false), m_shouldRebuildVertices(false) { - NazaraAssert(m_tiles.size() != 0U, "Invalid map size"); + NazaraAssert(m_tiles.size() != 0U, "invalid map size"); NazaraAssert(m_tileSize.x > 0 && m_tileSize.y > 0, "Invalid tile size"); NazaraAssert(m_layers.size() != 0U, "Invalid material count"); diff --git a/src/Nazara/OpenGLRenderer/Wrapper/WGL/WGLLoader.cpp b/src/Nazara/OpenGLRenderer/Wrapper/WGL/WGLLoader.cpp index 3853a21bf..636c80792 100644 --- a/src/Nazara/OpenGLRenderer/Wrapper/WGL/WGLLoader.cpp +++ b/src/Nazara/OpenGLRenderer/Wrapper/WGL/WGLLoader.cpp @@ -12,7 +12,7 @@ namespace Nz::GL WGLLoader::WGLLoader(const Renderer::Config& config) : m_baseContext(nullptr, *this) { - if (!m_opengl32Lib.Load("opengl32" NAZARA_DYNLIB_EXTENSION)) + if (!m_opengl32Lib.Load("opengl32.dll")) throw std::runtime_error("Failed to load opengl32 library, is OpenGL installed on your system?"); if (!m_gdi32Lib.Load("gdi32.dll"))