Home » Community » Forums » » SDL & Fonts Part 2: PrintStrings
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 SDL & Fonts Part 2: PrintStrings
Post Reply 
Excellent article, it cleared up quite a few issues which I was thinking about. One alternative had me trying to code a recursive algorithm to split the line and redraw the clipped text onto the next line until the remaining text fit within my box. Your method is much easier and conceptually a lot simpler.



 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Well, I'm glad that I could be of help.

The SDL_Rect parameter in PrintStrings() was also going to be for text wrapping as well as position, but I never needed it, so I left it out. I'd be glad to help write a wrapping function if you get stuck (I'm sure I'll need one sometime )

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Does this work on Linux?

 User Rating: 1015    Report this Post to a Moderator | Link

SDL_TTF is, as far as I know, compatible with Linux.

I think that you have to do some extra, weird stuff with FreeType that involves compiling it *as well as* SDL_TTF (Windows users just grab a big library). But if you can get SDL_TTF working, this should work just fine.

I don't have any Linux boxes with SDL on them yet, so can I get a second opinion, please

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Excellent article! I have, however, managed to create a problem. I have been using the suggested "helper" functions by including them in a separate header file - this had been working fine for some time but now I get:

Main.obj : error LNK2005: "struct SDL_Rect __cdecl newSDL_Rect(int,int,int,int)" (?newSDL_Rect@@YA?AUSDL_Rect@@HHHH@Z) already defined in Graphics.obj


I get an error line such as this one for each function in the helper file, newSDL_Rect, newSDL_Color etc. and I don't know what I have done to invoke this problem. I have include guards on all of my header files.

Can anybody help?

Thanks.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: