вторник, 3 февраля 2015 г.

Pure Basic, проба №1

На досуге между рерайтингом :-) скачал сабж, посмотрел, покопался.
Первая прога:

scx=700:scy=700 If OpenWindow(0, 0, 0, scx, scy, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) SmartWindowRefresh(0, 1) If CreateImage(0, scx, scy) x=0 j.f=0 Num=10 DataSection Data.s "Hello!", "Pure basic", "Greatest!", "COOL", "It's nice!", "* colorfull *","It's a w o n d e r !", "I tryed it", "r e a l l y", "[ 2 0 1 5 ]", "--= 2015 =--", "(c)", "*** Nice software ***", "PURE BASIC", "P u r e B a s i c" EndDataSection Global Dim x.f(Num): Global Dim y.f(Num) Global Dim xd(Num) Global Dim cr.f(Num):Global Dim cg.f(Num):Global Dim cb.f(Num) Global Dim crd.f(Num):Global Dim cgd.f(Num):Global Dim cbd.f(Num) Global Dim mes.s(30) For i= 1 To 15 Read. s mes.s(i) Next i For i = 1 To Num x.f(i)=Random(scx)/2+scx/4: y.f(i)=1 xd(i)=Random(scx)/3 cr(i)=Random(254):cg(i)=Random(254):cb(i)=Random(254) crd(i)=1:cgd(i)=1:cbd(i)=1 Next i StartDrawing(WindowOutput(0)) Box(0,0,scx,scy,RGB(0,0,0)) StopDrawing() j.f=0 h.f=0 Repeat For i = 1 To Num cr(i)=cr(i)+crd(i) ;Debug(cr(1)) If cr(i)>254 crd(i)=crd(i)*-1 EndIf If cr(i)=0 crd(i)=crd(i)*-1 EndIf cg(i)=cg(i)+cgd(i) If cg(i)>254 cgd(i)=cgd(i)*-1 EndIf If cg(i)=0 cgd(i)=cgd(i)*-1 EndIf cb(i)=cb(i)+cbd(i) If cb(i)>254 cbd(i)=cbd(i)*-1 EndIf If cb(i)=0 cbd(i)=cbd(i)*-1 EndIf Next i j.f=j.f+0.005 h.f=h.f+0.01 StartDrawing(WindowOutput(0)) GrabDrawingImage(0, 0, 0, scx, scy) DrawImage(ImageID(0),0,1,scx,scy) Box(1,1,scx,1,RGB(cr(8)/2, cg(8)/2, cb(8)/2)) x.f(1)=x.f(1)+Sin(j.f)*Cos(h.f)*1.5 x.f(2)=scx-x.f(1) Box(x.f(1),y.f(1),3,3,RGB(cr(1),cg(1),cb(1))) Box(x.f(2),y.f(2),3,3,RGB(cr(1),cg(1),cb(1))) Box(x.f(1)+xd(1),y.f(1),3,3,RGB(cr(1),cg(1),cb(1))) Box(x.f(2)-xd(1),y.f(2),3,3,RGB(cr(1),cg(1),cb(1))) Box(x.f(1)+xd(1)/4,y.f(1),1,1,RGB(cr(1),cg(1),cb(1))) Box(x.f(2)-xd(1)/4,y.f(2),1,1,RGB(cr(1),cg(1),cb(1))) x.f(3)=x.f(3)+Sin(h.f)*Cos(j.f)*1 x.f(4)=scx-x.f(3) Box(x.f(3),y.f(3),3,3,RGB(cr(2),cg(2),cb(2))) Box(x.f(4),y.f(4),3,3,RGB(cr(2),cg(2),cb(2))) Box(x.f(3)+xd(2),y.f(3),2,2,RGB(cr(2),cg(2),cb(2))) Box(x.f(4)-xd(2),y.f(4),2,2,RGB(cr(2),cg(2),cb(2))) Box(x.f(3)+xd(2)/2,y.f(3),1,1,RGB(cr(2),cg(2),cb(2))) Box(x.f(4)-xd(2)/2,y.f(4),1,1,RGB(cr(2),cg(2),cb(2))) x.f(5)=x.f(5)+Sin(h.f*5)*Cos(h.f)*Sin(j.f)*3 x.f(6)=scx-x.f(5) Box(x.f(5),y.f(5),5,5,RGB(cr(3),cg(3),cb(3))) Box(x.f(6),y.f(6),5,5,RGB(cr(3),cg(3),cb(3))) If Random(100)>90 xs=Random(scx) Box(xs,1,2,2,RGB(cr(7),cg(7),cb(7))) Box(scx-xs,1,2,2,RGB(cr(7),cg(7),cb(7))) EndIf If Random(1000)>995 i=Random(15) DrawingMode(#PB_2DDrawing_Transparent) x1=Random(scx/2)+Random(scx)/4 DrawText(x1+1, 51, mes.s(i), RGB(0,0,0)) DrawText(x1, 50, mes.s(i), RGB(255-cr(1),255-cg(2),cb)) EndIf Delay(30) StopDrawing() Until Event = #PB_Event_CloseWindow ; If the user has pressed on the close button EndIf EndIf