Changeset 33032 in project


Ignore:
Timestamp:
12/26/15 00:48:24 (4 years ago)
Author:
John Croisant
Message:

sdl2-ttf: Final docs for version 0.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/sdl2-ttf

    r33031 r33032  
    33The sdl2-ttf egg provides bindings to
    44[[http://www.libsdl.org/projects/SDL_ttf/|SDL_ttf]] version 2.
    5 SDL_ttf is a library for rendering TTF, OTF, and FON fonts,
    6 compatible with [[http://libsdl.org/|Simple DirectMedia Layer]] version 2 (SDL2),
     5SDL_ttf is a library for rendering text using TTF, OTF, and FON fonts.
     6It is compatible with [[http://libsdl.org/|Simple DirectMedia Layer]] version 2 (SDL2),
    77a popular library used in games and other media-rich software.
    88
    99The sdl2-ttf egg is designed to be compatible with the
    10 [[/egg/sdl2|sdl2]] egg, which provides bindings to SDL 2 itself.
     10[[/egg/sdl2|sdl2]] egg, which provides bindings to SDL 2.
    1111
    1212; Project / Source Code Repository : [[https://gitlab.com/chicken-sdl2/chicken-sdl2-ttf]]
     
    3434== Installation
    3535
    36 '''ATTENTION:''' The sdl2-ttf egg has not been released yet.
    37 For now, you must download it from its source code repository and follow the instructions in the README.
    38 
    3936When installing the egg, you should set the {{SDL2_FLAGS}} environment variable to a string of compiler flags to be used when compiling the egg.
    4037If you have the {{sdl2-config}} helper program installed on your system,
     
    6461
    6562<enscript highlight="scheme">
    66 (use (prefix sdl2-ttf ttf:))
     63(use (prefix sdl2     sdl2:)
     64     (prefix sdl2-ttf ttf:))
     65
     66(sdl2:set-main-ready!)
     67(sdl2:init!)
    6768(ttf:init!)
     69
     70(define font (ttf:open-font "ComicNeue-Regular.otf" 40))
     71(define text "Hello, World!")
     72(define-values (w h) (ttf:size-utf8 font text))
     73(define window (sdl2:create-window! text 'centered 'centered w h))
     74
     75(let ((text-surf (ttf:render-utf8-shaded
     76                  font text
     77                  (sdl2:make-color 0   0   0)
     78                  (sdl2:make-color 255 255 255))))
     79  (sdl2:blit-surface! text-surf #f
     80                      (sdl2:window-surface window) #f))
     81
     82(sdl2:update-window-surface! window)
     83(sdl2:delay! 5000)
     84(sdl2:quit!)
    6885</enscript>
    6986
     87The [[https://gitlab.com/chicken-sdl2/chicken-sdl2-ttf/tree/master/demos|demos directory]]
     88contains small programs demonstrating how to use various features of sdl2-ttf.
     89
    7090The [[https://gitlab.com/chicken-sdl2/chicken-sdl2-examples|chicken-sdl2-examples repository]]
    71 contains complete example games and programs, some of which use the sdl2-ttf egg.
     91contains complete example games and programs, some of which may use the sdl2-ttf egg.
    7292
    7393
    7494== Version History
    7595
    76 The sdl2-ttf egg has not been released yet.
     96; 0.1.0 (2015-12-25) : Initial release.
     97
     98For more information about what changed in each version,
     99see the [[https://gitlab.com/chicken-sdl2/chicken-sdl2-ttf/blob/master/CHANGELOG.md|CHANGELOG]].
    77100
    78101
     
    148171But, features from the new version would not be available until the user recompiles the sdl2-ttf egg.
    149172
    150 See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC7|SDL_TTF_VERSION and IMG_LinkedVersion]].
     173See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC7|SDL_TTF_VERSION and TTF_Linked_Version]].
    151174
    152175
     
    390413Render the given Latin-1-encoded text using
    391414[[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_42.html#SEC42|"shaded" rendering mode.]]
    392 See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_43.html#SEC43|TTF_RenderText_Shaded]].
     415See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_47.html#SEC47|TTF_RenderText_Shaded]].
    393416
    394417* {{font}} must be a ttf:font specifying the font to render with.
     
    409432Render the given Latin-1 (ISO 8859-1) encoded text using
    410433[[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_42.html#SEC42|"blended" rendering mode.]]
    411 See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_43.html#SEC43|TTF_RenderText_Blended]].
     434See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_51.html#SEC51|TTF_RenderText_Blended]].
    412435
    413436* {{font}} must be a ttf:font specifying the font to render with.
     
    442465Render the given UTF8 encoded text using
    443466[[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_42.html#SEC42|"solid" rendering mode.]]
    444 See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_43.html#SEC43|TTF_RenderUTF8_Solid]].
     467See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_44.html#SEC44|TTF_RenderUTF8_Solid]].
    445468
    446469* {{font}} must be a ttf:font specifying the font to render with.
     
    460483Render the given UTF8 encoded text using
    461484[[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_42.html#SEC42|"shaded" rendering mode.]]
    462 See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_43.html#SEC43|TTF_RenderUTF8_Shaded]].
     485See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_48.html#SEC48|TTF_RenderUTF8_Shaded]].
    463486
    464487* {{font}} must be a ttf:font specifying the font to render with.
     
    479502Render the given UTF8 encoded text using
    480503[[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_42.html#SEC42|"blended" rendering mode.]]
    481 See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_43.html#SEC43|TTF_RenderUTF8_Blended]].
     504See [[http://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_52.html#SEC52|TTF_RenderUTF8_Blended]].
    482505
    483506* {{font}} must be a ttf:font specifying the font to render with.
Note: See TracChangeset for help on using the changeset viewer.