コード例 #1
0
void ScriptComponent::Initialize()
{
    if (m_pFileName != nullptr)
    {
        IFile *pFile = MediaManager::Instance().FindMedia(m_pFileName, false);
        SetScriptFromBuffer(pFile->GetBuffer(), pFile->GetBufferLength());
        DELETE_AO pFile;

        //TODO crash
        //Game::Instance()->GetScriptEngine()->SetField(GetEntity(), "entity");

        //call function OnScriptInitialize()
        //Game::Instance()->GetScriptEngine()->CallFunction("OnScriptInitialize");
    }
}
コード例 #2
0
ファイル: AudioEngine.cpp プロジェクト: xcasadio/casaengine
//! OGG callback to read from a binary stream in memory.
size_t AudioEngine::OggRead(void *ptr, size_t size, size_t read, void *memory_ptr)
{
	unsigned int seof, pos;

	IFile *file = (IFile *) memory_ptr;

	seof = file->GetBufferLength() - file->Position();

	pos = ((read * size) < seof) ? pos = read * size :
	pos = seof;

	if (pos)
	{
		//memcpy(ptr, memory->buffer + memory->position, pos );
		//memory->position += pos;
	}

	return pos;
}