ARSA Language  2.8
(Encryption, GPU and Web 3.0)
operator.h File Reference

Go to the source code of this file.

Functions

void arsalang (const char *src_name)
 load external code, !!!use in Photoshop layer only!!! More...
 
bool psd (const char *filename, bool clear=true, bool cache=true, bool snd=true)
 load a new psd file More...
 
bool openloading (const char *filename, bool only_psd=true)
 show loading screen when load psd file More...
 
void closeloading ()
 close loading screen when load psd file More...
 
void textarea (const char *layername, const char *areaname, const char *string, int r=255, int g=255, int b=255, int a=255)
 display text in area follow layer position and attribute (build-in font is default) More...
 
void textareafont (const char *layername, const char *areaname, const char *fontname, const char *string, int r=255, int g=255, int b=255, int a=255)
 display text in area with custom font follow layer position and attribute. More...
 
void textlayer (const char *layername, const char *string, int r=255, int g=255, int b=255, int a=255)
 display text follow layer position and attribute (build-in font is default) More...
 
void textlayerfont (const char *layername, const char *fontname, const char *string, int r=255, int g=255, int b=255, int a=255)
 display text with custom font follow layer position and attribute. More...
 
void text (int x, int y, const char *string)
 display text on screen by build-in font More...
 
void textalign (int align)
 set text alignment, !!!call before and ONLY effect with textlayer() and textlayerfont()!!! More...
 
void text (int x, int y, const char *string, int r, int g, int b, int a)
 display text on screen by build-in font More...
 
void text (const char *fontname, int fontsize, int x, int y, const char *string)
 display text on screen by custom font More...
 
void text (const char *fontname, int fontsize, int x, int y, const char *string, int r, int g, int b, int a)
 display text on screen by custom font More...
 
void int (const char *name, int value)
 define local variable as integer More...
 
void gint (const char *name, int value)
 define global variable as integer More...
 
void float (const char *name, float value)
 define local variable as float More...
 
void gfloat (const char *name, int value)
 define global variable as float More...
 
void string (const char *name, const char *value)
 define local variable as string More...
 
void gstring (const char *name, int value)
 define global variable as string More...
 
void struct (const char *name, const char *element,...)
 define local structure More...
 
void gstruct (const char *name, int value)
 define global structure More...
 
void set (const char *name, const char *value)
 set value on variable More...
 
void setstring (const char *name, const char *value)
 set string on variable, don't skip space More...
 
void add (const char *name, const char *value)
 add value on variable More...
 
void addstring (const char *name, const char *value)
 string cat, don't skip space More...
 
void sub (const char *name, const char *value)
 subtract value on variable More...
 
void mul (const char *name, const char *value)
 multiply value on variable More...
 
void div (const char *name, const char *value)
 divide value on variable More...
 
void mod (const char *name, const char *value)
 mod value on variable More...
 
void _sin (const char *name, const char *value)
 _sin value on variable More...
 
void _cos (const char *name, const char *value)
 _cos value on variable More...
 
 if (test_expr) void *function
 An if statement consists of a boolean expression followed by one or more statements. More...
 
 ifcount (const char *name, test_expr, int count) void *function
 An if statement with count. More...
 
 iftime (const char *name, test_expr, int delay) void *function
 An if statement with time delay in millisecond. More...
 
void ifreset (const char *name="")
 reset ifcount() and iftime(), maybe call in deinit function. More...
 
void function (const char *name)
 function, a group of commands that together perform a task More...
 
void procedure (void *function1 >> void *function2 >> ... >> void *functionN)
 procedure, a single line of commands that together perform a task More...
 
void proc (void *function1 >> void *function2 >> ... >> void *functionN)
 short version of procedure(). More...
 
 ifelse (test_expr, void *function1, void *function2)
 if else condition More...
 
 for (init_expr;test_expr;increment_expr) void *function
 A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times. More...
 
 while (test_expr) void *function
 A while loop in ARSA Language repeatedly executes a target statement as long as a given condition is true. More...
 
long gettime ()
 get virtual time More...
 
long getrealtime ()
 get real time More...
 
float getdeltatime ()
 get delta time More...
 
int random ()
 get random number More...
 
int random (int min, int max)
 get random number in range More...
 
const char * random_string (int len)
 get random string in lenght More...
 
const char * random_guid (bool with_letter=false)
 get random GUID number More...
 
const char * random_string_custom (int len, const char *string_custom)
 get random string with custom string More...
 
void setdebug (int debug)
 set debug mode More...
 
int isdebug ()
 query this psd is on debug mode More...
 
void msgbox (const char *msg)
 show message box More...
 
void alog (const char *msg)
 log message, a msg is showing on log window More...
 
bool touch (const char *state)
 query touch state More...
 
void touch (const char *state, void *function)
 touch anywhere and call the function. More...
 
bool touch (const char *state, const char *layername)
 query touch on layername More...
 
void touch (const char *state, const char *layername, void *function)
 touch on layername and call the function. More...
 
void touchclear ()
 touch clear buffer. More...
 
int touchmax ()
 get touch maximum id. More...
 
bool touchid (int touch_id, const char *state)
 query touch state by id More...
 
void touchid (int touch_id, const char *state, void *function)
 touch by id in anywhere and call the function. More...
 
bool touchid (int touch_id, const char *state, const char *layername)
 query touch by id on layername More...
 
void touchid (int touch_id, const char *state, const char *layername, void *function)
 touch by id on layername and call the function. More...
 
bool strstr (const char *string, const char *keyword)
 search string, case sensitive More...
 
const char * strtok (const char *string, const char *token="")
 Split string into tokens, DON'T USE ',' (comma) as token More...
 
void return ()
 
void break ()
 
void continue ()
 continue(), stop and restart process after called. More...
 
void setgamefps (int fps)
 set game fps, default: 60 More...
 
