
Global
Color( r number, g number, b number ) color
Compose and returns a RGB Color object. Values for the 3 channels are always expressed in the range 0-255.
ColorRGBA( r number, g number, b number, a number ) color
Compose and returns a RGB Color object, with Alpha. Values for the 4 channels are always expressed in the range 0-255. Alpha 0 is transparent
ColorHSV( h number, s number, v number ) color
Compose and returns a RGB Color Object, expressing it in HSV values.
Hue [0-360]
Saturation [0-100]
Value [0-100]
log( message string )
logWarning( message string )
logError( message string )
write( text string )
writeln( text string )
setFgColor( colorId number )
Use ANSI colors:
Black 30
Dark red 31
Dark green 32
Dark yellow 33
Dark blue 34
Dark magenta 35
Dark cyan 36
Light gray 37
Dark gray 90
Red 91
Green 92
Orange 93
Blue 94
Magenta 95
Cyan 96
White 97
setBgColor( colorId number )
Use ANSI colors:
Black 40
Dark red 41
Dark green 42
Dark yellow 43
Dark blue 44
Dark magenta 45
Dark cyan 46
Light gray 47
Dark gray 100
Red 101
Green 102
Orange 103
Blue 104
Magenta 105
Cyan 106
White 107
resetFgColor( )
resetBgColor( )
resetColors( )
setCursorPos( column number, line number )
setCursorX( column number )
setCursorY( line number )
moveCursorX( deltaColumn number )
moveCursorY( deltaLine number )
saveCursorPos( )
restoreCursorPos( )
clear( )
clearToEndLine( )
Desk
desk.GetLampState( ) boolean
Return true if the lamp is on
desk.SetLampState( state boolean )
desk.SetLampColor( color color )
desk.ShowMessage( message string, persistent boolean )
desk.ShowWarning( message string, persistent boolean )
desk.ShowError( message string, persistent boolean )
desk.HideMessage( )
Input
Stick
Properties
X numberread only
The position of the stick along the X axis, ranging from -100 to 100
Y numberread only
The position of the stick along the Y axis, ranging from -100 to 100
InputSourceX InputSource
InputSourceY InputSource
Events
StickValueChangeEvent : { X number, Y number, Type string }
Sent when the value is changed
DPad
Properties
X numberread only
The position of the stick along the X axis, ranging from -100 to 100.
Y numberread only
The position of the stick along the Y axis, ranging from -100 to 100
InputSourceX InputSource
InputSourceY InputSource
Events
DPadValueChangeEvent : { X number, Y number, Type string }
Sent when the value is changed
Keypad
Properties
ButtonsState {{boolean}}read only
A multi-dimensional table mapping the state of each button to a boolean value.
The table must be addressed with [column][row]. A value of true means that the corrisponding button is pressed, a value of false tha the button is in it's released state.
ButtonsDown {{boolean}}read only
A multi-dimensional table mapping boolean flags which will be true only in the time tick the corresponding button changes it's state to pressed. The table must be addressed with [column][row]
ButtonsUp {{boolean}}read only
A multi-dimensional table mapping boolean flags which will be true only in the time tick the corresponding button changes it's state to released. The table must be addressed with [column][row]
ButtonsInputSource {{InputSource}}
Symbols {{Symbol}}
Events
KeypadButtonEvent : { X number, Y number, ButtonDown boolean, ButtonUp boolean, Type string }
Sent when a button state is changed
Knob
Properties
Value number
The actual positional value of the Knob, ranging from -100 to 100
IsMoving booleanread only
True if the user is moving the knob
Events
KnobValueChangeEvent : { Value number, Type string }
Sent when the value is changed
LedButton
Properties
InputSource InputSource
ButtonState booleanread only
The pressed/released state of the button.
ButtonDown booleanread only
A boolean flag which will be true only in the time tick the corresponding button changes it's state to pressed.
ButtonUp booleanread only
A boolean flag which will be true only in the time tick the corresponding button changes it's state to released.
LedState boolean
The lit/unlit state of the Led.
LedColor color
The color of the Led.
Symbol Symbol
Events
LedButtonEvent : { ButtonDown boolean, ButtonUp boolean, Type string }
Sent when the LedButton is pressed or released
ScreenButton
Properties
VideoChip VideoChip
The videochip the screen part of this button is bound to.
ButtonState booleanread only
The pressed/released state of this button.
ButtonDown booleanread only
A boolean flag which will be true only in the time tick the corresponding button changes it's state to pressed.
ButtonUp booleanread only
A boolean flag which will be true only in the time tick the corresponding button changes it's state to released.
InputSource InputSource
Offset vec2read only
Width numberread only
Height numberread only
Events
ScreenButtonEvent : { ButtonDown boolean, ButtonUp boolean, Type string }
Sent when the ScreenButton is pressed or released
Slider
Properties
Value number
The positional value of the slider, ranging from 0 to 100
IsMoving booleanread only
True if the user is moving the slider
Events
SliderValueChangeEvent : { Value number, Type string }
Sent when the value is changed
Switch
Properties
State boolean
The state of this switch.
InputSource InputSource
Symbol Symbol
Events
SwitchStateChangeEvent : { State boolean, Type string }
Sent when the Switch state is changed
Webcam
Properties
RenderTarget VideoChip
The VideoChip this camera is streaming contents to.
AccessDenied booleanread only
IsActive booleanread only
IsAvailable booleanread only
Methods
GetRenderBuffer( ) RenderBuffer
Gets the camera RenderBuffer. The render buffer obtained can then be fed to the DrawRenderBuffer method of the VideoChip module.
Events
WebcamIsActiveEvent : { IsActive boolean, IsAvailable boolean, AccessDenied boolean, Type string }
Sent when the Webcam active state is changed
Output
Gauge
Properties
Value number
Position 0-100
Lcd
Properties
Text string
The text to be visualized on the Lcd.
BgColor color
Background color for the Lcd.
TextColor color
The color for thew displayed text.
Led
Properties
State boolean
Led on/off state
Color color
Led color
LedMatrix
Properties
States {{boolean}}
A multi-dimensional table that maps all the Led lit/unlit stattus. Should be addressed with [column][row]
Colors {{color}}
A multi-dimensional table that maps all the Led colors. Should be addressed with [column][row]
LedStrip
Properties
States {boolean}
A table that maps all the Led lit/unlit states.
Colors {color}
A table that maps all the Led colors.
Screen
Properties
VideoChip VideoChip
The videochip this screen is bound to.
Offset vec2read only
Width numberread only
Height numberread only
SegmentDisplay
Properties
States {{boolean}}
A table that maps the lit/unlit state of all the Leds in the display.
Colors {{color}}
A table that maps the color of all the Leds in the display.
Methods
ShowDigit( groupIndex number, digit number )
SetDigitColor( groupIndex number, color color )
Speaker
Properties
State boolean
Misc
AudioChip
Properties
ChannelsCount numberread only
Number of available channels for this AudioChip. Each channel can independently play an audio sample.
Volume number
The global AudioChip volume.
Methods
GetSpectrumData( channel number, samplesCount number ) number[]
Returns the audio spectrum values of a channel as a table of number values, each one expressing the value of a different frequency.
samplesCount must be a power of 2 (ie 128/256/512 etc) Min = 64 Max = 8192.
GetDspTime( ) number
Returns the current internal AudioChip's DSP time. It is meant to be used in combination with the PlayScheduled method. The returned number is expressed in seconds.
Play( audioSample AudioSample, channel number )
Immediately plays an AudioSample on a specific channel.
PlayScheduled( audioSample AudioSample, channel number, dspTime number )
Schedule the play of and AudioSample at a specific DSP time, expressed in seconds, on the specific channel.
PlayLoop( audioSample AudioSample, channel number )
Immediately plays an AudioSample on a specific channel, looping it.
PlayLoopScheduled( audioSample AudioSample, channel number, dspTime number )
Schedule the play of and AudioSample at a specific DSP time, expressed in seconds, on the specific channel, looping it.
Stop( channel number )
Stops any audio playing on a specific channel
Pause( channel number )
Pause the audio on a specific channel
UnPause( channel number )
Resumes the audio on a specific channel
IsPlaying( channel number ) boolean
Returns true if a channel is currently playing audio
IsPaused( channel number ) boolean
Returns true if a channel is currently paused.
GetPlayTime( channel number ) number
Returns the current play time of a channel, expressed in seconds.
SeekPlayTime( time number, channel number )
Sets the current position of the play head, for the specific channel, expressed in seconds.
SetChannelVolume( volume number, channel number )
Sets the current volume for a channel, 0-100 range.
GetChannelVolume( channel number ) number
Gets the current volume for a channel, 0-100 range.
SetChannelPitch( pitch number, channel number )
Sets the pitch for a channel. Acts as a multiplier. A value of 1 means the default pitch for a sample, a value of 2 plays the sample one octave higher.
GetChannelPitch( channel number ) number
Gets the current pitch of a channel.
CPU
Properties
Source Coderead only
The code asset uploaded to the cpu.
Time numberread only
The time since the gadget is turned on, expressed in seconds.
DeltaTime numberread only
The time elapsed since the last tick, expressed in seconds.
EventChannels {Module}
Decoration
FlashMemory
Properties
Size numberread only
Usage numberread only
Methods
Save( table {} ) boolean
Load( ) {}
GamepadChip
Properties
GamepadIndex number
IsActive booleanread only
Methods
GetButton( name InputName ) InputSource
GetAxis( name InputName ) InputSource
GetButtonAxis( negativeName InputName, positiveName InputName ) InputSource
Events
GamepadChipIsActiveEvent : { IsActive boolean, Type string }
GamepadChipButtonEvent : { ButtonDown boolean, ButtonUp boolean, IsAxis boolean, InputName InputName, Type string }
Input names
GamepadChip.LeftStickX
GamepadChip.LeftStickY
GamepadChip.RightStickX
GamepadChip.RightStickY
GamepadChip.ActionBottomRow1
GamepadChip.ActionBottomRow2
GamepadChip.ActionBottomRow3
GamepadChip.ActionTopRow1
GamepadChip.ActionTopRow2
GamepadChip.ActionTopRow3
GamepadChip.LeftShoulder1
GamepadChip.LeftShoulder2
GamepadChip.RightShoulder1
GamepadChip.RightShoulder2
GamepadChip.Center1
GamepadChip.Center2
GamepadChip.Center3
GamepadChip.LeftStickButton
GamepadChip.RightStickButton
GamepadChip.DPadUp
GamepadChip.DPadRight
GamepadChip.DPadDown
GamepadChip.DPadLeft
KeyboardChip
Methods
GetButton( name InputName ) InputSource
GetButtonAxis( negativeName InputName, positiveName InputName ) InputSource
Events
KeyboardChipEvent : { ButtonDown boolean, ButtonUp boolean, InputName InputName, Type string }
Sent when a button is presse or released
Input names
KeyboardChip.Return
KeyboardChip.Space
KeyboardChip.LeftArrow
KeyboardChip.RightArrow
KeyboardChip.DownArrow
KeyboardChip.UpArrow
KeyboardChip.Backspace
KeyboardChip.Escape
KeyboardChip.Tab
KeyboardChip.Clear
KeyboardChip.Pause
KeyboardChip.Exclaim
KeyboardChip.DoubleQuote
KeyboardChip.Hash
KeyboardChip.Dollar
KeyboardChip.Percent
KeyboardChip.Ampersand
KeyboardChip.Quote
KeyboardChip.LeftParen
KeyboardChip.RightParen
KeyboardChip.Asterisk
KeyboardChip.Plus
KeyboardChip.Comma
KeyboardChip.Minus
KeyboardChip.Period
KeyboardChip.Slash
KeyboardChip.Alpha0
KeyboardChip.Alpha1
KeyboardChip.Alpha2
KeyboardChip.Alpha3
KeyboardChip.Alpha4
KeyboardChip.Alpha5
KeyboardChip.Alpha6
KeyboardChip.Alpha7
KeyboardChip.Alpha8
KeyboardChip.Alpha9
KeyboardChip.Colon
KeyboardChip.Semicolon
KeyboardChip.Less
KeyboardChip.Equals
KeyboardChip.Greater
KeyboardChip.Question
KeyboardChip.At
KeyboardChip.LeftBracket
KeyboardChip.Backslash
KeyboardChip.RightBracket
KeyboardChip.Caret
KeyboardChip.Underscore
KeyboardChip.BackQuote
KeyboardChip.A
KeyboardChip.B
KeyboardChip.C
KeyboardChip.D
KeyboardChip.E
KeyboardChip.F
KeyboardChip.G
KeyboardChip.H
KeyboardChip.I
KeyboardChip.J
KeyboardChip.K
KeyboardChip.L
KeyboardChip.M
KeyboardChip.N
KeyboardChip.O
KeyboardChip.P
KeyboardChip.Q
KeyboardChip.R
KeyboardChip.S
KeyboardChip.T
KeyboardChip.U
KeyboardChip.V
KeyboardChip.W
KeyboardChip.X
KeyboardChip.Y
KeyboardChip.Z
KeyboardChip.LeftCurlyBracket
KeyboardChip.Pipe
KeyboardChip.RightCurlyBracket
KeyboardChip.Tilde
KeyboardChip.Delete
KeyboardChip.Keypad0
KeyboardChip.Keypad1
KeyboardChip.Keypad2
KeyboardChip.Keypad3
KeyboardChip.Keypad4
KeyboardChip.Keypad5
KeyboardChip.Keypad6
KeyboardChip.Keypad7
KeyboardChip.Keypad8
KeyboardChip.Keypad9
KeyboardChip.KeypadPeriod
KeyboardChip.KeypadDivide
KeyboardChip.KeypadMultiply
KeyboardChip.KeypadMinus
KeyboardChip.KeypadPlus
KeyboardChip.KeypadEnter
KeyboardChip.KeypadEquals
KeyboardChip.Insert
KeyboardChip.Home
KeyboardChip.End
KeyboardChip.PageUp
KeyboardChip.PageDown
KeyboardChip.F1
KeyboardChip.F2
KeyboardChip.F3
KeyboardChip.F4
KeyboardChip.F5
KeyboardChip.F6
KeyboardChip.F7
KeyboardChip.F8
KeyboardChip.F9
KeyboardChip.F10
KeyboardChip.F11
KeyboardChip.F12
KeyboardChip.F13
KeyboardChip.F14
KeyboardChip.F15
KeyboardChip.Numlock
KeyboardChip.CapsLock
KeyboardChip.ScrollLock
KeyboardChip.RightShift
KeyboardChip.LeftShift
KeyboardChip.RightControl
KeyboardChip.LeftControl
KeyboardChip.RightAlt
KeyboardChip.LeftAlt
KeyboardChip.RightCommand
KeyboardChip.LeftCommand
KeyboardChip.AltGr
KeyboardChip.Help
KeyboardChip.Print
KeyboardChip.SysReq
KeyboardChip.Break
KeyboardChip.Menu
MagneticConnector
Properties
ButtonState booleanread only
Reflect the pressed/released state of the connector's button.
IsConnected booleanread only
True if the connector is connected to another one. False otherwise.
PowerButton
Properties
ButtonState booleanread only
RealityChip
Properties
Cpu.TotalUsage numberread only
The total CPU usage of the system 0-100
Cpu.CoresUsage {number}read only
An array that contains the cpu usage of each logical CPU core 0-100
Ram.Available numberread only
Available RAM expressed in MB
Ram.Used numberread only
Used RAM expressed in MB
Network.TotalSent numberread only
Total sent by network interfaces expressed in Mbps
Network.TotalReceived numberread only
Total received from network interfaces expressed in Mbps
ROM
Properties
User.Assets {string, Asset}read only
User.SpriteSheets {string, SpriteSheet}read only
User.Codes {string, Code}read only
User.AudioSamples {string, AudioSample}read only
System.Assets {string, Asset}read only
System.SpriteSheets {string, SpriteSheet}read only
System.Codes {string, Code}read only
System.AudioSamples {string, AudioSample}read only
SecurityChip
VideoChip
Properties
Mode VideoChipMode
The SingleBuffer/DoubleBuffer mode for this VideoChip.
Height numberread only
Height in pixels of the rendering buffer. The area takes in account all the displays cound to this VideoChip.
Width numberread only
WIdth in pixels of the rendering buffer. The area takes in account all the displays cound to this VideoChip.
Methods
Clear( color color )
Clears all the render area with the specified color
SetPixel( position vec2, color color )
Sets the pixel at the specified position to the specified color
DrawPointGrid( gridOffset vec2, dotsDistance number, color color )
Draws a dotted grid on the entire display area, with an offset. The dotsDistance parameter express the distance in pixels, on both axis, between dots.
DrawLine( start vec2, end vec2, color color )
Draws a line from position start to position end, using the specified color
DrawCircle( position vec2, radius number, color color )
Draws an empty circle at the specified position, with the specified radius, in the specified color.
FillCircle( position vec2, radius number, color color )
Draws a filled circle at the specified position, with the specified radius, in the specified color.
DrawRect( position1 vec2, position2 vec2, color color )
Draws an empty rect from position1 to position2, in the specified color.
FillRect( position1 vec2, position2 vec2, color color )
Draws a filled rect from position1 to position2, in the specified color.
DrawTriangle( position1 vec2, position2 vec2, position3 vec2, color color )
Draws an empty triangle with vertexes in position1,position2 and position3, in the specified color.
FillTriangle( position1 vec2, position2 vec2, position3 vec2, color color )
Draws a filled triangle with vertexes in position1,position2 and position3, in the specified color.
DrawSprite( position vec2, spriteSheet SpriteSheet, spriteX number, spriteY number, tintColor color, backgroundColor color )
Draws a specific sprite frame from the spriteSheet.
Position is the on-screen sprite desired position starting from the top left corner,
spriteSheet is the SpriteSheet asset containing the sprite frame to draw,
spriteX and spriteY are the coordinates to identify the desired sprite frame starting from the, top left corner, expressed in grid units.
spriteX=0 and spriteY=0 are the coordinates of the first sprite, top left.
tintColor is the color multiplier used to draw the sprite frame. Color(255,255,255) or color.white will leave the sprite frame unaffected.
backgroundColor is the color used to replay the transparent areas of the spriteFrame.
Using ColorRGBA(0,0,0,0) or color.clear will leave the transparency as it is.
DrawCustomSprite( position vec2, spriteSheet SpriteSheet, spriteOffset vec2, spriteSize vec2, tintColor color, backgroundColor color )
Draw a portion of a SpriteSheet (defined by spriteOffset, spriteSize) without taking into account the grid
DrawText( position vec2, fontSprite SpriteSheet, text string, textColor color, backgroundColor color )
Draws the string contained in the text parameter, at the desired position, using textColor and backgroundColor.
The parameter fontSprite expect a spriteSheet asset labeled as font.
By placing a ROM you can access the sandard font: gdt.ROM.System.SpriteSheets["StandardFont"]
RasterSprite( position1 vec2, position2 vec2, position3 vec2, position4 vec2, spriteSheet SpriteSheet, spriteX number, spriteY number, tintColor color, backgroundColor color )
Draws a specific sprite frame from the spriteSheet mapping it on a quad identified by position1, position2, position3, position4
RasterCustomSprite( position1 vec2, position2 vec2, position3 vec2, position4 vec2, spriteSheet SpriteSheet, spriteOffset vec2, spriteSize vec2, tintColor color, backgroundColor color )
Draws a portion of a SpriteSheet (defined by spriteOffset, spriteSize) without taking into account the grid mapping it on a quad identified by position1, position2, position3, position4
DrawRenderBuffer( position vec2, renderBuffer RenderBuffer, width number, height number )
Draws a render buffer (supposedly coming from Webcam component) at the desired position, width and height
Wifi
Properties
AccessDenied booleanread only
Methods
WebGet( url string ) number
Send a web HTTP GET request, return a numeric handle to identify the request
WebPutData( url string, data string ) number
Send a web HTTP PUT request, return a numeric handle to identify the request
WebPostData( url string, data string ) number
Send a web HTTP POST request, return a numeric handle to identify the request
WebPostForm( url string, form {} ) number
Send a web HTTP POST request, return a numeric handle to identify the request
WebCustomRequest( url string, method string, customHeaderFields {}, contentType string, contentData string ) number
Send a web request, return a numeric handle to identify the request
WebAbort( handle number ) boolean
Abort a web request
GetWebUploadProgress( handle number ) number
Percentual [0-100]
GetWebDownloadProgress( handle number ) number
Percentual [0-100]
ClearCookieCache( )
Clear stored cookies
ClearUrlCookieCache( url string )
Only cookies that apply to this url will be removed from the cache
Events
WifiWebResponseEvent : { RequestHandle number, ResponseCode number, IsError boolean, ErrorType string, ErrorMessage string, ContentType string, Text string, Type string }
Sent when a web request is completed
SpriteSheet
Properties
Palette Palette
RenderBuffer
Code
AudioSample
Properties
SamplesCount number
Channels number
Frequency number
Length number
Length of the AudioSample in seconds
Palette
VideoChipMode
VideoChip rendering mode.
Values
SingleBuffer
DoubleBuffer