1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
SDL Graphics Extension (SGE)
====================================================================================
http://www.etek.chalmers.se/~e8cal1/sge/index.html
http://home.swipnet.se/cal_home/sge/index.html
Author: Anders Lindstrm - email: cal@swipnet.se
1. Intro
2. Requirements
3. Compiling
4. Makefile options
4.1 Using pure C with SGE
4.2 FreeType
4.3 The SDL_Img library
4.4 C++ classes
4.5 The QUIET option
5. Cross compiling SGE to W32
6. Compiling SGE under W32 with MS VisC/C++
7. Thanks
8. Misc.
====================================================================================
1. Intro
SGE is an add-on graphics library for the Simple Direct Media Layer. SGE provides
pixel operations, graphics primitives, TrueType rendering, rotation/scaling and much
more.
This is free software (LGPL), read LICENSE for details.
SGE has the following parts:
[sge_surface] Pixel operations, blitting and some pallete stuff.
[sge_primitives] Drawing primitives.
[sge_tt_text] TrueType font support.
[sge_bm_text] Bitmapfont and SFont support.
[sge_textpp] Classes for handling and rendering text.
[sge_shape] Classes for blitting and sprites.
[sge_collision] Basic collision detection.
[sge_rotation] Rotation and scaling of surfaces.
[sge_blib] Normal, filled, gourand shaded and texture mapped triangles.
[sge_misc] Random number and delay functions.
Read docs/index.html for API documentation.
Always check WhatsNew for important (API) changes!
There is a "Beginners guide to SGE" in the html documentation about how to compile and
use SGE in your own project, please read it if you're new to Unix/Linux development.
Read INSTALL for quick compile and install instructions.
====================================================================================
2. Requirements
-GNU Make.
-SDL 1.2+.
-An ANSI/ISO C++ compiler. SGE should conform to ANSI/ISO C++.
-Optional:
-FreeType 2+
-SDL_Image (see 4.3)
-Some SDL knowledge.
First you need SDL (http://www.libsdl.org/) and the FreeType (2.x) library
at http://www.freetype.org/ (you only need the FreeType library if you want
to use SGE's truetype font routines, see below). The FreeType library is
included in most Linux distributions (RPM users: install the freetype dev rpm
package from the install cd).
After installing SDL and FreeType, don't forget to check that the dynamic
linker can find them (check /etc/ld.so.conf and run ldconfig).
You must also have a good C++ compiler (should be able to handle templates). Recent
versions of GNU c++ works fine. SGE will use gcc/g++ as default, but this can be
changed in the file "Makefile.conf".
====================================================================================
3. Compiling
Before compiling you might want to change some Makefile.conf options, see below.
Just do 'make install' to compile and install SGE. This will install SGE to the same
place as SDL. You can change the install location by editing the PREFIX line in
the file "Makefile.conf".
If you just want to test the examples (and not install anything) you can just do
'make'. This will build a static version of SGE (libSGE.a).
If you want a dynamic version of SGE (libSGE.so) but don't want the makefile to
install SGE, do 'make shared'.
To build the examples, goto the directory examples/ and do 'make'.
See the file INSTALL for more information. You can also read the file
"docs/guide.html"
====================================================================================
4. Makefile options
Edit Makefile.conf to turn on/off these options.
4.1 Using pure C with SGE
If you plan to use SGE with a pure C project you can try to edit Makefile.conf and
uncomment the line 'C_ONLY = y'. This will force the compiler to export all
references to the linker as C functions. If you do, you will be able to link SGE to C
code, BUT you will not be able to use any of the overloaded functions (only the Uint32
color version of the overloaded functions will be available) or C++ classes.
4.2 FreeType
If you don't need the TT font routines or just don't want do depend on FreeType,
uncomment 'NOTTF = y' in Makefile.conf.
4.3 The SDL_Image library
If you have installed the SDL_Image library
(http://www.libsdl.org/projects/SDL_image/index.html) you can uncomment the
'USE_IMG = y' build option in Makefile.conf. This enables SGE to load png images and
to use Karl Bartel's very nice SFont bitmapfonts (http://www.linux-games.com/sfont/).
If you build a static version (libSGE.a) of SGE you MUST link your code with SDL_Img
(-lSDL_image), if you're using the shared version (libSGE.so) this is done by the
dynamic linker at runtime.
4.4 C++ classes
SGE have some C++ classes ([sge_shape & sge_textpp]), but if you dislike/hate/don't
understand/have problems with classes or the STL you can disable them by setting
NO_CLASSES = y in Makefile.conf.
4.5 The QUIET option
Set QUIET = y if you don't want the makefile to output any SGE specific messages.
====================================================================================
5. Cross compiling SGE to W32
SGE can be compiled by a win32 crosscompiler. You need a crosscompiled version of
SDL and FreeType. Check SDL's documentation (README.Win32) on how to get and setup
a cross-compiler.
A crosscompiler and a precompiled version of the FreeType library can be found on
http://www.libsdl.org/Xmingw32/index.html. This crosscompiler seems to need the
flag '-lstdc++' when linking C++ code; edit Makefile.conf and change the SGE_LIBS
line to read 'SGE_LIBS =$(shell sdl-config --libs) -lstdc++'. This crosscompiler
also uses the new MS C-Run-time library "msvcrt.dll", you can get it from
www.microsoft.com/downloads (do a keyword search for "libraries update") if you
don't already have it.
If you want to build a dll ('cross-make dll' or 'dll-strip') then you might want to
do 'ln -s ../../bin/i386-mingw32msvc-dllwrap dllwrap' in
/usr/local/cross-tools/i386-mingw32msvc/bin.
====================================================================================
6. Compiling SGE under W32 with MS VisC/C++
Should work. Check the download page on SGEs homepage for project files (these are
untested by me and are often outdated but may be of some help).
====================================================================================
7. Thanks.
Thanks goes to...
-Sam Lantinga for the excellent SDL library.
-The FreeType library developers.
-John Garrison for the PowerPak library.
-Karl Bartel for the SFont library (http://www.linux-games.com/).
-Garrett Banuk for his bitmap font routines (http://www.mongeese.org/SDL_Console/).
-Seung Chan Lim (limsc@maya.com or slim@djslim.com).
-Idigoras Inaki (IIdigoras@ikerlan.es).
-Andreas Schiffler (http://www.ferzkopp.net/Software/SDL_gfx-2.0/index.html).
-Nicolas Roard (http://www.twinlib.org).
and many more...
====================================================================================
8. Misc.
Read the html documentation and study the examples.
/Anders Lindstrm - email: cal@swipnet.se
|