Posted: Thu Dec 19, 2002 9:29 pm Post subject: [Tutorials] Pictures/Images
How to use images in Turing
You can load 3 different types of pictures in Turing. They are PCX, BMP and TIM.
1st you need to load the image into Turing's memory:
var varname :int := Pic.FileNew ("filename")
Ex.
code:
%for a file that is in the same dir as your Turing code
var mypic :int := Pic.FileNew ("coolpic.bmp")
or
code:
%to specify the exact location of this file
var mypic :int:= Pic.FileNew ("c:\turing\mygame\coolpic.bmp")
2nd you need to show the picture and set it's location on the screen
Pic.Draw (picID, x, y, mode)
Ex.
%to draw the picture in the center of the screen with no mode
Pic.Draw (mypic, maxx div 2, maxy div 2, 0)
The modes:
picCopy This draws the picture on top of what was underneath, obscuring it completely.
picXOR This draws the picture XORing it with the background.
picMerge This draws the picture like picCopy except that any occurrence of the background color in the picture is not drawn to the screen.
picUnderMerge This draws the picture, but only where the background color was displayed underneath it
If you want to get rid of the picture after you have drawn it on the screen use cls and to get it out of the memory of the computer use Pic.Free (mypic).
Example of a program that uses pics:
code:
%program to show a logo picture
var mypic :int := Pic.FileNew ("coolpic.bmp")
Pic.Draw (mypic, maxx div 2, maxy div 2, 0)
delay (2000)
cls
Pic.Free (mypic)
this was one of the 1st turealrs i made, i dont think i did a good job on it but i figered why not post. so here it is...
Sponsor Sponsor
Tony
Posted: Thu Dec 19, 2002 10:29 pm Post subject: (No subject)
turing 4.x also supports .jpg format. And you can also hope for .gif support in about 4-5 years from now.