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 / what is LoopGDK()?

Author
Message
Chalkey
17
Years of Service
User Offline
Joined: 25th May 2007
Location:
Posted: 26th Jun 2007 01:21
I was just curious about this function...

I know it loops the engine but whats the point in it once void DarkGDK() has been called? Whats the difference between say using while (true) rather than while (LoopGDK())?
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 26th Jun 2007 01:58
Hi Chalkey,

I cannot say for sure the inner working of this method, but there is a huge difference between while(true) and while(LoopGDK()).

LoopGDK() will return false as soon as the inner engine of DarkDGK is destroyed, thus, telling your code to stop the loop (let's say, when you press ESC and it is still enabled).

If you used just a simple true statement, then the application would try to use the DarkGDK objects even after the engine is unloaded/destroyed.

I hope this sort it out for you. Anything else, I'd be glad to help (if it is in my possibilities).

Best regards,
Thiago
Chalkey
17
Years of Service
User Offline
Joined: 25th May 2007
Location:
Posted: 26th Jun 2007 19:18
kBessa, thanks for your post...

Does that mean you can call LoopGDK such as...



Which will effectivly terminate the engine?
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Jun 2007 20:40
LoopGDK has to be called during your game loop because this handles internal state information for both Input, Joystick control, sound interrupts and sprite movement etc. If you don't call this function, you're preventing the engine from functioning correctly by processing messages as well.

Paul.

kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 26th Jun 2007 21:12
Chalkey,

Paul's answer is better than mine. No, you can't do you what you proposed, but you could something like this:



I've used that on some demos and never had a problem with it.
Chalkey
17
Years of Service
User Offline
Joined: 25th May 2007
Location:
Posted: 26th Jun 2007 21:50
Cheers, just couldnt find a mention of it in the manual...

I guess its out with while (true) then hehe.
Mudbug
18
Years of Service
User Offline
Joined: 2nd Nov 2006
Location: Rome, GA USA
Posted: 27th Jun 2007 00:43 Edited at: 27th Jun 2007 15:30
You could still use while true if you really want to with something like this:



of course, probably easier just use while (LoopGDK())...

-MudBug

Login to post a reply

Server time is: 2024-11-19 13:19:39
Your offset time is: 2024-11-19 13:19:39