.gif with delphi

Started by
9 comments, last by Daboy 22 years, 5 months ago
Hey, the image component wont allow me to add a gif file. I was wondering how i can make it so it loads the gif file on a button click. Thx in advance
Jordan Weberwww.pheonixsoftware.com
Advertisement
That''s because the TImage does not support GIF. You will need a GIF component. Try Torry''s or any of the other Delphi component sites for a GIF component. Or try this Google search
http://www.google.com/search?q=Delphi+GIF+component

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
Ok cool i downloaded TGifimage and i was wondering how i can make it so it runs the animation from a button click?? When use this it runs it but not at my command. Thx
i don''t know if there is a possibility in the gif component that let you decide if the animation runs or not but :

you can, as an alternative, load the single images of this animation into an imagelist and run the animation by your self.

use a timer that counts from 1 to "imagecount" and changes the shown image to the current step
That sounds cool can u give me an example of the code for the timer? Thx
the simpliest would be :

var ani_step : integer;

on formcreate you set this to "0";

procedure dxtimertimer;

begin
dxdraw.canvas.fill(0);

dximagelist.items.find (''picname''+inttostr(ani_step)).draw (dxdraw.surface,x,y,0);

dxdraw.flip;

ani_step := ani_step +1;
if ani_step > max_image_count then ani_step := 0;

end;
For some reason thats throwing up alot of errors....and what do i put for the timer''s event handler???

good grief man, thats the code for the timer''s event handler right in front of you - procedure DXTimerTimer...

lhey i tried it and no problems. so check if your timers called "DXTimer" and your imagelists called "DXImageList" and your directDraw thingees called "DXDraw" otherwise its not likely to work.

sorry if i sound a bit patronising, thats not the intention. although people do make silly mistakes like the above.

theropod
Use the WriteCoolGame() function.Works every time.
just do ani_step as a pre-inited constant, like

const
ani_step: integer = 0;

saves your even having a FormCreate if yuo do nothing else then
Use the WriteCoolGame() function.Works every time.
Dude ive sat here and tried 5 different ways its not working

If i gave you the project would u make it flip through so i can see what im doing wrong???

This topic is closed to new replies.

Advertisement