Add Magnifier png to library
Add background image to library
Add font file to library
Create a style for image
Create a style for page
Create a release key style
Create a press key style
Create a font style with text box
Create variable for keystatus
Create variable for modified TouchX
Create variable for modified TouchY
Setup touch settings for a better smoother response
Define a page named "MainPage" with style "pageStyle"
place a down key to set variable
Place a release key to reset variable
Create text entity in top left
Create image entity
Create a loop running forever
Check status of variable and run keyfnc acccordingly
Create Keyfnc function
Calculate the offset for viewing glass
Position the image at TX, TY coordinates
After loading show the page named "pageName"
|
LIB(img1,"SDHC/mag2.png");
LIB(backg,"SDHC/Back.png");
LIB(asc_16,"SDHC/asc_16b.fnt");
STYLE(sTimg, Image) {curRel = CC;}
STYLE(pagestyle, Page) {back = black; image=backg;}
STYLE(sTkeyU, key) {type=touch; action=U; delay=0; currel=TL;}
STYLE(sTkeyD, key) {type=touch; action=D; delay=0; currel=TL;}
STYLE(textstyle,text){font=asc_16; col=white; currel=TL; maxLen=52;type=a; back=\\80000000; padding=3; bcol=white; width=1;}
VAR(keyD,0,U8);
VAR(TX,0,U16);
VAR(TY,0,U16);
SETUP(system ){touchsamples = 3; touchdebounce = 5; touchaccuracy = 50;}
PAGE(MainPage, pagestyle)
{
posn(0,0);
KEY(keyD1,[LOAD(keyD,1);],480,272,sTkeyD);
KEY(keyU1,[LOAD(keyD,0);],480,272,sTkeyU);
POSN(1,0);
TEXT(text1,"PNG Transparency Demo, Touch Page to Move Glass",textstyle);
POSN(396,124); IMG(imgA1,img1,sTimg);
LOOP(keymove,forever)
{
IF(keyD<>0?keyfnc);
}
}
FUNC(keyfnc)
{
CALC(TX,TOUCHX,42,"+");
CALC(TY,TOUCHY,42,"+");
POSN(TX,TY,imgA1);;
}
SHOW(MainPage);; |