Commit daa20be9 authored by Benjamin Moir's avatar Benjamin Moir

Add RefTextureID

parent 611d26a9
...@@ -15,10 +15,10 @@ class RefPrimitive_Impl_IHashable : IHashable ...@@ -15,10 +15,10 @@ class RefPrimitive_Impl_IHashable : IHashable
{ {
switch(this.GetClassName()) switch(this.GetClassName())
{ {
case 'RefInt8' : case 'RefUInt8' : case 'RefInt8' : case 'RefUInt8' :
case 'RefInt16': case 'RefUInt16': case 'RefInt16': case 'RefUInt16' :
case 'RefInt' : case 'RefUInt' : case 'RefInt' : case 'RefUInt' :
case 'RefName' : case 'RefName' : case 'RefTextureID':
return RefPrimitive(this).ToInt() + 0; return RefPrimitive(this).ToInt() + 0;
case 'RefDouble': case 'RefFloat': case 'RefString': case 'RefDouble': case 'RefFloat': case 'RefString':
return StringUtility.GetHash(RefPrimitive(this).ToString()); return StringUtility.GetHash(RefPrimitive(this).ToString());
...@@ -52,9 +52,10 @@ class RefPrimitive_Impl_IComparable : IComparable ...@@ -52,9 +52,10 @@ class RefPrimitive_Impl_IComparable : IComparable
{ {
switch(this.GetClassName()) switch(this.GetClassName())
{ {
case 'RefInt8' : case 'RefUInt8' : case 'RefInt8' : case 'RefUInt8' :
case 'RefInt16': case 'RefUInt16': case 'RefInt16' : case 'RefUInt16':
case 'RefInt' : case 'RefUInt' : case 'RefInt' : case 'RefUInt' :
case 'RefTextureID':
return CompareInt(RefPrimitive(this).ToInt(), RefPrimitive(other)); return CompareInt(RefPrimitive(this).ToInt(), RefPrimitive(other));
case 'RefFloat': case 'RefDouble': case 'RefFloat': case 'RefDouble':
return CompareDouble(RefPrimitive(this).ToDouble(), RefPrimitive(other)); return CompareDouble(RefPrimitive(this).ToDouble(), RefPrimitive(other));
...@@ -70,9 +71,10 @@ class RefPrimitive_Impl_IEquatable : IEquatable ...@@ -70,9 +71,10 @@ class RefPrimitive_Impl_IEquatable : IEquatable
{ {
switch(this.GetClassName()) switch(this.GetClassName())
{ {
case 'RefInt8' : case 'RefUInt8' : case 'RefInt8' : case 'RefUInt8' :
case 'RefInt16': case 'RefUInt16': case 'RefInt16' : case 'RefUInt16':
case 'RefInt' : case 'RefUInt' : case 'RefInt' : case 'RefUInt' :
case 'RefTextureID':
return RefPrimitive(this).ToInt() == RefPrimitive(other).ToInt(); return RefPrimitive(this).ToInt() == RefPrimitive(other).ToInt();
case 'RefFloat': case 'RefDouble': case 'RefFloat': case 'RefDouble':
return RefPrimitive(this).ToDouble() == RefPrimitive(other).ToDouble(); return RefPrimitive(this).ToDouble() == RefPrimitive(other).ToDouble();
...@@ -220,3 +222,25 @@ class RefString : RefPrimitive ...@@ -220,3 +222,25 @@ class RefString : RefPrimitive
return ref; 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