mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-22 01:55:25 -04:00
44124711e9
Adapted to changes in GDCore/GDL. git-svn-id: svn://localhost@768 8062f311-0dae-4547-b526-b8ab9ac864a5
41 lines
782 B
C++
41 lines
782 B
C++
#include "TheoraMemoryLoader.h"
|
|
#include <memory.h>
|
|
|
|
TheoraMemoryLoader::TheoraMemoryLoader(std::string name, unsigned char *source, unsigned long size) :
|
|
mReadPointer(0),
|
|
mData(0)
|
|
{
|
|
mName = name;
|
|
mData = source;
|
|
mSize = size;
|
|
}
|
|
|
|
TheoraMemoryLoader::~TheoraMemoryLoader()
|
|
{
|
|
//if (mData) delete [] mData;
|
|
}
|
|
|
|
int TheoraMemoryLoader::read(void* output,int nBytes)
|
|
{
|
|
int n=(mReadPointer+nBytes <= mSize) ? nBytes : mSize-mReadPointer;
|
|
if (!n) return 0;
|
|
memcpy(output,mData+mReadPointer,n);
|
|
mReadPointer+=n;
|
|
return n;
|
|
}
|
|
|
|
void TheoraMemoryLoader::seek(unsigned long byte_index)
|
|
{
|
|
mReadPointer=byte_index;
|
|
}
|
|
|
|
unsigned long TheoraMemoryLoader::size()
|
|
{
|
|
return mSize;
|
|
}
|
|
|
|
unsigned long TheoraMemoryLoader::tell()
|
|
{
|
|
return mReadPointer;
|
|
}
|