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 / Please Help, I'm a newbie to DGDK and I have alot of questions...

Author
Message
Kluskey
16
Years of Service
User Offline
Joined: 19th Jan 2008
Location:
Posted: 20th Jan 2008 05:42
Okay I have a bunch of questions....So here I go.

In things like this :

What is the f?

What is the best way to add floats easily? I'm trying to average something but it never works...:

and then I get an error

Another thing, is there anyway to get text to stay on the screen without looping it over and over? Like you have

How do you get it to stay there without having to loop everything else again?

What is the best way to get the camera position (all XYZ in the same string) and put it in dbText on the screen?
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 20th Jan 2008 12:34
Quote: "What is the f?"


In c/c++ you say with the "f" character at the end of any floating point number that you don't need full precision of the representation. The numbers 1.0 and 1.0f are thus of different types (the first one is 'double' the second one is 'float' - less precise).

Quote: "What is the best way to add floats easily? I'm trying to average something but it never works...:"


'float' is a standard variable type. With a type name you define a variable, so

defines a variable va of type float. You can not have two variables of the same name, so you can't do this:

actually, you don't have to define the variable again since it is already defined, so you can assign a new value to it:


Quote: "How do you get it to stay there without having to loop everything else again?"


Not possible in GDK as far as I know.

Quote: "What is the best way to get the camera position (all XYZ in the same string) and put it in dbText on the screen?"


This should work:


dbPrintC function should print text without "jumping" on next line.
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 24th Jan 2008 12:22 Edited at: 24th Jan 2008 12:22
Quote: ""How do you get it to stay there without having to loop everything else again?""


When you render something to the screen you are actually rendering to a buffer (image) in memory, and when you call dbSync( ) you are flipping the buffers. So the front buffer becomes the back buffer and the back buffer becomes the front, the front buffer being what you see on screen.

So when you call dbText() you render the text to the back buffer then call dbSync() to flip the buffers. Because 2d operations need to happen after 3d to prevent the 3d stuff from overwriting the 2d, the text you previously rendered will disappear. This is why dbText needs to be called every loop. As far as I'm aware this is true for all game development, language independent. Unless of course the language automatically does this for you, but it still needs to be done each loop, regardless of whether it's done behind the scenes or not.

Who is your Daddy, and what does he do?

Login to post a reply

Server time is: 2024-09-29 09:26:39
Your offset time is: 2024-09-29 09:26:39