1 / 11

Turing Graphics

Turing Graphics. TIK20 May 1, 2007 Ms. Nelson. What Can I Do?. Set up the screen for graphics Draw dots and lines Dot Line; DashedLine; ThickLine Draw empty and filled shapes Box; Oval; Arc; Polygon; MapleLeaf; Star “Flood” an area Clear the screen. Setting up the Screen.

romney
Download Presentation

Turing Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Turing Graphics TIK20 May 1, 2007 Ms. Nelson

  2. What Can I Do? • Set up the screen for graphics • Draw dots and lines • Dot • Line; DashedLine; ThickLine • Draw empty and filled shapes • Box; Oval; Arc; Polygon; MapleLeaf; Star • “Flood” an area • Clear the screen

  3. Setting up the Screen setscreen(“graphics:640,480, nocursor”) • This tells Turing: • Set up the screen for graphics, not text • Make the screen a standard 640 by 480 size • Don’t show the cursor (which you normally see when you “get” and “put”) • Once you are done drawing… Draw.Cls

  4. Drawing Dots and Lines • Dots have location and colour drawdot (50,50,0) • Draws a black dot at location (50, 50) Lines have beginnings, ends, and colour drawline (200,300,200,200,0) • Draws a black line from (200,300) to (600,200)

  5. Cartesian Plane (640,480) (0,480) (50,50) (0,0) (640,0)

  6. Colours? Cool!

  7. Squares and Circles • Boxes also have ends and beginnings drawbox (40,40,100,100,blue) • BUT… note that (40,40) and (100,100) are the two corners! • Other shapes have a center and radius drawoval (40,40,100,100,blue) • (40,40) is the centre; 100 is the radius

  8. Just for Fun! drawstar (0,0,100,100,yellow) drawmapleleaf (0,0,100,100,red)

  9. Try this setscreen("graphics:640,480,nocursor") var j : int for i : 1 .. maxcolour j:=i*10 drawfilloval(i*10,i*10,10,10,i) end for

  10. Exercises • Draw a ball (drawfilloval) • Make the ball move • Draw balls at different locations • Oops – the old balls stay! • Fix that – draw over in white • Make the ball bounce up when it hits the bottom of the screen

More Related