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 Previous  1, 2, 3, 4, 5
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jfenty15




PostPosted: Sun Dec 26, 2010 12:09 am   Post subject: RE:[Tutorials] Pictures/Images

oh and is it possible to delay one part but not another if they are both part of a fork?
Sponsor
Sponsor
Sponsor
sponsor
Jfenty15




PostPosted: Sun Dec 26, 2010 12:18 am   Post subject: RE:[Tutorials] Pictures/Images

:S sorry one more thing um... i ran out of max id numbers even tho im "cls"ing so if i can delete the image or reset the id numbers? but before i finish the whole thing crashes because of loss of id numbers... here is the new program:

View.Set ("graphics:800;600, nobuttonbar")

var i : int := 0

procedure sticky (y : real)
var stickyleft : int := Pic.FileNew ("Sticky left.GIF")
var stickyright : int := Pic.FileNew ("Sticky right.GIF")
if y = 1 then
cls
Pic.Draw (stickyleft, (800 div 2)-100, (600 div 2)-75, picMerge)
delay (100)
elsif y = 2 then
cls
Pic.Draw (stickyright, (800 div 2)-50, (600 div 2)-75, picMerge)
delay (100)
end if
end sticky

process playstuff
loop
Music.PlayFile ("Full Double Rainbow.wav")
end loop
end playstuff

process backround
loop
if Rand.Real > 0.5 then

for x : 32 .. 54
colorback (x)
end for
end if
end loop
end backround


fork playstuff
fork backround
loop
for y : 1 .. 2
sticky (y)
end for
end loop

please enter your own audio file and pic and see if you can make it work?... maybe using Pic.Mirror?
Tony




PostPosted: Sun Dec 26, 2010 12:28 am   Post subject: RE:[Tutorials] Pictures/Images

Every time you use Pic.FileNew, it uses a new ID (up to a max of 1000, I think). Think about what it does (do you really need 1000 unique pictures at the same time?).

The background and foreground can be conceptually different, but you have only one screen to draw on. At the point the only difference is that you draw the background first and then the foreground on top. If you clear the screen, the entire thing clears. If you draw the background after the foreground, all you'll have on the screen is the background. forks makes the computer draw stuff at random, making everything a huge mess. Stop doing that.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
gnauhZ




PostPosted: Thu May 19, 2011 11:33 am   Post subject: Re: [Tutorials] Pictures/Images

I get an "Illegal Extended Character in string literal" at ("H:\Turing Game--->\M<---ap.jpg")
any help. This also happens for the example that you gave me.
Tony




PostPosted: Thu May 19, 2011 11:46 am   Post subject: RE:[Tutorials] Pictures/Images

It sounds like part of the filename includes a character outside of ASCII's standard 0-127 values. This probably happens because \ is an escape character for special meanings; try using
code:

"H:\\Turing Game\\Map.jpg"

Although I'm not sure just how well spaces will be handled here.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
SwiftDynasty




PostPosted: Thu Jan 12, 2012 6:25 pm   Post subject: Re: [Tutorials] Pictures/Images

Okay I'm having trouble putting in this picture fot turing this is what i have so far:

var pic : int
pic := Pic.FileNew ("pic.jpg")
Pic.Draw(pic,maxx,maxy,picCopy)


Whats wrong with it, it says,
"Illegal Picture ID number "0". ( Probable cause: Picture was not succesfully created.)"

Please help.
SwiftDynasty




PostPosted: Thu Jan 12, 2012 6:57 pm   Post subject: Re: [Tutorials] Pictures/Images

Okay, now I put the picture in the same folder as the turing program and there are no errors but the picture won't come up.


pic.jpg
 Description:
 Filesize:  59.53 KB
 Viewed:  539 Time(s)

pic.jpg



Space Invaders.t
 Description:

Download
 Filename:  Space Invaders.t
 Filesize:  80 Bytes
 Downloaded:  296 Time(s)

Beastinonyou




PostPosted: Thu Jan 12, 2012 8:18 pm   Post subject: Re: [Tutorials] Pictures/Images

SwiftDynasty @ Thu Jan 12, 2012 6:57 pm wrote:
Okay, now I put the picture in the same folder as the turing program and there are no errors but the picture won't come up.


lol... When you are drawing a picture using Pic.Draw (), the X and Y coordinates is the where the Bottom Left corner of the picture starts..

So if you are trying to draw the Picture at maxx, maxy (top Right of screen), you don't see the picture because it's being drawn beyond the screen.

Try drawing at 0,0..
Sponsor
Sponsor
Sponsor
sponsor
Kman43759




PostPosted: Sat Oct 11, 2014 10:13 am   Post subject: Re: [Tutorials] Pictures/Images

Ugh it came up saying some crap like Illegal Item ID 0 (probable cause: picture not succesful) blah blah dfjhsdif
I tried BMP AND JPG and it did not work
Insectoid




PostPosted: Sat Oct 11, 2014 11:18 am   Post subject: RE:[Tutorials] Pictures/Images

There are a number of reasons your picture didn't load. Maybe you've mistyped the file name. Maybe the file is in the wrong folder. When it 'says some crap', that crap is usually some hint about what went wrong so you can try to fix it.
Raknarg




PostPosted: Sun Oct 12, 2014 5:00 pm   Post subject: RE:[Tutorials] Pictures/Images

Illegal Item ID 0 (probable cause: picture not succesful)

Your picture is stored as an int in Turing. When you're drawing or doing something to a picture, the value of that int can't be 0. If it is, it throws this error.

If your PIcture ID is zero, it's either because it's set to 0 and you didn't load a picture, or you attempted to load a picture and that picture as you specified it did not exist.
gohabsgo007




PostPosted: Mon Jan 12, 2015 7:32 pm   Post subject: RE:[Tutorials] Pictures/Images

Sometimes you just save your picture in a different folder and your code 'll work.
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 5 of 5  [ 72 Posts ]
Goto page Previous  1, 2, 3, 4, 5
Jump to:   


Style:  
Search: