Included Commands
ABSTIME() Returns the time of day in seconds only where 12:00:00 AM (Midnight) is second 0. ONSB3() Returns true if progam is currently running on SmileBASIC 3 ONSB4() Returns true if progam is currently running on SmileBASIC 4 NUL [Variable or funtion] Runs an inline function without saving its result WAITSEC [Seconds] Pauses execution for a specified number of seconds WAITMS [Milliseconds] Pauses execution for a specified number of milliseconds DISTANCE(X1, Y1, X2, Y2) Computes the distance between two points with the pythagorean theorem INF() Returns infinity NINF() Returns negative infinity NAN() Returns "not a number" READBIT([Number], [Bit selector]) Reads the value in a single selected bit of a number SETBIT([Number], [Bit selector], [Binary Value]) Sets the value in a single selected bit of a number PHI() Returns Phi FACT(N) Returns N factorial. SWITCH([Condition], [Result A], [Result B]) If condition is true, return A, otherwise, return B SDIV(Dividend, Divisor, Alternate) If Divisor is not zero, return Dividend/Divisor otherwise, return Alternate WITHINRANGE(Number, Start of range, End of range) Returns true if Number is within the specified range CAPRANGE(Number, Start of range, End of range) or CAP() 'SB3,SB4 Compatible If Number is within the specified range, return Number without change. If Number is outside of specified range, then return the nearest boundary. MAPRANGE(Number, Start of range, End of range, Start of range, End of range) or MAP() 'SB3,SB4 Compatible Linearly map values from one range to another. TOPOINT(X,Y) Stores a point as two signed 16-bit integers in one 32-bit integer GETX(Point) Retrieve the X value from a Point GETY(Point) Retrieve the Y value from a Point GRAY(Luminance) Returns gray RGB value with Alpha 255, Value Luminance GLINER Start point X, Start point Y ,End point X, End point Y, Thickness, Color Draws a line with a custom thickness RNDCOL() Returns a color value with random RGB, but alpha 255 DITHER(Color) Adds RND(8) to all RGB channels to dither colors on SB3 FADECOL(T, Color 1, Color 2) 'SB3,SB4 Compatible Returns a color in between two colors. T=0 is Color 1, T=1 is Color 2. Values of T in between 0 and 1 will return colors in between Color 1 and Color 2 GGRADIENT Mode, Left, Top, Right, Bottom, Color 1,Color 2 Draws a simple horizontal or vertical gradient within the specified boundaries and colors. Mode |b00| If true, Vertical, otherwise, Horizontal CR$() Returns Carriage Return character LF$() Returns Line Feed character QT$() Returns Quote character NUL$() Returns Null character UPPER$(Text$) Convert english text to uppercase LOWER$(Text$) Convert english text to lowercase PRINTAT X, Y, Text$ 'SB3 Compatible only Print a string at any position of the text screen HEXTOSTR$(String$,Digits) Convert a hexadecimal string to standard string with specified number of digits STRTOHEX$(String$,Digits) Convert a standard string to hexadecimal string with specified number of digits RNDSTR$(Length, Start of range, End of range) Generate a length of specified length with characters within the specified range GBEZIER Start point X, Start point Y ,End point X, End point Y, Control point X, Control point Y, Color Draw a 1px-wide bezier curve GBLUR Left, Top, Right, Bottom, Radius 'SB3 Compatible only Blur a specified region of the graphics screen with a specified radius BGSTR Layer, X,Y, String$ Draw a string to the BG page DEFYLOGO Draw DEFY Splash Screen GDEFYLOGO Draw DEFY logo ROTATEP X,Y, Origin X, Origin Y, Angle in radians OUT X, Y Rotate a point around a specified origin point DISTANCEP(P1,P2) Returns the distance between P1 and P2 with the pythagorean theorem INTERP(N, P1, P2) Returns a point interpolated between P1 and P2 TOUCHP() Returns the touch position as a pointInstructions:
Load the library file into an alternate slot and make it usable via the USE command.USE "PRG?:DEFY.LIB"(Where "?" can be 0-3 to choose a program slot.) After that, just write the listed commands normally into your code.