Support via Mod.Call - absoluteAquarian/GraphicsLib GitHub Wiki

While it's recommended to use GraphicsLib as a direct dependency, it isn't required.

Most functionality in the library can be done via Mod.Call usage.

Primitive Line Drawing

Mod.Call("Draw Connected Lines, Single Color", Vector2[] points, Color color)

Redirects to PrimitiveDrawing.DrawLineStrip(Vector2[], Color)

Mod.Call("Draw Connected Liens, Lerp Color", Vector2[] points, Color start, Color end)

Redirects to PrimitiveDrawing.DrawLineStrip(Vector2[], Color, Color)

Mod.Call("Draw Connected Lines, Lerp Color per Point", Vector2[] points, Color[] colors)

Redirects to PrimitiveDrawing.DrawLineStrip(Vector2[], Color[])

Mod.Call("Draw Lines, Single Color", Vector2[] points, Color color)

Redirects to PrimitiveDrawing.DrawLineList(Vector2[], Color)

Mod.Call("Draw Lines, Lerp Color per Point", Vector2[] points, Color[] colors)

Redirects to PrimitiveDrawing.DrawLineList(Vector2[], Color[])

Simple Shape Drawing

Mod.Call("Draw Hollow Rectangle", Vector2 coordTL, Vector2 coordBR, Color colorTL, Color colorTR, Color colorBL, Color colorBR)

Redirects to PrimitiveDrawing.DrawHollowRectangle(Vector2, Vector2, Color, Color, Color, Color)

Mod.Call("Draw Filled Rectangle", Vector2 coordTL, Vector2 coordBR, Color colorTL, Color colorTR, Color colorBL, Color colorBR)

Redirects to PrimitiveDrawing.DrawFilledRectangle(Vector2, Vector2, Color, Color, Color, Color)

Mod.Call("Draw Hollow Circle", Vector2 center, float radius, Color color)

Redirects to PrimitiveDrawing.DrawHollowCircle(Vector2, float, Color)

Mod.Call("Draw Filled Circle, Single Color", Vector2 center, float radius, Color color)

Redirects to PrimitiveDrawing.DrawFilledCircle(Vector2, float, Color)

Mod.Call("Draw Filled Circle, Lerp Color", Vector2 center, float radius, Color color, Color edge)

Redirects to PrimitiveDrawing.DrawFilledCircle(Vector2, float, Color, Color)

Primitive Triangle Drawing

Mod.Call("Draw Triangles, Single Color", Vector2[] points, Color color)

Redirects to PrimitiveDrawing.DrawTriangleList(Vector2[], Color)

Mod.Call("Draw Triangles, Lerp Color per Point", Vector2[] points, Color[] colors)

Redirects to PrimitiveDrawing.DrawTriangleList(Vector2[], Color[])

Mesh Drawing

Mod.Call("Draw Mesh, Single Color", Texture2D texture, Vector2[] positions, Vector2[] textureCoordinates, Color color, Effect shader)

Creates a Mesh instance via this constructor, draws it, then returns the new Mesh instance's ID.

Mod.Call("Draw Mesh, Lerp Color per Vertex", Texture2D texture, Vector2[] positions, Vector2[] textureCoords, Color[] colors, Effect shader)

Creates a Mesh instance via this constructor, draws it, then returns the new Mesh instance's ID.

Mod.Call("Draw Mesh, Direct Data", Texture2D texture, VertexPositionColorTexture[] vertices, Effect shader)

Creates a Mesh instance via this constructor, draws it, then returns the new Mesh instance's ID.

Mod.Call("Draw Mesh, Indirect", int id)

Retrieves the Mesh instance whose ID matches id then draws it.

Mesh Modification

Mod.Call("Modify Mesh", int id, string field, object value)

Retrieves the Mesh instance whose ID matches id, then attempts to find the field to modify with the following criteria:

  • field == "shader" and value is an Effect instance
  • field == "texture" and value is a Texture2D instance

If the criteria were met, the corresponding data is modified. Otherwise, an exception is thrown.

Mod.Call("Modify Mesh", int id, string arrayField, object value, int slot)

Retrieves the Mesh instance whose ID matches id, then attempts to find the field to modify with the following criteria:

  • field == "position" and value is a Vector2 instance
  • field == "texCoord" and value is a Vector2 instance
  • field == "color" and value is a Color instance

If the critera were met and slot is within the bounds of the mesh's vertex data, the cooresponding data is modified. Otherwise, an exception is thrown.

Mod.Call("Translate Mesh", int id, Vector2 offset)

Retrieves the Mesh instance whose ID matches id, then translates all of its vertices by offset.

Mod.Call("Rotate Mesh", int id, Vector2 rotationOrigin, float radians)

Retrieves the Mesh instance whose ID matches id, then revolves its vertices around the ABSOLUTE coordinate rotationOrigin by radians radians.

Mod.Call("Scale Mesh", int id, float scale, Vector2 scaleCenter, float scaleAxesDirection)

Retrieves the Mesh instance whose ID matches id, then scales the mesh by the scale factor, using scaleCenter as the anchor point (all points move away from or towards it) and scaleAxesDirection as the direction where the X-axis of scaling lies.

For meshes that have been rotated via Mod.Call("Rotate Mesh") or mesh.ApplyRotation(), it is recommended to pass in how much the mesh has been rotated by into scaleAxesDirection.

Mod.Call("Scale Mesh", int id, Vector2 scale, Vector2 scaleCenter, float scaleAxesDirection)

Retrieves the Mesh instance whose ID matches id, then scales the mesh by the scale factor, using scaleCenter as the anchor point (all points move away from or towards it) and scaleAxesDirection as the direction where the X-axis of scaling lies.

For meshes that have been rotated via Mod.Call("Rotate Mesh") or mesh.ApplyRotation(), it is recommended to pass in how much the mesh has been rotated by into scaleAxesDirection.

Mod.Call("Reset Mesh", int id)

Retrieves the Mesh instance whose ID matches id, then resets its vertices to their original values.