diff --git a/.gitignore b/.gitignore index 4de563671..6c6e64297 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ examples/bin/*.exe lib/libNazara*.a lib/Nazara*.dll lib/Nazara*.so +SDK/lib/libNazaraSDK*.a +SDK/lib/NazaraSDK*.dll +SDK/lib/NazaraSDK*.so # Codeblocks *.cbp @@ -15,13 +18,23 @@ lib/Nazara*.so # CodeLite *.project +# Visual Studio +*.filters +*.vcxproj +*.tlog +*.sln +*.vcxprojResolveAssemblyReference.cache +*.exp + # Compiled Object files *.slo *.lo *.o +*.obj # Compiled Dynamic libraries *.so +*.lib # Compiled Static libraries *.lai diff --git a/include/Nazara/Core/Color.inl b/include/Nazara/Core/Color.inl index 00b29321e..8e2caa76c 100644 --- a/include/Nazara/Core/Color.inl +++ b/include/Nazara/Core/Color.inl @@ -148,7 +148,7 @@ inline NzColor NzColor::FromHSV(float hue, float saturation, float value) if (NzNumberEquals(h, 6.f)) h = 0; // hue must be < 1 - int i = h; + int i = static_cast(h); float v1 = value * (1.f - s); float v2 = value * (1.f - s * (h - i)); float v3 = value * (1.f - s * (1.f - (h - i))); diff --git a/include/Nazara/Core/Endianness.hpp b/include/Nazara/Core/Endianness.hpp index 76b9e34ad..3f929f912 100644 --- a/include/Nazara/Core/Endianness.hpp +++ b/include/Nazara/Core/Endianness.hpp @@ -15,7 +15,8 @@ #if defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || (defined(__MIPS__) && defined(__MISPEB__)) || \ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || defined(__sparc__) || defined(__hppa__) #define NAZARA_BIG_ENDIAN - #elif defined(__i386__) || defined(__i386) || defined(__X86__) || defined (__x86_64) + #elif defined(__i386__) || defined(__i386) || defined(__X86__) || defined (__x86_64) || defined(_M_I86) || \ + defined(_M_IX86) || defined(_M_X64) #define NAZARA_LITTLE_ENDIAN #else #error Failed to identify endianness, you must define either NAZARA_BIG_ENDIAN or NAZARA_LITTLE_ENDIAN diff --git a/include/Nazara/Graphics/Model.hpp b/include/Nazara/Graphics/Model.hpp index e93b65679..c46a0c5aa 100644 --- a/include/Nazara/Graphics/Model.hpp +++ b/include/Nazara/Graphics/Model.hpp @@ -40,14 +40,10 @@ class NAZARA_API NzModel : public NzResource, public NzSceneNode virtual ~NzModel(); void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const override; - void AdvanceAnimation(float elapsedTime); NzModel* Clone() const; NzModel* Create() const; - void EnableAnimation(bool animation); - - NzAnimation* GetAnimation() const; NzMaterial* GetMaterial(const NzString& subMeshName) const; NzMaterial* GetMaterial(unsigned int matIndex) const; NzMaterial* GetMaterial(unsigned int skinIndex, const NzString& subMeshName) const; @@ -57,12 +53,7 @@ class NAZARA_API NzModel : public NzResource, public NzSceneNode unsigned int GetSkinCount() const; NzMesh* GetMesh() const; nzSceneNodeType GetSceneNodeType() const override; - NzSkeleton* GetSkeleton(); - const NzSkeleton* GetSkeleton() const; - bool HasAnimation() const; - - bool IsAnimationEnabled() const; virtual bool IsAnimated() const; bool IsDrawable() const; diff --git a/include/Nazara/Graphics/ParticleSystem.hpp b/include/Nazara/Graphics/ParticleSystem.hpp index 8484f4628..d4abb84e6 100644 --- a/include/Nazara/Graphics/ParticleSystem.hpp +++ b/include/Nazara/Graphics/ParticleSystem.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/include/Nazara/Graphics/SceneNode.hpp b/include/Nazara/Graphics/SceneNode.hpp index e05d7e68b..d34214137 100644 --- a/include/Nazara/Graphics/SceneNode.hpp +++ b/include/Nazara/Graphics/SceneNode.hpp @@ -23,7 +23,7 @@ class NAZARA_API NzSceneNode : public NzNode public: NzSceneNode(); NzSceneNode(const NzSceneNode& sceneNode); - NzSceneNode(NzSceneNode& sceneNode) = delete; + NzSceneNode(NzSceneNode&& sceneNode) = delete; virtual ~NzSceneNode(); virtual void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const = 0; diff --git a/include/Nazara/Utility/PixelFormat.inl b/include/Nazara/Utility/PixelFormat.inl index e399e408f..296bdc503 100644 --- a/include/Nazara/Utility/PixelFormat.inl +++ b/include/Nazara/Utility/PixelFormat.inl @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in Config.hpp #include +#include #include #include diff --git a/src/Nazara/Audio/Loaders/sndfile/Loader.cpp b/src/Nazara/Audio/Loaders/sndfile/Loader.cpp index 2c70f198b..140798a80 100644 --- a/src/Nazara/Audio/Loaders/sndfile/Loader.cpp +++ b/src/Nazara/Audio/Loaders/sndfile/Loader.cpp @@ -351,7 +351,7 @@ namespace if (info.format & SF_FORMAT_VORBIS) sf_command(file, SFC_SET_SCALE_FLOAT_INT_READ, nullptr, SF_TRUE); - sf_count_t sampleCount = info.frames * info.channels; + unsigned int sampleCount = static_cast(info.frames * info.channels); std::unique_ptr samples(new nzInt16[sampleCount]); if (sf_read_short(file, samples.get(), sampleCount) != sampleCount) @@ -364,14 +364,13 @@ namespace if (parameters.forceMono && format != nzAudioFormat_Mono) { // Nous effectuons la conversion en mono dans le même buffer (il va de toute façon être copié) - NzMixToMono(monoSamples.get(), monoSamples.get(), info.channels, info.frames); + NzMixToMono(samples.get(), samples.get(), static_cast(info.channels), static_cast(info.frames)); format = nzAudioFormat_Mono; - samples = std::move(monoSamples); - sampleCount = info.frames; + sampleCount = static_cast(info.frames); } - if (!soundBuffer->Create(format, static_cast(sampleCount), info.samplerate, samples.get())) + if (!soundBuffer->Create(format, sampleCount, info.samplerate, samples.get())) { NazaraError("Failed to create sound buffer"); return false; diff --git a/src/Nazara/Core/File.cpp b/src/Nazara/Core/File.cpp index 6c38f30f7..1acee0122 100644 --- a/src/Nazara/Core/File.cpp +++ b/src/Nazara/Core/File.cpp @@ -733,7 +733,7 @@ bool NzFile::FillHash(NzAbstractHash* hash) const unsigned int size; while (remainingSize > 0) { - size = std::min(remainingSize, static_cast(NAZARA_CORE_FILE_BUFFERSIZE)); + size = static_cast(std::min(remainingSize, static_cast(NAZARA_CORE_FILE_BUFFERSIZE))); if (file.Read(&buffer[0], sizeof(char), size) != sizeof(char)*size) { NazaraError("Unable to read file"); diff --git a/src/Nazara/Core/GuillotineBinPack.cpp b/src/Nazara/Core/GuillotineBinPack.cpp index 3127c4203..1d89515db 100644 --- a/src/Nazara/Core/GuillotineBinPack.cpp +++ b/src/Nazara/Core/GuillotineBinPack.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -22,8 +23,8 @@ namespace int ScoreBestLongSideFit(int width, int height, const NzRectui& freeRectSize) { - int leftoverHoriz = std::abs(freeRectSize.width - width); - int leftoverVert = std::abs(freeRectSize.height - height); + int leftoverHoriz = std::abs(static_cast(freeRectSize.width - width)); + int leftoverVert = std::abs(static_cast(freeRectSize.height - height)); int leftover = std::max(leftoverHoriz, leftoverVert); return leftover; @@ -31,8 +32,8 @@ namespace int ScoreBestShortSideFit(int width, int height, const NzRectui& freeRectSize) { - int leftoverHoriz = std::abs(freeRectSize.width - width); - int leftoverVert = std::abs(freeRectSize.height - height); + int leftoverHoriz = std::abs(static_cast(freeRectSize.width - width)); + int leftoverVert = std::abs(static_cast(freeRectSize.height - height)); int leftover = std::min(leftoverHoriz, leftoverVert); return leftover; diff --git a/src/Nazara/Core/HardwareInfo.cpp b/src/Nazara/Core/HardwareInfo.cpp index 6bc12835a..0309dd522 100644 --- a/src/Nazara/Core/HardwareInfo.cpp +++ b/src/Nazara/Core/HardwareInfo.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include diff --git a/src/Nazara/Core/HashDigest.cpp b/src/Nazara/Core/HashDigest.cpp index aeba77415..62baac0aa 100644 --- a/src/Nazara/Core/HashDigest.cpp +++ b/src/Nazara/Core/HashDigest.cpp @@ -5,9 +5,9 @@ #include #include #include +#include #include #include -#include #include NzHashDigest::NzHashDigest() : diff --git a/src/Nazara/Core/ParameterList.cpp b/src/Nazara/Core/ParameterList.cpp index 5b6e74b93..746f70ce6 100644 --- a/src/Nazara/Core/ParameterList.cpp +++ b/src/Nazara/Core/ParameterList.cpp @@ -91,7 +91,7 @@ bool NzParameterList::GetFloatParameter(const NzString& name, float* value) cons return true; case nzParameterType_Integer: - *value = it->second.value.intVal; + *value = static_cast(it->second.value.intVal); return true; case nzParameterType_String: @@ -99,7 +99,7 @@ bool NzParameterList::GetFloatParameter(const NzString& name, float* value) cons double converted; if (it->second.value.stringVal.ToDouble(&converted)) { - *value = converted; + *value = static_cast(converted); return true; } @@ -133,7 +133,7 @@ bool NzParameterList::GetIntegerParameter(const NzString& name, int* value) cons return true; case nzParameterType_Float: - *value = it->second.value.floatVal; + *value = static_cast(it->second.value.floatVal); return true; case nzParameterType_Integer: @@ -147,7 +147,7 @@ bool NzParameterList::GetIntegerParameter(const NzString& name, int* value) cons { if (converted <= std::numeric_limits::max() && converted >= std::numeric_limits::min()) { - *value = converted; + *value = static_cast(converted); return true; } } diff --git a/src/Nazara/Core/String.cpp b/src/Nazara/Core/String.cpp index af6cc630c..d2ba08601 100644 --- a/src/Nazara/Core/String.cpp +++ b/src/Nazara/Core/String.cpp @@ -3129,7 +3129,7 @@ NzString NzString::SubStringFrom(char character, int startPos, bool fromLast, bo else pos = Find(character, startPos, flags); - if (pos == 0 and include) + if (pos == 0 && include) return *this; else if (pos == npos) return NzString(); diff --git a/src/Nazara/Graphics/Loaders/OBJ/OBJParser.cpp b/src/Nazara/Graphics/Loaders/OBJ/OBJParser.cpp index 6bb87be56..fcefc2dd5 100644 --- a/src/Nazara/Graphics/Loaders/OBJ/OBJParser.cpp +++ b/src/Nazara/Graphics/Loaders/OBJ/OBJParser.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Nazara/Graphics/Scene.cpp b/src/Nazara/Graphics/Scene.cpp index 289ff1b1e..44e4b2610 100644 --- a/src/Nazara/Graphics/Scene.cpp +++ b/src/Nazara/Graphics/Scene.cpp @@ -81,12 +81,12 @@ void NzScene::Draw() if (m_renderTechniqueRanking > 0) { m_renderTechnique.reset(NzRenderTechniques::GetByRanking(m_renderTechniqueRanking-1, &m_renderTechniqueRanking)); - NazaraError("Render technique \"" + oldName + "\" failed, falling back to \"" + m_renderTechnique->GetName() + '"'); + NazaraError("Render technique \"" + oldName + "\" failed (" + NzString(e.what()) + "), falling back to \"" + m_renderTechnique->GetName() + '"'); } else { NzErrorFlags errFlags(nzErrorFlag_ThrowException); - NazaraError("Render technique \"" + oldName + "\" failed and no fallback is available"); + NazaraError("Render technique \"" + oldName + "\" failed (" + NzString(e.what()) + ") and no fallback is available"); } return; diff --git a/src/Nazara/Graphics/View.cpp b/src/Nazara/Graphics/View.cpp index 0316b9e53..07d7a2a97 100644 --- a/src/Nazara/Graphics/View.cpp +++ b/src/Nazara/Graphics/View.cpp @@ -294,7 +294,7 @@ void NzView::UpdateProjectionMatrix() const if (!m_viewportUpdated) UpdateViewport(); - m_projectionMatrix.MakeOrtho(0.f, m_viewport.width, 0.f, m_viewport.height, m_zNear, m_zFar); + m_projectionMatrix.MakeOrtho(0.f, static_cast(m_viewport.width), 0.f, static_cast(m_viewport.height), m_zNear, m_zFar); } else m_projectionMatrix.MakeOrtho(0.f, m_size.x, 0.f, m_size.y, m_zNear, m_zFar); diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index c232b8d25..c1e1fa875 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -173,7 +173,7 @@ bool NzLuaInstance::CheckBoolean(int index) const return false; } - return lua_toboolean(m_state, index); + return lua_toboolean(m_state, index) != 0; } bool NzLuaInstance::CheckBoolean(int index, bool defValue) const @@ -181,7 +181,7 @@ bool NzLuaInstance::CheckBoolean(int index, bool defValue) const if (lua_isnoneornil(m_state, index)) return defValue; - return lua_toboolean(m_state, index); + return lua_toboolean(m_state, index) != 0; } long long NzLuaInstance::CheckInteger(int index) const @@ -257,7 +257,7 @@ bool NzLuaInstance::Compare(int index1, int index2, nzLuaComparison comparison) } #endif - return (lua_compare(m_state, index1, index2, s_comparisons[comparison]) == 1); + return (lua_compare(m_state, index1, index2, s_comparisons[comparison]) != 0); } void NzLuaInstance::Compute(nzLuaOperation operation) @@ -476,7 +476,7 @@ nzLuaType NzLuaInstance::GetMetatable(const NzString& tname) const bool NzLuaInstance::GetMetatable(int index) const { - return lua_getmetatable(m_state, index) == 1; + return lua_getmetatable(m_state, index) != 0; } unsigned int NzLuaInstance::GetStackTop() const @@ -522,34 +522,34 @@ bool NzLuaInstance::IsOfType(int index, nzLuaType type) const switch (type) { case nzLuaType_Boolean: - return lua_isboolean(m_state, index) == 1; + return lua_isboolean(m_state, index) != 0; case nzLuaType_Function: - return lua_isfunction(m_state, index) == 1; + return lua_isfunction(m_state, index) != 0; case nzLuaType_LightUserdata: - return lua_islightuserdata(m_state, index) == 1; + return lua_islightuserdata(m_state, index) != 0; case nzLuaType_Nil: - return lua_isnil(m_state, index) == 1; + return lua_isnil(m_state, index) != 0; case nzLuaType_None: - return lua_isnone(m_state, index) == 1; + return lua_isnone(m_state, index) != 0; case nzLuaType_Number: - return lua_isnumber(m_state, index) == 1; + return lua_isnumber(m_state, index) != 0; case nzLuaType_String: - return lua_isstring(m_state, index) == 1; + return lua_isstring(m_state, index) != 0; case nzLuaType_Table: - return lua_istable(m_state, index) == 1; + return lua_istable(m_state, index) != 0; case nzLuaType_Thread: - return lua_isthread(m_state, index) == 1; + return lua_isthread(m_state, index) != 0; case nzLuaType_Userdata: - return lua_isuserdata(m_state, index) == 1; + return lua_isuserdata(m_state, index) != 0; } NazaraError("Lua type not handled (0x" + NzString::Number(type, 16) + ')'); @@ -569,7 +569,7 @@ bool NzLuaInstance::IsOfType(int index, const NzString& tname) const bool NzLuaInstance::IsValid(int index) const { - return !lua_isnoneornil(m_state, index); + return lua_isnoneornil(m_state, index) == 0; } unsigned int NzLuaInstance::Length(int index) const @@ -584,17 +584,17 @@ void NzLuaInstance::MoveTo(NzLuaInstance* instance, int n) bool NzLuaInstance::NewMetatable(const char* str) { - return luaL_newmetatable(m_state, str) == 1; + return luaL_newmetatable(m_state, str) != 0; } bool NzLuaInstance::NewMetatable(const NzString& str) { - return luaL_newmetatable(m_state, str.GetConstBuffer()); + return luaL_newmetatable(m_state, str.GetConstBuffer()) != 0; } bool NzLuaInstance::Next(int index) { - return lua_next(m_state, index) == 1; + return lua_next(m_state, index) != 0; } void NzLuaInstance::Pop(unsigned int n) @@ -604,7 +604,7 @@ void NzLuaInstance::Pop(unsigned int n) void NzLuaInstance::PushBoolean(bool value) { - lua_pushboolean(m_state, value); + lua_pushboolean(m_state, (value) ? 1 : 0); } void NzLuaInstance::PushCFunction(NzLuaCFunction func, int upvalueCount) @@ -750,7 +750,7 @@ void NzLuaInstance::SetTimeLimit(nzUInt32 timeLimit) bool NzLuaInstance::ToBoolean(int index) const { - return lua_toboolean(m_state, index); + return lua_toboolean(m_state, index) != 0; } long long NzLuaInstance::ToInteger(int index, bool* succeeded) const @@ -759,7 +759,7 @@ long long NzLuaInstance::ToInteger(int index, bool* succeeded) const long long result = lua_tointegerx(m_state, index, &success); if (succeeded) - *succeeded = (success == 1); + *succeeded = (success != 0); return result; } @@ -770,7 +770,7 @@ double NzLuaInstance::ToNumber(int index, bool* succeeded) const double result = lua_tonumberx(m_state, index, &success); if (succeeded) - *succeeded = (success == 1); + *succeeded = (success != 0); return result; } diff --git a/src/Nazara/Renderer/UberShaderPreprocessor.cpp b/src/Nazara/Renderer/UberShaderPreprocessor.cpp index 9654a9ee8..efcc492c5 100644 --- a/src/Nazara/Renderer/UberShaderPreprocessor.cpp +++ b/src/Nazara/Renderer/UberShaderPreprocessor.cpp @@ -92,7 +92,7 @@ NzUberShaderInstance* NzUberShaderPreprocessor::Get(const NzParameterList& param // On construit l'instant shaderIt = m_cache.emplace(flags, shader.Get()).first; } - catch (const std::exception& e) + catch (const std::exception&) { NzErrorFlags errFlags(nzErrorFlag_ThrowExceptionDisabled); diff --git a/src/Nazara/Utility/Loaders/FreeType/Loader.cpp b/src/Nazara/Utility/Loaders/FreeType/Loader.cpp index 70f65bc89..b16c89d02 100644 --- a/src/Nazara/Utility/Loaders/FreeType/Loader.cpp +++ b/src/Nazara/Utility/Loaders/FreeType/Loader.cpp @@ -212,12 +212,12 @@ namespace bool HasKerning() const override { - return FT_HAS_KERNING(m_face); + return FT_HAS_KERNING(m_face) != 0; } bool IsScalable() const override { - return FT_IS_SCALABLE(m_face); + return FT_IS_SCALABLE(m_face) != 0; } bool Open() diff --git a/src/Nazara/Utility/SimpleTextDrawer.cpp b/src/Nazara/Utility/SimpleTextDrawer.cpp index 1f47c0914..020ad021d 100644 --- a/src/Nazara/Utility/SimpleTextDrawer.cpp +++ b/src/Nazara/Utility/SimpleTextDrawer.cpp @@ -296,5 +296,5 @@ void NzSimpleTextDrawer::UpdateGlyphs() const m_glyphs.push_back(glyph); } - m_bounds.Set(std::floor(textBounds.x), std::floor(textBounds.y), std::ceil(textBounds.width), std::ceil(textBounds.height)); + m_bounds.Set(NzRectf(std::floor(textBounds.x), std::floor(textBounds.y), std::ceil(textBounds.width), std::ceil(textBounds.height))); } diff --git a/src/Nazara/Utility/Win32/CursorImpl.cpp b/src/Nazara/Utility/Win32/CursorImpl.cpp index 1b5f2ddf1..c772c1035 100644 --- a/src/Nazara/Utility/Win32/CursorImpl.cpp +++ b/src/Nazara/Utility/Win32/CursorImpl.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include bool NzCursorImpl::Create(const NzImage& cursor, int hotSpotX, int hotSpotY) diff --git a/src/Nazara/Utility/Win32/IconImpl.cpp b/src/Nazara/Utility/Win32/IconImpl.cpp index 078a9fece..d4b6970bd 100644 --- a/src/Nazara/Utility/Win32/IconImpl.cpp +++ b/src/Nazara/Utility/Win32/IconImpl.cpp @@ -4,6 +4,7 @@ #include #include +#include #include bool NzIconImpl::Create(const NzImage& icon)