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 an int value

Author
Message
kareem3d
15
Years of Service
User Offline
Joined: 3rd Aug 2009
Location:
Posted: 3rd Aug 2009 15:19
i have made alittle game with visual C++ and Dark GDk

but i don't know how to print ( int ) to the screen
i need it for the score part -->
for example : i need when object "1" hit object "2" the score decrease by 1, so i wrote it like that :

if(dbObjectHit(1,2))
{
score--;
}
before that i made score integer --> int score=3;

but i don't know how to print it on the screen ????????!!!!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Aug 2009 15:44
Please use meaningful titles in future or I'll simply delete your threads. Thanks

Drowneath
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location: In your eyes
Posted: 3rd Aug 2009 15:59
dbText(PositionX, PositionY, dbStr(score));

[oot]
What's the original title of the thread?
[/oot]

if(asleep) sheep++;
kareem3d
15
Years of Service
User Offline
Joined: 3rd Aug 2009
Location:
Posted: 3rd Aug 2009 16:07
THANKS 4 HELP

next time i will make specific title
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 3rd Aug 2009 16:08


Drowneath
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location: In your eyes
Posted: 3rd Aug 2009 16:49
itoa() has 3 parameters, not 2.


Radix is the base number you want to apply to the int.
Generally I use 10 as the radix for decimal numbers.

if(asleep) sheep++;
Cole Xemi
16
Years of Service
User Offline
Joined: 20th Aug 2008
Location:
Posted: 3rd Aug 2009 19:14
Why use dbText for an int?

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 3rd Aug 2009 20:50 Edited at: 3rd Aug 2009 20:55
Quote: "Why use dbText for an int?"


Ummmm, maybe because dbPrint and dbText (you used both of them) require a pointer to a null terminated string and an int or float doesn't represent a string.

EDIT: At a guess I'd say that the documentation for the dbPrint () function needs a bit of editing. It looks like it was describing functionality for a VB environment.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-10-01 08:35:52
Your offset time is: 2024-10-01 08:35:52