Changeset 37226 in project


Ignore:
Timestamp:
02/11/19 06:15:06 (6 months ago)
Author:
John Croisant
Message:

Move and symlink sdl2-image and sdl2-ttf wiki pages.

Location:
wiki/eggref
Files:
2 added
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/sdl2

    r37224 r37226  
    4242
    4343This egg requires CHICKEN Scheme 4.8 or higher.
    44 Please file an issue or contact the maintainer if you need to use this library with an earlier version of CHICKEN Scheme.
    45 
    46 The unit tests depend on the [[/egg/test|test]] egg, and many demos
    47 and examples depend on the [[/egg/miscmacros|miscmacros]] egg. Some
    48 demos and examples have other dependencies as well.
     44As of version 0.3.0, it is compatible with both CHICKEN 4 and CHICKEN 5.
     45
     46The unit tests depend on the [[/egg/test|test]] egg.
     47Some demos and examples have other dependencies as well.
    4948
    5049
     
    6059== Installation
    6160
    62 When installing the egg, you should set the SDL2_FLAGS environment
    63 variable to a string of compiler flags to be used when compiling the
    64 egg. If you have the {{sdl2-config}} helper program installed on your
    65 system, you can set appropriate flags and install the extension like
    66 so (notice these are back ticks, not quotes):
    67 
    68  export SDL2_FLAGS=`sdl2-config --cflags --libs`
     61In most cases, you can install the sdl2 egg in the usual way:
     62
    6963 chicken-install sdl2
    7064
    71 If you do not have the {{sdl2-config}} helper program installed on your
    72 computer, you may manually specify SDL-related compiler flags (notice
    73 these are double quotes, not back ticks):
    74 
    75  export SDL2_FLAGS="-I/usr/local/include/SDL2 -L/usr/local/lib -lSDL2"
     65The installer will try to automatically determine the SDL2 compiler and linker flags
     66using the {{sdl2-config}} command.
     67
     68In special cases, you may need to set the {{SDL2_CFLAGS}} and {{SDL2_LDFLAGS}}
     69environment variables to provide the compiler and linker flags (respectively),
     70then try again. For example:
     71
     72 export SDL2_CFLAGS="-I/usr/local/include/SDL2"
     73 export SDL2_LDFLAGS="-L/usr/local/lib -lSDL2"
    7674 chicken-install sdl2
    7775
    78 You only need to set the SDL2_FLAGS environment variable when installing the egg,
    79 not when using it.
    80 
     76These environment variables are needed only when installing the egg itself.
     77They are not needed when compiling or running games that use the egg.
     78
     79=== Installing on macOS
     80
     81On macOS, the sdl2 egg can be compiled using either UNIX-style libraries
     82(e.g. SDL2 compiled from source or installed via Homebrew)
     83or Mac-style frameworks (e.g. downloaded from the SDL website).
     84
     85When automatically determining compiler and linker flags on macOS,
     86the installer will first check to see if {{sdl2-config}} is available.
     87If it is available, the installer will use it to determine the flags.
     88
     89If {{sdl2-config}} is not available,
     90the installer will check to see if {{SDL2.framework}} is available
     91in either the {{/Library/Frameworks}} or {{/System/Library/Frameworks}} directories.
     92If so, the installer will use the framework.
     93
     94If the framework is installed in some other directory,
     95or if you want to force using the framework even when {{sdl2-config}} is available,
     96you must set the {{SDL2_CFLAGS}} and {{SDL2_LDFLAGS}} enviroment variables
     97to tell the compiler where to find the framework:
     98
     99 export SDL2_CFLAGS="-F/path/to/your/frameworks"
     100 export SDL2_LDFLAGS="-F/path/to/your/frameworks -framework SDL2"
     101 chicken-install sdl2
    81102
    82103== Usage and Examples
     
    86107
    87108<enscript highlight="scheme">
    88 (use (prefix sdl2 sdl2:))
     109;; Works in both CHICKEN 4 and CHICKEN 5.
     110(cond-expand
     111 (chicken-4 (use (prefix sdl2 "sdl2:")))
     112 (chicken-5 (import (prefix sdl2 "sdl2:"))))
     113
    89114(sdl2:set-main-ready!)
    90115(sdl2:init! '(video))
     
    118143
    119144<enscript highlight="scheme">
    120 (use (prefix sdl2 sdl2:))
     145(cond-expand
     146 (chicken-4 (use (prefix sdl2 "sdl2:")))
     147 (chicken-5 (import (prefix sdl2 "sdl2:"))))
    121148
    122149;; Initialize SDL
     
    50475074==== Version Feature Identifiers
    50485075
    5049 In '''sdl2 egg version 0.2.0 and higher''', the egg automatically registers feature identifiers
     5076In '''sdl2 egg version 0.2.0 and higher''', the egg registers feature identifiers
    50505077which can be used to detect the versions of the sdl2 egg and SDL at compile time or run time,
    5051 for example using the {{cond-expand}} macro, {{#+foo}} syntax, or the {{feature?}} procedure.
     5078using the {{cond-expand}} macro, {{#+foo}} syntax, or the {{feature?}} procedure.
    50525079
    50535080Some or all of the following feature identifiers will be registered depending on the circumstances:
     
    50675094  <tr>
    50685095  <tr>
     5096    <td>sdl2-0.3.0+</td>
     5097    <td>... 0.3.0 or higher</td>
     5098  <tr>
     5099  <tr>
    50695100    <td>libSDL-2.0.0+</td>
    50705101    <td>The sdl2 egg was compiled with SDL 2.0.0 or higher</td>
     
    50935124
    50945125<enscript highlight="scheme">
    5095 (use (prefix sdl2 sdl2:))
     5126(cond-expand
     5127 (chicken-4 (use (prefix sdl2 "sdl2:"))
     5128            (use-for-syntax sdl2))
     5129 (chicken-5 (import (prefix sdl2 "sdl2:"))
     5130            (import-for-syntax sdl2)))
    50965131
    50975132;; Compile time check using #+foo reader syntax:
     
    51565191
    51575192<enscript highlight="scheme">
    5158 (use (prefix sdl2 sdl2:))
     5193(cond-expand
     5194 (chicken-4 (use (prefix sdl2 "sdl2:")))
     5195 (chicken-5 (import (prefix sdl2 "sdl2:"))))
    51595196
    51605197#+(not sdl2-0.2.0+)
Note: See TracChangeset for help on using the changeset viewer.