my qr app, but u need a cam with focus, my tablet have no autofocus.
//QR
SetDisplayAspect( 1.0 / 1.0 )
setvirtualresolution(100,100)
SetResolutionMode( 1 )
SetSyncRate( 10, 0 )
SetOrientationAllowed( 1,1,1,1 )
setclearcolor(128,128,128)
global qrtext$
qrtext$="hello my agk friends :-)"
global qrimage
qrimage=encodeqrcode(qrtext$,0)
//saveimage(qrimage,"qr.png")
global qrsprite
qrsprite=createsprite(qrimage)
setspritesize(qrsprite,100,100)
get=1
AddVirtualButton( get,5, 5, 10 )
SetVirtualButtonText( get, "Cam" )
SetVirtualButtonColor( get, 64, 64, 192 )
SetVirtualButtonAlpha( get, 192 )
url=2
AddVirtualButton( url,5, 15, 10 )
SetVirtualButtonText( url, "URL" )
SetVirtualButtonColor( url, 64, 64, 192 )
SetVirtualButtonAlpha( url, 192 )
ende=12
AddVirtualButton( ende,100-5, 5, 10 )
SetVirtualButtonText( ende, "End" )
SetVirtualButtonColor( ende, 64, 64, 192 )
SetVirtualButtonAlpha( ende, 192 )
Text()
do
//Print(qrtext$)
if GetVirtualButtonPressed( get ) then GetCamImage()
if GetVirtualButtonPressed( ende ) then exit
if GetVirtualButtonReleased( url )
if HaveASpace(qrtext$) =0
else
message("a real url have no spaces")
endif
if left(qrtext$,3)="???"
message("i have no url")
else
OpenBrowser(qrtext$)
endif
endif
Sync()
loop
end
function Text()
i=1
if gettextexists(i) then deletetext(i)
CreateText(i,qrtext$)
SetTextPosition(i,getvirtualwidth()/2,0)
SetTextSize(i,3)
SetTextAlignment( i, 1 )
SetTextColor (i,0,0,0 ,255)
endfunction
function GetCamImage()
qrtext$=""
if getcameraexists()=1
if showimagecapturescreen()=1
while Iscapturingimage()=1
Sync()
endwhile
clearscreen()
swap()
print("wait ...") //frontbuffer
image=GetCapturedimage() //geht bei jürgen nicht
if image=0
qrtext$="cancel dialog"
else
deleteimage(qrimage)
qrimage=image
qrtext$=decodeqrcode(qrimage)
endif
if len(qrtext$)>0
//da kommt nicht das gleiche heraus^^
//deleteimage(qrimage)
//qrimage=encodeqrcode(qrtext$,0)
endif
if qrsprite then deletesprite(qrsprite)
qrsprite=createsprite(qrimage)
setspritesize(qrsprite,100,-1)
setspriteposition(qrsprite,0,50-getspriteheight(qrsprite)/2)
endif
else
qrtext$="can't find a cam for get a picture with qr code"
endif
if len(qrtext$)=0 then qrtext$="???"
Text()
endfunction
function HaveASpace(abc$)
c=0
for i=1 to len(abc$)
if mid(abc$,i,1)=" "
c=c+1
exit
endif
next
endfunction c