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 / Ammo System with dbText?

Author
Message
Spooter
16
Years of Service
User Offline
Joined: 27th May 2008
Location:
Posted: 30th May 2008 23:35 Edited at: 31st May 2008 18:05
I'm making an Ammo System for my game and i was wondering if I can print the amount of ammo left, with dbText. I can make it say Ammo:
and then a selected string after that. Lets say 100.

Using this to post how much ammo left.

Using this to draw the text to screen.

And I end up with the ammo in the top right.


But I want the char Ammo to change to an integer called AmmoAmount.
How can I change char Ammo to have a string value of what ever number AmmoAmount is, or is this even possible.

Thanks
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 31st May 2008 00:47
You'll probably need to set aside a char buffer to receive the character string then run:

char* dbStr ( char* szString, int iValue );

to place the integer value as a string into that buffer.



Then just output szAmmoAmount to the display.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 31st May 2008 01:13
you can use just:
dbText ( x, y, dbStr(val) );
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 31st May 2008 02:12
Which, according to a previous discussion, appears to leave you with a buffer created with new that doesn't get deleted or reused.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Spooter
16
Years of Service
User Offline
Joined: 27th May 2008
Location:
Posted: 31st May 2008 18:07
Ok, I got it up and running. Thanks guys for those who want to see final code I ended up with this.



And that displayed the image from my original post.

Login to post a reply

Server time is: 2024-09-29 21:19:14
Your offset time is: 2024-09-29 21:19:14