Download presentation
Presentation is loading. Please wait.
1
Basic Graphics Drawing Shapes 2
2
Learning Goals By the end of the lesson you should know:
How to draw an ellipse How to draw a filled ellipse How to drawn an arc How to draw a filled arc
3
Draw an Ellipse Draw.Ellipse(gfx,400,300,200,100,3,Helper.RED,0.5f)
Draw.Ellipse(gfx, x, y, xRadius, yRadius, lineWidth, Color, transparency) gfx represents your game window, leave this alone x, y is the coordinate of the centre of the ellipse xRadius, yRadius are the horiztonal and vertical radii length of the ellipse respectively lineWidth is the number of pixels wide the border is Color is the colour of the ellipse, e.g. Helper.RED transparency is how see-through the border is, a float number from 0 to 1 where 0 is invisible Example: Draw a red ellipse at (400,300) that is 200 pixels wide and 100 tall. The ellipse is half transparent and 3 pixels wide Draw.Ellipse(gfx,400,300,200,100,3,Helper.RED,0.5f)
4
Draw a Filled Ellipse Draw.FillEllipse(gfx, x, y, xRadius, yRadius, color, transparency) gfx represents your game window, leave this alone x,y is the coordinate for the centre of the ellipse xRadius, yRadius are the horiztonal and vertical radii length of the ellipse respectively color is the colour the ellipse is filled in with transparency is how see-through the ellipse is, a float number from 0 to 1 where 0 is invisible Example: Draw an opaque white ellipse at (400,300) that is 100 pixels wide and 200 tall. The ellipse is 5 pixels wide Draw.FillEllipse(gfx,400,30,100,200,Helper.WHITE,0.5f);
5
Draw an Arc Draw.Arc(gfx,x,y,xRadius,yRadius,startAngle,angleDuration,arcType,lineWidth,Color,transparency) An Arc is simply an ellipse that doesn’t go all the way around gfx represents your game window, leave this alone x, y is the coordinate of the centre of the arc xRadius, yRadius are the horiztonal and vertical radii length of the arc respectively startAngle is the to start the arc at angleDuration is the number of degrees to continue the arc for arcType is one of three types of arc to draw: Arc2D.PIE (shaped like a pizza slice) Arc2D.CHORD (Draws a straight line joining the start and end point) Arc2D.Open (Draws only the Arc itself) lineWidth is the number of pixels wide the border is Color is the colour of the arc, e.g. Helper.RED transparency is how see-through the border is, a float number from 0 to 1 where 0 is invisible Example: Draw an opaque blue arc at (700,500) that is 50 pixels wide and 100 tall. The arc has a border of 5 pixels, starts at 45o and runs for 90o (will end at 135o). The arc will be pizza shaped. Draw.Arc(gfx,700,500,50,100,45,90,Arc2D.PIE,5,Helper.BLUE,1f)
6
Draw a Filled Arc Draw.FillArc(gfx,x,y,xRadius,yRadius,startAngle,angleDuration,arcType,Color,transparency) An Arc is simply an ellipse that doesn’t go all the way around gfx represents your game window, leave this alone x, y is the coordinate of the centre of the arc xRadius, yRadius are the horiztonal and vertical radii length of the arc respectively startAngle is the to start the arc at angleDuration is the number of degrees to continue the arc for arcType is one of three types of arc to draw: Arc2D.PIE (shaped like a pizza slice) Arc2D.CHORD (Draws a straight line joining the start and end point) Arc2D.Open (Draws only the Arc itself) Color is the colour of the arc, e.g. Helper.RED transparency is how see-through the border is, a float number from 0 to 1 where 0 is invisible Example: Draw a ¾ opaque yellow arc at (700,500) that is 100 pixels wide and 50 tall. The arc has a border of 5 pixels, starts at 30o and runs for 300o (will end at 330o). The arc will be pizza shaped. Draw.FillArc(gfx,700,500,100,50,30,300,Arc2D.PIE,Helper.YELLOWE,0.75f)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.