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 / Exit game

Author
Message
Yero008
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location: Romania
Posted: 21st Dec 2010 11:20
What command should I use so when I press the ok button it closes the game.
I tried this one but it keeps showing the messagebox.

Forward Thanks.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 21st Dec 2010 15:53
show us more code, we don't even know where you put this, inside a loop or another function or something

Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
Neon Sheild
14
Years of Service
User Offline
Joined: 27th Aug 2010
Location: Mt. Olympus
Posted: 21st Dec 2010 19:30
Although I agree with Hassan that you should show us more code, try using the command "break;"
Assuming your piece of code is inside of the game loop, it will break out of the loop and return to the OS.

Perhaps, I theoretically might possibly have potential to hypothetically maybe have the chance to attempt something.
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 21st Dec 2010 21:13
Use exit(int) to immediately exit.



“C++ : Where friends have access to your private members.”
-Gavin Russell Baker
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 22nd Dec 2010 14:08
Well Exiting your application with removing data is really, really BAD! Can cause mem leaks.

Anyway so you would need to delete your level, libs, or anything before closing down.

For example:



Don't mind the function name and such...

But when I destroy the app, before doing that I destroy the physics object, lua, and dargdk itself. Before calling that function I call another function to delete my last used level containing all objects, and such, altough it seams that that is not really imporant.

Good luck with your project, and merry c++mas.

Yero008
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location: Romania
Posted: 23rd Dec 2010 09:12
This is inside the dark gdk loop, when my player falls it check's it's life, and if it's 0 it tells it gameover.
If I use exit(1); and outside the loop I have a for that deletes the object, will it still delete those objects?

////code
void DarkGDK ( void )
{

while ( LoopGDK ( ) )
{
//in here there's a function: gameover()
and it shows the Message Box

}

for ( int i = 1; i < 115; i++ )
dbDeleteObject ( i );

return;
}
Yero008
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location: Romania
Posted: 23rd Dec 2010 11:00
When I run this code it says:
error C2040: '>' : 'int *' differs in levels of indirection from 'int'
error C2446: '>' : no conversion from 'int' to 'int *'
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 23rd Dec 2010 12:31


Assuming every function is right... in your code.

Greets,

RedEye

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 23rd Dec 2010 14:40







Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 23rd Dec 2010 16:21
Wich is what I said?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 23rd Dec 2010 17:11
Quote: "Wich is what I said?"

i think so...i thought that since he didn't notice it in his code, why would he notice it in yours? thats my point, not saying you're wrong

Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
Yero008
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location: Romania
Posted: 23rd Dec 2010 22:01
Thanks for the answers. If I use exit(1) will it still delete the object, I have a for outside the while darkgdk.
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 23rd Dec 2010 23:29
Quote: "will it still delete the object"

Is your question, if i use exit will it delete the object? ? then please read the whole thread again lol.

But if you delete before calling exit then it's okay.

Quote: ", why would he notice it in yours? thats my point,"


Haha, that's true.

Login to post a reply

Server time is: 2024-09-28 14:04:06
Your offset time is: 2024-09-28 14:04:06