This class represents a two-dimensional Cartesian vector with the object variables x and y (floats).
The following functions are implemented:
normalize()
add(v:vector)
sub(v:vector)
addScalar(s:float)
subScalar(s:float)
mulScalar(s:float)
fromAngle(angle:float)
random()
magnitude()->float
distance(v:vector)->float
angle()->float
dot(v:vector)->float
limitToScreen(offset:float)
limit(xMin:float, xMax:float, yMin:float, yMax:float)
toString()->byte[30]
This class represents a three-dimensional vector with the object variables x,y, and z (floats).
The following functions are implemented:
normalize()
add(v:vector3D)
sub(v:vector3D)
addScalar(s:float)
subScalar(s:float)
mulScalar(s:float)
fromAngle(alpha:float, theta:float)
random()
magnitude()->float
distance(v:vector3D)->float
dot(v:vector3D)->float
cross(v:vector3D)->vector3D
toString()->byte[40]
The Buttons class has a boolean variable for each button: up, down, left, right and middle.
This class has no other functions and serves only as return type of the function “getButtons()”.
Pattern:
def onDraw()
b = getButtons()
if b.up:
# ...
if b.down:
# ...
if b.left:
# ...
if b.right:
# ...
if b.middle:
# ...
The dateTime class consists of a epoch time value (long) and a millisecond value (int).
Analogous to the time functions, clock time functions such as dateTime.getHour() or dateTime.getMillis() can be applied.
It is used for example for time stamps when logging sensor values.
dt:dateTime
dt.setTime(22, 33, 44)
dt.getHour() # => 22
dt.getMinute() # => 33
dt.getSecond() # => 44
The logValue class consists of a timestamp (dateTime) and a sensor data value (float).
It serves as the return type of the “logRead()” function.
logData(C_TEMP)
lv = logRead(C_TEMP, 0)
lv.timeStamp.getEpoch() # => 1651765847
lv.data # => 23.251343
The color class can be used to create colors in RGB and HSV mode.
c = color()
c.hsv(255,100,100)
c.fill()
sets the fill color to an HSV color value.
Fields: - color.r - red value - color.g - green value - color.b = blue value
Functions:
Sets a color in the RGB color space.
Sets a color from the HSV color space.
color.fill() - sets the fill color
color.stroke() - sets the stroke color
color.hex(0xffffff) - sets a color in the hexadecimal system 3 x 8 bits.
color.setByte(color) - sets a color on the color palette of the sprite colors.
New as of 1.6.3:
With setInt/getInt you can now specify 16bit colors. This is the internal resolution of the screen in 565 format (5 bits for red, 6 bits for green and 5 bits for blue).
The getHSV() function can be used to export the current color in HSV format. The return value is a byte array. The value range per value is limited to 0-255.