A dynamic texture renders it's pixels in a custom way. This can be considered similar to a canvas element. This allows for some very dynamic graphics on the UI (for example, a curved health bar).
Public Member Functions | |
DynamicTexture (int width, int height, string name) | |
Creates a new dynamic texture of the given dimensions. More... | |
DynamicTexture () | |
Creates an empty dynamic texture. Note that this is used internally by canvas. If used, you must call Resize to set it up. More... | |
void | ResizeX (int width) |
Resize this texture on the X axis. More... | |
void | ResizeY (int height) |
Resize this texture on the Y axis. More... | |
void | Resize (int width, int height) |
Resize this texture on the X and Y axis. More... | |
void | Resize (int width, int height, bool createIfZero) |
Resize this texture on the X and Y axis, optionally only doing so if dimensions aren't zero. More... | |
Texture2D | GetTexture () |
Gets the texture. More... | |
Texture2D | GetTextureHolder () |
Gets the placeholder texture. More... | |
void | DrawPixel (int x, int y, Color32 colour) |
Draws a pixel at the given x/y coordinates to the atlas. More... | |
void | DrawLine (int x, int y, int x2, int y2, Color32 colour) |
Draws a line on the atlas from one point to another. More... | |
void | DrawCircle (int x0, int y0, int radius, Color32 colour) |
Draws a filled circle on the atlas. More... | |
void | Clear () |
Wipes the graphic clean using transparent black. More... | |
void | Clear (Color32 clearColour) |
Wipes the graphic clean. More... | |
void | SetPixel (int index, Color32 colour) |
Sets a the colour of a particular global pixel on the atlas. More... | |
void | Refresh () |
Called to refresh the texture. More... | |
virtual void | Flush () |
Override this to write to the pixels. Should internally use SetPixel for this. More... | |
void | FlushDirect () |
Internally used only. Flushes the pixel array to the texture right now. More... | |
Static Public Member Functions | |
static DynamicTexture | Get (string byName) |
Gets a dynamic texture by name from the global lookup. More... | |
static void | RemoveAll () |
Removes all dynamic textures. More... | |
static void | Update () |
Redraw requests are buffered and done in one go by this method. More... | |
Public Attributes | |
int | Width |
The width of the dynamic texture. More... | |
int | Height |
The height of the dynamic texture. More... | |
string | Name |
The name for this texture. More... | |
bool | Refreshing |
True if this texture needs a refresh this frame. More... | |
Color32[] | Pixels |
The pixels of this texture. More... | |
int | ResizedWidth |
The resized height of the texture (internal). Only used if this texture is resized and it gets shrunk. More... | |
int | ResizedHeight |
The resized height of the texture (internal). Only used if this texture is resized and it gets shrunk. More... | |
Static Public Attributes | |
static bool | SomethingToUpdate |
True if at least one dynamic texture must be flushed this frame. More... | |
static Dictionary< string, DynamicTexture > | Instances |
A global lookup of available dynamic textures used for mapping a URL to an object. E.g. background:url("dynamic://healthbar"); More... | |
Properties | |
FilterMode | FilterMode [get, set] |
The filter mode of this dynamic texture. The default filtering is point. More... | |
Private Member Functions | |
void | Redraw () |
Called by the update system to redraw this texture, only if it requires it. More... | |
Private Attributes | |
Texture2D | Texture |
A placeholder texture which is only used by the atlas. More... | |
|
inline |
Creates a new dynamic texture of the given dimensions.
width | The width of the texture. |
height | The height of the texture. |
name | The name of the texture. This is used in urls to locate it (e.g. dynamic://theName). |
|
inline |
Creates an empty dynamic texture. Note that this is used internally by canvas. If used, you must call Resize to set it up.
|
inline |
Wipes the graphic clean using transparent black.
|
inline |
Wipes the graphic clean.
clearColour | The colour to set the whole graphic to. |
|
inline |
Draws a filled circle on the atlas.
x0 | The x coordinate of the circles center in pixels from the left. |
y0 | The y coordinate of the circles center in pixels from the bottom. |
radius | The radius of the circle, in pixels. |
colour | The colour of the circle. |
|
inline |
Draws a line on the atlas from one point to another.
x | The x coordinate in pixels from the left of the start of the line. |
y | The y coordinate in pixels from the left of the start of the line. |
x2 | The x coordinate in pixels from the left of the end of the line. |
y2 | The y coordinate in pixels from the left of the end of the line. |
colour | The colour of the line. |
|
inline |
Draws a pixel at the given x/y coordinates to the atlas.
x | The x coordinate in pixels from the left of the texture. |
y | The y coordinate in pixels from the bottom of the texture. |
colour | The colour of the pixel to draw. |
|
inlinevirtual |
|
inline |
Internally used only. Flushes the pixel array to the texture right now.
|
inlinestatic |
Gets a dynamic texture by name from the global lookup.
byName | The name of the dynamic texture. |
|
inline |
Gets the texture.
|
inline |
Gets the placeholder texture.
|
inlineprivate |
Called by the update system to redraw this texture, only if it requires it.
|
inline |
Called to refresh the texture.
|
inlinestatic |
Removes all dynamic textures.
|
inline |
Resize this texture on the X and Y axis.
width | The new width. |
height | The new height. |
|
inline |
Resize this texture on the X and Y axis, optionally only doing so if dimensions aren't zero.
width | The new width. |
height | The new height. |
createIfZero | Only do the resize if the dimensions are non-zero. |
|
inline |
Resize this texture on the X axis.
width | The new width. |
|
inline |
Resize this texture on the Y axis.
height | The new height. |
|
inline |
Sets a the colour of a particular global pixel on the atlas.
index | The global index of the pixel on the atlas. |
colour | The colour of the pixel to set. |
|
inlinestatic |
Redraw requests are buffered and done in one go by this method.
int PowerUI.DynamicTexture.Height |
The height of the dynamic texture.
|
static |
A global lookup of available dynamic textures used for mapping a URL to an object. E.g. background:url("dynamic://healthbar");
string PowerUI.DynamicTexture.Name |
The name for this texture.
Color32 [] PowerUI.DynamicTexture.Pixels |
The pixels of this texture.
bool PowerUI.DynamicTexture.Refreshing |
True if this texture needs a refresh this frame.
int PowerUI.DynamicTexture.ResizedHeight |
The resized height of the texture (internal). Only used if this texture is resized and it gets shrunk.
int PowerUI.DynamicTexture.ResizedWidth |
The resized height of the texture (internal). Only used if this texture is resized and it gets shrunk.
|
static |
True if at least one dynamic texture must be flushed this frame.
|
private |
A placeholder texture which is only used by the atlas.
int PowerUI.DynamicTexture.Width |
The width of the dynamic texture.
|
getset |
The filter mode of this dynamic texture. The default filtering is point.