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

Username:   Password: 
 RegisterRegister   
 How do I import a picture into my program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kenster102.5




PostPosted: Wed Dec 20, 2006 6:59 pm   Post subject: How do I import a picture into my program

I am taking computer engineering at school and am wondering how do I import a picture into a program so it acts as a background for the program?

Thank you
Sponsor
Sponsor
Sponsor
sponsor
Prince Pwn




PostPosted: Wed Dec 20, 2006 7:33 pm   Post subject: (No subject)

Start by making the variable for the picture:
code:
var backgroundPic : int


Then make it equal to the directory of your picture. eg:
code:
backgroundPic := Pic.FileNew("C:/Documents and Settings/"+Sys.getUserName+"/My Documents/My Pictures/background.bmp")


Now to draw it, put it inside your main loop before you draw anything alse and do:
code:
Pic.Draw(backgroundPic,x,y,picCopy)
Prince Pwn




PostPosted: Wed Dec 20, 2006 7:36 pm   Post subject: (No subject)

X and Y are also usually 0 when making a background picture, and you can also use
code:
picMerge
in place of
code:
picCopy
if you wish to blend it in with stuff beneath it, which doesn't really matter if that's your background image.
Bunny_Man_OC




PostPosted: Wed Dec 20, 2006 7:50 pm   Post subject: (No subject)

Prince Pwn wrote:
code:
backgroundPic := Pic.FileNew("C:/Documents and Settings/"+Sys.getUserName+"/My Documents/My Pictures/background.bmp")


you can also put the picture in the same folder as the turing program that will be ussing it. if you do this then you simply need to put

code:
backgroundPic := Pic.FileNew ("backgroundPic.bmp")
Pic.Draw (backgroundPic,0,0,picCopy)
ericfourfour




PostPosted: Wed Dec 20, 2006 10:01 pm   Post subject: (No subject)

Prince Pwn wrote:
Start by making the variable for the picture:
code:
var backgroundPic : int


Then make it equal to the directory of your picture. eg:
code:
backgroundPic := Pic.FileNew("C:/Documents and Settings/"+Sys.getUserName+"/My Documents/My Pictures/background.bmp")


With the above poster's code this can be reduced further to:
code:
var backgroundPic := Pic.FileNew ("backgroundPic.bmp")

Turing will figure out the data type for you (as long as it is predefined).
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: