Ejemplo n.º 1
0
bool NzMesh::IsAnimable() const
{
	#if NAZARA_UTILITY_SAFE
	if (!m_impl)
	{
		NazaraError("Mesh not created");
		return false;
	}
	#endif

	return m_impl->animationType != nzAnimationType_Static;
}
Ejemplo n.º 2
0
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]);
}
Ejemplo n.º 3
0
	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;
	}
Ejemplo n.º 4
0
	bool Animation::IsLoopPointInterpolationEnabled() const
	{
		#if NAZARA_UTILITY_SAFE
		if (!m_impl)
		{
			NazaraError("Animation not created");
			return false;
		}
		#endif

		return m_impl->loopPointInterpolation;
	}
Ejemplo n.º 5
0
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]);
}
Ejemplo n.º 6
0
	unsigned int Animation::GetSequenceCount() const
	{
		#if NAZARA_UTILITY_SAFE
		if (!m_impl)
		{
			NazaraError("Animation not created");
			return 0;
		}
		#endif

		return m_impl->sequences.size();
	}
Ejemplo n.º 7
0
	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();
	}
Ejemplo n.º 8
0
	UInt32 Music::GetSampleRate() const
	{
		#if NAZARA_AUDIO_SAFE
		if (!m_impl)
		{
			NazaraError("Music not created");
			return 0;
		}
		#endif

		return m_impl->sampleRate;
	}
Ejemplo n.º 9
0
	bool Music::IsLooping() const
	{
		#if NAZARA_AUDIO_SAFE
		if (!m_impl)
		{
			NazaraError("Music not created");
			return false;
		}
		#endif

		return m_impl->loop;
	}
Ejemplo n.º 10
0
	/*!
	* \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;
	}
Ejemplo n.º 11
0
	/*!
	* \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;
	}
Ejemplo n.º 12
0
	/*!
	* \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;
	}
Ejemplo n.º 13
0
	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;
	}
Ejemplo n.º 14
0
void NzMesh::SetAnimation(const NzString& animationPath)
{
	#if NAZARA_UTILITY_SAFE
	if (!m_impl)
	{
		NazaraError("Mesh not created");
		return;
	}
	#endif

	m_impl->animationPath = animationPath;
}
Ejemplo n.º 15
0
	void Animation::EnableLoopPointInterpolation(bool loopPointInterpolation)
	{
		#if NAZARA_UTILITY_SAFE
		if (!m_impl)
		{
			NazaraError("Animation not created");
			return;
		}
		#endif

		m_impl->loopPointInterpolation = loopPointInterpolation;
	}
Ejemplo n.º 16
0
	void Music::EnableLooping(bool loop)
	{
		#if NAZARA_AUDIO_SAFE
		if (!m_impl)
		{
			NazaraError("Music not created");
			return;
		}
		#endif

		m_impl->loop = loop;
	}
Ejemplo n.º 17
0
	unsigned int Animation::GetFrameCount() const
	{
		#if NAZARA_UTILITY_SAFE
		if (!m_impl)
		{
			NazaraError("Animation not created");
			return false;
		}
		#endif

		return m_impl->frameCount;
	}
Ejemplo n.º 18
0
	UInt32 Music::GetDuration() const
	{
		#if NAZARA_AUDIO_SAFE
		if (!m_impl)
		{
			NazaraError("Music not created");
			return 0;
		}
		#endif

		return m_impl->stream->GetDuration();
	}
Ejemplo n.º 19
0
	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;
	}
Ejemplo n.º 20
0
	AudioFormat Music::GetFormat() const
	{
		#if NAZARA_AUDIO_SAFE
		if (!m_impl)
		{
			NazaraError("Music not created");
			return AudioFormat_Unknown;
		}
		#endif

		return m_impl->stream->GetFormat();
	}
Ejemplo n.º 21
0
	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();
	}
Ejemplo n.º 22
0
	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);
	}
Ejemplo n.º 23
0
	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);
	}
Ejemplo n.º 24
0
void NzScene::RegisterForUpdate(NzUpdatable* object)
{
	#if NAZARA_GRAPHICS_SAFE
	if (!object)
	{
		NazaraError("Invalid object");
		return;
	}
	#endif

	m_impl->updateList.push_back(object);
}
Ejemplo n.º 25
0
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);
}
Ejemplo n.º 26
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");
		}
Ejemplo n.º 27
0
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]);
}
Ejemplo n.º 28
0
	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];
}
Ejemplo n.º 30
0
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();
}