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 box and variables

Author
Message
Eevee
12
Years of Service
User Offline
Joined: 26th Mar 2012
Location:
Posted: 27th Mar 2012 00:13
Hello, I'm using the code:

I've got the Integer


How can I get the value to display in the text?

Thanks
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 27th Mar 2012 01:17
Cast the int as a char:

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Mar 2012 02:47
I use something like this:



The fastest code is the code never written.
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 27th Mar 2012 18:39 Edited at: 27th Mar 2012 18:40
@Hawkblood: True, but to keep it clean, maybe it's better to use a resizable array.

>



Cheers,

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Mar 2012 18:55
Can you do string formatting with that?

The fastest code is the code never written.
xix psycho xix
15
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 27th Mar 2012 22:42
@Mr. Bigglesworth: If you cast the int to a char the function will print out a null character, not the ascii value of the null character which is I believe 0x30. If you wrote score=0x30 and then used a cast you would get the appropriate value. I am at work I have some good code for doing this I just can't remember what that code is. When I get home I will look and see what I have.
Kerl
User Banned
Posted: 28th Mar 2012 08:41
dbText(5,5,"Score: "dbStr(Score));

I'm pretty sure that would work. I can't test it out at the moment. But mess around with the dbStr() function. That's what I've always done...
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 29th Mar 2012 00:43
Your original code is probably the fastest you'll get as it is using standard Ansi C, instead of the un-necessary bloated or slow use of constant function calls to the STL library. Using sprintf() is also fine but I believe now it's sprintf_s() or something.

I like STL but after writing stuff I always try to optimise by converting "WORKING" code to ansi C.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2024-04-19 05:14:53
Your offset time is: 2024-04-19 05:14:53