remstart ============================================================== = Title : matrix letters = Author : Latch Grapple = Date : 02/18/2007 = Update : = Version: ============================================================== Comments ============================================================== remend autocam off set display mode 800,600,32 hide mouse sync on sync rate 60 gosub _init do text 0,0,"Press Y to enter some text" if keystate(21)=1 wait 100 cls gosub _enter_text endif gosub _move_camera sync loop end _enter_text: backdrop off for n=1 to mat if matrix exist(n) then delete matrix n if matrix exist(n+300) then delete matrix n+300 next n oldmatx=0 set text font "arial" set text size 20 input "Enter some text :";string$ backdrop on for n = 1 to len(string$) letter$=mid$(string$,n) tilex=text width(letter$) tilez=text height(letter$) matx=tilex*10 matz=tilez*10 mat=avail_mat(n) posx=matx+oldmatx make matrix mat,matx,matz,tilex,tilez position matrix mat,oldmatx,0,0 oldmatx=posx gosub _save_bitmap gosub _handle_bitmap next n position camera 200,200,-100 xrotate camera 45 return _init: dim letter$(255) position camera 100,200,-100 xrotate camera 45 return _save_bitmap: create bitmap 1,tilex+1,tilez+1 text 0,0,letter$ save bitmap "zzz_hello.bmp",1 delete bitmap 1 fsize=file size("zzz_hello.bmp") bmapsize=fsize-53-1 pad1=3*(tilex+1)*(tilez+1) pad2=bmapsize-pad1 padding=pad2/(tilez+1) return _handle_bitmap: open to read 1,"zzz_hello.bmp" for skip = 1 to 53 read byte 1,a next skip for z=0 to tilez for x=0 to tilex read byte 1,b read byte 1,g read byte 1,r a=rgb(r,g,b) if a <> 0 set matrix height mat,x,z,20 endif next x for pad=1 to padding read byte 1,skip next pad next z update matrix mat close file 1 return _move_camera: camangy#=wrapvalue(camera angle y()+mousemovex()) camangx#=wrapvalue(camera angle x()+mousemovey()) rotate camera camangx#,camangy#,0 if mouseclick()=1 move camera +5 endif if mouseclick()=2 move camera -5 endif return function avail_mat(num) while matrix exist(num)=1 inc num endwhile endfunction num