Commit daa20be9 authored by Benjamin Moir's avatar Benjamin Moir

Add RefTextureID

parent 611d26a9
......@@ -16,9 +16,9 @@ class RefPrimitive_Impl_IHashable : IHashable
switch(this.GetClassName())
{
case 'RefInt8' : case 'RefUInt8' :
case 'RefInt16': case 'RefUInt16':
case 'RefInt16': case 'RefUInt16' :
case 'RefInt' : case 'RefUInt' :
case 'RefName' :
case 'RefName' : case 'RefTextureID':
return RefPrimitive(this).ToInt() + 0;
case 'RefDouble': case 'RefFloat': case 'RefString':
return StringUtility.GetHash(RefPrimitive(this).ToString());
......@@ -53,8 +53,9 @@ class RefPrimitive_Impl_IComparable : IComparable
switch(this.GetClassName())
{
case 'RefInt8' : case 'RefUInt8' :
case 'RefInt16': case 'RefUInt16':
case 'RefInt16' : case 'RefUInt16':
case 'RefInt' : case 'RefUInt' :
case 'RefTextureID':
return CompareInt(RefPrimitive(this).ToInt(), RefPrimitive(other));
case 'RefFloat': case 'RefDouble':
return CompareDouble(RefPrimitive(this).ToDouble(), RefPrimitive(other));
......@@ -71,8 +72,9 @@ class RefPrimitive_Impl_IEquatable : IEquatable
switch(this.GetClassName())
{
case 'RefInt8' : case 'RefUInt8' :
case 'RefInt16': case 'RefUInt16':
case 'RefInt16' : case 'RefUInt16':
case 'RefInt' : case 'RefUInt' :
case 'RefTextureID':
return RefPrimitive(this).ToInt() == RefPrimitive(other).ToInt();
case 'RefFloat': case 'RefDouble':
return RefPrimitive(this).ToDouble() == RefPrimitive(other).ToDouble();
......@@ -220,3 +222,25 @@ class RefString : RefPrimitive
return ref;
}
}
class RefTextureID : RefPrimitive
{
TextureID value;
override int ToInt() { return int(value); }
override string ToString() { return TexMan.GetName(value); }
static RefTextureID Create(TextureID value)
{
let ref = new("RefTextureID");
ref.value = value;
return ref;
}
static RefTextureID CreateFromInt(int value)
{
TextureID tex;
tex.SetNull();
tex += value;
return Create(tex);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment