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:
-
Math.Add (Addition)
-
Math.Subtract (Subtraction)
-
Math.Multiply (Multiplication)
-
Math.Divide (Division)
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.
-
Math.Inc (Increase value by 1)
-
Math.Dec (Decrease value by 1)
-
Math.Lerp (Linearly interpolate between two values)
More complex operations can also be executed with shards such as:
Strings¶
These shards allow you to work with strings and text in Shards.
-
AppendTo (Append to a string)
-
PrependTo (Prepend to a string)
-
String.Contains (Searches for a string)
-
String.Join (Combines strings)
-
String.ToLower (Converts to lower case)
-
String.ToUpper (Converts to upper case)
-
String.Trim (Trims a string)
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:
Shards to schedule another Wire:
Shards to control the flow of Wires:
Shards to run code in bulk:
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:
-
GFX.Drawable (An object to be drawn)
-
GFX.View (The camera view)
-
GFX.gITF (Loads a model from a file)
Shards to set parameters to your drawables:
-
GFX.Texture (Converts an image)
-
GFX.Material (Creates a reusable setting)
Shards to control what is or will be drawn:
-
GFX.DrawQueue (Records
Draw
commands) -
GFX.ClearQueue (Clears the
Draw
queue) -
GFX.Draw (Adds
Drawable
s into the RenderQueue) -
GFX.Feature (Allows for customizable shaders)
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:
-
UI.Horizontal (Horizontal layout)
-
UI.Group (Groups content together)
-
UI.Grid (Organizes content in a grid)
-
UI.Frame (Groups content in a frame)
Shards to add UI elements to your interface:
-
UI.CodeEditor (Code segment)
-
UI.Label (Text)
-
UI.Spinner (Spinning loading widget)
Shards to capture User Input:
-
UI.ColorInput (Color picker)
-
UI.Combo (Drop-down menu)
-
UI.FloatSlider (Numeric slider)
-
UI.FloatInput (Numeric 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
.