Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / any way to make an animated sprite from an image not from a file?

Author
Message
bloodmage2
15
Years of Service
User Offline
Joined: 14th Jun 2009
Location:
Posted: 19th Aug 2009 22:15
let me elaborate. the function dbCreateAnimatedSprite() requires a file name. is there any way to acheive a similar effect (an animated sprite) from an image from a memblock or a dbSendNetMessageImage()?

-to the optimist, the glass is half full. to the pessimist, it is half empty, to the engineer, it is twice as big as it needs to be.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 20th Aug 2009 03:56
You could save your image to a temporary file with dbSaveImage.. the reload it with the dbCreateAnimatedSprite command, and delete the temp file that you saved, as a workaround.. I think it may depend on the image format though, im not sure if the dbSaveImage command would preserve all of the image data or if it would convert it to a different format to save .... for example, if you are using a png with transparency setup, will dbSaveImage save it as a png with the transparency intact ? or would it save it as a bmp.... I dont know if that would even make a difference, but its something to think about.

Otherwise you could kind of manually set it up by dividing the image into seperate images/sprites and writing some code to cycle them through like an animation(you could even texture the images onto small 3d plains and make a "3d sprite" system if you wanted to)... I think saving the image and reloading though would be the easier way to do it lol

If it ain't broke.... DONT FIX IT !!!
bloodmage2
15
Years of Service
User Offline
Joined: 14th Jun 2009
Location:
Posted: 20th Aug 2009 19:32 Edited at: 20th Aug 2009 19:43
hmm, that seems like a plausable solution, but one thing: does the GDK store the image, or does it constantly read the file for the image? if the latter, deleting the temp file would throw everything off.

edit: i looked, and you can't save as png, which just about all my images are. any other ideas?

-to the optimist, the glass is half full. to the pessimist, it is half empty, to the engineer, it is twice as big as it needs to be.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Aug 2009 21:07
Quote: "you can't save as png"


Yes you can...

Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 21st Aug 2009 01:13
I cant say what image format dbSaveImage supports as ive not tested it with anything other than bmp's lol... but I would give it a go anyway.

To answer your other question, no, gdk doesnt continously read the image from the disk.Once it's loaded into memory, thats where its accessed from, so deleting it from the disk is completely viable.

My solution though isnt the most efficient way of doing it, but it does seem to be the quickest and easiest. And in reality, with the speed of hard disks and the size of them these days, a few millisecs during load and a couple hunderd k or so of diskspace isnt going to matter too much

If it ain't broke.... DONT FIX IT !!!

Login to post a reply

Server time is: 2024-10-01 10:36:48
Your offset time is: 2024-10-01 10:36:48