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 / Print ScreenFPS

Author
Message
Enkrypted Code
16
Years of Service
User Offline
Joined: 27th Feb 2008
Location:
Posted: 27th Feb 2008 15:35
how would i convert the DBPro command

Print "FPS: ",Screen_FPS

to DarkGDK?

I've tried:

dbPrint ("FPS: ",dbScreenFPS());

dosen't work. Any help?
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 27th Feb 2008 17:28
I imagine my way is pretty nooby, but this is one way of doing it:



Full example:

Dark Inferno Studios
17
Years of Service
User Offline
Joined: 7th Nov 2006
Location: United Kingdom
Posted: 28th Feb 2008 00:07
Why not:


-Dark Inferno Studios
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 28th Feb 2008 08:49
When I run that, lots of strange characters get printed or nothing after 'FPS:' appears. I think that is because dbScreenFPS returns an integer, and not chars, which dbPrint seems to have trouble converting between by itself; dbPrint probably assumes that dbScreenFPS is chars since the "FPS: " part at the start is.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th Feb 2008 08:53
Quote: "Why not"

Because you can't add an integer to a pointer and expect it to work.

I would personally do this:



jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Feb 2008 16:25
Agreed - best way - reliable - simple.

Micheal - I made a char buffer that's 1024 bytes long - and I use it like a "Temp Global" from all over the place - because I use that sprintf like Benjamin did to fill it, then I immediately do something with the result - USUALLY just dbPrint it... so its throw away. This makes it so I don't need a ton of char[255] buffers in my program.

It's still not perfect - (fixed length) - but for what I use it for ... (Like you displaying FPS, or whatever) ... 1024 seems plenty

Login to post a reply

Server time is: 2024-09-29 13:33:03
Your offset time is: 2024-09-29 13:33:03