Results 1 to 5 of 5

Thread: SDL Text

  1. #1
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45

    SDL Text

    Is there any EASY way to get text onto a surface in SDL? I've looked at this http://www.freepascal-meets-sdl.net/ but I find it a bit too, uhh, complicated for what I want to achieve (but i do understand it). I have also fiddled around with SDL and let it spit out as many errors as I can take in one day. My main complaint is: I don't need the background colour, and do you have to load a font from hd? I want to make it cross-platform and I doubt you find fonts at C:\Windows on a linux machine.

    And if there is no really easy way, can I use wingraph/graph to do so instead and have it work on the same screen/surface?

    Any help would be veeeery nice please...
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #2

    Re: SDL Text

    Quote Originally Posted by code_glitch
    Is there any EASY way to get text onto a surface in SDL? I've looked at this http://www.freepascal-meets-sdl.net/ but I find it a bit too, uhh, complicated for what I want to achieve (but i do understand it). I have also fiddled around with SDL and let it spit out as many errors as I can take in one day. My main complaint is: I don't need the background colour, and do you have to load a font from hd?
    You can use bitmap fonts, for example SFont which is included in JEDI-SDL package along with some examples. It's really easy to use, but has a few disadvantages like no unicode support.

    You could also load fonts from streams (SDL_RWops or TStream) or alternatively load the font from a website (that would require to establish a connection using SDL_net/SDL_web, downloading the file onto the hard disk or writing a stream containing the font, and deleting the file/freeing the stream if the application has been closed.)

    Quote Originally Posted by code_glitch
    I want to make it cross-platform and I doubt you find fonts at C:\Windows on a linux machine.
    The best way is to distribute the fonts with your games and not to load the fonts with an absolute path.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45

    Re: SDL Text

    so there is no general command I take it? That's a shame
    out of interest, what sdl unit come with freepascal 2.2.4? are they the JEDI-SDL untis or sdl4fpc units? and does it amke a difference?
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  4. #4

    Re: SDL Text

    Quote Originally Posted by code_glitch
    so there is no general command I take it? That's a shame
    There is no built-in font in SDL.

    Quote Originally Posted by code_glitch
    out of interest, what sdl unit come with freepascal 2.2.4? are they the JEDI-SDL untis or sdl4fpc units? and does it amke a difference?
    As far as I know the SDL units shipped with FreePascal are modified JEDI-SDL units, for example link automatically against the SDL libaries on Linux.
    SDL4FreePascal was last updated in 2001, so it is not as up-to-date as JEDI-SDL.
    But the units shipped with FreePascal are just the core SDL (and SDL friends) units, like SDL, SDL_mixer, SDL_ttf, SDL_image and so on.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  5. #5
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45

    Re: SDL Text

    ah I see. thanks for that explanation. I'm kinda new to SDL so still learning the ropes
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •