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

Go to the source code of this file.

Functions

void hitlayer (const char *layername, void *function)
 query layername collide with other layer in psd file More...
 
void hitlayer (const char *layername_a, const char *layername_b, void *function)
 query layername_a collide with layername_b More...
 
void hitlayerfirst (const char *layername_a, const char *layername_b, void *function)
 query !!!FIRST TIME!!! layername_a collide with layername_b More...
 
void hitlayerlast (const char *layername_a, const char *layername_b, void *function)
 query !!!LAST TIME!!! layername_a collide with layername_b More...
 
void hitlayerall (const char *layername_a, const char *layername_b, void *function)
 query layername_a collide with all of layername_b More...
 
void pos ()
 set layer position by build-in layername and current touch position. More...
 
void pos (const char *layername)
 set layer position by current touch position. More...
 
void pos (const char *layername, int x, int y)
 set layer position by x and y axis More...
 
void pos (const char *layername_dest, const char *layername_src)
 set layername_dest position by layername_src More...
 
void posx (const char *layername, int x)
 set layer position by x axis More...
 
void posy (const char *layername, int y)
 set layer position by y axis More...
 
void move (const char *layername, int velx, int vely, bool deltatime=true)
 move layer by velocity More...
 
void movex (const char *layername, int velx, bool deltatime=true)
 move layer by x velocity More...
 
void movey (const char *layername, int vely, bool deltatime=true)
 move layer by y velocity More...
 
void scale (const char *layername, float scalex, float scaley)
 scaling layer, value is 1: normal, great 1: larger, less 1: smaller More...
 
float getdistance (const char *layername_a, const char *layername_b)
 get distance between layer a and b More...
 
float getdistance (const char *layername)
 
int getposx (const char *layername)
 get x position from layer More...
 
int getposy (const char *layername)
 get y position from layer More...
 
int getposxf (const char *layername, int flags)
 get x position from layer with flags More...
 
int getposyf (const char *layername, int flags)
 get y position from layer with flags More...
 
int getorix (const char *layername)
 get original x position from layer More...
 
int getoriy (const char *layername)
 get original y position from layer More...
 
int getoutx (const char *layername)
 get out from screen in x position from layer More...
 
int getouty (const char *layername)
 get out from screen in y position from layer More...
 
void setorder (const char *layername, int order)
 set layer draw order, 0 is draw first, 999 is draw last More...
 
int getorder (const char *layername)
 get layer draw order More...
 
void setdrawflags (const char *layername, int flags)
 set draw pivot flags More...
 
int getdrawflags (const char *layername)
 get draw pivot flags More...
 
void setrotflags (const char *layername, int flags)
 set rotate pivot flags, default is c More...
 
int getrotflags (const char *layername)
 get rotate pivot flags More...
 
void setscaleflags (const char *layername, int flags)
 set scale pivot flags, default is c More...
 
int getscaleflags (const char *layername)
 get scale pivot flags More...
 
void setvisibleflags (const char *layername, int flags)
 set visible pivot flags, default is l|t More...
 
int getvisibleflags (const char *layername)
 get visible pivot flags More...
 
int getwidth (const char *layername)
 get layer width More...
 
int getheight (const char *layername)
 get layer height More...
 
void setoffset (int x, int y)
 set psd offset by x, y axis More...
 
void moveoffset (int velx, int vely, bool deltatime=true)
 move psd offset by velocity More...
 
int getoffsetx ()
 get psd offset x axis More...
 
int getoffsety ()
 get psd offset y axis More...
 
void settexture (const char *layername, const char *layer_name_or_image_file, bool resize=false)
 set new texture from psd layer or image (jpg, png, tga or etc.) More...
 
void settexturelayer (const char *layername, const char *layer_name_or_image_file, int layer_num, bool resize=false)
 set a new texture on material by layer number from psd layer or image (jpg, png, tga or etc.)
More...
 
int addlayer (const char *layername_new, const char *image_file, bool force_add=false)
 add layer from image (jpg, png, tga or etc.) More...
 
void clonelayer (const char *layername_new, const char *layername_original, bool force_add=false)
 clone layer, the new layer name must unique. More...
 
void clonelayerbyid (const char *layername_new, int layername_original_id, bool force_add=false)
 clone layer by id, the new layer name must unique. More...
 
void removelayer (const char *layername)
 remove layer in psd More...
 
void getlayerall (const char *layername, void *function)
 loop all layer by name, program will loop all of layer and call function each one. More...
 
int getlayercount ()
 get all layer count in psd file More...
 
void rot (const char *layername, int velx, int vely, int velz)
 advance rotation layer by axis More...
 
void play ()
 play animation on build-in layer More...
 
void play (const char *layername)
 play animation on layername More...
 
void pause ()
 pause animation on build-in layer More...
 
void pause (const char *layername)
 pause animation on layername More...
 
bool isplaying ()
 query build-in layer is playing animation More...
 
bool isplaying (const char *layername)
 query layername is playing animation More...
 
void setframe (const char *layername, int frame)
 set animation frame on layername More...
 
int getframe (const char *layername)
 get current frame animation on layername More...
 
int getframecount (const char *layername)
 get animation frame count on layername More...
 
