Archived

This topic is now archived and is closed to further replies.

tstrimp

sdl console

Recommended Posts

ok, even after all the help on the c_str() woes thread I''m not able to get it working. So instead I''m asking if anyone could tell me a better way to do it. What I was attempting to do was make a generic console system for use in games my problem is this. I''m using sdl events to get the input for the console, I''m using the SDL_EnableUNICODE(1); function so that I can use the data directly without having to use a lookup function. string + unicode = mess; wstring + cout = mess; wstring + TTF_RenderText_Solid = mess; How should I go about getting that unicode data into TTF_RenderText_Solid() which only wants const char* ? Am I going about this entirely the wrong way? Should I be getting my input diffrently? Any help would be great!
     Hope is the first step on the road to disappointment

Share this post


Link to post
Share on other sites
I still don’t get why you are using Unicode as opposed to ANSI strings.

Check out the SDL_ttf.h file and you will see that there are actually three functions for rendering text: TTF_RenderText_Solid (for ANSI strings), TTF_RenderUTF8_Solid (for UTF strings) and TTF_RenderUNICODE_Solid (for Unicode strings note that *text is 16 bits).

Follow the SDL & Fonts tutorial first so that you have an SDL app that is actually rending text correctly using SDL TTF and then take it from there.

I’m working on SDL TTF console class as well so let us know how you go. Good Luck.

Share this post


Link to post
Share on other sites
I had that tutorial working. I was just having trouble with the unicode part. I'm using unicode because that is how I'm having sdl return the input. Is there a way to have it return ansii?


     Hope is the first step on the road to disappointment

[edited by - tstrimp on July 4, 2003 11:47:36 PM]

Share this post


Link to post
Share on other sites
Nevermind! I''m so hopeless somtimes! I didn''t realize the keysym.sym was mapped to the ascii value. I''m on my way again, I''ll be back soon I''m sure.



     Hope is the first step on the road to disappointment

Share this post


Link to post
Share on other sites