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 / dbText and dbStr issues

Author
Message
Scarface
18
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 1st Aug 2008 22:21
I am having issues with these function:



It just won't compile with the added dbStr, I'm probably mis-using it, but all I want to do is print the string "Player 1 Score: ", and the player score which is an int variable named p1_score.

What's up?

- Scarface
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 1st Aug 2008 22:59
You can't combine strings with +'s. This is C++.

http://www.cplusplus.com/reference/clibrary/cstring/

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
Scarface
18
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 1st Aug 2008 23:10
I can't see any function in that header that will convert an int to a string.

- Scarface
Scarface
18
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 1st Aug 2008 23:14
I meant I can't find any help for my issue in the reference you posted.

- Scarface
Scarface
18
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 1st Aug 2008 23:21
Nevermind I think I figured it out, thanks.

- Scarface
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 1st Aug 2008 23:23
http://www.cplusplus.com/reference/clibrary/cstdlib/itoa.html

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
Scarface
18
Years of Service
User Offline
Joined: 21st Oct 2006
Location:
Posted: 2nd Aug 2008 00:20
Thanks, handy function.

- Scarface
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 2nd Aug 2008 15:07
Just use sprintf():

char buffer[256];
sprintf(buffer,"Player 1 Score: %d",p1_score);
dbText( 10, 5, buffer);


Login to post a reply

Server time is: 2024-11-20 17:37:50
Your offset time is: 2024-11-20 17:37:50