Computer Science Canada

Character Graphics/Pixel Graphics Turing Commands

Author:  Triple Five [ Thu Jan 08, 2004 11:30 am ]
Post subject:  Character Graphics/Pixel Graphics Turing Commands

This is my first tutorial and it is very basic for very new turing students who just started to learn this language.( Like ME! Very Happy )

View.Set("graphics:x;y,nocursor")- nocursor will hide the cursor after last output, graphics:x;y- will set the screen to (x) pixels wide by (y)pixels high, and View.Set is the command needed

Locate(x,y)- used to position cursor at row x and column y in character graphics mode.
eg. locate(20,50)

cls- clears the screen procedure to blank the screen

color(number)- change the current active color number.
eg. color(25)

colorback(number)- change the current active background color number. eg.colorback(13)

maxcolor- determines the number of available colors
eg. put maxcolor

delay(x)- delay the program for x intervals

In Turing 4.0 View.Update refresh the screen and is much clearer than
delay

maxx- dertermines the maximum value of x in graphics mode
maxy-determines the maximum value of y in graphics mode

drawing commands
--------------------------------------------------------------------------------------
drawdot(x,y,c)- this draws a dot at location(x,y) and in color c
eg. drawdot(200,150,7)

drawline(x1,y1,x2,y2,c)- this will draw a line from(x1,y1) to (x2,y2) in color c
eg. drawline(50,60,120,160,12)

drawbox/drawfillbox(x1,y1,x2,y2,c)- this will draw a box from the bottom left corner(x1,y1) to upper right corner(x2,y2) in color c/ drawfillbox will draw a filled box with filling color as c
eg. drawbox(100,100,200,150,45)

drawfill(x,y,fillcolor,bordercolor)- colors in a closed figure with interior points x,y in color fillcolor with a border in color bordercolor
eg. drawfill(101,101,20,50)

drawoval/drawfilloval(x,y,xradius.yradius,c)- draws an oval with centre(x,y) and xradius and yradius in color c/ drawfilloval with fill in the oval with a color as c
eg. drawoval(50,50,25,100,4)

drawstar/drawfillstar(x1,y1,x2,y2,c)- draws a five pointed star bounded by bottom left corner(x1,y1) and upper right corner(x2,y2) in color c/drawfillstar will fill the star in with a color as c
eg. drawstar(100,100,200,200,13)

drawmapleleaf/drawfillmapleleaf(x1,y1,x2,y2,c)- draws a maple leaf bounded by a bottom left corner(x1,y1) and upper right corner(x2,y2) in color c/drawfillmapleleaf will fill in the maple leaf with a color as c
eg. drawmapleleaf(50,50,200,200,16)

drawarc/drawfillarc(x,y,xradius,yradius,initialAngle,finalAngle,c)- draws an arc whose centre is x,y starting point at initial angle and stoping angle an final angle in color c/drawfillarc will draw a filled arc
eg.drawarc(100,130,200,250,202,101,01)

-------------------------------------------------------------------------------------

I hope that this will be usefull for newbie programmers and that people will use this as a guideline for pixel and graphic creations!

sources- compsci.ca & Grade 10 compsci class

Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy

Author:  Thuged_Out_G [ Thu Jan 08, 2004 3:07 pm ]
Post subject: 

good tutorial for n00bs...have some bits

+BITS


: