;-------------------------------------- ; ; 作:せつき ; HP:http://www.setsuki.com/ ; ;-------------------------------------- #include "llmod.as" ;====================================== ;擬似ボタンの描画 ;-------------------------------------- ; ; btn str,p1,p2,p3,p4 ; str = ボタンに表示する文字 ; p1 = x座標 ; p2 = y座標 ; p3 = ボタンの横幅 ; p4 = ボタンの高さ ; ; ※ボタンは64個まで作ることが出来ます。 ; ;====================================== ;擬似ボタンのクリック取得 ;-------------------------------------- ; ; btn_check p1 ; p1 = 0 ;ボタンを押した時にIDを取得 ; p2 = 1 ;ボタンを押して離した時にIDを取得 ; ; stat = 押したボタンのID ; refstr = 押したボタンの文字列 ; ; ※stat=-1 は、ボタンを押していない状態です。 ; ;====================================== ;擬似ボタンのクリック取得 ;-------------------------------------- ; ; btn_size p1,p2,p3,p4,p5 ; p1 = ボタンID ; p2 = 変更後の x座標 ; p3 = 変更後の y座標 ; p4 = 変更後の ボタンの横幅 ; p5 = 変更後の ボタンの高さ ; ;====================================== ; ;モジュール内使用変数一覧 ;dim bt , sdim btmes dim rect ;x , y , w , h , bw , bh , id ;mstr , rstr , p1 , p2 ;btchk , mleft , mleft2 ;sdim ts ;stt ;bmscr , VRAM , prm ; ;※btは69個使用(0-68) ; #module #deffunc btn_view int,int ;************************************** ; 擬似ボタンの描写 ;************************************** mref btchk,0 ;ID mref p1,1 ;ボタンのON/OFF mref bmscr,67 x=bt.btchk.2 : y=bt.btchk.3 : w=bt.btchk.0 : h=bt.btchk.1 bw=bt.btchk.4 : bh=bt.btchk.5 : mstr=btmes.btchk rect=x, y, x+w, y+h prm=bmscr.4,0,4,$200*p1|$10 : getptr prm.1,rect dllproc "DrawFrameControl" ,prm,4,D_USER redraw 1 sysfont 17 prm=18 : dllproc "GetSysColor",prm,1,D_USER color dllret@&$ff, (dllret@>>8)&$ff, (dllret@>>16)&$ff pos w-bw/2+x+p1, h-bh/2+y+p1 : mes btmes.btchk sysfont 0 return #deffunc btn str,int,int,int,int ;************************************** ; 擬似ボタン ;************************************** mref bmscr,67 ;BMSCR構造体 mref mstr,32 ;文字数 mref x,1 ;x mref y,2 ;y mref w,3 ;width mref h,4 ;height mref stt,64 ;stat if(id<0)|(id>64):stt=0:return if bt=0 { id=0 : dim rect,2 dim bt,70,10 : sdim btmes,1000,64 } sysfont 17 : bh=bmscr.32 bt.id.0=w : bt.id.1=h bt.id.2=x : bt.id.3=y : btmes.id=mstr ;指定文字の長さをピクセル単位で取得 if mstr!"" { strlen x,btmes.id : prm=bmscr.4,0,x,0 getptr prm.1,btmes.id : getptr prm.3,rect dllproc "GetTextExtentPoint32A",prm,4,D_GDI } else : rect=0,0 bt.id.4=rect : bt.id.5=rect.1 btn_view id : id++ : stt=id return #deffunc btn_check int ;************************************** ; 擬似ボタンチェック ;************************************** mref p1,0 ;ボタンのクリック取得 mref stt,64 ;stat mref rstr,65 ;refstr p2=p1 : stt=-1 getkey mleft,1 if mleft!mleft2 { if mleft=1 { btchk=-1 : repeat id if(mousex>bt.cnt.2)&(mousey>bt.cnt.3)&(bt.cnt.0+bt.cnt.2>mousex)&(bt.cnt.1+bt.cnt.3>mousey):btchk=cnt:break loop : if btchk=-1 : return btn_view btchk,1 : if p2=0 : stt=btchk : rstr=btmes.btchk : else : stt=-1 } else { if btchk>=0&(btchk50 : s=0 color 255,255,255 btn_size 2,100,100,100+s,100+s goto *main