Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Tutorials] Pictures/Images
Index -> Programming, Turing -> Turing Tutorials
Goto page 1, 2, 3, 4, 5  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Dan




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
cutecotton




PostPosted: Mon Dec 23, 2002 12:59 am   Post subject: (No subject)

*sniff* how i wished i found this forum earlier..i've been struggling for 2 days to find out howt o do that in turing..*sniff*
Vicous




PostPosted: Fri Feb 28, 2003 9:52 am   Post subject: window size

on a side note, what is the code for changing the window size, I know it has something to do with setscreen
Tony




PostPosted: Fri Feb 28, 2003 10:02 am   Post subject: (No subject)

View.Set("graphics:length;height")

as in View.Set("graphics:400;100")
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Vicous




PostPosted: Fri Feb 28, 2003 10:12 pm   Post subject: view.set, setscreen

wha? whats the dif between view.set and setscreen?
Tony




PostPosted: Sat Mar 01, 2003 12:08 am   Post subject: (No subject)

no difference... you can use ether one you like.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Vicous




PostPosted: Sun Mar 02, 2003 4:45 am   Post subject: Re: [Tutorials] Pics

Hacker Dan wrote:
How to use images in Turing

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



can you elaborate on a few things, such as how to set which background color, and what XORing means?
Asok




PostPosted: Wed Mar 05, 2003 7:09 pm   Post subject: (No subject)

I figured picXor was just some guys at UofT being leet.

don't hax0r my picX0r!

ooooh yea! Smile
Tony




PostPosted: Wed Mar 05, 2003 7:33 pm   Post subject: (No subject)

someone beeing playing too much counter-stike Wink

its a good game though 8)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Tubs




PostPosted: Wed Mar 05, 2003 7:40 pm   Post subject: (No subject)

rofl thats good

its not just in cs, that kind of language is on every internet game

btw cs sucks compared to mohaa bf1942 etc etc
Asok




PostPosted: Wed Mar 05, 2003 7:51 pm   Post subject: (No subject)

I have to agree, in bf1942 you get to run people over in viechles! *remembers tribes2*

*beep beep*
whoops Laughing
Vicous




PostPosted: Wed Mar 05, 2003 7:56 pm   Post subject: well

hate to be the one to break up this converstation (Counterstrike sounds familiar but I can't pin it down right now) but I kinda want the answer
Asok




PostPosted: Wed Mar 05, 2003 8:11 pm   Post subject: (No subject)

k, all the pic options have to do with picture layering on top of eachother

picMerge will set it so that the color that matches the background is actually transparents so you can see images underneath

picCopy place the image on top of allready drawn images.

picXor inverts the color that is different than the background when a picture is touching it.

picUnderMerge sends the picture to the back so that other images that were drawn before it are still above it.

EDIT: oh and to set the background color is:

code:
colorback(color)


where the parameter is replaced with the actual color you want. (the Candian spelling of "colour" works too.)
Vicous




PostPosted: Wed Mar 05, 2003 8:22 pm   Post subject: the devil made me say it

what is this candian place and do they have candy?

sorry, that was just too tempting, thank you for answering my questions and giving me a reason to laugh
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 5  [ 72 Posts ]
Goto page 1, 2, 3, 4, 5  Next
Jump to:   


Style:  
Search: