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 / dark gdk, want code to add text in terrain demo, nothing fancy, also snippet buttons?

Author
Message
spring water
15
Years of Service
User Offline
Joined: 15th Jan 2009
Location: Eugene OR
Posted: 17th Jan 2009 21:29
Hi and Help, I would like to display sometext in the terrain demo, such as my current height, or messages of some sort, so some simple code would be of use, Im including my code that Ive got and also was wondering about how to embed those cool code snippet buttons if you know how, thanks a bunch!

If you're not livin', you're already dead!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th Jan 2009 22:06 Edited at: 17th Jan 2009 22:08
[ c o d e ]
Code here
[ / c o d e ] with out odd spacing gives ya:



Text? Hmm.... You should probably learn the STDLIB for string manipulation - but for myself, I wanted to really dig into the whole string thing myself... to get a handle on it. Now I found I like my string classes better than stdlib... but that's just me... There are bits from stdlib... but I don't use the string class... perhaps you should try the string class. Some googling will definately help.


I have this string class:

jfc_string.h





jfc_string.cpp



Now before you read this code and freak... (Like you might not know classes good etc).... There is a Cheap Trick I use ALL THE TIME to get values....

First I make a fixed char buffer, and just use it all the time. I make it 1k usually... in fact in my "jfc_common.h" namespace... its named: CHAR1K, so I refer to it like: JFC::CHAR1K.... anyways....


Sample:


How did I declare CHAR1K? Like this: char CHAR1K[1024];
So you can place that up top in your code, and drop the whole JFC:: part... and then that function named: sprintf becomes your pal

Google it... cuz MSDN help stinks... but you can pass multiple variables... and they show where the format specifiers are, respectfully... %i = integer, %f = float, %s = string... the rest of them and the variations - I'll leave you to google.

--Jason

spring water
15
Years of Service
User Offline
Joined: 15th Jan 2009
Location: Eugene OR
Posted: 17th Jan 2009 22:34
Thanks a lot, you are light years ahead of me in this, i've been learning on my own and although I have come a long way, I am still like a baby in all this. i think I checked out your webpage before btw, with the choppers? If it was your its awesome! I'm gonna do my homework so I'll be able to try and utilize this string thingy, I think i got the code snippet part at least but will try it here.
or it didnt!@#$

If you're not livin', you're already dead!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th Jan 2009 23:00

Login to post a reply

Server time is: 2024-11-25 11:35:54
Your offset time is: 2024-11-25 11:35:54