Table of Contents

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

Texture2D[]

Rotation

Angle rotation of graphics in degrees.

public static float Rotation { get; set; }

Property Value

float

Scale

Scale of graphics. Default is 1.

public static float Scale { get; set; }

Property Value

float

Tint

Color tint of graphics. DEfault is white.

public static Color Tint { get; set; }

Property Value

Color

Methods

Draw(Texture2D, Vector2)

Draw a texture graphic to the screen at position.

public static void Draw(Texture2D texture, Vector2 position)

Parameters

texture Texture2D

The texture to draw.

position Vector2

The position to draw at.

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 Texture2D

The texture to draw.

x float

The X position to draw at.

y float

The 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 Texture2D

The texture to draw.

position Vector2

The position to draw at.

subsetOrigin Vector2

Subset origin within the texture.

subsetSize Vector2

Subset 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 Texture2D

The texture to draw.

position Vector2

The position to draw at.

subsetOrigin Vector2

Subset origin within the texture.

subsetSize Vector2

Subset size within the texture.

rotationOrigin Vector2

Rotation origin of the texture subset.

LoadTexture(string)

Loads texture at filePath into GPU memory.

public static Texture2D LoadTexture(string filePath)

Parameters

filePath string

The 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 Texture2D

The texture to unload from GPU memory.