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 / Printing camera position and angles on the screen

Author
Message
Gould660
15
Years of Service
User Offline
Joined: 12th May 2009
Location:
Posted: 18th May 2009 22:33
I am a complete noob to dark gdk and I know you can print strings on the screen. So all I want to do is just print the camera position and angle because in the game i'm making i want it to do something when you go through a door. Like

if (dbcamerapositionX > ____){

play sequence ___

}

something like that. Help Please.
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 18th May 2009 23:51
I had a lot of trouble with this but I managed to sort of figure something out.

So to print the camera position you'd first need to make the proper variables


x = dbCameraPositionX();
y = dbCameraPositionY();
z = dbCameraPositionZ();


Then you'd need to make it into a string.



char CameraPositionXString[5];
sprintf(CameraPositionXString, "%s", x);
char ThingToPrint[25] = "X = ";
strcat(ThingToPrint, CameraPositionXString);


The if this doesn't work, try using %d instead of %s

Then you have to print it


[/code]
dbText (10, 10, CameraPositionXString);
[code]
I didn't run this but it should work.
Gould660
15
Years of Service
User Offline
Joined: 12th May 2009
Location:
Posted: 19th May 2009 00:07 Edited at: 19th May 2009 00:55
The regular float convertion (shouldn't it be float x = __ but nvm)x = dbcamerapositionX works fine thank you but i dont get the string convertion.

Also all it does is print (null)
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 19th May 2009 00:56 Edited at: 19th May 2009 01:03
Why not just use dbStr()?

It will convert a float or an int to a string.

Example:


Or if you want to combine everything into one string and not use dbStr(), use printf() like the puppy of kosh.

Example:


You can search google for everything that sprintf() can convert to a string. For example, it will replace the first '%d' in the format string with the double or integer form of the first parameter.

#ifdef _DEBUG
FixBugs(All);
#endif
Gould660
15
Years of Service
User Offline
Joined: 12th May 2009
Location:
Posted: 19th May 2009 01:42
ok this is making me more confused heres a print of my code like don't just rewrite it i just want to show you like what I have so far



and that is so far it it gets messed up and says that i have an error with windows (it crashes) and it gives me an error support message thing.
Gould660
15
Years of Service
User Offline
Joined: 12th May 2009
Location:
Posted: 19th May 2009 02:05
Sorry moderator for doubble posting

I just want to say thank you i combinded your ideas and got it to work

now i have two other questions how to limit camera amgle between 75 and -75 degrees and how to use shellexecute because with this it was so when you walked out a green door it would run another program type thing

you dont have to do it but like if you have examples or like somthing just to help me with like dbexecutefile how do you use it stuff like that it would be much abliged

thanks again

Gould660

Login to post a reply

Server time is: 2024-10-01 01:25:20
Your offset time is: 2024-10-01 01:25:20