zscript-doc/api/drawing/TextureID.md

46 lines
784 B
Markdown
Raw Normal View History

2018-12-29 16:05:19 -08:00
# TextureID
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();
}
```
2019-08-14 03:31:41 -07:00
### `Exists`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Checks if the texture exists within the texture manager at all.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `IsNull`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Checks if the texture is the null index (`0`.)
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `IsValid`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Checks if the texture index is not the invalid index (`-1`.)
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `SetInvalid`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Sets the texture index to `-1`.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `SetNull`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Sets the texture index to `0`.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
The proper way to zero-initialize a `textureid` is:
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
```
textureid tex;
tex.SetNull();
```
2018-12-29 16:05:19 -08:00
<!-- EOF -->