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 / The game just sits there...

Author
Message
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 16th Sep 2008 02:33
I've been making experiments with DarkGDK so I can get used to everything before I try to make a game. I made some code where it loads the same .x file twice, giving it two different IDs so they will both appear on screen. I made it so that one car will move with the arrow keys pressed in and the other car will move with the Shift key and the arrow keys pressed in. I get no compiler errors, but when I select to Debug, the game just sits there with a black screen and does not respond to anything. Not even if I try to close it. After a while if click it, Vista will try to find out why it is not responding. Any ideas why it is not working?
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 16th Sep 2008 07:33
Your program will load your car models from the folder that you are currently logged into.

If you are running your program from within the Visual C++ Integrated Environment (ie: you pressed Function 5 key), Then you are logged into the same folder that you have your source files inside of. Under this condition, you will have to have the car models also mixed in with your code files in the same folder.

If you make a free standing code EXE file, then you will have to have you car models in the same folder that you will be running the free standing EXE file in.
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 16th Sep 2008 21:41
Yes I already know that, I do have them there and did have this working before I had added the two 'while' statements to add in the Shift function. But that just hanged there when i ran it. So, now I changed the two 'while' statements to 'if' statements shown below, and it works now. But why won't this work with two 'while' statements?


IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Sep 2008 22:40
Perhaps you should read your code again?

Why are you doing this?

It will work, but I don't understand why you are carrying out this unnecessary operation.

Anyway, first, you set ShiftKey at the top of the main loop - it is not set anywhere else. Then you have your while loops - one of these will run because ShiftKey is either 0 or 1, and because the ShiftKey variable is never changed, control will stay in that loop forever. It will never reach the dbSync() function call.

When you changed the while's to if's, you no longer go into those infinite loops, you do reach the dbSync() call, and then you go back to the top to do it all again.

Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 17th Sep 2008 03:36
Oh I didn't think of that... Thanks for the knowledge!
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 19th Sep 2008 10:32
I think maybe you should have a look at the different way in which different loops function.. maybe have a look at some basic tutorials around the web on learning C++ programming and its syntax.

essentially:

a While loop will execute the code inside it, until its condition becomes true... essentially, it will loop forever, unless you include a way for it's condition to become negative from INSIDE the loop....

an If loop will evaluate its condition, and that decides if it executes the code inside the loop or not, but it will only execute the code once(it it does execute at all), then the program will move on...

a For loop operates a little differently, and is used mainly to iterate through sequences of values, executing the code inside the loop, once for each iteration until its final condition becomes true ie. a for loop might look like:


once the final condition in a for loop becomes true, the for loop stops executing the code inside its braces and the program moves on....

If it ain't broke.... DONT FIX IT !!!
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 24th Sep 2008 17:11
Quote: "a While loop will execute the code inside it, until its condition becomes true... "


I believe you mean while the condition is true.

Quote: "for ( int i = 0; i == 5; ++i ) { // code here executes until i==5, i is iterated by one, each time the loop executes }"


have you used a loop before?

~you can call me lantz~

Login to post a reply

Server time is: 2024-09-30 07:25:35
Your offset time is: 2024-09-30 07:25:35