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.

AppGameKit Classic Chat / AGK caching images

Author
Message
tessoft
12
Years of Service
User Offline
Joined: 28th Mar 2012
Location:
Posted: 6th Apr 2012 15:42
Hello,

is there an internal image cache system - for example loading an image for one sprite is reused if I try to load the same image for again?

So, how many times the image "test.png" will be loaded in the next fragment of code:

agk::LoadImage(1, "test.png");
agk::LoadImage(2, "test.png");
agk::LoadImage(3, "test.png");

Thank you!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Apr 2012 02:18
The image will be loaded 3 times.

When we release image manipulation commands you would be able to modify the contents of an image ID so an image cache would be difficult to implement.
victordavion
12
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 13th Apr 2012 08:28
To avoid this type of situation, I usually tend to load my images into a global array (or std::<map> if you desire) and access from App.ImageArray.

If you have a ton of media that you'd prefer to dynamically load, you could always load on demand for that particular gamestate, or if you're using the std::<map> option, just run a quick
polomint
12
Years of Service
User Offline
Joined: 3rd Apr 2012
Location: Lancashire, United Kingdom
Posted: 14th Apr 2012 15:36
Ahh, that's a good way to do things, I'll use that from now on,

Blackberry App Development & ZX Spectrum Game Development.
tessoft
12
Years of Service
User Offline
Joined: 28th Mar 2012
Location:
Posted: 17th Apr 2012 16:19
Thanks for the useful information!

Login to post a reply

Server time is: 2024-05-19 10:37:25
Your offset time is: 2024-05-19 10:37:25