program HowToDrawPrimitiveShapes; uses SwinGame,sgTypes; procedure Main(); begin OpenGraphicsWindow('Primitive shapes' ,800 ,250 ); LoadDefaultColors(); ClearScreen(ColorWhite ); DrawCircle(ColorBlack ,50 ,50 ,30 ); DrawEllipse(ColorBlue ,150 ,20 ,120 ,60 ); DrawLine(ColorGreen ,300 ,40 ,450 ,40 ); DrawRectangle(ColorGrey ,500 ,20 ,100 ,60 ); DrawTriangle(ColorPink ,650 ,80 ,750 ,80 ,700 ,20 ); FillCircle(ColorMagenta ,50 ,160 ,30 ); FillEllipse(ColorRed ,150 ,130 ,120 ,60 ); FillRectangle(ColorTurquoise ,300 ,130 ,100 ,60 ); FillTriangle(ColorYellow ,500 ,190 ,700 ,190 ,600 ,130 ); RefreshScreen(); Delay(5000 ); ReleaseAllResources(); end; begin Main(); end.
How To Draw Primitive Shapes
This article will show you how to draw basic shapes in SwinGame.
SwinGame allows you to draw triangle, rectangle, square, circle, ellipse. To draw these shape you need to:
- Make sure your code is opening SwinGame's graphic windows
- Clear the screen
- Work out what shape you want to draw, their color, and coordinates
- Call the required method to draw that particular shape
- Refresh the screen
- Set how long you want your windows to appear for
- Released all resources
- Run the program
Under Read These First is a screenshot showing what the program look like and below is the code for it.
- Draw different object and thing using shape such as human stick, tank, boat, magnifying glass, snow man.
- Impress your friend by being creative :)