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 / Using dbImageExist() to get free IDs doesn't work?

Author
Message
InsanitY
15
Years of Service
User Offline
Joined: 6th Aug 2009
Location: The Netherlands
Posted: 17th Jul 2011 06:03 Edited at: 17th Jul 2011 06:05
Hello all,

I have made a helper function which is very much like the one mentioned here:

http://forum.thegamecreators.com/?m=forum_view&t=169275

Unfortunately it doesn't seem to work. My code:



And it is used here:


getFreeImageID returns the value 0 every time, not only the first time it is called. Does anyone know why? Am I doing something wrong, or is dbImageExist bugged? (And yes, I'm trying to make a GUI element with a scrollbar, made of seperate .png files.)
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 17th Jul 2011 10:28 Edited at: 17th Jul 2011 10:37
What if you change:
int nID = 0;
to
int nID = 1;
This might be causing an error because you can not have an image number of 0 and so dbImageExist may not like it. But it may also be something else...

Edit- Actually, I think it is because the first number your function returns is 0 (nothing wrong with dbImageExist) and like I said before, you can't have an image number of 0.

InsanitY
15
Years of Service
User Offline
Joined: 6th Aug 2009
Location: The Netherlands
Posted: 17th Jul 2011 15:48
Ah yes, thank you. Now that I'm looking into it, it explains why the first image I load and manually give an ID gets ID 1, not 0. I should've seen that myself I guess.

Unfortunately my program still doesn't work properly now (the images don't show up if I paste them), but at least the images have unique IDs now haha. Debug time!

Login to post a reply

Server time is: 2024-11-19 09:44:50
Your offset time is: 2024-11-19 09:44:50