mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 21:31:03 +00:00
36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
|
#pragma once
|
||
|
|
||
|
class FTextureID
|
||
|
{
|
||
|
friend class FTextureManager;
|
||
|
|
||
|
public:
|
||
|
FTextureID() = default;
|
||
|
bool isNull() const { return texnum == 0; }
|
||
|
bool isValid() const { return texnum > 0; }
|
||
|
bool Exists() const { return texnum >= 0; }
|
||
|
void SetInvalid() { texnum = -1; }
|
||
|
void SetNull() { texnum = 0; }
|
||
|
bool operator ==(const FTextureID &other) const { return texnum == other.texnum; }
|
||
|
bool operator !=(const FTextureID &other) const { return texnum != other.texnum; }
|
||
|
FTextureID operator +(int offset) throw();
|
||
|
int GetIndex() const { return texnum; } // Use this only if you absolutely need the index!
|
||
|
|
||
|
// The switch list needs these to sort the switches by texture index
|
||
|
int operator -(FTextureID other) const { return texnum - other.texnum; }
|
||
|
bool operator < (FTextureID other) const { return texnum < other.texnum; }
|
||
|
bool operator > (FTextureID other) const { return texnum > other.texnum; }
|
||
|
|
||
|
protected:
|
||
|
FTextureID(int num) { texnum = num; }
|
||
|
private:
|
||
|
int texnum;
|
||
|
};
|
||
|
|
||
|
// This is for the script interface which needs to do casts from int to texture.
|
||
|
class FSetTextureID : public FTextureID
|
||
|
{
|
||
|
public:
|
||
|
FSetTextureID(int v) : FTextureID(v) {}
|
||
|
};
|
||
|
|