Code: Select all
XIncludeFile "gDrawing.pbi"
Global Dim poly.POINTF(3)
;the body
poly(0)\X =110; /* first vertex */
poly(0)\Y = 114;
poly(1)\X = 322; /* second vertex */
poly(1)\Y = 114;
poly(2)\X = 322; /* third vertex */
poly(2)\Y = 148;
poly(3)\X = poly(0)\x; /* close the polygon */
poly(3)\Y = poly(0)\y
Global Dim poly2.POINTF(4)
;uppper propeller
poly2(0)\x =255; /* first vertex */
poly2(0)\y = 35;
poly2(1)\x = 388; /* second vertex */
poly2(1)\y = 71;
poly2(2)\x = 490; /* third vertex */
poly2(2)\y = 51
poly2(3)\x = 158
poly2(3)\y = 55
poly2(4)\x = poly2(0)\x
poly2(4)\y = poly2(0)\y; /* close the polygon */
Global Dim poly3.POINTF(4)
;rear propeller
poly3(0)\x = 109; /* first vertex */
poly3(0)\y = 78;
poly3(1)\x = 108; /* second vertex */
poly3(1)\y = 151;
poly3(2)\x = 121; /* third vertex */
poly3(2)\y = 125
poly3(3)\x = 97
poly3(3)\y = 103
poly3(4)\x = poly3(0)\x
poly3(4)\y = poly3(0)\y; /* close the polygon */
Procedure Draw()
gDrawingMode(#PB_2DDrawing_Default)
gSetPenSize(1)
gSetPenColor(RGBA(255,0,0,$FF))
gSetPenPattern(4,RGBA(255,0,0,$FF),RGBA(255,200,0,$FF))
;rear chamber (with pattern)
gPie(322,114,60,60,180,90)
gSetPenColor(RGBA(255,255,0,$FF))
;yellow bottom chamber
gPie(322,114,40,35,0,90)
gPoly(poly(),RGBA(105,0,255,$FF))
gPoly(poly2(),RGBA($00,$FF,$00,$FF))
gPoly(poly3(),RGBA($00,$FF,$00,$FF))
gSetPenSize(3)
gSetPenColor(RGBA(255,215,0,$FF))
gArc(322,110,40,55,-90,97); pilot front wind shield
gCircle(322,148,12,RGBA($00,$FF,$00,$FF)) ; wheel
gCircle(322,148,6,RGBA($00,$00,$00,$FF))
EndProcedure
If gInit()
mainWin = OpenWindow(#PB_Any,0,0,800,600,"gDrawing: Helicopter for vacations",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
img = CreateImage(#PB_Any,800,600,24)
If gStartDrawing( ImageOutput(img) )
gClear( RGBA($AA,$AA,$AA,$FF) )
Draw()
gStopDrawing()
EndIf
imgWin = ImageGadget(#PB_Any,0,0,800,600,ImageID(img))
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
gEnd()
EndIf