2018-12-29 16:05:19 -08:00
|
|
|
# TextureID
|
|
|
|
|
2019-02-02 18:06:35 -08:00
|
|
|
Texture IDs can be explicitly converted to integers, but not the other way
|
|
|
|
around. You can add and subtract integers with a `textureid`, however. (This
|
|
|
|
only works with the integer on the right hand side.)
|
2018-12-29 16:05:19 -08:00
|
|
|
|
|
|
|
```
|
|
|
|
struct TextureID
|
|
|
|
{
|
|
|
|
bool Exists() const;
|
|
|
|
bool IsNull() const;
|
|
|
|
bool IsValid() const;
|
|
|
|
void SetInvalid();
|
|
|
|
void SetNull();
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- `Exists`
|
|
|
|
|
|
|
|
Checks if the texture exists within the texture manager at all.
|
|
|
|
|
|
|
|
- `IsNull`
|
|
|
|
|
|
|
|
Checks if the texture is the null index (`0`.)
|
|
|
|
|
|
|
|
- `IsValid`
|
|
|
|
|
|
|
|
Checks if the texture index is not the invalid index (`-1`.)
|
|
|
|
|
|
|
|
- `SetInvalid`
|
|
|
|
|
|
|
|
Sets the texture index to `-1`.
|
|
|
|
|
|
|
|
- `SetNull`
|
|
|
|
|
|
|
|
Sets the texture index to `0`.
|
|
|
|
|
|
|
|
The proper way to zero-initialize a `textureid` is:
|
|
|
|
|
|
|
|
```
|
|
|
|
textureid tex;
|
|
|
|
tex.SetNull();
|
|
|
|
```
|
|
|
|
|
|
|
|
<!-- EOF -->
|