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 / Help Can't Exit Running Program

Author
Message
elsole
14
Years of Service
User Offline
Joined: 4th Dec 2009
Location:
Posted: 25th Feb 2010 16:56
Can someone help me coz i can't exit the program. Please correct me if i use the right command in exiting the program.



when i tried to select the choice 2 my program does not do anything except that i can't exit it manually using ESCAPE button or press the X button at the top right portion of the window.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 25th Feb 2010 17:02
You need to put a return; after your main loop!

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Aldur
16
Years of Service
User Offline
Joined: 8th Oct 2007
Location: Melbourne, Australia
Posted: 25th Feb 2010 17:03 Edited at: 25th Feb 2010 17:04
You need a return after:



EDIT:
Beat me to it Pauli!

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 25th Feb 2010 17:19
No, putting return after the while loop will have no effect...

Change:


To:


Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 25th Feb 2010 20:44 Edited at: 26th Feb 2010 02:36
Maybe you'd like to use DarkGDK's loop? That's where the escape button functionality lies, and also ends the process automatically with "PostQuitMessage(0)".



EDIT: Whoops, didn't see that you already had it (duh).

Success = Determination * Mood;
elsole
14
Years of Service
User Offline
Joined: 4th Dec 2009
Location:
Posted: 26th Feb 2010 01:26
Still aint working guys...even i press escaped the program does not stopped and exit.
Aldur
16
Years of Service
User Offline
Joined: 8th Oct 2007
Location: Melbourne, Australia
Posted: 26th Feb 2010 01:29
Change your do loop to a while loop and take the dbSync() out of your function as it is called afterwards anyway.

Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 27th Feb 2010 05:02
You program get stuck in the inner do while loop.

you should not write any infinite loop inside the outer while(LoopGDK()) loop because LoopGDK() is responsible for processing the engine thingy and dbSync() for flipping the screen buffers or updaing the screen.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 27th Feb 2010 11:12
The problem is that your GameTitle function is inside the Dark GDK main loop. After you make your choice once in the title, the program execution gets back into the main loop, so the GameTitle function gets called again... and again... Try to change it like this:

elsole
14
Years of Service
User Offline
Joined: 4th Dec 2009
Location:
Posted: 28th Feb 2010 02:36
but if i will make the gameTitle before the loop how could i manage to get back to the game title if i want to. It serves as a main menu.
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 28th Feb 2010 07:12 Edited at: 28th Feb 2010 07:26
You have a logic problem with your code. Even if you pressed the right keys, your program won't close. Look carefully at your code. When you press the right keys, what happens? You exit the function gameTitle() right? Good. Now what? Does the program exit the while ( LoopGDK() ) loop? Does your program quit? It doesn't. Why? Because you never told it to. The program just loops back up and it ends up calling the gameTitle() function again. Just like you have a switch case inside your gameTitle() function that is used to exit that function when certain keys are pressed, you need some sort of if statement inside the while ( LoopGDK() ) loop to detect when those same keys have been pressed so the program can quit.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 28th Feb 2010 10:39
Quote: "but if i will make the gameTitle before the loop how could i manage to get back to the game title if i want to. It serves as a main menu."


That's quite another issue. You need to build a program structure that can display either menu or gameplay screen or whatever other screen you need, based on the current status of the game. You can have a switch in your main loop to call the appropriate functions. In the Dark Invaders tutorial, there is a good example of a game control switch, I think you need something similar.

Login to post a reply

Server time is: 2024-10-05 16:20:05
Your offset time is: 2024-10-05 16:20:05