Computer Science Canada

[Tutorial] Using .GIF Images In Turing! YES its posible!!!!

Author:  the_short1 [ Sat Apr 24, 2004 2:29 am ]
Post subject:  [Tutorial] Using .GIF Images In Turing! YES its posible!!!!

Ok... ever wonder how u could put a picture like this into Turing??
Posted Image, might have been reduced in size. Click Image to view fullscreen.

Here it is folks... I have known about this for a while know and i though i would share with u my knowledge.... YES!!!! u can use GIF images in TURING!!! You cant just go:
Pic.Draw (pic,0,0,"pic.gif") but noone said compsci was that easy
ok.... here is the simplified version of my code...
Code:
code:

var picnum, pic : int := 0
loop
if picnum not= 8 then
picnum += 1
else     
picnum := 1   
end if   
pic := Pic.FileNew ("can" + intstr (picnum) + ".BMP")   
Pic.Draw (pic, maxx div 2 - 75, maxy div 2 - 50, picCopy)
end loop

Looks simple eh?... note above wont work without the pictures...
just wanted to show its not much coding... the downloadable one below explains it all in the use of commenting..... Plus below is also some instructions that u need to know..

First off... its almost mandatory to have 'Irfanview' to do this...
www.irfanview.com
irfamview is only 800 Kb and its free... no spyware.. No crap.. Its awesome

First Step:
open the .gif in irfanview
go to 'options'
click on extract all frames
save to a location on ur hard drive
*** u can rename the files using irfanviews BATCH rename/conversion in the 'file' menu... or u can do it by hand to make the file name short with numbers at the end... *** note for my tutorial start at the number one..

Ok.... now u should have a bunch of pictures.... lets say...
can1.bmp
can2.bmp...
etc"¦ no zeros before the numbers! Or you'll have to change this line to:
("can0" + intstr (picnum) + ".BMP") or worse if u have more then one zero appear.. easier if u don't..
Now the magic... ***download the file bellow...

hope this inspires young minds to make cooler programs with animated pictures... and hopefully some brownie points or some compsci bits
if u want an example of how benificial this can be.... go download my Jail break remake in source code... it has an animated zergling....!!!

Hope That Helps, Edited For Spelling And Spaces On Jan15th By Short1 <sorry it was REALLY bad before.

Author:  Paul [ Sat Apr 24, 2004 6:21 am ]
Post subject: 

Nice tutorial, I might use it for some kind of intro to a program. But you should have correct spelling on the topic title lol.

Author:  Dan [ Sat Apr 24, 2004 3:31 pm ]
Post subject: 

well that is not realy using gif images but it is a good demostartion on how to animate things in turing. this conspece can also be modfied to show videos in turing by spliting all the frames in to jpg or other img files.

there are many apps out there to slpit up video and gif files, but persoanly i like VirtualDub and some of abobes imging tools.

i think it whould be cool if some one looked up the foramt for gif images and aucaly worte an add on for turing to realy load gif files even if they where not animated. but that whould probly be alot of work when free langs like java can all ready do it...

Author:  recneps [ Sat Apr 24, 2004 4:35 pm ]
Post subject: 

i was searching for corel or something on google, and this page popped up with the whole shematics for wordperfect graphics(.wpg)
so im sure theres one on gif... it wouldnt be that hard.
*dont look at me to do it* lol Wink

Author:  the_short1 [ Sun Apr 25, 2004 5:51 pm ]
Post subject: 

COOL!.... i fixed spelling..
.
yea... lots of works to make .gif files load.... and they prob not animated.. cuz it would need to be a process...

yea.... to show videos..... u can use Sys.Exec .. itll pop up wmp but hey...

*** look in turing examples... they open a video...

Author:  Raugrist [ Sun Apr 25, 2004 6:12 pm ]
Post subject: 

That video playing "tutorial" had to have been among the stupidest things holtsoft could've thought to include. That's almost like saying:

Here's how to make a first person shooter in one line of code
code:

if Sys.Exec ("c:/unreal tournament/system/ut.exe") then end if