int getgamefps ()
 get game fps More...
 
int getcurrentfps ()
 get current fps More...
 
void winsize (int width, int height)
 windows size, Emulator only!!! More...
 
int getwinsizewidth ()
 get width on windows size Emulator only!!! More...
 
int getwinsizeheight ()
 get height on windows size Emulator only!!! More...
 
void setlandscape ()
 set landscape mode, call before screensize() More...
 
void setportrait ()
 set portrait mode call before screensize() More...
 
float getzrot (float x1, float y1, float x2, float y2)
 get z rotation between vector2d(x1,y1) and vector2d(x2,y2) More...
 
void setbgcolor (int r, int g, int b, int a)
 set background color More...
 
const char * version ()
 get version of thrid party libs in a string format. More...
 
const char * getversion ()
 get version of ARSA Framework in a string format. More...
 
const char * getredeemcode ()
 get current redeem code More...
 
const char * getuuid ()
 get device UUID More...
 
const char * getpackage ()
 get application package More...
 
const char * getplatform ()
 get current patform using. More...
 
void setuserstring (const char *str)
 set user string More...
 
const char * getuserstring ()
 get user string More...
 
void exit ()
 exit application More...
 
void clear ()
 free current psd file More...
 
void drawonce (bool clear=false, bool updateall=false)
 drawing screen immediately! More...
 
bool url (const char *url, bool webapp=false, bool use_webbrowser=true)
 open url More...
 
bool phonecall (const char *number)
 phone call More...
 
bool sharefile (const char *mailto, const char *subject, const char *msg, const char *filename)
 share text and file More...
 
const char * savescreenshot (bool silent=false)
 save current screenshot to jpg format More...
 
bool sharescreenshot (const char *mailto, const char *subject, const char *msg)
 share current screenshot More...
 
const char * getscreenshotname ()
 get a random name of screenshot More...
 
const char * getgps ()
 get a gps location More...
 
bool isset (const char *var)
 Determine if a variable is considered set, this means if a variable is declared and is different than null. More...
 
bool isnumber (const char *var)
 Determine if a variable is a number both int or float. More...
 
bool isint (const char *var)
 Determine if a variable is an int. More...
 
bool isfloat (const char *var)
 Determine if a variable is a float. More...
 
bool isstring (const char *var)
 Determine if a variable is a string. More...
 
bool isspace (const char *var)
 Determine if a variable is a whitespace. More...
 
void clearqueuerender ()
 clear queue rendering both psd and font. More...
 
void psdrenderall ()
 adding all layers in current psd file to queue rendering. More...
 
const char * camera ()
 
bool pickup (const char *state, const char *layername)
 pickup on layername by state condition. More...
 
const char * pickupgetlayername ()
 get layername from user pickup layer. More...
 
void pickupclear ()
 clear pickup buffer. More...
 
const char * base64encode (const char *str)
 base64 encode More...
 
const char * base64decode (const char *str)
 base64 decode More...
 
const char * scanvar (const char *str)
 scan string variable and math replacement More...
 
const char * urlencode (const char *str)
 url encode More...
 
const char * urldecode (const char *str)
 url decode More...
 
const char * getwritepath (const char *filename)
 get write path with filename and extension More...
 
const char * md5 (const char *filename_or_string)
 get md5 More...
 
const char * sha256 (const char *filename_or_string)
 get sha256 More...
 
const char * openfile ()
 openfile dialog. More...
 
const char * getpushfile ()
 
bool voicestart (const char *savefilename)
 start voice recording and removing savefilename from audio system before recording. More...
 
void voicestop ()
 stop voice recording. More...
 
int clamp (int value, int min, int max)
 clamp value as int More...
 
float clamp (float value, float min, float max)
 clamp value as float More...
 
int lerp (int a, int b, float t)
 lerp value as int, Computes the linear interpolation between a and b, if the parameter t is inside [0, 1] More...
 
float lerp (float a, float b, float t)
 lerp value as float, Computes the linear interpolation between a and b, if the parameter t is inside [0, 1] More...
 
void setclipboard (const char *text)
 Put UTF-8 text into the clipboard. More...
 
const char * getclipboard ()
 Get UTF-8 text from the clipboard. More...
 
void delay (int millisec)
 delay cpu circle in milli second More...
 
const char * strftime (const char *format)
 Get time format. More...
 
const char * strcmp (const char *str1, const char *str2)
 The strcmp() compares two strings character by character. If the strings are equal, the function returns 0. More...
 
const char * getfilebasename (const char *filename, bool keep_extension=true)
 get filename from full path. More...
 
const char * getfileextension (const char *filename)
 get extension from from full path. More...
 
const char * getfiledir (const char *filename)
 get directory from from full path. More...
 
bool permission (const char *permission_name, bool require=true)
 checking permission on mobile devices only. More...
 
bool ispsdfile (const char *filename)
 checking is psd file More...
 
float getaccx ()
 get accelerometer x More...
 
float getaccy ()
 get accelerometer y More...
 
float getaccz ()
 get accelerometer z More...
 
int getorient ()
 get current screen orientation More...
 
float getdpid ()
 get screen dpi density More...
 
float getdpix ()
 get screen dpi x More...
 
float getdpiy ()
 get screen dpi y More...
 
bool or (test_expr,...)
 OR operation with if statement consists of a boolean expression followed by one or more statements. More...
 
bool and (test_expr,...)
 AND operation with if statement consists of a boolean expression followed by one or more statements. More...
 

Function Documentation

◆ _cos()

void _cos ( const char *  name,
const char *  value 
)

_cos value on variable

Parameters
namevariable name
valuevariable value

◆ _sin()

void _sin ( const char *  name,
const char *  value 
)

_sin value on variable

Parameters
namevariable name
valuevariable value

◆ add()

void add ( const char *  name,
const char *  value 
)

add value on variable

Parameters
namevariable name
valuevariable value

◆ addstring()

void addstring ( const char *  name,
const char *  value 
)

string cat, don't skip space

Parameters
namevariable name
valuevariable value

◆ alog()

void alog ( const char *  msg)

log message, a msg is showing on log window

Parameters
msgmessage

Example:

◆ and()

bool and ( test_expr  ,
  ... 
)

AND operation with if statement consists of a boolean expression followed by one or more statements.

Parameters
test_exprthe condition is evaluated. If it is true, the function is executed. If it is false, the function does not execute.
Returns
all of expressions is true then return true, otherwise is false.

Example:
if(and($i>10, $i>20, $i>30)==true) text(100,100, value greater than: 30.)

◆ arsalang()

void arsalang ( const char *  src_name)

load external code, !!!use in Photoshop layer only!!!

Parameters
src_nameis text file formatted only and put this file in same psd folder.

◆ base64decode()

const char* base64decode ( const char *  str)

base64 decode

Parameters
strstring that want decode.
Returns
base64 decode string.

◆ base64encode()

const char* base64encode ( const char *  str)

base64 encode

Parameters
strstring that want encode.
Returns
base64 encode string.

◆ break()

void break ( )

break(), stop below process after called. equal return()

See also
return()

◆ camera()

const char* camera ( )

open camera and take a photo.
win32 only show text on messagebox.
android open camera device from INTENT.

Returns
successed is path of photo's name, failed is empty.

◆ clamp() [1/2]

int clamp ( int  value,
int  min,
int  max 
)

clamp value as int

Returns
clamp value as int

◆ clamp() [2/2]

float clamp ( float  value,
float  min,
float  max 
)

clamp value as float

Returns
clamp value as float

◆ clear()

void clear ( )

free current psd file

◆ clearqueuerender()

void clearqueuerender ( )

clear queue rendering both psd and font.

◆ closeloading()

void closeloading ( )

close loading screen when load psd file

See also
openloading()

◆ continue()

void continue ( )

continue(), stop and restart process after called.

◆ delay()

void delay ( int  millisec)

delay cpu circle in milli second

◆ div()

void div ( const char *  name,
const char *  value 
)

divide value on variable

Parameters
namevariable name
valuevariable value

◆ drawonce()

void drawonce ( bool  clear = false,
bool  updateall = false 
)

drawing screen immediately!

Parameters
clearremove and free all objects before draw, default: false
updateallupdate all psd layer, default: false

◆ exit()

void exit ( )

exit application

◆ float()

void float ( const char *  name,
float  value 
)

define local variable as float

Parameters
namevariable name
valuevariable value
Example
float($f, 0.545)
text(10, 50, Float: $f)
Example Array
float($f[3], 0)
set($f[0], 0.543)
set($f[1], 1.7)
set($f[2], 20.6327)
text(300, 40, Float 0: $f[0])
text(300, 70, Float 1: $f[1])
text(300, 100, Float 2: $f[2])

◆ for()

for ( init_expr;test_expr;  increment_expr)

A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times.

Here is the flow of control in a for loop:

Parameters
init_exprThe init step is executed first, and only once. This step allows you to declare and initialize any loop control variables. You are not required to put a statement here, as long as a semicolon appears.
test_exprNext, the condition is evaluated. If it is true, the body of the loop is executed. If it is false, the body of the loop does not execute and flow of control jumps to the next statement just after the for loop.
increment_exprAfter the body of the for loop executes, the flow of control jumps back up to the increment statement. This statement allows you to update any loop control variables. This statement can be left blank, as long as a semicolon appears after the condition.
functioncall the function when loop process

Example1:
for($i=0;$i<10;$i++) text(10,$i*30,Value is: $i)
Example2:
int($num,10)
for($i=0;$i<$num;$i++) text(10,$i*30,Value is: $i)

◆ function()

void function ( const char *  name)

function, a group of commands that together perform a task

can be recursive other function.

Parameters
namefunction name
Example:
{
text(10,10,Hello World)
}function(print)

◆ getaccx()

float getaccx ( )

get accelerometer x

Returns
value on accelerometer x

◆ getaccy()

float getaccy ( )

get accelerometer y

Returns
value on accelerometer y

◆ getaccz()

float getaccz ( )

get accelerometer z

Returns
value on accelerometer z

◆ getclipboard()

const char* getclipboard ( )

Get UTF-8 text from the clipboard.

Returns
text from the clipboard

◆ getcurrentfps()

int getcurrentfps ( )

get current fps

Returns
current frame per second as integer

◆ getdeltatime()

float getdeltatime ( )

get delta time

Returns
delta time as float

◆ getdpid()

float getdpid ( )

get screen dpi density

Returns
density dpi

◆ getdpix()

float getdpix ( )

get screen dpi x

Returns
x dpi

◆ getdpiy()

float getdpiy ( )

get screen dpi y

Returns
y dpi

◆ getfilebasename()

const char* getfilebasename ( const char *  filename,
bool  keep_extension = true 
)

get filename from full path.

Parameters
filenameis a full path.
keep_extensionkeep the extension of filename, default is true.
Returns
filename only (extension is optional).

◆ getfiledir()

const char* getfiledir ( const char *  filename)

get directory from from full path.

Parameters
filenameis a full path.
Returns
directory only.

◆ getfileextension()

const char* getfileextension ( const char *  filename)

get extension from from full path.

Parameters
filenameis a full path.
Returns
extension only.

◆ getgamefps()

int getgamefps ( )

get game fps

Returns
frame per second as integer

◆ getgps()

const char* getgps ( )

get a gps location

Returns
a string of gps format with a comma (,): lat,lon
100.546,275.233

◆ getorient()

int getorient ( )

get current screen orientation

sa setlandscape() setportrait()

Returns
orientation as integer
0 = The display orientation can't be determined.
1 = The display is in landscape mode, with the right side up, relative to portrait mode.
2 = The display is in landscape mode, with the left side up, relative to portrait mode.
3 = The display is in portrait mode.
4 = The display is in portrait mode, upside down.

◆ getpackage()

const char* getpackage ( )

get application package

Returns
package name.

◆ getplatform()

const char* getplatform ( )

get current patform using.

Returns
platform name follows:
Windows
Mac OS X
Linux
iOS
Android

◆ getpushfile()

const char* getpushfile ( )

get push file from other application with single file or multi push files.
this support only mobile device that possible sharing file to the other app.

See also
ftointernalstorage() use this function to tranfers file to internal storage.
Returns
just only first time, getpushfile will return full filename with path in json fotmat, remember next cpu cycle is an empty string.
json file format:
{
"type":"file",
"file":"/usr/app/filename1.ext",
"file":"/usr/app/filename2.ext"
"file":"/usr/app/filename3.ext"
}
json text format:
{
"type":"text",
"file":"hello world",
}

◆ getrealtime()

long getrealtime ( )

get real time

Returns
current real time as millisec, 1000 millisec = 1 sec

◆ getredeemcode()

const char* getredeemcode ( )

get current redeem code

Returns
redeem code.

◆ getscreenshotname()

const char* getscreenshotname ( )

get a random name of screenshot

Returns
random string of screenshot name.

◆ gettime()

long gettime ( )

get virtual time

Returns
current time as millisec, 1000 millisec = 1 sec

◆ getuserstring()

const char* getuserstring ( )

get user string

Returns
user string.

◆ getuuid()

const char* getuuid ( )

get device UUID

Returns
UUID.

◆ getversion()

const char* getversion ( )

get version of ARSA Framework in a string format.

Returns
string version of ARSA Framework.

◆ getwinsizeheight()

int getwinsizeheight ( )

get height on windows size Emulator only!!!

Returns
windows size height

◆ getwinsizewidth()

int getwinsizewidth ( )

get width on windows size Emulator only!!!

Returns
windows size width

◆ getwritepath()

const char* getwritepath ( const char *  filename)

get write path with filename and extension

Parameters
filenamefilename and extension that want to write with fullpath on disk.
Returns
writepath with filename and extension.

◆ getzrot()

float getzrot ( float  x1,
float  y1,
float  x2,
float  y2 
)

get z rotation between vector2d(x1,y1) and vector2d(x2,y2)

Parameters
x1vector x1
y1vector y1
x2vector x2
y2vector y2
Returns
z rotation

◆ gfloat()

void gfloat ( const char *  name,
int  value 
)

define global variable as float

Parameters
namevariable name
valuevariable value
See also
float()

◆ gint()

void gint ( const char *  name,
int  value 
)

define global variable as integer

Parameters
namevariable name
valuevariable value
See also
int()

◆ gstring()

void gstring ( const char *  name,
int  value 
)

define global variable as string

Parameters
namevariable name
valuevariable value
See also
string()

◆ gstruct()

void gstruct ( const char *  name,
int  value 
)

define global structure

Parameters
namevariable name
valuevariable value
See also
struct()

◆ if()

if ( test_expr  )

An if statement consists of a boolean expression followed by one or more statements.

Parameters
test_exprthe condition is evaluated. If it is true, the function is executed. If it is false, the function does not execute.
functioncall the function when condition is true

Example:
if($i==10) text(100,100,Value is: $i)

◆ ifcount()

ifcount ( const char *  name,
test_expr  ,
int  count 
)

An if statement with count.

Parameters
nameuniqueness name of this statement, purpose reset for.
test_exprthe condition is evaluated. If it is true, the function is executed. If it is false, the function does not execute.
counttime to do if statement in true case, false not do anything, 0 equal if().
functioncall the function when condition is true

Example:
ifcount("if count i", $i==10, 3) text(100,100,Value is: $i) // just print 3 times.

◆ ifelse()

ifelse ( test_expr  ,
void *  function1,
void *  function2 
)

if else condition

Parameters
test_exprthe condition is evaluated. If it is true, the function is executed. If it is false, the function does not execute.
function1call the function when condition is true
function2call the function when condition is false

Example:
ifelse($i==10, text(100,100,Value i=10), text(100,100,Value i!=10))

◆ ifreset()

void ifreset ( const char *  name = "")

reset ifcount() and iftime(), maybe call in deinit function.

Parameters
nameuniqueness name of reset statement, empty reset all.

◆ iftime()

iftime ( const char *  name,
test_expr  ,
int  delay 
)

An if statement with time delay in millisecond.

Parameters
nameuniqueness name of this statement, purpose reset for.
test_exprthe condition is evaluated. If it is true, the function is executed. If it is false, the function does not execute.
delaytime to delay in millisecond then doing if statement in true case, false not do anything, 0 equal if().
functioncall the function when condition is true

Example:
iftime("if time i", $i==10, 1000) text(100,100,Value is: $i) // just print in every 1 second.

◆ int()

void int ( const char *  name,
int  value 
)

define local variable as integer

Parameters
namevariable name
valuevariable value
Example
int($i, 10)
text(10, 10, Int: $i)
Example Array
int($i[3], 0)
set($i[0], 10)
set($i[1], 20)
set($i[2], 30)
text(10, 40, Int 0: $i[0])
text(10, 70, Int 1: $i[1])
text(10, 100, Int 2: $i[2])
Example Array with constant
int($num, 20)
int($i[$num], 0)

◆ isdebug()

int isdebug ( )

query this psd is on debug mode

Returns
> 0 is debug mode, 0 is not

◆ isfloat()

bool isfloat ( const char *  var)

Determine if a variable is a float.

Parameters
varonly variable name
Returns
successed return true, otherwise is false.

◆ isint()

bool isint ( const char *  var)

Determine if a variable is an int.

Parameters
varonly variable name
Returns
successed return true, otherwise is false.

◆ isnumber()

bool isnumber ( const char *  var)

Determine if a variable is a number both int or float.

Parameters
varonly variable name
Returns
successed return true, otherwise is false.

◆ ispsdfile()

bool ispsdfile ( const char *  filename)

checking is psd file

Parameters
filenamefile that user want to checking.
Returns
true is psd file, false is otherwise.

◆ isset()

bool isset ( const char *  var)

Determine if a variable is considered set, this means if a variable is declared and is different than null.

Parameters
varonly variable name , not enter $ at front!
Returns
If parameters are supplied then isset() will return true, otherwise is false.

◆ isspace()

bool isspace ( const char *  var)

Determine if a variable is a whitespace.

Parameters
varonly variable name
Returns
successed return true, otherwise is false.

◆ isstring()

bool isstring ( const char *  var)

Determine if a variable is a string.

Parameters
varonly variable name
Returns
successed return true, otherwise is false.

◆ lerp() [1/2]

int lerp ( int  a,
int  b,
float  t 
)

lerp value as int, Computes the linear interpolation between a and b, if the parameter t is inside [0, 1]

Returns
lerp value as int

◆ lerp() [2/2]

float lerp ( float  a,
float  b,
float  t 
)

lerp value as float, Computes the linear interpolation between a and b, if the parameter t is inside [0, 1]

Returns
lerp value as float

◆ md5()

const char* md5 ( const char *  filename_or_string)

get md5

Parameters
filename_or_stringcheck sum from file or string
Returns
md5 hash of a string

◆ mod()

void mod ( const char *  name,
const char *  value 
)

mod value on variable

Parameters
namevariable name
valuevariable value

◆ msgbox()

void msgbox ( const char *  msg)

show message box

Parameters
msgmessage

◆ mul()

void mul ( const char *  name,
const char *  value 
)

multiply value on variable

Parameters
namevariable name
valuevariable value

◆ openfile()

const char* openfile ( )

openfile dialog.

See also
ftointernalstorage() use this function to tranfers file to internal storage.
Returns
just only first time, openfile will return full filename with path in json fotmat.
json format:
{
"type":"file",
"file":"/usr/app/filename1.ext",
"file":"/usr/app/filename2.ext"
"file":"/usr/app/filename3.ext"
}

◆ openloading()

bool openloading ( const char *  filename,
bool  only_psd = true 
)

show loading screen when load psd file

Parameters
psd_onlyshow loading screen only loading psd file
loading screen can have built-in layer name on psd file follows:

loadingbar

horizontal animation progress bar start from left(empty) to right(full) support only psd class, counting with number of layers.

loadingh

horizontal animation loop progress bar start from left to right cannot count progress!

loadingv

vertical animation loop progress bar start from top to bottom cannot count progress!

how to use

{
openloading("loading.psd") // open loading file
}function(init)
Returns
true is successed, false is failed.

◆ or()

bool or ( test_expr  ,
  ... 
)

OR operation with if statement consists of a boolean expression followed by one or more statements.

Parameters
test_exprthe condition is evaluated. If it is true, the function is executed. If it is false, the function does not execute.
Returns
one or all expression is true then return true, otherwise is false.

Example:
if(or($i>10, $i>20, $i>30)==true) text(100,100, value greater than: 10 or 20 or 30.)

◆ permission()

bool permission ( const char *  permission_name,
bool  require = true 
)

checking permission on mobile devices only.

Parameters
permission_namechecking string of permission, follows:
storage
gps
camera
mic
requiretrue: if permission is false then call permission process from os, false: check permission only, default: true.
Returns
true is allow, false is not allow.

◆ phonecall()

bool phonecall ( const char *  number)

phone call

Parameters
numberphone number that you want to make a call.
Returns
true was successed, false was failed

Example:
phonecall("0891234567")

◆ pickup()

bool pickup ( const char *  state,
const char *  layername 
)

pickup on layername by state condition.

If state and layername are match then return true, otherwise is false and send layername as build-in variable to other the function.
User can be use null instread layername.

Parameters
statecheck user pickup state, use same touch state as well.
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
successed is true, otherwise is false.
See also
touch()

◆ pickupclear()

void pickupclear ( )

clear pickup buffer.

◆ pickupgetlayername()

const char* pickupgetlayername ( )

get layername from user pickup layer.

Returns
current layername is pickup.

◆ proc()

void proc ( void *function1 >> void *function2 >> ... >> void *  functionN)

short version of procedure().

◆ procedure()

void procedure ( void *function1 >> void *function2 >> ... >> void *  functionN)

procedure, a single line of commands that together perform a task

benefit is reduce line of code, every command in procedure token by >>
cannot be recursive any procedure.

Parameters
function1call the function first
function2call the function second
functionNcall the function end
Example:
procedure( set($i,50) >> text(10,10,$i) )

◆ psd()

bool psd ( const char *  filename,
bool  clear = true,
bool  cache = true,
bool  snd = true 
)

load a new psd file

Parameters
filenameload psd file only (.psd)
cleartrue: clear scene before load, false: import psd only
cachetrue: allocate memory before load, false: directly read from storage
sndtrue: clear all audio/video before load
Returns
true is successed, false is failed
Example 1. load a new one
psd(image.psd)

Example 2. import psd into another, cache and clear sound
psd(image.psd,false)

Example 3. import psd into another, NOT cache and NOT clear sound
psd(image.psd,false, false, false)

Example 4. load from cloud
psd(http://sarosworld.com/chars4_bg.psd)

◆ psdrenderall()

void psdrenderall ( )

adding all layers in current psd file to queue rendering.

◆ random() [1/2]

int random ( )

get random number

Returns
random number as integer

◆ random() [2/2]

int random ( int  min,
int  max 
)

get random number in range

Parameters
minstart random value
maxend random value
Returns
random number as integer

◆ random_guid()

const char* random_guid ( bool  with_letter = false)

get random GUID number

Parameters
with_letteruse - between guid
Returns
a 36-character string in the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
where "X" is an "upper-case" hexadecimal digit [0-9A-F].
Use the string.lower() function if you want lower-case letters.
Example:
random_guid( ) // result: 424F585A4D384F568833354350424631
random_guid( true ) // result: 53514B41-4339-4247-8E48-4E4131584C30

◆ random_string()

const char* random_string ( int  len)

get random string in lenght

Parameters
lensize of string random
Returns
random string

◆ random_string_custom()

const char* random_string_custom ( int  len,
const char *  string_custom 
)

get random string with custom string

Parameters
lensize of string random
string_customcharacter want to random
Returns
random string
Example:
random_string_custom( 8, "123456") // result: 15542532
random_string_custom( 5, "abc") // result: bccaa

◆ return()

void return ( )

return(), stop below process after called. equal break()

See also
break()

◆ savescreenshot()

const char* savescreenshot ( bool  silent = false)

save current screenshot to jpg format

Parameters
silentnotify message on screen, default: false
Returns
successed will filename and location of saved screenshot, failed return empty string.

◆ scanvar()

const char* scanvar ( const char *  str)

scan string variable and math replacement

Parameters
strstring that want scan variable and math replacement.
Returns
replaced string.

◆ set()

void set ( const char *  name,
const char *  value 
)

set value on variable

Parameters
namevariable name
valuevariable value

◆ setbgcolor()

void setbgcolor ( int  r,
int  g,
int  b,
int  a 
)

set background color

Parameters
rred value
ggreen value
bblue value
aalpha value

◆ setclipboard()

void setclipboard ( const char *  text)

Put UTF-8 text into the clipboard.

Parameters
textstring into the clipboard.

◆ setdebug()

void setdebug ( int  debug)

set debug mode

Parameters
debugvalue of debuging

◆ setgamefps()

void setgamefps ( int  fps)

set game fps, default: 60

Parameters
fpsframe per second

◆ setlandscape()

void setlandscape ( )

set landscape mode, call before screensize()

set screen size to default

◆ setportrait()

void setportrait ( )

set portrait mode call before screensize()

set screen size to default

◆ setstring()

void setstring ( const char *  name,
const char *  value 
)

set string on variable, don't skip space

Parameters
namevariable name
valuevariable value

◆ setuserstring()

void setuserstring ( const char *  str)

set user string

Parameters
strany string.

◆ sha256()

const char* sha256 ( const char *  filename_or_string)

get sha256

Parameters
filename_or_stringcheck sum from file or string
Returns
sha256 hash of a string

◆ sharefile()

bool sharefile ( const char *  mailto,
const char *  subject,
const char *  msg,
const char *  filename 
)

share text and file

Parameters
mailtoan email that you want to share to.
subjectthe head of message.
msgthis is a content.
filenamelocation of filename that you want to share, may same psd folder.
Returns
true was successed, false was failed

Example:
sharefile("support@sarosworld.com", "get redeem code", "Hello, How do I get a redeem code ?" )
Example share with a file:
sharefile("support@sarosworld.com", "get redeem code", "Hello, How do I get a redeem code ?", "image.png" ) // image.png must present in same psd folder.

◆ sharescreenshot()

bool sharescreenshot ( const char *  mailto,
const char *  subject,
const char *  msg 
)

share current screenshot

Parameters
mailtoan email that you want to share to.
subjectthe head of message.
msgthis is a content.
Returns
true was successed, false was failed

Example:
sharescreenshot("someone@abc.com", "Share photo", "Hey, Check this photo!" )

◆ strcmp()

const char* strcmp ( const char *  str1,
const char *  str2 
)

The strcmp() compares two strings character by character. If the strings are equal, the function returns 0.

Parameters
str1a string 1
str2a string 2
Returns
0 is equal, > 0 is greater, < 0 is lower

◆ strftime()

const char* strftime ( const char *  format)

Get time format.

Parameters
formatThis is the C string format are:
%a Abbreviated weekday name Sun
%A Full weekday name Sunday
%b Abbreviated month name Mar
%B Full month name March
%c Dateand time representation Sun Aug 19 02:56 : 02 2012
%d Day of the month(01 - 31) 19
%H Hour in 24h format(00 - 23) 14
%I Hour in 12h format(01 - 12) 05
%j Day of the year(001 - 366) 231
%m Month as a decimal number(01 - 12) 08
%M Minute(00 - 59) 55
%p AM or PM designation PM
%S Second(00 - 61) 02
%U Week number with the first Sunday as the first day of week one(00 - 53) 33
%w Weekday as a decimal number with Sunday as 0 (0 - 6) 4
%W Week number with the first Monday as the first day of week one(00 - 53) 34
%x Date representation 08 / 19 / 12
%X Time representation 02:50 : 06
%y Year, last two digits(00 - 99) 01
%Y Year 2012
%Z Timezone name or abbreviation CDT
%% A % sign %
strftime example:
strftime("%x - %I:%M%p") // 08/23/12 - 12:40AM
Returns
current time in string format.

◆ string()

void string ( const char *  name,
const char *  value 
)

define local variable as string

Parameters
namevariable name
valuevariable value
Example
string($str,Hello World)
text(10, 90, String: $str)
Example Array
string($str[3],"")
setstring($str[0], Hello Array)
setstring($str[1], I'm Slot two.)
setstring($str[2], ending)
text(600, 40, String 0: $str[0])
text(600, 70, String 1: $str[1])
text(600, 100, String 2: $str[2])

◆ strstr()

bool strstr ( const char *  string,
const char *  keyword 
)

search string, case sensitive

Parameters
stringoriginal string
keywordsearch string
Returns
true found, false not found
See also
string.find()

◆ strtok()

const char* strtok ( const char *  string,
const char *  token = "" 
)

Split string into tokens, DON'T USE ',' (comma) as token

Parameters
stringoriginal string
tokenC string containing the delimiter characters. These can be different from one call to another.
If use want token by whitespace use "" or " " or leave empty parameter.
Returns
If a token is found, a pointer to the beginning of the token. Otherwise, empty string.
Example 1.
string($str,boss:10:20:30)
// boss
text(10, 10, strtok($str,:))
// 10
text(10, 40, strtok(null,:))
// 20
text(10, 70, strtok(null,:))
// 30
text(10, 100, strtok(null,:))

Example 2.
string($str,Hello How are you)
// Hello
text(10, 10, strtok($str,))
// How
text(10, 40, strtok(null,))
// are
text(10, 70, strtok(null,))
// you
text(10, 100, strtok(null,))

◆ struct()

void struct ( const char *  name,
const char *  element,
  ... 
)

define local structure

Parameters
elementdata member on this structure
Example
struct($Player,Name,Hp,Att,Def,Int)
set($Player.Name, Saros)
set($Player.Hp, 1000)
set($Player.Att, 99)
set($Player.Def, 99)
set($Player.Int, 99)
text(10, 40, Name: $Player.Name)
text(10, 70, ATT: $Player.Att)
text(10, 100, DEF: $Player.Def)
text(10, 130, INT: $Player.Int)
Example Array
struct($Player[3],Name,Hp, Att, Def, Int)
setstring($Player[0].Name,Jerido)
set($Player[0].Hp,500)
set($Player[0].Att,75)
set($Player[0].Def,22)
set($Player[0].Int,50)
setstring($Player[1].Name,Mu)
set($Player[1].Hp,550)
set($Player[1].Att,60)
set($Player[1].Def,25)
set($Player[1].Int,45)
setstring($Player[2].Name,Exact)
set($Player[2].Hp,600)
set($Player[2].Att,70)
set($Player[2].Def,30)
set($Player[2].Int,50)

◆ sub()

void sub ( const char *  name,
const char *  value 
)

subtract value on variable

Parameters
namevariable name
valuevariable value

◆ text() [1/4]

void text ( int  x,
int  y,
const char *  string 
)

display text on screen by build-in font

Parameters
xposition on x axis
yposition on y axis
stringtext, sometime can use variable or function instread.

◆ text() [2/4]

void text ( int  x,
int  y,
const char *  string,
int  r,
int  g,
int  b,
int  a 
)

display text on screen by build-in font

specify custom color range between 0-255

Parameters
xposition on x axis
yposition on y axis
stringtext, sometime can use variable or function instread.
rred value
ggreen value
bblue value
aalpha value

◆ text() [3/4]

void text ( const char *  fontname,
int  fontsize,
int  x,
int  y,
const char *  string 
)

display text on screen by custom font

Parameters
fontnamesupport only TTF font, user must copy font same psd location
fontsizesize of font, much is bigger
xposition on x axis
yposition on y axis
stringtext, sometime can use variable or function instread.

◆ text() [4/4]

void text ( const char *  fontname,
int  fontsize,
int  x,
int  y,
const char *  string,
int  r,
int  g,
int  b,
int  a 
)

display text on screen by custom font

specify custom color range between 0-255

Parameters
fontnamesupport only TTF font, user must copy font same psd location
fontsizesize of font, much is bigger
xposition on x axis
yposition on y axis
stringtext, sometime can use variable or function instread.
rred value
ggreen value
bblue value
aalpha value

◆ textalign()

void textalign ( int  align)

set text alignment, !!!call before and ONLY effect with textlayer() and textlayerfont()!!!

Parameters
alignflags of text alignment, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
d = default is l|t

◆ textarea()

void textarea ( const char *  layername,
const char *  areaname,
const char *  string,
int  r = 255,
int  g = 255,
int  b = 255,
int  a = 255 
)

display text in area follow layer position and attribute (build-in font is default)

Parameters
layernamename of psd layer, font follow: color, alpha and size = layer height.
areanamename of psd layer, rectangle of display text with position (top left corner), wordwrap and scissor.
stringtext, maybe variable or function allow.
rred value
ggreen value
bblue value
aalpha value

◆ textareafont()

void textareafont ( const char *  layername,
const char *  areaname,
const char *  fontname,
const char *  string,
int  r = 255,
int  g = 255,
int  b = 255,
int  a = 255 
)

display text in area with custom font follow layer position and attribute.

Parameters
layernamename of psd layer, font follow: color, alpha and size = layer height.
areanamename of psd layer, rectangle of display text with position (top left corner), wordwrap and scissor.
fontnamesupport only TTF font, user must copy font same psd location
stringtext, maybe variable or function allow.
rred value
ggreen value
bblue value
aalpha value

◆ textlayer()

void textlayer ( const char *  layername,
const char *  string,
int  r = 255,
int  g = 255,
int  b = 255,
int  a = 255 
)

display text follow layer position and attribute (build-in font is default)

Parameters
layernamename of psd layer, font follow: position, color, alpha and size = layer height*2.
stringtext, maybe variable or function allow.
rred value
ggreen value
bblue value
aalpha value

◆ textlayerfont()

void textlayerfont ( const char *  layername,
const char *  fontname,
const char *  string,
int  r = 255,
int  g = 255,
int  b = 255,
int  a = 255 
)

display text with custom font follow layer position and attribute.

Parameters
layernamename of psd layer, font follow: position, color, alpha and size = layer height.
fontnamesupport only TTF font, user must copy font same psd location
stringtext, maybe variable or function allow.
rred value
ggreen value
bblue value
aalpha value

◆ touch() [1/4]

bool touch ( const char *  state)

query touch state

Parameters
statecheck user touch state, values are:
up
down
press
release
isleft
isright
isup
isdown
isdouble
istripple
ismoving
iszoomin
iszoomout
getrepeat
gettime
gettouchx
gettouchy
gettouchx_old
gettouchy_old
gettouchx_fromstart
gettouchy_fromstart
gettouchxy_diff
gettouchx_diff
gettouchy_diff
gettouchx_diff_fromstart
gettouchy_diff_fromstart
limit // add limit layer touch input that can recursive adding until call limiteclear, e.g. touch( limit, layer1, layer2, ... , layerN )
limitclear // clear limit layer e.g. touch( limitclear )
clear // clear all input buffer and limit
Returns
true or false, getrepeat return number of repeat count
See also
touch()

◆ touch() [2/4]

void touch ( const char *  state,
void *  function 
)

touch anywhere and call the function.

If state match then call the function and send layername as build-in variable to other the function.
User can be use null instread layername.

Parameters
statecheck user touch state.
functioncall the function.
See also
touch()

◆ touch() [3/4]

bool touch ( const char *  state,
const char *  layername 
)

query touch on layername

If state and layername are match then call the function and send layername as build-in variable to other the function.
User can be use null instread layername.

Parameters
statecheck user touch state.
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
true or false, getrepeat return number of repeat count on layer
See also
touch()

◆ touch() [4/4]

void touch ( const char *  state,
const char *  layername,
void *  function 
)

touch on layername and call the function.

If state and layername are match then call the function and send layername as build-in variable to other the function.
User can be use null instread layername.
Note: this style is not effect with below states:
isleft
isright
isup
isdown

Parameters
statecheck user touch state.
layernamename of layer, can be null that choose build-in layername from the other function.
functioncall the function.
See also
touch()

◆ touchclear()

void touchclear ( )

touch clear buffer.

clear all input buffer of touch screen.

◆ touchid() [1/4]

bool touchid ( int  touch_id,
const char *  state 
)

query touch state by id

Parameters
touch_idnumber of touch id, maximum id can get from touchmax()
statecheck user touch state, values are:
up
down
press
release
isleft
isright
isup
isdown
isdouble
istripple
ismoving
iszoomin
iszoomout
getrepeat
gettime
gettouchx
gettouchy
gettouchx_old
gettouchy_old
gettouchx_fromstart
gettouchy_fromstart
gettouchxy_diff
gettouchx_diff
gettouchy_diff
gettouchx_diff_fromstart
gettouchy_diff_fromstart
limit // limit layer touch input e.g. touch( limit, layer1, layer2, ... , layerN )
limitclear // clear limit layer e.g. touch( limitclear )
clear // clear all input buffer and limit
Returns
true or false, getrepeat return number of repeat count
See also
touchmax()

◆ touchid() [2/4]

void touchid ( int  touch_id,
const char *  state,
void *  function 
)

touch by id in anywhere and call the function.

If state match then call the function and send layername as build-in variable to other the function.
User can be use null instread layername.

Parameters
touch_idnumber of touch id, maximum id can get from touchmax()
statecheck user touch state.
functioncall the function.
See also
touchmax()

◆ touchid() [3/4]

bool touchid ( int  touch_id,
const char *  state,
const char *  layername 
)

query touch by id on layername

If state and layername are match then call the function and send layername as build-in variable to other the function.
User can be use null instread layername.

Parameters
touch_idnumber of touch id, maximum id can get from touchmax()
statecheck user touch state.
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
true or false, getrepeat return number of repeat count on layer
See also
touchmax()

◆ touchid() [4/4]

void touchid ( int  touch_id,
const char *  state,
const char *  layername,
void *  function 
)

touch by id on layername and call the function.

If state and layername are match then call the function and send layername as build-in variable to other the function.
User can be use null instread layername.

Parameters
touch_idnumber of touch id, maximum id can get from touchmax()
statecheck user touch state.
layernamename of layer, can be null that choose build-in layername from the other function.
functioncall the function.
See also
touchmax()

◆ touchmax()

int touchmax ( )

get touch maximum id.

Returns
maximum touch id on device, default: 5

◆ url()

bool url ( const char *  url,
bool  webapp = false,
bool  use_webbrowser = true 
)

open url

Parameters
urlname of website that want to open
webappopen as webapp, default: false
use_webbrowserusing system web browser, default: true
Returns
true was successed, false was failed

Example:
url("https://www.google.com") // jump to default browser.
url("https://www.google.com", true, false ) // is webapp, cannot exit from website in any case.
url("https://www.google.com", false, false ) // using webview and stay on app (url MUST start with -> https://).

◆ urldecode()

const char* urldecode ( const char *  str)

url decode

Parameters
strstring that url decode.
Returns
url decode string.

◆ urlencode()

const char* urlencode ( const char *  str)

url encode

Parameters
strstring that url encode.
Returns
url encode string.

◆ version()

const char* version ( )

get version of thrid party libs in a string format.

Returns
string of thrid party libs all.

◆ voicestart()

bool voicestart ( const char *  savefilename)

start voice recording and removing savefilename from audio system before recording.

Parameters
savefilenamesave filename on disk.
Returns
successed is true, otherwise is false.

◆ voicestop()

void voicestop ( )

stop voice recording.

◆ while()

while ( test_expr  )

A while loop in ARSA Language repeatedly executes a target statement as long as a given condition is true.

Here is the flow of control in a while loop:

Parameters
test_exprthe condition is evaluated. If it is true, the body of the loop is executed. If it is false, the body of the loop does not execute and flow of control jumps to the next statement just after the for loop.
functioncall the function when loop process

Example:
int($i,0)
while($i<10) procedure(text(10,($i*30)+40,Value is: $i) >> add($i, 1))

◆ winsize()

void winsize ( int  width,
int  height 
)

windows size, Emulator only!!!

Parameters
widthwindow size on horizontal
heightwindow size on vertical