Binding more class in IO lib to Lua, Fixed multi inheritance class.
This commit is contained in:
parent
da45ff6b6b
commit
00342501ab
@ -2,10 +2,9 @@ $#include "Deserializer.h"
|
||||
|
||||
class Deserializer
|
||||
{
|
||||
virtual unsigned Seek(unsigned position);
|
||||
|
||||
virtual const String& GetName() const;
|
||||
virtual unsigned GetChecksum();
|
||||
unsigned Seek(unsigned position);
|
||||
const String& GetName() const;
|
||||
unsigned GetChecksum();
|
||||
unsigned GetPosition() const;
|
||||
unsigned GetSize() const;
|
||||
bool IsEof() const;
|
||||
@ -33,6 +32,10 @@ class Deserializer
|
||||
String ReadFileID();
|
||||
StringHash ReadStringHash();
|
||||
ShortStringHash ReadShortStringHash();
|
||||
|
||||
// PODVector<unsigned char> ReadBuffer();
|
||||
VectorBuffer ReadBuffer();
|
||||
|
||||
ResourceRef ReadResourceRef();
|
||||
ResourceRefList ReadResourceRefList();
|
||||
Variant ReadVariant();
|
||||
@ -48,4 +51,4 @@ class Deserializer
|
||||
tolua_readonly tolua_property__get_set unsigned position;
|
||||
tolua_readonly tolua_property__get_set unsigned size;
|
||||
tolua_readonly tolua_property__is_set bool eof;
|
||||
};
|
||||
};
|
||||
|
@ -7,18 +7,12 @@ enum FileMode
|
||||
FILE_READWRITE
|
||||
};
|
||||
|
||||
class File : public Deserializer
|
||||
class File : public Object
|
||||
{
|
||||
File(Context* context);
|
||||
File(Context* context, const String fileName, FileMode mode = FILE_READ);
|
||||
File(Context* context, PackageFile* package, const String fileName);
|
||||
virtual ~File();
|
||||
|
||||
virtual unsigned Read(void* dest, unsigned size);
|
||||
virtual unsigned Seek(unsigned position);
|
||||
virtual unsigned Write(const void* data, unsigned size);
|
||||
virtual const String& GetName() const;
|
||||
virtual unsigned GetChecksum();
|
||||
~File();
|
||||
|
||||
bool Open(const String fileName, FileMode mode = FILE_READ);
|
||||
bool Open(PackageFile* package, const String fileName);
|
||||
@ -31,9 +25,97 @@ class File : public Deserializer
|
||||
void* GetHandle() const;
|
||||
bool IsPackaged() const;
|
||||
|
||||
tolua_readonly tolua_property__get_set String& name;
|
||||
tolua_readonly tolua_property__get_set unsigned checksum;
|
||||
// From Deserializer
|
||||
unsigned Seek(unsigned position);
|
||||
const String& GetName() const;
|
||||
unsigned GetChecksum();
|
||||
unsigned GetPosition() const;
|
||||
unsigned GetSize() const;
|
||||
bool IsEof() const;
|
||||
|
||||
int ReadInt();
|
||||
short ReadShort();
|
||||
signed char ReadByte();
|
||||
unsigned ReadUInt();
|
||||
unsigned short ReadUShort();
|
||||
unsigned char ReadUByte();
|
||||
bool ReadBool();
|
||||
float ReadFloat();
|
||||
IntRect ReadIntRect();
|
||||
IntVector2 ReadIntVector2();
|
||||
Rect ReadRect();
|
||||
Vector2 ReadVector2();
|
||||
Vector3 ReadVector3();
|
||||
Vector3 ReadPackedVector3(float maxAbsCoord);
|
||||
Vector4 ReadVector4();
|
||||
Quaternion ReadQuaternion();
|
||||
Quaternion ReadPackedQuaternion();
|
||||
Color ReadColor();
|
||||
BoundingBox ReadBoundingBox();
|
||||
String ReadString();
|
||||
String ReadFileID();
|
||||
StringHash ReadStringHash();
|
||||
ShortStringHash ReadShortStringHash();
|
||||
|
||||
// PODVector<unsigned char> ReadBuffer();
|
||||
VectorBuffer ReadBuffer();
|
||||
|
||||
ResourceRef ReadResourceRef();
|
||||
ResourceRefList ReadResourceRefList();
|
||||
Variant ReadVariant();
|
||||
Variant ReadVariant(VariantType type);
|
||||
VariantVector ReadVariantVector();
|
||||
VariantMap ReadVariantMap();
|
||||
unsigned ReadVLE();
|
||||
unsigned ReadNetID();
|
||||
String ReadLine();
|
||||
|
||||
// From Serializer
|
||||
bool WriteInt(int value);
|
||||
bool WriteShort(short value);
|
||||
bool WriteByte(signed char value);
|
||||
bool WriteUInt(unsigned value);
|
||||
bool WriteUShort(unsigned short value);
|
||||
bool WriteUByte(unsigned char value);
|
||||
bool WriteBool(bool value);
|
||||
bool WriteFloat(float value);
|
||||
bool WriteIntRect(const IntRect& value);
|
||||
bool WriteIntVector2(const IntVector2& value);
|
||||
bool WriteRect(const Rect& value);
|
||||
bool WriteVector2(const Vector2& value);
|
||||
bool WriteVector3(const Vector3& value);
|
||||
bool WritePackedVector3(const Vector3& value, float maxAbsCoord);
|
||||
bool WriteVector4(const Vector4& value);
|
||||
bool WriteQuaternion(const Quaternion& value);
|
||||
bool WritePackedQuaternion(const Quaternion& value);
|
||||
bool WriteColor(const Color& value);
|
||||
bool WriteBoundingBox(const BoundingBox& value);
|
||||
bool WriteString(const String value);
|
||||
bool WriteFileID(const String value);
|
||||
bool WriteStringHash(const StringHash& value);
|
||||
bool WriteShortStringHash(const ShortStringHash& value);
|
||||
|
||||
// bool WriteBuffer(const PODVector<unsigned char>& buffer);
|
||||
tolua_outside bool SerializerWriteBuffer @ WriteBuffer(const VectorBuffer& buffer);
|
||||
|
||||
bool WriteResourceRef(const ResourceRef& value);
|
||||
bool WriteResourceRefList(const ResourceRefList& value);
|
||||
bool WriteVariant(const Variant& value);
|
||||
bool WriteVariantData(const Variant& value);
|
||||
bool WriteVariantVector(const VariantVector& value);
|
||||
bool WriteVariantMap(const VariantMap& value);
|
||||
bool WriteVLE(unsigned value);
|
||||
bool WriteNetID(unsigned value);
|
||||
bool WriteLine(const String value);
|
||||
|
||||
tolua_readonly tolua_property__get_set FileMode mode;
|
||||
tolua_readonly tolua_property__is_set bool open;
|
||||
tolua_readonly tolua_property__is_set bool packaged;
|
||||
|
||||
// From Deserializer
|
||||
tolua_readonly tolua_property__get_set String& name;
|
||||
tolua_readonly tolua_property__get_set unsigned checksum;
|
||||
tolua_readonly tolua_property__get_set unsigned position;
|
||||
tolua_readonly tolua_property__get_set unsigned size;
|
||||
tolua_readonly tolua_property__is_set bool eof;
|
||||
};
|
||||
|
9
Source/Extras/LuaScript/pkgs/IO/FileWatcher.pkg
Normal file
9
Source/Extras/LuaScript/pkgs/IO/FileWatcher.pkg
Normal file
@ -0,0 +1,9 @@
|
||||
$#include "FileWatcher.h"
|
||||
|
||||
class FileWatcher : public Object
|
||||
{
|
||||
bool StartWatching(const String& pathName, bool watchSubDirs);
|
||||
void StopWatching();
|
||||
void AddChange(const String fileName);
|
||||
const String& GetPath() const;
|
||||
};
|
@ -8,6 +8,7 @@ static const int LOG_NONE;
|
||||
|
||||
class Log : public Object
|
||||
{
|
||||
void Open(const String fileName);
|
||||
void SetLevel(int level);
|
||||
void SetTimeStamp(bool enable);
|
||||
void SetQuiet(bool quiet);
|
||||
|
@ -11,7 +11,7 @@ class PackageFile : public Object
|
||||
{
|
||||
PackageFile(Context* context);
|
||||
PackageFile(Context* context, const String fileName);
|
||||
virtual ~PackageFile();
|
||||
~PackageFile();
|
||||
|
||||
bool Open(const String fileName);
|
||||
bool Exists(const String fileName) const;
|
||||
|
@ -10,28 +10,39 @@ class Serializer
|
||||
bool WriteUByte(unsigned char value);
|
||||
bool WriteBool(bool value);
|
||||
bool WriteFloat(float value);
|
||||
bool WriteIntRect(const IntRect value);
|
||||
bool WriteIntVector2(const IntVector2 value);
|
||||
bool WriteRect(const Rect value);
|
||||
bool WriteVector2(const Vector2 value);
|
||||
bool WriteVector3(const Vector3 value);
|
||||
bool WritePackedVector3(const Vector3 value, float maxAbsCoord);
|
||||
bool WriteVector4(const Vector4 value);
|
||||
bool WriteQuaternion(const Quaternion value);
|
||||
bool WritePackedQuaternion(const Quaternion value);
|
||||
bool WriteColor(const Color value);
|
||||
bool WriteBoundingBox(const BoundingBox value);
|
||||
bool WriteIntRect(const IntRect& value);
|
||||
bool WriteIntVector2(const IntVector2& value);
|
||||
bool WriteRect(const Rect& value);
|
||||
bool WriteVector2(const Vector2& value);
|
||||
bool WriteVector3(const Vector3& value);
|
||||
bool WritePackedVector3(const Vector3& value, float maxAbsCoord);
|
||||
bool WriteVector4(const Vector4& value);
|
||||
bool WriteQuaternion(const Quaternion& value);
|
||||
bool WritePackedQuaternion(const Quaternion& value);
|
||||
bool WriteColor(const Color& value);
|
||||
bool WriteBoundingBox(const BoundingBox& value);
|
||||
bool WriteString(const String value);
|
||||
bool WriteFileID(const String value);
|
||||
bool WriteStringHash(const StringHash value);
|
||||
bool WriteShortStringHash(const ShortStringHash value);
|
||||
bool WriteResourceRef(const ResourceRef value);
|
||||
bool WriteResourceRefList(const ResourceRefList value);
|
||||
bool WriteVariant(const Variant value);
|
||||
bool WriteVariantData(const Variant value);
|
||||
bool WriteVariantVector(const VariantVector value);
|
||||
bool WriteVariantMap(const VariantMap value);
|
||||
bool WriteStringHash(const StringHash& value);
|
||||
bool WriteShortStringHash(const ShortStringHash& value);
|
||||
|
||||
// bool WriteBuffer(const PODVector<unsigned char>& buffer);
|
||||
tolua_outside bool SerializerWriteBuffer @ WriteBuffer(const VectorBuffer& buffer);
|
||||
|
||||
bool WriteResourceRef(const ResourceRef& value);
|
||||
bool WriteResourceRefList(const ResourceRefList& value);
|
||||
bool WriteVariant(const Variant& value);
|
||||
bool WriteVariantData(const Variant& value);
|
||||
bool WriteVariantVector(const VariantVector& value);
|
||||
bool WriteVariantMap(const VariantMap& value);
|
||||
bool WriteVLE(unsigned value);
|
||||
bool WriteNetID(unsigned value);
|
||||
bool WriteLine(const String value);
|
||||
};
|
||||
|
||||
${
|
||||
static bool SerializerWriteBuffer(Serializer* serializer, const VectorBuffer& buffer)
|
||||
{
|
||||
return serializer->WriteBuffer(buffer.GetBuffer());
|
||||
}
|
||||
$}
|
||||
|
106
Source/Extras/LuaScript/pkgs/IO/VectorBuffer.pkg
Normal file
106
Source/Extras/LuaScript/pkgs/IO/VectorBuffer.pkg
Normal file
@ -0,0 +1,106 @@
|
||||
$#include "VectorBuffer.h"
|
||||
|
||||
class VectorBuffer
|
||||
{
|
||||
VectorBuffer();
|
||||
// VectorBuffer(const PODVector<unsigned char>& data);
|
||||
VectorBuffer(Deserializer& source, unsigned size);
|
||||
~VectorBuffer();
|
||||
|
||||
// void SetData(const PODVector<unsigned char>& data);
|
||||
void SetData(Deserializer& source, unsigned size);
|
||||
void Clear();
|
||||
void Resize(unsigned size);
|
||||
|
||||
// const PODVector<unsigned char>& GetBuffer() const;
|
||||
|
||||
// From Deserializer
|
||||
unsigned Seek(unsigned position);
|
||||
const String& GetName() const;
|
||||
unsigned GetChecksum();
|
||||
unsigned GetPosition() const;
|
||||
unsigned GetSize() const;
|
||||
bool IsEof() const;
|
||||
|
||||
int ReadInt();
|
||||
short ReadShort();
|
||||
signed char ReadByte();
|
||||
unsigned ReadUInt();
|
||||
unsigned short ReadUShort();
|
||||
unsigned char ReadUByte();
|
||||
bool ReadBool();
|
||||
float ReadFloat();
|
||||
IntRect ReadIntRect();
|
||||
IntVector2 ReadIntVector2();
|
||||
Rect ReadRect();
|
||||
Vector2 ReadVector2();
|
||||
Vector3 ReadVector3();
|
||||
Vector3 ReadPackedVector3(float maxAbsCoord);
|
||||
Vector4 ReadVector4();
|
||||
Quaternion ReadQuaternion();
|
||||
Quaternion ReadPackedQuaternion();
|
||||
Color ReadColor();
|
||||
BoundingBox ReadBoundingBox();
|
||||
String ReadString();
|
||||
String ReadFileID();
|
||||
StringHash ReadStringHash();
|
||||
ShortStringHash ReadShortStringHash();
|
||||
|
||||
// PODVector<unsigned char> ReadBuffer();
|
||||
VectorBuffer ReadBuffer();
|
||||
|
||||
ResourceRef ReadResourceRef();
|
||||
ResourceRefList ReadResourceRefList();
|
||||
Variant ReadVariant();
|
||||
Variant ReadVariant(VariantType type);
|
||||
VariantVector ReadVariantVector();
|
||||
VariantMap ReadVariantMap();
|
||||
unsigned ReadVLE();
|
||||
unsigned ReadNetID();
|
||||
String ReadLine();
|
||||
|
||||
// From Serializer
|
||||
bool WriteInt(int value);
|
||||
bool WriteShort(short value);
|
||||
bool WriteByte(signed char value);
|
||||
bool WriteUInt(unsigned value);
|
||||
bool WriteUShort(unsigned short value);
|
||||
bool WriteUByte(unsigned char value);
|
||||
bool WriteBool(bool value);
|
||||
bool WriteFloat(float value);
|
||||
bool WriteIntRect(const IntRect& value);
|
||||
bool WriteIntVector2(const IntVector2& value);
|
||||
bool WriteRect(const Rect& value);
|
||||
bool WriteVector2(const Vector2& value);
|
||||
bool WriteVector3(const Vector3& value);
|
||||
bool WritePackedVector3(const Vector3& value, float maxAbsCoord);
|
||||
bool WriteVector4(const Vector4& value);
|
||||
bool WriteQuaternion(const Quaternion& value);
|
||||
bool WritePackedQuaternion(const Quaternion& value);
|
||||
bool WriteColor(const Color& value);
|
||||
bool WriteBoundingBox(const BoundingBox& value);
|
||||
bool WriteString(const String value);
|
||||
bool WriteFileID(const String value);
|
||||
bool WriteStringHash(const StringHash& value);
|
||||
bool WriteShortStringHash(const ShortStringHash& value);
|
||||
|
||||
// bool WriteBuffer(const PODVector<unsigned char>& buffer);
|
||||
tolua_outside bool SerializerWriteBuffer @ WriteBuffer(const VectorBuffer& buffer);
|
||||
|
||||
bool WriteResourceRef(const ResourceRef& value);
|
||||
bool WriteResourceRefList(const ResourceRefList& value);
|
||||
bool WriteVariant(const Variant& value);
|
||||
bool WriteVariantData(const Variant& value);
|
||||
bool WriteVariantVector(const VariantVector& value);
|
||||
bool WriteVariantMap(const VariantMap& value);
|
||||
bool WriteVLE(unsigned value);
|
||||
bool WriteNetID(unsigned value);
|
||||
bool WriteLine(const String value);
|
||||
|
||||
// From Deserializer
|
||||
tolua_readonly tolua_property__get_set String& name;
|
||||
tolua_readonly tolua_property__get_set unsigned checksum;
|
||||
tolua_readonly tolua_property__get_set unsigned position;
|
||||
tolua_readonly tolua_property__get_set unsigned size;
|
||||
tolua_readonly tolua_property__is_set bool eof;
|
||||
};
|
@ -1,9 +1,11 @@
|
||||
$pfile "IO/Deserializer.pkg"
|
||||
$pfile "IO/File.pkg"
|
||||
$pfile "IO/FileSystem.pkg"
|
||||
$pfile "IO/FileWatcher.pkg"
|
||||
$pfile "IO/Log.pkg"
|
||||
$pfile "IO/PackageFile.pkg"
|
||||
$pfile "IO/Serializer.pkg"
|
||||
$pfile "IO/VectorBuffer.pkg"
|
||||
|
||||
$using namespace Urho3D;
|
||||
$#pragma warning(disable:4800)
|
||||
|
@ -27,6 +27,7 @@ struct JoystickState
|
||||
|
||||
class Input : public Object
|
||||
{
|
||||
void SetToggleFullscreen(bool enable);
|
||||
void SetMouseVisible(bool enable);
|
||||
bool OpenJoystick(unsigned index);
|
||||
void CloseJoystick(unsigned index);
|
||||
|
@ -11,7 +11,7 @@ struct RemoteEvent
|
||||
class Connection : public Object
|
||||
{
|
||||
void SendMessage(int msgID, bool reliable, bool inOrder, const VectorBuffer& msg, unsigned contentID = 0);
|
||||
void SendMessage(int msgID, bool reliable, bool inOrder, const unsigned char* data, unsigned numBytes, unsigned contentID = 0);
|
||||
|
||||
|
||||
void SendRemoteEvent(StringHash eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
|
||||
void SendRemoteEvent(const String eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
|
||||
|
Loading…
Reference in New Issue
Block a user