void setloopflags (const char *layername, int flags)
 set animation loop flags on layername More...
 
void setvisiblepercent (const char *layername, int percentx, int percenty)
 set layername visible area by percent More...
 
int getvisiblepercentx (const char *layername)
 get visible area x axis on layer More...
 
int getvisiblepercenty (const char *layername)
 get visible area y axis on layer More...
 
int getlayerid (const char *layername)
 get layer id from build-in layer More...
 
const char * getlayername (int layer_id)
 get layername from build-in layer More...
 
const char * getcurrentvalue ()
 get current return value from the function. More...
 
void setfps (const char *layername, int fps)
 set animation speed on layer More...
 
int getfps (const char *layername)
 get animation speed on layer More...
 
void visible (bool visible)
 Visible layer. More...
 
void visible (bool visible, const char *layername)
 Visible layer by name. More...
 
void visibleall (bool visible, const char *layername)
 Visible all layer by name, program will select all equal name. More...
 
void isvisible (const char *layername, void *function)
 query and call function if layername is visible. More...
 
void !isvisible (const char *layername, void *function)
 query and call function if layername is invisible. More...
 
void isvisibleall (const char *layername, void *function)
 query and call function if all layername is visible. More...
 
void !isvisibleall (const char *layername, void *function)
 query and call function if all layername is invisible. More...
 
void setcolor (const char *layername, long color)
 set color on layer More...
 
void setcolor (const char *layername, int r, int g, int b)
 set color on layer, value between 0-255 More...
 
void setcolor (const char *layername, int r, int g, int b, int a)
 set color on layer, value between 0-255 More...
 
void setalpha (const char *layername, int a)
 set alpha on layer, value between 0-255 More...
 
int getcolor (const char *layername, const char *channel)
 get color by channel More...
 
void maxsize (int left, int top, int right, int bottom)
 maximum scene size More...
 
int getmaxsizestartx ()
 get start point on x axis in maximum scene More...
 
int getmaxsizestarty ()
 get start point on y axis in maximum scene More...
 
int getmaxsizewidth ()
 get width on maximum scene More...
 
int getmaxsizeheight ()
 get height on maximum scene More...
 
void screensize (int width, int height)
 
int getscreensizewidth ()
 get width on screensize More...
 
int getscreensizeheight ()
 get height on screensize More...
 
bool addgroup (const char *groupname)
 add group to a psd file More...
 
void addelement (const char *groupname, const char *layername,...)
 add layer to a group More...
 
void removeelement (const char *groupname, const char *layername,...)
 remove layer on a group More...
 
void setgrouppos (const char *groupname, int x, int y)
 set group position by x and y axis More...
 
void setgroupscale (const char *groupname, int scalex, int scalex)
 group scaling , value is 1: normal, great 1: larger, less 1: smaller More...
 
void setgroupvisible (const char *groupname, bool visible=true)
 group visible More...
 
void setgroupvisibleonlyone (const char *groupname, const char *layername, bool visible=true)
 group visible, invisible all except that specify one More...
 
void setgroupplay (const char *groupname, bool play=true)
 play animation on group More...
 
void setgroupplayonlyone (const char *groupname, const char *layername, bool play=true)
 play animation on group, stop all except that specify one More...
 
void setgroupdrawflags (const char *groupname, int flags)
 set group draw pivot flags More...
 
void setgrouprotflags (const char *groupname, int flags)
 set group rotate pivot flags More...
 
void setgroupcolor (const char *groupname, int r, int g, int b, int a)
 set color on group, value between 0-255 More...
 
void setgrouprot (const char *groupname, int velx, int vely, int velz)
 advance group rotation by axis More...
 
void setgroupclamppos (const char *groupname, bool clamp=true)
 group clamp pos in maxsize area More...
 
void setgroupdraworder (const char *groupname, int order=0)
 set group draw order, 0 is draw first, 999 is draw last More...
 
bool isgroupplay (const char *groupname)
 query group is playing animation More...
 
int getgroupcount ()
 query all group count. More...
 
const char * getgroupnamebyid (int group_num)
 query group name from group number (not group id). More...
 
int getelementcount (const char *groupname)
 query all elements count in a group. More...
 
const char * getelementnamebynum (const char *groupname, int element_num)
 query element name from group by number. More...
 
void anim (const char *layername, const char *type, float start, float end, float vel, bool wait=true)
 animation layer More...
 
void bat (float sec, const char *cmd)
 batch command follow by time (sec). More...
 
void batvoid (float sec, const char *cmd)
 
void batplay (bool play)
 batch play/pause process. More...
 
void batstop ()
 batch stop process. More...
 
void batclear ()
 batch clear all command More...
 
void batreset ()
 batch reset and get back to first command More...
 
int batgetcount ()
 batch get count More...
 
const char * savelayertoimage (const char *layername, const char *image_filename_ext)
 save psd layer to image and return fullpath of new saved file. More...
 
const char * savelayertobase64 (const char *layername, const char *image_filename_ext)
 save psd layer to base64 encode and return data string. More...
 
const char * savelayertomd5 (const char *layername, const char *image_filename_ext)
 save psd layer to md5 and return data string. More...
 
void psdlog ()
 debug and print current psd information and layer name in log window. More...
 
float getrotx (const char *layername)
 get X layer rotation. More...
 
float getroty (const char *layername)
 get Y layer rotation. More...
 
float getrotz (const char *layername)
 get Z layer rotation. More...
 
float getscalex (const char *layername)
 get X layer scale. More...
 
float getscaley (const char *layername)
 get y layer scale. More...
 
void settpos (const char *layername, float u, float v)
 set texture UV position More...
 
void settposx (const char *layername, float u)
 set texture U position More...
 
void settposy (const char *layername, float v)
 set texture V position More...
 
void settrot (const char *layername, float x, float y)
 set texture XY rotation More...
 
void settrotx (const char *layername, float x)
 set texture X rotation More...
 
void settroty (const char *layername, float y)
 set texture Y rotation More...
 
void settscale (const char *layername, float x, float y)
 set texture XY scale More...
 
void settscalex (const char *layername, float x)
 set texture Y scale More...
 
void settscaley (const char *layername, float y)
 set texture Y scale More...
 
void settclamp (const char *layername, const char *value="repeat")
 set texture coord clamp mode outside [0.0, 1.0] More...
 
float gettposx (const char *layername)
 get texture U position More...
 
float gettposy (const char *layername)
 get texture V position More...
 
float gettrotx (const char *layername)
 get texture X rotation More...
 
float gettroty (const char *layername)
 get texture Y rotation More...
 
float gettscalex (const char *layername)
 get texture X scale More...
 
float gettscaley (const char *layername)
 get texture Y scale More...
 
const char * gettclamp (const char *layername)
 get texture coord clamp mode More...
 
void setuserstring (const char *layername, const char *key, const char *value)
 set psd user string More...
 
const char * getuserstring (const char *layername, const char *key)
 get psd user string More...
 
void setcliprect (const char *layername, int x1, int y1, int x2, int y2)
 set layer with clip rect. More...
 
void setgroupcliprect (const char *layername, int x1, int y1, int x2, int y2)
 set group of layers with clip rect. More...
 
void setmaterialtype (const char *layername, int shader_id)
 set material type to layer More...
 
int getmaterialtype (const char *layername)
 get material type from layer More...
 

Function Documentation

◆ !isvisible()

void !isvisible ( const char *  layername,
void *  function 
)

query and call function if layername is invisible.

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
functionif layername invisible then call the function.
See also
visible() visibleall() isvisible() !isvisible() isvisibleall() !isvisibleall()

◆ !isvisibleall()

void !isvisibleall ( const char *  layername,
void *  function 
)

query and call function if all layername is invisible.

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
functionif all layername invisible then call the function.
See also
visible() visibleall() isvisible() !isvisible() isvisibleall() !isvisibleall()

◆ addelement()

void addelement ( const char *  groupname,
const char *  layername,
  ... 
)

add layer to a group

Parameters
groupnamename of group that you want operator
layernamename of layer
...use comma as token and add next layer to group
Example
addelement(g_mu, mu_run, mu_jump, mu_idle)

◆ addgroup()

bool addgroup ( const char *  groupname)

add group to a psd file

Parameters
groupnamename of group that you want operator

◆ addlayer()

int addlayer ( const char *  layername_new,
const char *  image_file,
bool  force_add = false 
)

add layer from image (jpg, png, tga or etc.)

Parameters
layername_newa new name of clone layer.
image_filename of image file.
force_addtrue is always add layer this, default is false
Returns
new layer id, -1 is failed.

◆ anim()

void anim ( const char *  layername,
const char *  type,
float  start,
float  end,
float  vel,
bool  wait = true 
)

animation layer

automation animation on focus layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
typeanimation type follows:
fade
delay
audio
video
loop
scale
scalex
scaley
rot
rotx
roty
rotz
move
movex
movey
visible
visiblex
visibley
reset
resetall
clear
clearall
getcount
offset
offsetx
offsety
isend // is end all animate, if loop on then no effect.
spline // anim( layername, spline, spline_num, vel, inverse, head, hed_degree_offset, wait, reset )
startvalue definition depending on type of animation.
endvalue definition depending on type of animation.
velspeed of animation.
waitcondition going to next animation after this animation finished, default: true

Example: layer animation fx
anim("boss", "rotx", 0, 360, 300) // rotation in x axis
anim("boss", "roty", 0, 360, 300) // rotation in y axis
anim("boss", "rotz", 0, 360, 300) // rotation in z axis

Example: move screen offset may layer name is empty string
anim("", "offset", 100, 500, 200, 750, 100, 300) // move position in x 100 to 500 pixel and y 200 to 750 axis with vel x 100 and y 350 sequencely.
anim("", "offsetx", 200, 300, 100 ) // move from position 200 to 300 pixel in x axis with velocity 100 unit sequencely.
anim("", "offsety", 400, 800, 200) // move from position 400 to 800 pixel in y axis with velocity 200 unit sequencely.

Example: layer clear animation fx in individual and all layers
anim("boss", "clear") // clear only boss layer
anim("boss", "reset") // reset only boss layer
anim("", "clearall") // clear all
anim("", "resetall") // reset all

◆ bat()

void bat ( float  sec,
const char *  cmd 
)

batch command follow by time (sec).

Parameters
sectime for trigger command in second.
cmdarsa script command.

◆ batclear()

void batclear ( )

batch clear all command

◆ batgetcount()

int batgetcount ( )

batch get count

Returns
number of batch command

◆ batplay()

void batplay ( bool  play)

batch play/pause process.

Parameters
playtrue = play, false = pause.

◆ batreset()

void batreset ( )

batch reset and get back to first command

◆ batstop()

void batstop ( )

batch stop process.

◆ batvoid()

void batvoid ( float  sec,
const char *  cmd 
)

batch command follow by time (sec) with not changing any command until trigger call. purpose for change state in programmatically.

Parameters
sectime for trigger command in second.
cmdarsa script command.

◆ clonelayer()

void clonelayer ( const char *  layername_new,
const char *  layername_original,
bool  force_add = false 
)

clone layer, the new layer name must unique.

Parameters
layername_newa new name of clone layer.
layername_originalname of layer, can be null that choose build-in layername from the other function.
force_addtrue is always add clone layer this, default is false.

◆ clonelayerbyid()

void clonelayerbyid ( const char *  layername_new,
int  layername_original_id,
bool  force_add = false 
)

clone layer by id, the new layer name must unique.

Parameters
layername_newa new name of clone layer
layername_original_idid of layer, can be null that choose build-in layername from the other function.
force_addtrue is always add clone layer this, default is false

◆ getcolor()

int getcolor ( const char *  layername,
const char *  channel 
)

get color by channel

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
channelthe channel that want you get follows:
red
green
blue
alpha
all
Returns
color value on each channel

◆ getcurrentvalue()

const char* getcurrentvalue ( )

get current return value from the function.

Returns
value as string, int or float that depend on called function

◆ getdistance() [1/2]

float getdistance ( const char *  layername_a,
const char *  layername_b 
)

get distance between layer a and b

Parameters
layername_aname of layer, can be null that choose build-in layername from the other function.
layername_bname of layer, can be null that choose build-in layername from the other function.
Returns
distance as float

◆ getdistance() [2/2]

float getdistance ( const char *  layername)

get distance between layername and build-in layer
not working! if invalid build-in layer.

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
distance as float

◆ getdrawflags()

int getdrawflags ( const char *  layername)

get draw pivot flags

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
draw flags as integer

◆ getelementcount()

int getelementcount ( const char *  groupname)

query all elements count in a group.

Parameters
groupnamename of group that you want operator.
Returns
elements count, 0 is empty.

◆ getelementnamebynum()

const char* getelementnamebynum ( const char *  groupname,
int  element_num 
)

query element name from group by number.

Parameters
groupnamename of group that you want operator.
element_numnumber of element (maybe from for loop)
Returns
name of element, empty string is failed, otherwise id successed.

◆ getfps()

int getfps ( const char *  layername)

get animation speed on layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
fps as integer

◆ getframe()

int getframe ( const char *  layername)

get current frame animation on layername

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
frame as integer

◆ getframecount()

int getframecount ( const char *  layername)

get animation frame count on layername

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
count as integer

◆ getgroupcount()

int getgroupcount ( )

query all group count.

Returns
group count.

◆ getgroupnamebyid()

const char* getgroupnamebyid ( int  group_num)

query group name from group number (not group id).

Parameters
group_numnumber of group (maybe from for loop)
Returns
name of group, empty string is failed, otherwise id successed.

◆ getheight()

int getheight ( const char *  layername)

get layer height

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
height as integer

◆ getlayerall()

void getlayerall ( const char *  layername,
void *  function 
)

loop all layer by name, program will loop all of layer and call function each one.

Parameters
layernamename of layer, can be "" is loop all layers or null that choose build-in layername from the other function.
functioncall the function, in function user can be save current layername follow:
Example: loop layers by prefix
{
string($name,getlayername(null))
text(10,10,Name: $name)
}function(loop_layer)
getlayerall(missile, function(loop_layer))
Example: loop all layers
{
string($name,getlayername(null))
text(10,10,Name: $name)
}function(loop_layer)
getlayerall("", function(loop_layer))

◆ getlayercount()

int getlayercount ( )

get all layer count in psd file

Returns
layer count as integer

◆ getlayerid()

int getlayerid ( const char *  layername)

get layer id from build-in layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
layer id as int

◆ getlayername()

const char* getlayername ( int  layer_id)

get layername from build-in layer

Parameters
layer_idis specify layer from id, can be null that choose build-in layername from the other function.
Returns
layer name as string

◆ getmaterialtype()

int getmaterialtype ( const char *  layername)

get material type from layer

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
Returns
shader id, -1 is no materialtype, otherwise is shader id.

◆ getmaxsizeheight()

int getmaxsizeheight ( )

get height on maximum scene

Returns
maximum scene height

◆ getmaxsizestartx()

int getmaxsizestartx ( )

get start point on x axis in maximum scene

Returns
starting point on x axis

◆ getmaxsizestarty()

int getmaxsizestarty ( )

get start point on y axis in maximum scene

Returns
starting point on y axis

◆ getmaxsizewidth()

int getmaxsizewidth ( )

get width on maximum scene

Returns
maximum scene width

◆ getoffsetx()

int getoffsetx ( )

get psd offset x axis

Returns
x offset as integer

◆ getoffsety()

int getoffsety ( )

get psd offset y axis

Returns
y offset as integer

◆ getorder()

int getorder ( const char *  layername)

get layer draw order

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
draw order as integer

◆ getorix()

int getorix ( const char *  layername)

get original x position from layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
original x position as integer

◆ getoriy()

int getoriy ( const char *  layername)

get original y position from layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
original y position as integer

◆ getoutx()

int getoutx ( const char *  layername)

get out from screen in x position from layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
out from screen in x position as integer

◆ getouty()

int getouty ( const char *  layername)

get out from screen in y position from layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
out from screen in y position as integer

◆ getposx()

int getposx ( const char *  layername)

get x position from layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
x position as integer

◆ getposxf()

int getposxf ( const char *  layername,
int  flags 
)

get x position from layer with flags

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
flagsdraw pivot flags, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
h = horizontal flip
v = vertical flip
d = default is l|t
Returns
x position as integer

◆ getposy()

int getposy ( const char *  layername)

get y position from layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
y position as integer

◆ getposyf()

int getposyf ( const char *  layername,
int  flags 
)

get y position from layer with flags

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
flagsdraw pivot flags, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
h = horizontal flip
v = vertical flip
d = default is l|t
Returns
y position as integer

◆ getrotflags()

int getrotflags ( const char *  layername)

get rotate pivot flags

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
rotate pivot flags as integer

◆ getrotx()

float getrotx ( const char *  layername)

get X layer rotation.

◆ getroty()

float getroty ( const char *  layername)

get Y layer rotation.

◆ getrotz()

float getrotz ( const char *  layername)

get Z layer rotation.

◆ getscaleflags()

int getscaleflags ( const char *  layername)

get scale pivot flags

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
scale pivot flags as integer

◆ getscalex()

float getscalex ( const char *  layername)

get X layer scale.

◆ getscaley()

float getscaley ( const char *  layername)

get y layer scale.

◆ getscreensizeheight()

int getscreensizeheight ( )

get height on screensize

Returns
screensize height

◆ getscreensizewidth()

int getscreensizewidth ( )

get width on screensize

Returns
screensize width

◆ gettclamp()

const char* gettclamp ( const char *  layername)

get texture coord clamp mode

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
Returns
string of clamp value:
repeat
clamp
clamp_to_edge
clamp_to_border
mirror
mirror_clamp
mirror_clamp_to_edge
mirror_clamp_to_border

◆ gettposx()

float gettposx ( const char *  layername)

get texture U position

◆ gettposy()

float gettposy ( const char *  layername)

get texture V position

◆ gettrotx()

float gettrotx ( const char *  layername)

get texture X rotation

◆ gettroty()

float gettroty ( const char *  layername)

get texture Y rotation

◆ gettscalex()

float gettscalex ( const char *  layername)

get texture X scale

◆ gettscaley()

float gettscaley ( const char *  layername)

get texture Y scale

◆ getuserstring()

const char* getuserstring ( const char *  layername,
const char *  key 
)

get psd user string

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
keyuserdata key.
Returns
if founded return user string.

◆ getvisibleflags()

int getvisibleflags ( const char *  layername)

get visible pivot flags

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
visible pivot flags as integer

◆ getvisiblepercentx()

int getvisiblepercentx ( const char *  layername)

get visible area x axis on layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
percent of visible area x axis as integer

◆ getvisiblepercenty()

int getvisiblepercenty ( const char *  layername)

get visible area y axis on layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
percent of visible area y axis as integer

◆ getwidth()

int getwidth ( const char *  layername)

get layer width

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
width as integer

◆ hitlayer() [1/2]

void hitlayer ( const char *  layername,
void *  function 
)

query layername collide with other layer in psd file

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

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
functioncall the function.

◆ hitlayer() [2/2]

void hitlayer ( const char *  layername_a,
const char *  layername_b,
void *  function 
)

query layername_a collide with layername_b

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

Parameters
layername_aname of layer, must enter real layername
layername_bname of layer, must enter real layername
functioncall the function.

◆ hitlayerall()

void hitlayerall ( const char *  layername_a,
const char *  layername_b,
void *  function 
)

query layername_a collide with all of layername_b

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

Parameters
layername_aname of layer, can be null that choose build-in layername from the other function.
layername_bname of layer, can be null that choose build-in layername from the other function.
functioncall the function.

◆ hitlayerfirst()

void hitlayerfirst ( const char *  layername_a,
const char *  layername_b,
void *  function 
)

query !!!FIRST TIME!!! layername_a collide with layername_b

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

Parameters
layername_aname of layer, must enter real layername
layername_bname of layer, must enter real layername
functioncall the function.

◆ hitlayerlast()

void hitlayerlast ( const char *  layername_a,
const char *  layername_b,
void *  function 
)

query !!!LAST TIME!!! layername_a collide with layername_b

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

Parameters
layername_aname of layer, must enter real layername
layername_bname of layer, must enter real layername
functioncall the function.

◆ isgroupplay()

bool isgroupplay ( const char *  groupname)

query group is playing animation

Parameters
groupnamename of group that you want operator
Returns
bool, true: playing, false: stop

◆ isplaying() [1/2]

bool isplaying ( )

query build-in layer is playing animation

Returns
bool, true: playing, false: stop

◆ isplaying() [2/2]

bool isplaying ( const char *  layername)

query layername is playing animation

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
Returns
bool, true: playing, false: stop

◆ isvisible()

void isvisible ( const char *  layername,
void *  function 
)

query and call function if layername is visible.

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
functionif layername visible then call the function.
See also
visible() visibleall() isvisible() !isvisible() isvisibleall() !isvisibleall()

◆ isvisibleall()

void isvisibleall ( const char *  layername,
void *  function 
)

query and call function if all layername is visible.

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
functionif all layername visible then call the function.
See also
visible() visibleall() isvisible() !isvisible() isvisibleall() !isvisibleall()

◆ maxsize()

void maxsize ( int  left,
int  top,
int  right,
int  bottom 
)

maximum scene size

make maximum scene bounding box

◆ move()

void move ( const char *  layername,
int  velx,
int  vely,
bool  deltatime = true 
)

move layer by velocity

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
velxvelocity in x axis, can be +/-
velyvelocity in y axis, can be +/-
deltatimetrue is multiple delta time on velx and vely, false is not use that

◆ moveoffset()

void moveoffset ( int  velx,
int  vely,
bool  deltatime = true 
)

move psd offset by velocity

Parameters
velxvelocity in x axis, can be + / -
velyvelocity in y axis, can be + / -
deltatimetrue is multiple delta time on velx and vely, false is not use that

◆ movex()

void movex ( const char *  layername,
int  velx,
bool  deltatime = true 
)

move layer by x velocity

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
velxvelocity in x axis, can be +/-
deltatimetrue is multiple delta time on velx, false is not use that

◆ movey()

void movey ( const char *  layername,
int  vely,
bool  deltatime = true 
)

move layer by y velocity

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
velyvelocity in y axis, can be +/-
deltatimetrue is multiple delta time on vely, false is not use that

◆ pause() [1/2]

void pause ( )

pause animation on build-in layer

◆ pause() [2/2]

void pause ( const char *  layername)

pause animation on layername

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.

◆ play() [1/2]

void play ( )

play animation on build-in layer

◆ play() [2/2]

void play ( const char *  layername)

play animation on layername

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.

◆ pos() [1/4]

void pos ( )

set layer position by build-in layername and current touch position.

◆ pos() [2/4]

void pos ( const char *  layername)

set layer position by current touch position.

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.

◆ pos() [3/4]

void pos ( const char *  layername,
int  x,
int  y 
)

set layer position by x and y axis

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
xhorizontal position, positive is right, negative is left
yvertical position, positive is down, negative is up

◆ pos() [4/4]

void pos ( const char *  layername_dest,
const char *  layername_src 
)

set layername_dest position by layername_src

Parameters
layernamename of layer, must enter real layername
layername_srcname of layer, can be null that choose build-in layername from the other function.

◆ posx()

void posx ( const char *  layername,
int  x 
)

set layer position by x axis

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
xhorizontal position, positive is right, negative is left

◆ posy()

void posy ( const char *  layername,
int  y 
)

set layer position by y axis

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
yvertical position, positive is down, negative is up

◆ psdlog()

void psdlog ( )

debug and print current psd information and layer name in log window.

◆ removeelement()

void removeelement ( const char *  groupname,
const char *  layername,
  ... 
)

remove layer on a group

Parameters
groupnamename of group that you want operator
layernamename of layer
...use comma as token and add next layer to group
<>Example
removeelement(g_mu, mu_run, mu_jump, mu_idle)

◆ removelayer()

void removelayer ( const char *  layername)

remove layer in psd

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.

◆ rot()

void rot ( const char *  layername,
int  velx,
int  vely,
int  velz 
)

advance rotation layer by axis

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
velxvelocity in x axis, can be +/-
velyvelocity in y axis, can be +/-
velzvelocity in z axis, can be +/-

◆ savelayertobase64()

const char* savelayertobase64 ( const char *  layername,
const char *  image_filename_ext 
)

save psd layer to base64 encode and return data string.

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
image_filename_extfilename with extension of image that you want to save, may be *.jpg, *.png or *.bmp
Returns
successed will return base64 data string, false is empty path.

◆ savelayertoimage()

const char* savelayertoimage ( const char *  layername,
const char *  image_filename_ext 
)

save psd layer to image and return fullpath of new saved file.

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
image_filename_extfilename with extension of image that you want to save, may be *.jpg, *.png or *.bmp
Returns
successed will return fullpath of new saved file, false is empty path.

◆ savelayertomd5()

const char* savelayertomd5 ( const char *  layername,
const char *  image_filename_ext 
)

save psd layer to md5 and return data string.

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
image_filename_extfilename with extension of image that you want to save, may be *.jpg, *.png or *.bmp
Returns
successed will return md5 data string, false is empty path.

◆ scale()

void scale ( const char *  layername,
float  scalex,
float  scaley 
)

scaling layer, value is 1: normal, great 1: larger, less 1: smaller

NOT equal 0

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
scalexscale in x axis, value can be float
scaleyscale in y axis, value can be float

◆ screensize()

void screensize ( int  width,
int  height 
)

screen size, default in landscape: 960,640 portrait: 640,960
set universal resolution, screen will run same size in any devices
Specify aspect ratio fist and resolution after. calculate apect raio from:
https://calculateaspectratio.com/
https://andrew.hedges.name/experiments/aspect_ratio/

Parameters
widthscreen size on x axis
heightscreen size on y axis

◆ setalpha()

void setalpha ( const char *  layername,
int  a 
)

set alpha on layer, value between 0-255

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
aalpha channel value

◆ setcliprect()

void setcliprect ( const char *  layername,
int  x1,
int  y1,
int  x2,
int  y2 
)

set layer with clip rect.

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
x1is left in pixel
y1is top in pixel
x2is right in pixel
y2is bottom in pixel

◆ setcolor() [1/3]

void setcolor ( const char *  layername,
long  color 
)

set color on layer

Parameters
colorvalue of color

◆ setcolor() [2/3]

void setcolor ( const char *  layername,
int  r,
int  g,
int  b 
)

set color on layer, value between 0-255

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
rred channel value
ggreen channel value
bblue channel value

◆ setcolor() [3/3]

void setcolor ( const char *  layername,
int  r,
int  g,
int  b,
int  a 
)

set color on layer, value between 0-255

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
rred channel value
ggreen channel value
bblue channel value
aalpha channel value

◆ setdrawflags()

void setdrawflags ( const char *  layername,
int  flags 
)

set draw pivot flags

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
flagsdraw pivot flags, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
h = horizontal flip
v = vertical flip
d = default is l|t

◆ setfps()

void setfps ( const char *  layername,
int  fps 
)

set animation speed on layer

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
fpsframe per second, default is 30

◆ setframe()

void setframe ( const char *  layername,
int  frame 
)

set animation frame on layername

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
frameanimation going to frame

◆ setgroupclamppos()

void setgroupclamppos ( const char *  groupname,
bool  clamp = true 
)

group clamp pos in maxsize area

Parameters
groupnamename of group that you want operator
See also
maxsize()

◆ setgroupcliprect()

void setgroupcliprect ( const char *  layername,
int  x1,
int  y1,
int  x2,
int  y2 
)

set group of layers with clip rect.

Parameters
groupnamename of group that you want operator
x1is left in pixel
y1is top in pixel
x2is right in pixel
y2is bottom in pixel

◆ setgroupcolor()

void setgroupcolor ( const char *  groupname,
int  r,
int  g,
int  b,
int  a 
)

set color on group, value between 0-255

Parameters
groupnamename of group that you want operator
rred channel value
ggreen channel value
bblue channel value
aalpha channel value

◆ setgroupdrawflags()

void setgroupdrawflags ( const char *  groupname,
int  flags 
)

set group draw pivot flags

Parameters
groupnamename of group that you want operator
flagsdraw pivot flags, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
h = horizontal flip
v = vertical flip
d = default is l|t

◆ setgroupdraworder()

void setgroupdraworder ( const char *  groupname,
int  order = 0 
)

set group draw order, 0 is draw first, 999 is draw last

Parameters
groupnamename of group that you want operator
orderdraw order, 0-999

◆ setgroupplay()

void setgroupplay ( const char *  groupname,
bool  play = true 
)

play animation on group

Parameters
groupnamename of group that you want operator
playtrue: playing, false: stop

◆ setgroupplayonlyone()

void setgroupplayonlyone ( const char *  groupname,
const char *  layername,
bool  play = true 
)

play animation on group, stop all except that specify one

Parameters
groupnamename of group that you want operator
layernamename of layer, must enter real layername
playtrue: playing, false: stop

◆ setgrouppos()

void setgrouppos ( const char *  groupname,
int  x,
int  y 
)

set group position by x and y axis

Parameters
groupnamename of group that you want operator
xhorizontal position, positive is right, negative is left
yvertical position, positive is down, negative is up

◆ setgrouprot()

void setgrouprot ( const char *  groupname,
int  velx,
int  vely,
int  velz 
)

advance group rotation by axis

Parameters
groupnamename of group that you want operator
velxvelocity in x axis, can be +/-
velyvelocity in y axis, can be +/-
velzvelocity in z axis, can be +/-

◆ setgrouprotflags()

void setgrouprotflags ( const char *  groupname,
int  flags 
)

set group rotate pivot flags

Parameters
groupnamename of group that you want operator
flagsrotate pivot flags, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
h = horizontal flip
v = vertical flip
d = default is l|t

◆ setgroupscale()

void setgroupscale ( const char *  groupname,
int  scalex,
int  scalex 
)

group scaling , value is 1: normal, great 1: larger, less 1: smaller

NOT equal 0

Parameters
groupnamename of group that you want operator
scalexscale in x axis, value can be float
scaleyscale in y axis, value can be float

◆ setgroupvisible()

void setgroupvisible ( const char *  groupname,
bool  visible = true 
)

group visible

Parameters
groupnamename of group that you want operator
visibletrue, false. the layer shall be visible.
See also
visible() visibleall()

◆ setgroupvisibleonlyone()

void setgroupvisibleonlyone ( const char *  groupname,
const char *  layername,
bool  visible = true 
)

group visible, invisible all except that specify one

