Skip to content

Overview

An overview of the different areas covered by Shards.

Math

Various shards exist to allow for the execution of Mathematical calculations.

Basic mathematical operations can be done with the following shards:

Some shards encapsulate a few operations to help reduce code verbosity and promote simpler code. For example, Math.Inc can be used to simply increase a variable's value by 1, removing the need to specify the operand and reassigning the new value back to the variable.

More complex operations can also be executed with shards such as:

Strings

These shards allow you to work with strings and text in Shards.

Collections

Collections are used to group multiple items into a single element. There exists various shards that can be used to facilitate working with collections.

Shards to create collections:

Shards to work with collections:

  • AppendTo (Append to a collection)

  • PrependTo (Prepend to a collection)

  • Sort (Sort a collection)

  • Take (Extract elements from a collection)

  • Push (Adds new elements to the back of a collection)

Flow

Flow shards allow you to manipulate the flow of your Shards program.

Shards to run another Wire in-line:

  • Do (Flow stays on the new Wire if paused)

  • Step (Flow returns to original Wire if paused)

Shards to schedule another Wire:

  • Detach (Schedules original Wire)

  • Spawn (Schedules a clone)

  • Branch (Schedules Wires on a Submesh)

Shards to control the flow of Wires:

Shards to run code in bulk:

  • Expand (Creates copies of a Wire)

  • TryMany (Creates clones for each input to try)

For more information on Shards Flow, check out the primer guide here.

Shaders

Shader shards allow you to write shader code and create material effects in your program.

Shards to aid shader writing:

Graphics

Graphics shards fall under the GFX shards family and are used to create and render objects to your program.

The base of the graphic shards:

Shards to set parameters to your drawables:

Shards to control what is or will be drawn:

UI

UI shards allow you to customize and render User Interfaces in Shards.

Shards to define the segments in your interface:

Shards to organize UI elements on your interface:

Shards to add UI elements to your interface:

Shards to capture User Input:

Shards to draw graphs:

To customize the User Interface:

Additional UI controls:

Inputs

Inputs shards allow you to capture mouse and keyboard inputs and bind actions to them.

Keyboard Captures:

Mouse Captures:

Physics

Physics shards allow you to realize physics concepts in your Shards program.

Shards to simulate objects:

Shards to simulate force:

Shards to aid Physics calculations:

Conversion

These shards are used for converting between data types.

For type conversions:

Note

ToBytes and FromBytes serializes and deserializes values to a Shard specific format. Do not use them interchangeably with StringToBytes and BytesToString!

For converting between vector types:

Note

To construct vectors out of components, you can employ the type's keyword.

For example, you can use (float2 x y) to create a vector with the values x and y.