Well, perhaps a bit of exaggeration, but....

Anyways, for GIFs (and all images really) in a real language, you would open the file, then read in a sequence of bytes that are used to draw pixels with those specific colours.

Author:  Paul [ Sun Apr 25, 2004 6:19 pm ]
Post subject: 

the_short1 wrote:
COOL!.... i fixed spelling..

Well, you're special enough to be allowed to spell images in your own way Razz

Author:  Tony [ Sun Apr 25, 2004 6:32 pm ]
Post subject: 

Raugrist wrote:
you would open the file, then read in a sequence of bytes that are used to draw pixels with those specific colours.


'cept that you'd have to know .gif encoding. And it would be a part of turing, but apparently the encoding is copyrighted and holtsoft is being cheap Rolling Eyes

Author:  Catalyst [ Sun Apr 25, 2004 6:47 pm ]
Post subject: 

have fun

http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/GIF89a.txt

Author:  Raugrist [ Sun Apr 25, 2004 6:58 pm ]
Post subject: 

tony wrote:
Raugrist wrote:
you would open the file, then read in a sequence of bytes that are used to draw pixels with those specific colours.


'cept that you'd have to know .gif encoding.

Sorry, I guess I just thought that was implied.

tony wrote:
And it would be a part of turing, but apparently the encoding is copyrighted and holtsoft is being cheap Rolling Eyes

Yeah, I know the encoding is copyrighted and you aren't supposed to use it without paying [insert name of morons who created GIF format], but you need not look any further than your own copy of turing to see how a copyright isn't going to stop many people. It'd be really cool if you could load a picture much the same way you load one in OpenGL and stuff instead of just Pic.FileNew(...) so you could add support for better formats like PNG or even GIF.

Author:  Catalyst [ Sun Apr 25, 2004 6:59 pm ]
Post subject: 

u can load anything anyway you like in turing its just a matter of actually doing it

Author:  the_short1 [ Mon Apr 26, 2004 9:07 am ]
Post subject: 

yea..... sounds to hard an confusing.,.... maybe u can do it catalyst.... ***since ur a pro... and im not.. :S

anyways.... this is the most viable and easy way to add .gif pictures... or movies into Turing....... . . . . . i hope to make a REALLY cool Bound Map where everything **including deaths are GIF images...
so u can run around and kill lets say... marine... it will work Smile

Author:  jordan [ Sun Jan 16, 2005 12:47 am ]
Post subject: 

the_short1 wrote:
yea..... sounds to hard an confusing.,.... maybe u can do it catalyst.... ***since ur a pro... and im not.. :S

anyways.... this is the most viable and easy way to add .gif pictures... or movies into Turing....... . . . . . i hope to make a REALLY cool Bound Map where everything **including deaths are GIF images...
so u can run around and kill lets say... marine... it will work Smile


cool,, but the picture has to be in the same folder as in the file of turing, correct?

Author:  Leftover [ Sun Jan 16, 2005 1:32 am ]
Post subject: 

Paul wrote:
Nice tutorial, I might use it for some kind of intro to a program. But you should have correct spelling on the topic title lol.


As well as all the text in the post, considering someone want's their tutorial posted Razz

Author:  Leftover [ Sun Jan 16, 2005 1:35 am ]
Post subject: 

jordan wrote:
cool,, but the picture has to be in the same folder as in the file of turing, correct?


You can put it in the directory where the .t file is stored, or you can put the full file path in, with the \ reversed so it is like the web with /. I.E. "C:/Program Files/Companyname/Gamename/data/image.jpg" would include a picture in the root folder of your game, in this case, C:\Program Files\Companyname\Game name, then in the data directory of that file, with an image named image.jpg.

Author:  the_short1 [ Sun Jan 16, 2005 11:29 am ]
Post subject: 

yea sorry those were in my days of stupid typing.. with all those spaces and spelling errors.. my bad.. ill plop it in word... . and fix it up a tad...

Author:  Mr. T [ Sun Jan 23, 2005 10:45 pm ]
Post subject: 

