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, Vector2, Vector2)
Draw a texture graphic to the screen at position
rotating and scaling about origin.
public static void Draw(Texture2D texture, Vector2 position, Vector2 origin)
Parameters
textureTexture2DThe texture to draw.
positionVector2The position to draw at.
originVector2The origin within the texture.
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
textureTexture2DThe texture to draw.
xfloatThe X position to draw at.
yfloatThe Y position to draw at.
Draw(Texture2D, float, float, float, float)
Draw a texture graphic to the screen at
position (positionX, positionY)
rotating and scaling about (originX, originY).
public static void Draw(Texture2D texture, float positionX, float positionY, float originX, float originY)
Parameters
textureTexture2DThe texture to draw.
positionXfloatThe X position to draw at.
positionYfloatThe Y position to draw at.
originXfloatThe X-axis origin within the texture.
originYfloatThe Y-axis origin within the texture.
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
textureTexture2DThe texture to draw.
positionVector2The position to draw at.
subsetOriginVector2Subset origin within the texture.
subsetSizeVector2Subset 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
textureTexture2DThe texture to draw.
positionVector2The position to draw at.
subsetOriginVector2Subset origin within the texture.
subsetSizeVector2Subset size within the texture.
rotationOriginVector2Rotation origin of the texture subset.
LoadTexture(string)
Loads texture at filePath into GPU memory.
public static Texture2D LoadTexture(string filePath)
Parameters
filePathstringThe 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
textureTexture2DThe texture to unload from GPU memory.