Gosub G_Animations Gosub G_Events Gosub G_Grid Gosub G_Objects Gosub G_OtherFunctions gr.open 0,255,255,255,0,1 gr.set.antialias 1 gr.screen sw,sh gosub Create_Interface gosub Create_Menu_Layer gosub Create_About gosub Draw gosub Create_TouchObjects DO Move(Cursor) Gosub Panel_Closed gr.render UNTIL E_N_D end "Привет! Это Я - консоль!" Panel_Closed: If gr_collision(Cursor,OpenBorderTouch) & PanelOpened=-1 then G_DragPanelAnimation(MenuPanel,PanelWidth,PanelOpened) Endif If gr_collision(Cursor,MenuButtonBorderTouch) & PanelOpened=-1 then G_OpenPanelAnimation(MenuPanel,PanelWidth) Endif PanelOpened=PanelGetStatus(MenuPanel,PanelWidth) CursorOutOfScreen(Cursor) If PanelOpened=1 then gosub Panel_Opened Endif BackKeyPress=0 Return Panel_Opened: Do Move(Cursor) If gr_collision(Cursor,CloseBorderTouch) then G_DragPanelAnimation(MenuPanel,PanelWidth,PanelOpened) Endif If gr_collision(Cursor,MenuAreaClose) then gr.touch fl, xtch, ytch if !fl then G_ClosePanelAnimation(MenuPanel,PanelWidth) Endif If BackKeyPress then G_ClosePanelAnimation(MenuPanel,PanelWidth) CursorOutOfScreen(Cursor) BackKeyPress=0 EndIf If gr_collision(Cursor,AreaButtonsPanel) then Do Move(Cursor) gr.touch fl,xtch, ytch For i=1 to 5 If gr_collision(Cursor,ButtonTouchPanel[i]) then ButtonPanelAnimated=G_ButtonAnimation(ButtonTouchPanel[i],ButtonPanelAnimated) f_n.break endif Next Until !fl If i=1 then G_ClosePanelAnimation(MenuPanel,PanelWidth) Endif If i=2 then G_ClosePanelAnimation(MenuPanel,PanelWidth) Endif If i=3 then G_ClosePanelAnimation(MenuPanel,PanelWidth) Endif If i=4 then G_ClosePanelAnimation(MenuPanel,PanelWidth) gosub About Endif If i=5 then exit Endif PanelOpened=PanelGetStatus(MenuPanel,PanelWidth) Until PanelOpened=-1 Return About: AboutOpened=1 gr.show AboutLayer gr.render Do gr.touch fl,xtch,ytch Until fl | AboutBackKeyPress Do gr.touch fl,xtch,ytch Until !fl | AboutBackKeyPress gr.hide AboutLayer gr.render AboutOpened=0 AboutBackKeyPress=0 Return Create_TouchObjects: PanelOpened=-1 gr.color 0,255,0,0,1 gr.circle Cursor,sh,sw,q(0.25) gr.color 0,0,255,0,1 gr.rect OpenBorderTouch,0,y(4),x(0.5),sh gr.rect CloseBorderTouch,q(15.5),0,q(17),sh gr.rect MenuButtonBorderTouch,x(1),y(1),x(3),y(3) gr.rect MenuAreaClose,q(17.5),0,sw,sh gr.color 0,0,200,0,1 Dim ButtonTouchPanel[5] For i=1 to 5 gr.rect ButtonTouchPanel[i],x(1),y(5+(i-1)*3),x(15),y(8+(i-1)*3) Next gr.rect AreaButtonsPanel,x1,y(5),x(15),y(20) Return Draw: Gr.bitmap.draw InterSpr, Bitmap_Interface, 0, 0 Gr.bitmap.draw MenuPanel, MenuBmp, -sw, 0 Gr.bitmap.draw AboutLayer, AboutBmp, 0, 0 gr.hide AboutLayer Return Create_About: s$=" Я демонстрационнаяпрограмма. Показываюкак с нуля можнонарисовать и создатьпанель меню. И самоеглавное я написанана языке RFO Basic ;) © b0ing 03 2017" lengthS=len(s$) Dim s$[400] for i=1 to lengthS z$=mid$(s$,i,1) if z$="." | z$=")" then s$[i-1]=s$[i-1]+z$ else s$[i]=z$ endif next xd=sw/30 xt=sh/50 gr.color 100,0,0,0,0 gr.set.stroke 2 gr.rect rect,xd*3,xt*19,xd*27,xt*32 gr.color 10,0,0,0,1 for i=1 to 15 gr.rect rect,xd*3.25,xt*32,xd*27,xt*32+i gr.rect rect,xd*27,xt*19.25,xd*27+i,xt*32+i next gr.color 255,230,230,255,1 gr.rect rect,xd*3,xt*19,xd*27,xt*32 t=0 gr.color 255,0,0,150,1 for i=1 to 20 for j=1 to 20 text(xd*j+xd*4.5,xt*i+xt*20.5,s$[++t],xt,2,2) next next gr.color 255 Gr.screen.to_bitmap AboutBmp Gr.cls Return Create_Menu_Layer: otstup=30 x=sw-otstup y=0 w=sw-otstup h=sh lt=0 tp=0 rt=x bt=h !Shadow gr.color 10,0,0,0,1 for i=1 to otstup step 3 gr.rect Obj,sw-30,tp,rt+i,bt next !FullPanel gr.color 255,255,255,255,1 gr.rect Obj,lt,tp,rt,bt !TopPanel x=sw-otstup y=0 w=sw-otstup h=q(5) lt=0 tp=0 rt=x bt=h !Shadow gr.color 10,0,0,0,1 for i=1 to 10 gr.rect Obj,lt,tp,rt,bt+i next !FaceTopPanel gr.color 255,50,220,150,1 gr.rect Obj,lt,tp,rt,bt !LeftHighLightBorder gr.color 10,0,250,0,1 for i=1 to otstup step 3 gr.rect rect,0,0,q(7)+i-30,sh next !PanelElements for i=1 to 5 gr.color 50,0,0,0,0 gr.set.stroke 2 gr.line line,x(8),y(5+i*3),x(22),y(5+i*3) next gr.color 255,255,255,255,1 text(x(15),y(2.5),"Program Demo Panel v. 1", q(1),2,2) gr.color 255,0,0,0,1 text(x(8.5),y(6),"Файл", q(1.125),1,2) gr.color 255,150,150,150,1 text(x(8.5),y(7),"Открыть файл для редактирования", q(0.75),1,2) text(x(8.5),y(7.7),"(Демо)", q(0.5),1,2) gr.color 255,0,0,0,1 text(x(8.5),y(9),"Сохранить", q(1.125),1,2) gr.color 255,150,150,150,1 text(x(8.5),y(10),"Сохранить текущие изменения", q(0.75),1,2) text(x(8.5),y(10.7),"(Демо)", q(0.5),1,2) gr.color 255,0,0,0,1 text(x(8.5),y(12),"Опции", q(1.125),1,2) gr.color 255,150,150,150,1 text(x(8.5),y(13),"Настроить по своим предпочтениям", q(0.75),1,2) text(x(8.5),y(13.7),"(Демо)", q(0.5),1,2) gr.color 255,0,0,0,1 text(x(8.5),y(15),"Обо мне", q(1.125),1,2) gr.color 255,150,150,150,1 text(x(8.5),y(16),"Инфо о программе", q(0.75),1,2) text(x(8.5),y(16.7),"(Функция реализована)", q(0.5),1,2) gr.color 255,0,0,0,1 text(x(8.5),y(18),"Выход", q(1.125),1,2) gr.color 255,150,150,150,1 text(x(8.5),y(19),"Завершить программу.", q(0.75),1,2) text(x(8.5),y(19.7),"(Функция реализована)", q(0.5),1,2) gr.color 255 Gr.screen.to_bitmap MenuBmp Gr.cls let PanelWidth=w Return Create_Interface: Gr.color 255,255,255,255,1 gr.rect obj,0,0,sw,sh gr.color 100,100,0,0,1 for i=1 to 30 gr.line line, i*sw/30, 0, i*sw/30, sh next for i=1 to 50 gr.line line, 0,sh/50*i,sw,sh/50*i next !Panel let y=y(4) gr.color 10,0,0,0,1 for i=1 to 10 gr.rect panel,0,0,sw,y+i next gr.color 255,50,150,220,1 gr.rect panel,0,0,sw,y !ThreeLines let x=x(2) let y=y(2) let w=q(0.75) let h=q(0.1) let m=q(0.5) let lt=x-w let rt=x+w let tp=y-h let bt=y+h gr.color 255,255,255,255,1 gr.rect rect, lt,tp-m,rt,bt-m gr.rect rect, lt,tp,rt,bt gr.rect rect, lt,tp+m,rt,bt+m ! Тиснение с краев gr.color 20,0,0,0,1 for i=1 to 30 step 3 gr.rect rect,sw-30+i,0,sw,sh gr.rect rect,0,0,30-i,sh next gr.color 255 Gr.screen.to_bitmap Bitmap_Interface Gr.cls Return G_Grid: fn.def x(a) gr.screen w,h fn.rtn w/24*a fn.end fn.def y(a) gr.screen w,h fn.rtn h/40*a fn.end fn.def q(a) gr.screen w,h fn.rtn (w/24)*a fn.end Return G_Objects: fn.def text(x,y,s$,s,ag,av) gr.text.align ag gr.text.size s if av=1 then v=0 if av=2 then v=-(s*(0.29/2))+s/2 if av=3 then v=-(s*0.29)+s gr.text.draw oTx,x,y+v,s$ fn.rtn oTx fn.end Return G_Events: Fn.def move(obj) gr.touch f,x,y if f then gr.modify obj,"x",x,"y",y Fn.end Return G_Animations: ! PanelAnimations -> Fn.def G_ClosePanelAnimation(Panel,PanelWidth) Do gr.get.position Panel, PanelX, y if PanelX<=-PanelWidth then closed=1 If !closed then i+=5 gr.move panel, -i,0 Else gr.modify panel,"x", -PanelWidth-10 Endif gr.render Until closed Fn.end Fn.def G_OpenPanelAnimation(Panel,PanelWidth) Let BorderTouch=-q(7) Do gr.get.position Panel, PanelX, y if PanelX>=BorderTouch then opened=1 If !opened then i+=5 gr.move panel, i,0 Else gr.modify panel,"x", BorderTouch Endif gr.render Until opened Fn.end Fn.def G_DragPanelAnimation(Panel,PanelWidth,Opened) gr.touch fl, xtch, ytch If fl then Let BorderTouch=q(17) Let BorderOpenTouch=x(2) Do gr.touch fl,xtch,ytch if xtch>=BorderTouch then xtch=BorderTouch gr.modify panel, "x", xtch-PanelWidth ! gr.modify group, "x", xtch-PanelWidth gr.render Until !fl If opened=-1 then if xtch>=BorderOpenTouch then G_OpenPanelAnimation(Panel,PanelWidth) elseif xtchBorderTouch-q(3) then G_OpenPanelAnimation(Panel,PanelWidth) endif Endif Endif Fn.end !ButtonPanelAnimation fn.def G_ButtonAnimation(Button,press) gr.touch fl,xtch,ytch If !press & fl then press=1 for i=0 to 95 step 20 gr.modify Button, "alpha",i gr.render next gr.modify Button, "alpha",100 for i=0 to 95 step 20 gr.modify Button, "alpha",95-i gr.render next gr.modify Button, "alpha",0 gr.render Elseif !fl press=fl Endif fn.rtn press Fn.end Return G_OtherFunctions: Fn.def PanelGetStatus(Panel,PanelWidth) gr.screen sw,sh Gr.get.position Panel, x, y if x<=-x(23) then rtn=-1 if x>=-x(7) then rtn=1 fn.rtn rtn Fn.end Fn.def CursorOutOfScreen(Cursor) gr.screen sw,sh gr.modify cursor, "x", sh Fn.end Return OnBackKey: If PanelOpened=1 & !BackKeyPress then BackKeyPress=1 ElseIf AboutOpened=1 & !AboutBackKeyPress then AboutBackKeyPress=1 Elseif PanelOpened=-1 then E_N_D=1 Endif Back.resume !! OnError: end "Где-то была ошибка"