Parameters
groupnamename of group that you want operator
layernamename of layer, must enter real layername
visibletrue, false. the layer shall be visible.
See also
visible() visibleall()

◆ setloopflags()

void setloopflags ( const char *  layername,
int  flags 
)

set animation loop flags on layername

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
flagsloop flags canbe orbit:
true - loop forever
once - play one time
pp - ping pong

◆ setmaterialtype()

void setmaterialtype ( const char *  layername,
int  shader_id 
)

set material type to layer

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
shader_idid from gpu.addshader()

◆ setoffset()

void setoffset ( int  x,
int  y 
)

set psd offset by x, y axis

Parameters
xhorizontal position, positive is right, negative is left
yvertical position, positive is down, negative is up

◆ setorder()

void setorder ( const char *  layername,
int  order 
)

set layer draw order, 0 is draw first, 999 is draw last

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
orderdraw order, 0-999

◆ setrotflags()

void setrotflags ( const char *  layername,
int  flags 
)

set rotate pivot flags, default is c

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
flagsrotate pivot flags, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
h = horizontal flip
v = vertical flip
d = default is l|t

◆ setscaleflags()

void setscaleflags ( const char *  layername,
int  flags 
)

set scale pivot flags, default is c

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
flagsscale pivot flags, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
h = horizontal flip
v = vertical flip
d = default is l|t

◆ settclamp()

void settclamp ( const char *  layername,
const char *  value = "repeat" 
)

set texture coord clamp mode outside [0.0, 1.0]

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
valueclamp value:
repeat
clamp
clamp_to_edge
clamp_to_border
mirror
mirror_clamp
mirror_clamp_to_edge
mirror_clamp_to_border

◆ settexture()

void settexture ( const char *  layername,
const char *  layer_name_or_image_file,
bool  resize = false 
)

set new texture from psd layer or image (jpg, png, tga or etc.)

Parameters
layernamename of layer or null that choose build-in layername from the other function.
layer_name_or_image_filelayer name or name of image file or null is clear texture on first slot.
resize!!!effective for image filename ONLY!!! resize texture fit to layer before set.

◆ settexturelayer()

void settexturelayer ( const char *  layername,
const char *  layer_name_or_image_file,
int  layer_num,
bool  resize = false 
)

set a new texture on material by layer number from psd layer or image (jpg, png, tga or etc.)

Parameters
layernamename of layer or null that choose build-in layername from the other function.
layer_name_or_image_filelayer name or name of image file or null is clear texture on a slot.
layer_numnumber layer of texture to be set. Must be a value smaller than MATERIAL_MAX_TEXTURES (0-7)
resize!!!effective for image filename ONLY!!! resize texture fit to layer before set.

◆ settpos()

void settpos ( const char *  layername,
float  u,
float  v 
)

set texture UV position

◆ settposx()

void settposx ( const char *  layername,
float  u 
)

set texture U position

◆ settposy()

void settposy ( const char *  layername,
float  v 
)

set texture V position

◆ settrot()

void settrot ( const char *  layername,
float  x,
float  y 
)

set texture XY rotation

◆ settrotx()

void settrotx ( const char *  layername,
float  x 
)

set texture X rotation

◆ settroty()

void settroty ( const char *  layername,
float  y 
)

set texture Y rotation

◆ settscale()

void settscale ( const char *  layername,
float  x,
float  y 
)

set texture XY scale

◆ settscalex()

void settscalex ( const char *  layername,
float  x 
)

set texture Y scale

◆ settscaley()

void settscaley ( const char *  layername,
float  y 
)

set texture Y scale

◆ setuserstring()

void setuserstring ( const char *  layername,
const char *  key,
const char *  value 
)

set psd user string

Parameters
layernamename of layer, can be null that choose build - in layername from the other function.
keyuserdata key, cannot be empty and if key not exist is insert, otherwise update.
valueuserdata value.

◆ setvisibleflags()

void setvisibleflags ( const char *  layername,
int  flags 
)

set visible pivot flags, default is l|t

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
flagsvisible pivot flags, every flags can or bit.
c = center
l = left
r = right
t = top
b = bottom
h = horizontal flip
v = vertical flip
d = default is l|t

◆ setvisiblepercent()

void setvisiblepercent ( const char *  layername,
int  percentx,
int  percenty 
)

set layername visible area by percent

value between 0 - 100
0: invisible, 100: full visible
value canbe positive or negative
positive visible area starting from left to right
negative visible area starting from right to left

Parameters
layernamename of layer, can be null that choose build-in layername from the other function.
percentxvisible area on horizontal
percentyvisible area on vertical

◆ visible() [1/2]

void visible ( bool  visible)

Visible layer.

Parameters
visibletrue, false. the layer shall be visible.
See also
visible() visibleall()

◆ visible() [2/2]

void visible ( bool  visible,
const char *  layername 
)

Visible layer by name.

Parameters
visibletrue, false. the layer shall be visible.
layernamename of layer, can be null that choose build-in layername from the other function.
See also
visible() visibleall()

◆ visibleall()

void visibleall ( bool  visible,
const char *  layername 
)

Visible all layer by name, program will select all equal name.

Parameters
visibletrue, false. the layer shall be visible.
layernamename of layer, can be null that build-in layername from the other function choose.
See also
visible() visibleall()