Class Graphics
- Namespace
- MohawkGame2D
- Assembly
- GAME 10003 Game Development Foundations - 2D Game Template.dll
Access texture drawing functions.
public static class Graphics
- Inheritance
-
Graphics
- Inherited Members
Remarks
A static wrapper to standardize raylib's texture drawing API.
Properties
LoadedTextures
Get an array of all loaded textures.
public static Texture2D[] LoadedTextures { get; }
Property Value
Rotation
Angle rotation of graphics in degrees.
public static float Rotation { get; set; }
Property Value
Scale
Scale of graphics. Default is 1.
public static float Scale { get; set; }
Property Value
Tint
Color tint of graphics. DEfault is white.
public static Color Tint { get; set; }
Property Value
Methods
Draw(Texture2D, Vector2)
Draw a texture
graphic to the screen at
position
.
public static void Draw(Texture2D texture, Vector2 position)
Parameters
Draw(Texture2D, float, float)
Draw a texture
graphic to the screen at
position (x
, y
).
public static void Draw(Texture2D texture, float x, float y)
Parameters
texture
Texture2DThe texture to draw.
x
floatThe X position to draw at.
y
floatThe Y position to draw at.
DrawSubset(Texture2D, Vector2, Vector2, Vector2)
Draw a subset of texture
graphic at screen
position
. Subset begins at upper-left corner
subsetOrigin
and size of subsetSize
.
public static void DrawSubset(Texture2D texture, Vector2 position, Vector2 subsetOrigin, Vector2 subsetSize)
Parameters
texture
Texture2DThe texture to draw.
position
Vector2The position to draw at.
subsetOrigin
Vector2Subset origin within the texture.
subsetSize
Vector2Subset size within the texture.
DrawSubset(Texture2D, Vector2, Vector2, Vector2, Vector2)
Draw a subset of texture
graphic at screen
position
. Subset begins at upper-left corner
subsetOrigin
and size of subsetSize
.
rotationOrigin
is the point around which the
subset is rotated; default is upper-left corner.
public static void DrawSubset(Texture2D texture, Vector2 position, Vector2 subsetOrigin, Vector2 subsetSize, Vector2 rotationOrigin)
Parameters
texture
Texture2DThe texture to draw.
position
Vector2The position to draw at.
subsetOrigin
Vector2Subset origin within the texture.
subsetSize
Vector2Subset size within the texture.
rotationOrigin
Vector2Rotation origin of the texture subset.
LoadTexture(string)
Loads texture at filePath
into GPU memory.
public static Texture2D LoadTexture(string filePath)
Parameters
filePath
stringThe texture file path.
Returns
- Texture2D
Returns the loaded texture.
Remarks
This is slow and reads from disk. Reuse the resulting Texture2D where possible rather than laoding again from disk.
UnloadTexture(Texture2D)
Unloads texture
from GPU memory.
public static void UnloadTexture(Texture2D texture)
Parameters
texture
Texture2DThe texture to unload from GPU memory.