1 #LyX 1.4.3 created this file. For more info see http://www.lyx.org/
10 \paperfontsize default
17 \paperorientation portrait
20 \paragraph_separation indent
22 \quotes_language english
25 \paperpagestyle default
26 \tracking_changes false
44 \begin_layout Standard
45 \begin_inset LatexCommand \tableofcontents{}
53 Introduction to LuaGame
56 \begin_layout Subsection
60 \begin_layout Standard
61 LuaGame is a tool for rapid game development.
62 It is similar in scope to GameMaker, except that it is multiplatform, free,
67 \begin_layout Subsection
68 Who Should Use LuaGame
71 \begin_layout Standard
72 LuaGame has been designed for use in situations where rapid or simplified
73 development of games is neccesary.
74 That is, it's inappropriate for use by professional developers.
75 However, it is perfect for use by amateurs looking for an easy to use engine
76 that offers more control than GameMaker, is free, and will run on many
78 It has been designed to be good for events known as
79 \begin_inset Quotes eld
83 \begin_inset Quotes erd
86 : short, spontaneous game development contests where ease of use of the
87 development tool is very important.
94 \begin_layout Subsection
98 \begin_layout Standard
99 LuaGame is a C++ container to Lua that acts as a very high-level interface
100 to the SDL libraries.
104 \begin_layout Standard
105 The only required file, besides the base classes and the LuaGame executable
107 \begin_inset Quotes eld
111 \begin_inset Quotes erd
115 This file is automatically run after the base classes are initialized.
116 After the execution of this file ends, control passes back to the C++ layer,
117 cleanup is performed, and execution ends.
120 \begin_layout Subsection
124 \begin_layout Standard
125 The only required code is a loop that will end when the game is supposed
127 In this loop, the entire game will run.
128 Input should be checked, entities should be updated and drawn, and the
130 The code should also do some sort of FPS management.
131 In the end, it should looks something like this:
135 done = false --controls the loop
139 while done ~= true do
168 \begin_layout Section
172 \begin_layout Standard
173 This reference details the Lua functions.
174 The formatting is thus: <return type> <function name>(<arguments>).
175 The return type is actually rather important as in many cases it is tied
176 directly to a C/C++ type and not obeying this typing can cause some serious
178 All filenames should be realtive to the LuaGame executable directory.
181 \begin_layout Subsection
185 \begin_layout Subsubsection
186 image get_image(string filename)
189 \begin_layout Standard
190 If an image is already loaded, then it returns the pointer to the image
191 surface, otherwise it loads it and returns the pointer.
194 \begin_layout Subsubsection
195 void release_image(string filename)
198 \begin_layout Standard
199 If the image has already been loaded, it will be unloaded from memory.
200 Otherwise, nothing will happen.
203 \begin_layout Subsubsection
207 \begin_layout Standard
208 This causes the entire screen to be updated (redrawn).
211 \begin_layout Subsubsection
212 void blit(image i, int x, int y)
215 \begin_layout Standard
216 This will blit the image i to the screen at coordinates (x, y).
217 Blits do not show up until the screen is updated.
220 \begin_layout Subsubsection
221 void blit_frame(image i, int x, int y, int frame)
224 \begin_layout Standard
225 Blits the corresponding frame of the animation contained as a horizontal
226 image strip in image i.
227 Please take note that the numbering for frames starts at zero.
228 That is, the first frame is zero, the last is the number of frames minus
232 \begin_layout Subsubsection
233 void show_cursor(boolean b)
236 \begin_layout Standard
237 If true then the mouse cursor is visible, if false then it is not.
240 \begin_layout Subsubsection
241 void fill_screen(int red, int green, int blue)
244 \begin_layout Standard
245 Fills the entire screen with the color specified by RGB components.
248 \begin_layout Subsubsection
249 image rotzoom(image i, double angle, double zoom)
252 \begin_layout Standard
253 This returns an image that has been rotated by the angle amount and zoomed
257 \begin_layout Subsection
261 \begin_layout Subsubsection
262 void play_sample(string filename)
265 \begin_layout Standard
267 This should never be used to play music because it loads the entire file
268 into memory and leaves it there so that playing it the second time is much
272 \begin_layout Subsubsection
273 void play_music(string filename, int loop)
276 \begin_layout Standard
278 Loop is the number of times to loop.
279 -1 means loop forever, otherwise it will loop that many times.
280 If music is already playing then it will be unloaded and the new music
284 \begin_layout Subsubsection
288 \begin_layout Standard
289 Stops any currently playing music.
292 \begin_layout Subsection
296 \begin_layout Subsubsection
297 font load_font(string filename, int size)
300 \begin_layout Standard
302 Filename is the path to the font file, and size is the size (in pixels)
303 that the font should be.
306 \begin_layout Subsubsection
307 void unload_font(font f)
310 \begin_layout Standard
311 Unloads a loaded font f and releases any resources related to it.
314 \begin_layout Subsubsection
315 int w, int h rendered_string_size(font f, string s)
318 \begin_layout Standard
319 Returns two integers w and h that are the width and height of the string
320 s in the currently loaded font f (the size it would be if rendered).
323 \begin_layout Subsubsection
324 image, int w, int h render_string(font f, string s, int r, int g, int b)
327 \begin_layout Standard
328 Renders the string s in font f in color RGB(int r, int g, int b) and returns
329 the surface containing it and the width w and height h.