bool NzMesh::IsAnimable() const { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Mesh not created"); return false; } #endif return m_impl->animationType != nzAnimationType_Static; }
void NzLuaInstance::Compute(nzLuaOperation operation) { #ifdef NAZARA_DEBUG if (operation > nzLuaOperation_Max) { NazaraError("Lua operation out of enum"); return; } #endif lua_arith(m_state, s_operations[operation]); }
void TaskScheduler::SetWorkerCount(unsigned int workerCount) { #ifdef NAZARA_CORE_SAFE if (TaskSchedulerImpl::IsInitialized()) { NazaraError("Worker count cannot be set while initialized"); return; } #endif s_workerCount = workerCount; }
bool Animation::IsLoopPointInterpolationEnabled() const { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Animation not created"); return false; } #endif return m_impl->loopPointInterpolation; }
void NzLuaInstance::CheckType(int index, nzLuaType type) const { #ifdef NAZARA_DEBUG if (type > nzLuaType_Max) { NazaraError("Lua type out of enum"); return; } #endif luaL_checktype(m_state, index, s_types[type]); }
unsigned int Animation::GetSequenceCount() const { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Animation not created"); return 0; } #endif return m_impl->sequences.size(); }
bool Animation::HasSequence(const String& sequenceName) const { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Animation not created"); return false; } #endif return m_impl->sequenceMap.find(sequenceName) != m_impl->sequenceMap.end(); }
UInt32 Music::GetSampleRate() const { #if NAZARA_AUDIO_SAFE if (!m_impl) { NazaraError("Music not created"); return 0; } #endif return m_impl->sampleRate; }
bool Music::IsLooping() const { #if NAZARA_AUDIO_SAFE if (!m_impl) { NazaraError("Music not created"); return false; } #endif return m_impl->loop; }
/*! * \brief Loads the sound from memory * \return true if loading is successful * * \param data Raw memory * \param size Size of the memory * \param params Parameters for the sound * * \remark Produces a NazaraError if loading failed */ bool Sound::LoadFromMemory(const void* data, std::size_t size, const SoundBufferParams& params) { SoundBufferRef buffer = SoundBuffer::New(); if (!buffer->LoadFromMemory(data, size, params)) { NazaraError("Failed to load buffer from memory (" + String::Pointer(data) + ')'); return false; } SetBuffer(buffer); return true; }
/*! * \brief Loads the sound from stream * \return true if loading is successful * * \param stream Stream to the sound * \param params Parameters for the sound * * \remark Produces a NazaraError if loading failed */ bool Sound::LoadFromStream(Stream& stream, const SoundBufferParams& params) { SoundBufferRef buffer = SoundBuffer::New(); if (!buffer->LoadFromStream(stream, params)) { NazaraError("Failed to load buffer from stream"); return false; } SetBuffer(buffer); return true; }
/*! * \brief Loads the sound from file * \return true if loading is successful * * \param filePath Path to the file * \param params Parameters for the sound * * \remark Produces a NazaraError if loading failed */ bool Sound::LoadFromFile(const String& filePath, const SoundBufferParams& params) { SoundBufferRef buffer = SoundBuffer::New(); if (!buffer->LoadFromFile(filePath, params)) { NazaraError("Failed to load buffer from file (" + filePath + ')'); return false; } SetBuffer(buffer); return true; }
bool SocketImpl::Initialize() { int errorCode = WSAStartup(MAKEWORD(2, 2), &s_WSA); if (errorCode != 0) { NazaraError("Failed to initialize Windows Socket 2.2: " + Error::GetLastSystemError(errorCode)); return false; } NazaraDebug("Initialized Windows Socket " + String::Number(LOBYTE(s_WSA.wVersion)) + '.' + String::Number(HIBYTE(s_WSA.wVersion)) + " (" + String(s_WSA.szDescription) + ')'); return true; }
void NzMesh::SetAnimation(const NzString& animationPath) { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Mesh not created"); return; } #endif m_impl->animationPath = animationPath; }
void Animation::EnableLoopPointInterpolation(bool loopPointInterpolation) { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Animation not created"); return; } #endif m_impl->loopPointInterpolation = loopPointInterpolation; }
void Music::EnableLooping(bool loop) { #if NAZARA_AUDIO_SAFE if (!m_impl) { NazaraError("Music not created"); return; } #endif m_impl->loop = loop; }
unsigned int Animation::GetFrameCount() const { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Animation not created"); return false; } #endif return m_impl->frameCount; }
UInt32 Music::GetDuration() const { #if NAZARA_AUDIO_SAFE if (!m_impl) { NazaraError("Music not created"); return 0; } #endif return m_impl->stream->GetDuration(); }
AnimationType Animation::GetType() const { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Animation not created"); return AnimationType_Static; // Ce qui est une valeur invalide pour Animation } #endif return m_impl->type; }
AudioFormat Music::GetFormat() const { #if NAZARA_AUDIO_SAFE if (!m_impl) { NazaraError("Music not created"); return AudioFormat_Unknown; } #endif return m_impl->stream->GetFormat(); }
bool Animation::HasSequence(unsigned int index) const { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Animation not created"); return false; } #endif return index >= m_impl->sequences.size(); }
void TaskSchedulerImpl::WaitForTasks() { #ifdef NAZARA_CORE_SAFE if (s_workerCount == 0) { NazaraError("Task scheduler is not initialized"); return; } #endif WaitForMultipleObjects(s_workerCount, &s_doneEvents[0], true, INFINITE); }
void Animation::RemoveSequence(unsigned int index) { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Animation not created"); return; } if (index >= m_impl->sequences.size()) { NazaraError("Sequence index out of range (" + String::Number(index) + " >= " + String::Number(m_impl->sequences.size()) + ')'); return; } #endif auto it = m_impl->sequences.begin(); std::advance(it, index); m_impl->sequences.erase(it); }
void NzScene::RegisterForUpdate(NzUpdatable* object) { #if NAZARA_GRAPHICS_SAFE if (!object) { NazaraError("Invalid object"); return; } #endif m_impl->updateList.push_back(object); }
bool NzLuaInstance::Compare(int index1, int index2, nzLuaComparison comparison) const { #ifdef NAZARA_DEBUG if (comparison > nzLuaComparison_Max) { NazaraError("Lua comparison out of enum"); return false; } #endif return (lua_compare(m_state, index1, index2, s_comparisons[comparison]) != 0); }
void EventImpl::SetMousePosition(int x, int y, const Window& relativeTo) { HWND handle = reinterpret_cast<HWND>(relativeTo.GetHandle()); if (handle) { POINT pos = {x, y}; ClientToScreen(handle, &pos); SetCursorPos(pos.x, pos.y); } else NazaraError("Invalid window handle"); }
const char* NzLuaInstance::GetTypeName(nzLuaType type) const { #ifdef NAZARA_DEBUG if (type > nzLuaType_Max) { NazaraError("Lua type out of enum"); return nullptr; } #endif return lua_typename(m_state, s_types[type]); }
bool RenderWindow::CopyToImage(AbstractImage* image, const Vector3ui& dstPos) const { #if NAZARA_RENDERER_SAFE if (!m_context) { NazaraError("Window has not been created"); return false; } #endif return CopyToImage(image, Rectui(Vector2ui(0U), GetSize()), dstPos); }
NzTexture* NzDeferredRenderTechnique::GetGBuffer(unsigned int i) const { #if NAZARA_GRAPHICS_SAFE if (i >= 3) { NazaraError("GBuffer texture index out of range (" + NzString::Number(i) + " >= 3)"); return nullptr; } #endif return m_GBuffer[i]; }
bool NzMesh::HasSubMesh(unsigned int index) const { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Mesh not created"); return false; } #endif return index < m_impl->subMeshes.size(); }