i followed the instructions for incorporating gifs into turing, but for unexplicable reason it jus wont work
any ideas why not?

Author:  Tony [ Sun Jan 23, 2005 10:54 pm ]
Post subject: 

Pwned wrote:
any ideas why not?

you pressed a wrong button while trying to execute the code? Laughing I have no idea - what's the problem?

Author:  fabulos [ Thu May 05, 2005 5:28 pm ]
Post subject: 

after some time of animating it gives me an error.

"Illegal picture ID number "0" (Probable cause:picture was not successfully)"

in the flag program it says. the same thing.


so how would u make it so it loops forever...??

Author:  Cervantes [ Thu May 05, 2005 5:34 pm ]
Post subject: 

Fix the error. You've probably misnamed a picture, either in your code or it's actual name. If not that, then it's probably located in the correct folder. It's easiest if it's in the same folder as your turing file.

Author:  bolufromthesoo [ Sat May 14, 2005 8:45 pm ]
Post subject: 

I used Fraps to save alot of screenshots (800x600.jpg) from my favourite fps games. (1sec per screenshot) Then I batch processed them with Irfanview so they would be halo1, halo2, etc.

The problems is that: after about 20 seconds (or 150 frame-ish) the program gets an error (). Upon furthur inspection, I found that the program errors when I ran out of memory (256MB).

Can anyone fix this? Or do I have to batch resize them? The program looks pretty cool and you could probably sync it with in-game sounds.

EDIT Problem solved. Thx Cervantes.

Author:  Cervantes [ Sun May 15, 2005 7:27 am ]
Post subject: 

IIRC, Turing has a limit of 1000 pictures that can be stored at any given time. You've probably exceeded that limit. Are you using Pic.Free at any point? You should probably have that inside your loop after you've drawn the picture (assuming you won't need that specific picture again). The problem is, this program will run really slowly, because you can't set each picture outside the main loop. Rather, you have to create a picture inside the loop, draw it, and then free it. It's as though you're using Pic.ScreenLoad().

Author:  the_short1 [ Mon May 16, 2005 1:48 pm ]
Post subject: 

thanks for covering it cervants Very Happy. ..ive been AFK a lot... and yes i saw one of the guys programs who made that.. i think it was bolu.. . hes at my school... hes making halo .. and omfg.. it looks like a REAL animation.. its awsome!..laggy at times with 800x600 pix.. but still awsome

yea i wish turing would allow more then 1000. .picfree helpsa lot .. but sometimes its really a pain to incorporate without delay when you clear the pics then reinit the picture var..

Author:  BigBear [ Wed Jun 10, 2009 1:53 pm ]
Post subject:  RE:[Tutorial] Using .GIF Images In Turing! YES its posible!!!!

Turing:
%http://compsci.ca/v3/viewtopic.php?t=4637&highlight=gif
%%%%%%%%%%%%%%%%%%%%%%%
% Program To Use GIFs %
% Kevin The Short One %
% Canada Flag Animated%
%%%%%%%%%%%%%%%%%%%%%%%
View.Set ("offscreenonly")
colorback (black)
cls   %% make the screen look good...
%%%%%% ^ sets the window size etc, i used window.open so i can close at the end
var picnum, pic : int := 0
%%%% u need a variable for the picture.. and one to count up the frames
loop
    exit when hasch %%% exits when u push a button
    if picnum not= 8 then  %%% the number of frames, makes sure it done exceed
        picnum += 1 %%% makes the frame count go higher
    else %%% the frame number is higher then the amount of pictures
        picnum := 1 %%% restart at frame 1
    end if
    pic := Pic.FileNew ("Images/can" + intstr (picnum) + ".BMP")
    %%% ok... that makes the picture variable change to reflect the current picture
    %%%% intstr converts interger to string so it will be can1.bmp or can2.bmp depending on the frame...
    Pic.Draw (pic, maxx div 2 - 75, maxy div 2 - 50, picCopy) %%% draws the flag in the middle of screen
    View.Update
    cls
    delay (100)
end loop


: