class cTextNode {
//public functions
private:
int nType;
string sText;
}
std::list<cTextNode> lTextList;
What would be the easiest way to draw this using SDL? A diferent class or library would be OK if I would have to re-invent the wheel to do it this way, but I want to use as few libraries as possible.
It would be really nice if I could just redirect cout to the box. Another thing I would need is a way to get input from a text bar above the box. How could I read text instead of just keypresses, and allow the mouse to focus between the little non-movable box and the screen, with the box always on top?
[edited by - nagromo on November 30, 2003 2:23:18 PM]
text box in SDL?
(Dev-)C++,Win2k,SDL
[edit]:Sorry I double-posted. I asked a mod to delete the other one. I know that ticks people off.
For starters, this will be used by a text-based RPG, but I hope to someday expand it to a graphical RPG and the web. I know that this will be a ton of work, which is why I am starting very small.
I need to have a text box that can be scrolled. It will be filled with arbitiary text. I will have a list/vector of strings (I think list would be better, it will only be appended to at the end and small segments will be read in order) Each node in the list will have a member nType. This will determine whether it is rendered, and what color it is. Here is my idea of what it could look like (from my FTP program):
here is my idea of the list:
Just as an aside, if you click the edit button after making a post, you can delete a double post yourself.
-fel
-fel
SDL_ttf to render a line of text
SDL_EnableUnicode or something like that will put the unicode character of the keys pressed in the key down event (so you don''t have to write ugly piles of SDL_K means the letter ''K'' is shift is down or caps lock on...) Don''t be afraid of the big word Unicode, if the value is < 128, then its the same as ASCII.
Alternatively, you could look for a free SDL UI kit...
SDL_EnableUnicode or something like that will put the unicode character of the keys pressed in the key down event (so you don''t have to write ugly piles of SDL_K means the letter ''K'' is shift is down or caps lock on...) Don''t be afraid of the big word Unicode, if the value is < 128, then its the same as ASCII.
Alternatively, you could look for a free SDL UI kit...
Why don''t you just make it a console game? Then you don''t have to focus on the graphics, which is the whole point of making a text based game.
--------
"Hey, what about those baggy pants you kids are wearin'' these days? Aren''t they hip and cool and poppin'' fresh?"-Peter Griffin
"Everytime I see an M followed by a dollar sign I just say "oh god" and go to the next post."-Neurokaotix
the D programming language
--------
"Hey, what about those baggy pants you kids are wearin'' these days? Aren''t they hip and cool and poppin'' fresh?"-Peter Griffin
"Everytime I see an M followed by a dollar sign I just say "oh god" and go to the next post."-Neurokaotix
the D programming language
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement