You are on page 1of 47

1.

GMFileSystem
GMFileSystem is an extensions for GameMaker studio. It allows users to ignore the(arbitrary) sandbox
restrictions set up by yoyogames. GMFileSystem tries to look like! gamemaker"s built in functions# $s
such one of the core components is to make the functions as transparent as possible% the functions.
&his means no helpfile should be necessary# the help comes from the GM manual.
&here are some differences# some impro'ements as well as extra restrictions. &hese differences will be
discussed during this small manual. $lso some performance notes will be explained as well as an
indication of how GMFileSystem works behind the schemes. &he final parts of the manual contain a
reference list# where each function is (uickly explained (and the corresponding function inside the
manual is shown).
)pdates to the GMFileSystem extension can always be found at the GM* topic
(http+,,gmc.yoyogames.com,index.php-showtopic./01/23). GMFileSystem is licensed under the new
4S5 license% the source is a'ailable on google (http+,,gm6filesystem.googlecode.com,).
GMFileSystem consist of se'eral parts# those parts can be separated at will# as to pre'ent unnecessary
file si7e increase. *urrent the parts are as following
GMFile GMResource GMIni GMXML
Size
(Kb)
288 2/88 298 :;8
Use
s
File system functions
&ext file functions
binary file functions
Sprite management
4ackground
management
Sound management
Image sa'ing
Ini handling <ml handling
File
s
GMFile.dll GM=esource.dll
GM=esource.gml
5MIni.dll GM<M>.dll
Table of Contents
:.GMFileSystem..........................................................................................................................................:
2.Manual....................................................................................................................................................0
?.GMFile.....................................................................................................................................................1
?.:.&ext files...........................................................................................................................................1
?.2.>ocality.............................................................................................................................................3
?.?.4inary files.......................................................................................................................................3
?.9.@rror Aandling.................................................................................................................................;
?./.File System.....................................................................................................................................:8
9.GM=esource..........................................................................................................................................::
9.:.Internal beha'iour.........................................................................................................................::
9.2.>oading resources..........................................................................................................................:2
9.?.@xporting resources.......................................................................................................................:2
/.GMIni.....................................................................................................................................................:9
/.:.GM6like interface...........................................................................................................................:9
/.2.Multiple ini file interface...............................................................................................................:9
0.GM<M>..................................................................................................................................................:0
0.:.&hree datatypes.............................................................................................................................:0
0.2.>oading an xml file ........................................................................................................................:1
0.?.Iterating o'er elements.................................................................................................................:3
0.9.@lement access..............................................................................................................................:;
0./.*hanging xml tree6structure..........................................................................................................28
0.0.$ttribute access.............................................................................................................................2:
1.=eference..............................................................................................................................................22
FSBfileBtextBopenBread(fname).....................................................................................................22
FSBfileBtextBopenBwrite(fname)....................................................................................................22
FSBfileBtextBopenBappend(fname)................................................................................................22
FSBfileBtextBreadBstring(file).........................................................................................................22
FSBfileBtextBreadBchar(file# number).............................................................................................22
FSBfileBtextBreadBreal(file)............................................................................................................22
FSBfileBtextBreadln(file).................................................................................................................2?
FSBfileBtextBunread(file)................................................................................................................2?
FSBfileBtextBwriteBstring(file# string).............................................................................................2?
FSBfileBtextBwriteBreal(file# number)............................................................................................2?
FSBfileBtextBwriteln(file)................................................................................................................2?
FSBfileBtextBeof(file)......................................................................................................................2?
FSBfileBtextBfail(file).......................................................................................................................29
FSBfileBtextBbad(file)......................................................................................................................29
FSBfileBtextBgood(file)....................................................................................................................29
FSBfileBtextBsetBfail(file# fail).........................................................................................................29
FSBfileBtextBsetBfail(file# bad)........................................................................................................29
FSBfileBbinBopen(fname# mode)....................................................................................................29
FSBfileBbinBreadBbyte(file)............................................................................................................2/
FSBfileBbinBreadBword(file)...........................................................................................................2/
FSBfileBbinBreadBdword(file).........................................................................................................2/
FSBfileBbinBwriteBbyte(file# 'alue).................................................................................................2/
FSBfileBbinBwriteBword(file# 'alue)................................................................................................2/
FSBfileBbinBwriteBdword(file# 'alue).............................................................................................2/
FSBfileBbinBwriteBbyte(file# 'alue).................................................................................................20
FSBfileBbinBsi7e(file).......................................................................................................................20
FSBfileBbinBposition(file)................................................................................................................20
FSBfileBbinBseek(file# pos)..............................................................................................................20
FSBfileBbinBseek(file# offset# rel)....................................................................................................20
FSBdirectoryBexists(dir)..................................................................................................................20
FSBdirectoryBcreate(dir).................................................................................................................21
FSBdirectoryBdelete(dir).................................................................................................................21
FSBfileBexists(filename)..................................................................................................................21
FSBfileBdelete(filename).................................................................................................................21
FSBfileBrename(filename# newname)............................................................................................21
FSBfileBcopy(filename# newname).................................................................................................21
FSBfileBattributes(filename)...........................................................................................................23
FSBfileBfindBfirst(mask# attributes)................................................................................................23
FSBfileBfindBnext()..........................................................................................................................23
FSBfileBfindBclose().........................................................................................................................23
FSBmaxBopenBfile()........................................................................................................................23
FSBsetBworkingBdirectory(dir).......................................................................................................23
FSBsetBgmBsa'eBarea(dir)..............................................................................................................2;
FSBcleanBtemporary()....................................................................................................................2;
FSBgetBuni(ueBfilename(dir# ext)..................................................................................................2;
FSBspriteBadd(fname# numb# remo'eback# smooth# xorig# yorig).................................................2;
FSBspriteBreplace(ind# fname# numb# remo'eback# smooth# xorig# yorig)....................................2;
FSBbackgroundBreplace(ind# fname# remo'eback# smooth)..........................................................?8
FSBbackgroundBadd(fname# remo'eback# smooth)......................................................................?8
FSBsoundBreplace(ind# fname# kind# preload)................................................................................?8
FSBsoundBadd(fname# kind# preload)............................................................................................?8
FSBbackgroundBsa'e(ind# fname)..................................................................................................?8
FSBbackgroundBsa'eBad'(ind# fname# param)..............................................................................?:
FSBspriteBsa'e(ind# subimg# fname)...............................................................................................?:
FSBspriteBsa'eBad'(ind# subimg# fname# param)..........................................................................?:
FSBscreenBsa'e(fname)..................................................................................................................?:
FSBscreenBsa'eBad'(fname# param)..............................................................................................?:
FSBscreenBsa'eBpart(fname# x# y# w# h)..........................................................................................?2
FSBscreenBsa'eBpartBad'(fname# x# y# w# h# param)......................................................................?2
FSBsurfaceBsa'e(id# fname)............................................................................................................?2
FSBsurfaceBsa'eBad'(id# fname# param)........................................................................................?2
FSBsurfaceBsa'eBpart(id# fname# x# y# w# h)....................................................................................??
FSBsurfaceBsa'eBpartBad'(id# fname# x# y# w# h# param)...............................................................??
FSBd?dBmodelBload(ind# fname)...................................................................................................??
FSBd?dBmodelBsa'e(ind# fname)...................................................................................................??
FSBiniBopen(fname)........................................................................................................................??
FSBiniBclose()..................................................................................................................................?9
FSBiniBreadBstring(section# key# def)..............................................................................................?9
FSBiniBreadBreal(section# key# def).................................................................................................?9
FSBiniBwriteBstring(section# key# 'al).............................................................................................?9
FSBiniBwriteBreal(section# key# 'al)................................................................................................?9
FSBiniBkeyBexists(section# key).......................................................................................................?/
FSBiniBkeyBdelete(section# key).....................................................................................................?/
FSBiniBsectionBexists(section)........................................................................................................?/
FSBiniBsectionBdelete(section).......................................................................................................?/
FSBiniBopenBext(ini# fname)...........................................................................................................?/
FSBiniBcloseBext(ini).......................................................................................................................?/
FSBiniBreadBstringBext(ini# section# key# def).................................................................................?0
FSBiniBreadBrealBext(ini# section# key# def)....................................................................................?0
FSBiniBwriteBstringBext(ini# section# key# 'al).................................................................................?0
FSBiniBwriteBrealBext(ini# section# key# 'al)....................................................................................?0
FSBiniBkeyBexistsBext(ini# section# key)..........................................................................................?1
FSBiniBkeyBdeleteBext(ini# section# key).........................................................................................?1
FSBiniBsectionBexistsBext(ini# section)...........................................................................................?1
FSBiniBsectionBdeleteBext(ini# section)..........................................................................................?1
FSBxmlBopen(fname)......................................................................................................................?1
FSBxmlBopenBext(fname# whatespace).........................................................................................?3
FSBxmlBclose(xml)..........................................................................................................................?3
FSBxmlBgetBnodeBtype(xml# node)................................................................................................?3
FSBxmlBnodeBmakeBelement(xml# node)......................................................................................?3
FSBxmlBsameBnode(nodeBleft# nodeBright)..................................................................................?3
FSBxmlBrootBelement(xml)............................................................................................................?3
FSBxmlBnumBelem(xml# parentBnode)..........................................................................................?;
FSBxmlBnumBnode(xml# parentBnode)..........................................................................................?;
FSBxmlBelemBfirst(xml# parentBnode)...........................................................................................?;
FSBxmlBelemBlast(xml# parentBnode)............................................................................................?;
FSBxmlBelemBnext(xml# elem).......................................................................................................?;
FSBxmlBelemBpre'(xml# elem).......................................................................................................98
FSBxmlBnamedBelemBfirst(xml# parentBnode# name)...................................................................98
FSBxmlBnamedBelemBlast(xml# parentBnode# name)...................................................................98
FSBxmlBnamedBelemBnext(xml# elem)..........................................................................................98
FSBxmlBnamedBelemBpre'(xml# elem)..........................................................................................98
FSBxmlBnodeBfirst(xml# parentBnode)...........................................................................................9:
FSBxmlBnodeBlast(xml# parentBnode)............................................................................................9:
FSBxmlBnodeBnext(xml# node).......................................................................................................9:
FSBxmlBnodeBpre'(xml# node).......................................................................................................9:
FSBxmlBfindBelem(xml# path).........................................................................................................9:
FSBxmlBfindBelem(xml# parentBelem# path)..................................................................................92
FSBxmlBparentBelem(xml# node)...................................................................................................92
FSBxmlBgetBelemBname(xml# elem)..............................................................................................92
FSBxmlBgetBelemBdata(xml# elem)................................................................................................92
FSBxmlBgetBnodeBrawBdata(xml# node)........................................................................................92
FSBxmlBsetBelemBname(xml# elem# name)...................................................................................9?
FSBxmlBgetBelemBdata(xml# elem# 'al)..........................................................................................9?
FSBxmlBsetBnodeBrawBdata(xml# node# 'al).................................................................................9?
FSBxmlBinsertBbeginBelem(xml# parentBelem# name# 'alue)........................................................9?
FSBxmlBinsertBendBelem(xml# parentBelem# name# 'alue)...........................................................9?
FSBxmlBinsertBelem(xml# parentBelem# afterBnode# name# 'alue)...............................................99
FSBxmlBinsertBbeginBnode(xml# parentBelem# type# 'alue).........................................................99
FSBxmlBinsertBendBnode(xml# parentBelem# type# 'alue)............................................................99
FSBxmlBinsertBelem(xml# parentBelem# afterBnode# type# 'alue).................................................99
FSBxmlBdeleteBnode(xml# parentBelem# node).............................................................................9/
FSBxmlBdeleteBnode(xml# parentBnode).......................................................................................9/
FSBxmlBnumBattributes(xml# elem)...............................................................................................9/
FSBxmlBgetBattribute(xml# elem# name)........................................................................................9/
FSBxmlBsetBattribute(xml# elem# name# 'alue)..............................................................................9/
FSBxmlBdeleteBattribute(xml# elem# name)...................................................................................90
FSBxmlBattributeBfirst(xml# parentBelem).....................................................................................90
FSBxmlBattributeBlast(xml# parentBelem)......................................................................................90
FSBxmlBattributeBnext(xml# attribute)...........................................................................................90
FSBxmlBattributeBpre'(xml# attribute)...........................................................................................90
FSBxmlBattributeBgetBname(xml# attribute)..................................................................................91
FSBxmlBattributeBgetB'alue(xml# attribute)..................................................................................91
2. Manual
5uring this chapter the different parts of GMFileSystem will be discussed. @ach part has its own files C
can be completely separated from the other parts C the extension without making those other parts
no longer work. &o remo'e a part simply delete all files that belong to the part from the extension in
the resource tree (generally all files belonging to the same part ha'e the same name# Dust different
extensions).
*urrently the parts implemented are as following+
GMFile GMResource GMIni GMXML
Size
(Kb)
288 2/88 298 :;8
Uses File system functions
&ext file functions
binary file functions
Sprite management
4ackground
management
Sound management
Image sa'ing
Ini handling <ml handling
Files GMFile.dll GM=esource.dll
GM=esource.gml
5MIni.dll GM<M>.dll
@ach function starts with the prefix FSB!# and most functions ha'e names e(ual to gamemaker"s
e(ui'alent. &he biggest difference is that these functions work not like the sandboxed 'ersions# they
work more straightforward (as the GM3.x C earlier 'ersions). &he functions often re(uire a string as
filename# in this string you can use the general en'ironment 'ariables E like in windows. (F$GG5$&$F#
FG=HG=$M5$&$F# F&MGF etc) E or things like F)S@=G=HFI>@FIdocuments! get the my
documents! folder in windows 'ista.
. GMFile
Si7e+ 288Jb
Files+ GMFile.dll
GMFile handles all basic file management functions. &ext file functions (reading writing)# binary file
functions (with some extra strength)# and generic filesystem functions (copying files# deleting,creating
directories C files).
First the text file functions will be handled# followed by the binary functions% after that some
information will be gi'en on error handling (as this is the same for both text C binary files). Finally the
functions of filesystem will be shortly discussed
.1. !e"t #iles
Function Description
File = FS_file_text_open_read(fname)
Opens file for reading
FS_file_text_read_string(file)
Reads contents of current line as string
FS_file_text_read_char(file, number)
Reads a number of characters
FS_file_text_read_real(file)
Reads a number from file
FS_file_text_unread(file)
Unreads a character.
FS_file_text_readln(file)
Goes to the next line
File = FS_file_text_open_append(fname)
Opens the file for writing at the end
File = FS_file_text_open_write(fname)
Opens the file for writing
FS_file_text_write_string(file, string)
Writes a string to the file
FS_file_text_write_read(file, number)
Writes a number to a file
FS_file_text_writeln(file)
Writes a newline
FS_write_flush(file)
Flushes the buffer to the hard drive
FS_set_locality(localstring)
Sets locality
>ocality for text files is handled correctly. (possix file systems will ha'e a >K byte at the ends of a line#
windows based ha'e *=L>K). Further locality regarding numeric 'alues will be handled in the next
paragraph.
&he text files act almost exactly as GameMaker"s built in functions# in the part reference > File
Handling > Files. Mhen reading a numeric 'alue from a file the parser will skip leading spaces# and
ends the moment a number is no longer a number. &his allows you to ha'e multiple numbers
separated by spaces on a line.
&he function FS_file_write_flush() is added+ to allow you to force writing of the buffer to the hard
dri'e. $nother extra function is FS_file_text_read_char(). &his function reads a gi'en number of
characters E or until an end of line character is found. Finally the function FS_text_unread() is added.
&his function allows you to unread! characters+ so to mo'e back in the file.
.2. Locality
Function Description
FS_set_locality(localstring)
Sets locality
Mhen the program starts the locality is set to t$e current system locality (c$an%e& #rom 1..'). &his is
different from the standard! c6locality# though more in line with GM C other office programs. &he
function gi'en abo'e allows you to change the locality manually during program execution.
&here some 'alue for localstring that work
:) pro'iding an empty string sets locality to the system locality
2) pro'iding *! sets the locality to original c6style
?) Hn windows (when the 5>> is compiled with NS) there are a lot of locality strings. &hese ha'e
the form >anguageB*ountry.*odeGage. (I@+ GermanBGermany.:2/2# or @nglishB)nited
States.:2/2). $ll 'alues can be found at
http+,,www.mydigitallife.info,ansi6code6page6for6windows6system6locale6with6identifier6
constants6and6strings,
&he function returns whether the locale set was successful# in effect whether the locale is installed on
the user"s G*. (*! and ! should always work).
.. (inary #iles
Function Description
File=FS_file_bin_open(fname, mode)
Opens a file for writing or reading
FS_file_bin_read_byte(file)
Reads a byte from the file
FS_file_bin_read_word(file)
Reads a short ! bytes" from the file
FS_file_bin_read_dword(file)
Reads a long # bytes" from the file
FS_file_bin_write_byte(file, value)
Writes a byte to the file
FS_file_bin_write_word(file, value)
Write a short ! bytes" to the file
FS_file_bin_write_dword(file, value)
Writes a long # bytes" to the file
FS_file_bin_size(file)
Returns the si$e of the file
FS_file_bin_position(file)
Returns the current position
FS_bin_see(file, pos)
Sets the position
FS_bin_see_relative(file, offset, rel)
Sets the position relative to the target
&he binary files work exactly the same as the build in binary functions reference > File Handling >
Binary Files. &here are some extra features added to the binary functions to impro'e usage of binary
files.
First of are the impro'ement in binary file reading C writing.
FS_file_bin_read_word, FS_file_bin_write_word &hese 2 functions allow one to read,write a 26
byte6'alue at once. (So instead of a 'alue between 862//# the 'alue can be between 860/#/?/). &he
format in which the bytes are stored is depending on the system used to read,write the bytes. (>ittle
endian on intel pcs# big endian on other systems). $s such you should take a lot of care when writing a
file in 6say6 mac osx and reading it in windows.
FS_file_bin_read_dword, FS_file_bin_write_dword Similar to abo'e# but instead thse write a 96byte6
'alue at once. (So instead of a 'alue between 862//# the 'alue can be between 869#2;9#;01#2;/ ).
&he other impro'ement is the function FS_bin_seek_relative &his function allows more control o'er
setting the position. &he ?
rd
argument describes from what position the offset is calculated# it can ha'e
? 'alues+
8 6 relati'e to the beginning of the file (default operation# like in gamemaker)
: 6 relati'e to the end of the file
2 6 relati'e to the current position
.). *rror +an&lin%
File functions can easily gi'e errors. &he error handling is the same for both text as well as binary files.
Mhere gamemaker only allows one to check if reading a file has reached the end6of6file#
GMFileSystem allows for a lot more control. &hey do use the _text_ part instead of _bin_ because
GM"s also does.
Function Description
FS_file_text_eof(file)
Whether reading has reach the end of file
FS_file_text_fail(file)
Failbit has been set
FS_file_text_bad(file)
%adbit has been set
FS_file_text_good(file)
Whether any of previous & bits has been set
FS_file_text_set_fail(file, fail)
Sets the failbit to 'fail(
FS_fail_text_set_bad(file, bad)
Sets the failbit to 'bad(
FS_file_text_eof() &his is an actual GM function# though it is also part of the group to handle
exceptions. =eturns true if filereading has reached end of file.
FS_file_text_fail() Means an exception happened. Aas three prime causes+ when opening a file this
exception happens if the file can"t be opened (isn"t there# something locked it out etc). Mhen reading
data it can happen if trying to read past end of file. $nd finally it can happen if you try to write bad
formatted data to a file.
FS_file_text_bad() Means the file has crashed. Main cause of this is when the file can"t be written to
anymore while it was opened. (I@ storage medium got remo'ed).
FS_file_text_good() Means non of the abo'e states is set.
Hnly when good() returns true the functions actually work# otherwise they are simply ignored and a
default 'alue is returned. In case you wish to continue after the file6reading crashed (ie% you know the
storage medium got reconnected) you can set the fail and bad bits to true!
.,. File System
File system part handles all file management tasks. &he filesystem is almost a direct copy of the
functions inside reference > File Handling > File System though some extra function from the main part
(reference > File Handling)# mainly the directory! functions.
Function Description
FS_directory_exists(dir)
)ests if dir exists
FS_directory_create(dir)
*reates directory and parent directories"
FS_directory_delete(dir)
+eletes directory and all files,subdirectories
FS_file_exists(fname)
)ests if fname exists
FS_file_delete(fname)
+eletes file fname
FS_file_rename(fname, newname)
Renames fname to newname
FS_file_copy(fname, newname)
*opies fname to newname
FS_file_attributes(fname)
Returns attributes of fname
FS_file_find_first(mas, attributes)
Finds first file that satisfies mas- .attributes
FS_file_find_next()
Finds next file that satisfies mas- . attributes
FS_file_find_close()
Frees file find memory
FS_max_open_file()
Returns maximum open files
&hese functions mostly work exactly the alike to the built in functions. Mith three notable exceptions%
file_rename() can be used to mo'e files to another directory E simply pro'iding a different directory
will do this. (Kotice that for newname you will ha'e to pro'ide a full path).
FS_file_attributes will po'ide many more attributes than those specified by gamemaker. (&hough
testing if a certain exists using FS_file_attributes("file") & fa_readonly fa_readonly works.
&he full attribute list can be found at MS5K (
:
). $lso note that (like in gamemaker) for GHSSI<
filesystems only the fa_directory works.
FSBmaxBopenBfile returns the maximum number of simultaneously opened files. Mindows uses a ;6
bit number for this so the maximum open files is /:2!. Hn possix systems this is limited to the
internal format (?2 bit or 09 bit)# or the a'ailable memory.
1 File attribute list: http://msdn.microsoft.com/en-us/library/windows/desktop/gg25811!28"#"s.85!2$.asp%
). GMResource
Si7e+ 2/88 Jb
Files+ GM=esource.dll
GM=esource.gml
GM=esource handles input C output of gamemaker# it basically allows users to load (and sa'e)
external resources from anywhere on the disk. ($nd in the future from memory! might become
possible too). 5uring this chapter first a short explanation of the internal works will be made# after
which the actual loading will be described.
).1. Internal be$a-iour
&he basic structure uses almost always the same 'ery simple steps+
(File is con'erted) O copied to workingBdirectory O using GM"s functions to import
Pou will notice that this part uses 2 files# the copying and con'ersion are done by the dll# while the
importing is done by a GM6script.
Kow I said copying!# but this isn"t always the correct term# as disk writing is often a factor of low
importance. &o understand this more we separate two cases+
.$en t$e #ile $as correct #ormat an& can be im/orte&
Mhen the file already has a correct format we don"t ha'e to do any internal work# the file will be
pro'ided to GM as6is!. &o speed this up# the file will not be copied# instead a hard6link will be created
(hard link is similar to a shortcut with a few differences# like the file will only be deleted from a hard
dri'e when the last hard link to it is remo'ed). Gro'iding a hard link is 'ery fast# and the whole
operation takes (on my core 2 duo# /9888 =GM dri'e) only around / micro seconds to complete. &his
speed is independent of the si7e of the file. Hnly in obscure cases the file has to be copied (like when
there exist already :82? hard links to the file).
.$en #ile $as to be con-erte& to correct #ormat
Mhen file con'ersion has to be done# this is the main limiting factor. *on'ersion is done by the
open*N library. &he complete process of con'erting C sa'ing a file this way depends a lot on the si7e
of an image# but for a large image (:238 Q 388 pixels) it takes around :88 micro seconds to complete.
Generic functions
$s the copying is 'ery fast# the decision was made to not delete the temporary file each time# rather
the files will be deleted when gamemaker normally closes. 6 Hr if you wish you could force a delete of
temporary files at any moment. $lso you ha'e some control o'er where the temporary files are stored
Function Description
FS_set_woring_directory(dir)
Sets the temporary directory
FS_clean_temporary()
*leans temporary files
FS_set_gm_save_area(dir)
Sets the G/ save area.
FS_get_uni!ue_filename(dir, ext)
Gets a randomly0based uni1ue filename
&he working directory is normally somewhere in the temporary directories. Pou can set it to any
directory from 0$ere %m can rea&. 4eware of the bug currently haunting backgroundBadd() though
2
.
&he gm6sa'e6area is a special directory that you ha'e to manually identify# it is always Flocalappdata
FIRPH)=G$M@K$M@O. It is explained more thoroughly below.
).2. Loa&in% resources
&he resource loading is mostly transparent# and copies gamemaker. Kotice howe'er that the
soundBadd function only works with legacy sound systems. Mith the new audio there is no way to
load external files. &here are basically three sets of 2 functions for this+
Function Description
FS_sprite_add(fname, imgnumb, removebac,
smooth, xorig, yorig)
2dds an image from a file
FS_bacground_add(fname, removebac, smooth)
2dds a bac-ground from a file
FS_sound_add(fname, ind, preload)
2dds a sound from a file
FS_sprite_replace(ind, fname, imgnumb,
removebac, smooth, xorig, yorig)
Replaces sprite ind with image from a file
FS_bacground_replace(ind, fname,
removebac, smooth)
Replaces bac-ground ind with image from a
file
FS_sound_add(ind, fname, ind, preload)
Replaces sound ind with image from a file
&he file formats supported are+
images+ portable network graphics, bitmaps, jpeg files, jpeg 2000, portable image format, sn rasters
! tiff files
sounds+ mp"
).. *"/ortin% resources
@xporting resources is a bit a strange child# it is impossible to make it completely transparent. &his is
because there is no way to programmatic get the location where the items are stored by gamemaker
(see this
?
bug report). &o get around this limitation in gamemaker you (as programmer) ha'e to
manually gi'e this folder to GMFileSystem. >uckily this folder is always at a similar location#
2 &an't load background from !localappdata!/(gamename) http://bugs.yoyogames.com/"iew.php*id#$+1,
, &an't get gamename programmatically: http://bugs.yoyogames.com/"iew.php*id#$+5$
F>H*$>$GG5$&$FIRG$M@O. So in the case of a game called testBgame! you would call
FS_set_gm_save_area("!locala""data!#test_game") before any exporting operations.
Functions Description
FS_bacground_save(ind, fname) Saves bac-ground
FS_bacground_save_adv(ind, fname, param) Saves bac-ground with parameter
FS_screen_save(fname) Saves a screenshot
FS_screen_save_adv(fname, param) Saves a screenshot with parameter
FS_screen_save_part(fname, x, y, w, h) Saves a part of the screen
FS_screen_save_part_adv(fname, x, y, w, h,
param) Saves a part of the screen with parameter
FS_sprite_save(ind, subimg fname) Saves a sprite
FS_sprite_save_adv(ind, subimg, fname,
param) Saves a sprite with parameter
FS_sprite_save_strip(ind, fname) Saves a sprite as strip
FS_sprite_save_strip_adv(ind, fname,
param) Saves a sprite as strip with parameter
FS_surface_save(id, fname) Saves a surface
FS_surface_save_adv(id, fname, param) Saves a surface with parameter
FS_surface_save_part(id, fname, x, y, w,
h) Saves a part of a surface
FS_surface_save_part_adv(id, fname, x, y,
w, h, param) Saves a part of a surface with parameter
First of all# notice that each function comes in two fla'ours# one with and one without the extra _adv
extension. &he ad'anced sa'ing options ha'e an extra parameter that is used to define the storage
manner for the compressed images. For a GKG this 'alue describes simply the compression le'el# the
'alue can be between 86; where ;! is slower but also better compressed. (5efault would be ?). For
Dpeg this describes the (uality le'el# this 'alue can be between 86:88# where :88 would be best
(uality E but highest filesi7e (default is ;/).
$nother thing to notice is the huge bugs currently in GameMakerStudio (:.:.13/). (
9
) &his pre'ents
background sa'ing to work with large images. (unless those resources are created from a
screen,surface). In the future added sprite,backgrounds will work# howe'er the build in won"t E to use
them you will ha'e to make a duplicate (spriteBduplicate()).
- .on't sa"e large background images http://bugs.yoyogames.com/"iew.php*id#$15
,. GMIni
Ini files are a method to store options. &he ini specification is 'ery simple# and hence easy to use for
small amounts of data. Gamemaker (e'en pre'ious 'ersion) has only allowed users to open ini files in
specific locations (program directory in GM 3.x and earlier# aplication data in gm studio)% and on top of
that only a single ini file can be opened at once. GMIni tries to lift those problems# while keeping
compatibility should this be wanted. $ll ini functions hence ha'e two 'ersion# a normal 'ersion that
beha'es exactly as GM"s ini functions. $nd a function with the affix Bext E these also take an ini6file6
index. $nd beha'e as text files (with ini functions).
,.1. GM1li2e inter#ace
Functions Description
FS_ini_open(fname) Opens the ini file
FS_ini_close() *loses the opened ini file.
FS_ini_read_string(section, ey, def) Read a string from the section3 -ey
FS_ini_read_real(section, ey, def) Read a numeric from the section3 -ey
FS_ini_write_string(section, ey, val) Sets the section3 -ey to the given value
FS_ini_write_real(section, ey, val) Sets the section3 -ey to the given value
FS_ini_ey_exists(section, ey) Whether the given -ey exists
FS_ini_section_exists(section) Whether the given section exists
FS_ini_ey_delete(section, ey) +eletes the given -ey
FS_ini_section_delete(section) +eletes the given section and all -eys"
&he most simplistic interface is gained when using the normal 'ersion of each function. Mhen using
these# the functions copy GM"s beha'iour exactly (apart from being able to read,write outside gm"s
default directories). &hey do howe'er limit you to : open ini file at once.
,.2. Multi/le ini #ile inter#ace
Functions Description
FS_ini_open_ext(fname) Opens the ini file
FS_ini_close_ext(ini) *loses the given ini file.
FS_ini_read_string_ext(ini, section, ey, def) Read a string from the section3 -ey
FS_ini_read_real_ext(ini, section, ey, def) Read a numeric from the section3 -ey
FS_ini_write_string_ext(ini, section, ey, val) Sets the section3 -ey to the given value
FS_ini_write_real_ext(ini, section, ey, val) Sets the section3 -ey to the given value
FS_ini_ey_exists_ext(ini, section, ey) Whether the given -ey exists
FS_ini_section_exists_ext(ini, section) Whether the given section exists
FS_ini_ey_delete_ext(ini, section, ey) +eletes the given -ey
FS_ini_section_delete_ext(ini, section) +eletes the given section and all -eys"
&he extended interface is also relati'elly easy to use. $ll functions do correspond gm"s functionality#
howe'er this ini6interface also allows you as user to open multiple ini files at once. &o do this the
open6function (FS_ini_o"en_ext) returns a file6handle. &his file handle is passed to the other
functions.
3. GMXML
From 'ersion :.9 and newer a complete new feature has been added to GMFilesystem+ reading and
writing <M> files. <M> files are ideal for markup and storage of data. &he xml6part is named
GM<M>.dll!. &he core library used for GM<M> is tinyxml2# a lightweight hea'ily optimi7ed <M>
parser. &he interface and constants correspond to the interface of that library.
&he data in an xml file is written in a (5HM) tree6structure. Sust as with ini files the whole file is read t
once. (and changes are only sa'ed when you close the file). $s tree structures are alien to gamemaker
a new syntax,handling had to be written. Most functions return a pointer! (actually a pointer binary
copied into a double floating point)# where get C set functions ha'e to be used to get the exact 'alues.
3.1. !$ree &ataty/es
Functions Description
FS_xml_get_node_type(xml, node) Gets the type id of a node
FS_xml_node_mae_element(xml, node) *hanges element 'node( to element
FS_xml_same_node(node_left, node_right) Whether two handles point to the same node
GMFilesystem"s <M> functions basically work o'er ? data types!. &hese are attributes!# nodes! C
elements!. 4elow I will (uickly describe what is what and how you can know what function takes
what.
First consider the element!# an element is similar to a branch! or leaf! in <M># an element can
contain attributes# other elements or 'alues. @lements always ha'e a name. &he shortname used for
elements is elem!.
Secondly we ha'e nodes!. Kodes are a more generic concept of elements+ any element is considered
a node. Aowe'er things like the actual text under an element is also a node E as are comments. Kode
access should be considered closer to the metal than using element6based functions. Aowe'er in
some cases (example below) this is necessary. &he type of node can be re(uested# and a node can 6if
the type is correct6 be con'erted to an element. &he follow types are possible+
4alue 5escri/tion 4alue is
"#$#%_&'()*(
6 6
"#$#%_+,$+
=aw text data &he actual text
"#$#%_,%,#,(+
*ontains sub nodes Kame of the node
"#$#%_-).&#,(+
=oot of the <M> file (not root node) Kame of the file
"#$#%_-,.%/0/+1)(
Meta data
"#$#%_.)##,(+
*omment *omment text
Finally there are attributes. $ttributes are rather simple+ as they are exactly the same as attributes
standard in xml files. In GM<M> they are often abbre'iated to attr!. $ttributes ha'e a name and a
'alue# and for each element the name of an attribute is always uni(ue.
&o summari7e# consider the following snippet from an xml file
$u%normal text here
$b%this is bold text$&b%
'his text is hidden when using element(based functions
$&u%
&he main element root! has as data text! 6 the data is only read read upto the first child element. It
contains : child element. )sing node access it has ? child nodes+
:) GM><M>B&@<& with 'alue normal text here !
2) GM><M>B@>@M@K& with 'alue b!
?) GM><M>B&@<& with 'alue &his text is hidden when using element6based functions!
So if an element in the xml tree can contain data L sub elements it is probably better to use the node6
functions to access these.
In GM<M> functions and arguments are always named to show what they operate o'er# by node!
elem! or attr!. Function are also clearly marked if returning an element or a node. Kotice howe'er
that the actual data returned by such a function is rather abstract+ it is a handle to the element,node.
Hther functions ha'e to be used to read this handle into actual text.
Finally there is a function to compare handles. (GM"s rounding with floating point 'alues pre'ent a
nati'e comparison) Pou can compare two nodes# elements or e'en nodes C elements to see if they
point to the same location!.
3.2. Loa&in% an "ml #ile
Functions Description
FS_xml_open(filename) Opens xml file.
FS_xml_open_ext(filename, whitespace)
Opens xml file and gives a parameter for
whitespace handling
FS_xml_close(xml) *loses and saves xml file.
Hpening a file is similar to opening text files E you gi'e the filename and it returns a handle for future
operations. Aowe'er do notice that the complete file is read C the 5HM is constructed the moment
you open a file. &he extended open function has a parameter called whitespace! 6 this determines
the manner whitespace is handled# the options are+
FS_)*+_,-++./S0_123'0S/.,0 E &his collapses multiple spaces into a single space# and remo'es all
linebreaks. 6 &his is the beha'iour you see in A&M>.
FS_)*+_/40S0450_123'0S/.,0 E &his preser'es internal whitespace and linebreaks. Aowe'er do notice
that whitespace between elements is remo'ed.
$root%hello world
$sub%
666
&he 'alue of abo'e function would be hello world! (9 spaces).
3.. Iteratin% o-er elements
Functions Description
FS_xml_root_element(xml) Gets the root element
FS_xml_num_elem(xml, parent_node) Gets number of child elements under parent
FS_xml_elem_first(xml, parent_node) Gets the first element under parent4node
FS_xml_elem_last(xml, parent_node) Gets the last element under parent4node
FS_xml_elem_next(xml, elem) Gets the next element
FS_xml_elem_prev(xml, elem) Gets the previous element
FS_xml_named_elem_first(xml,
parent_node, name)
Gets the first element with name 'name( under
parent4node
FS_xml_named_elem_last(xml,
parent_node, name)
Gets the last element with name 'name( under
parent4node
FS_xml_named_elem_next(xml, elem) Gets the next element with name 'name(
FS_xml_named_elem_prev(xml, elem) Gets the previous element
FS_xml_num_node(xml, parent_node) Gets number of child nodes under parent
FS_xml_node_first(xml, parent_node) Gets the first node under parent4node
FS_xml_node_last(xml, parent_node) Gets the last node under parent4node
FS_xml_node_next(xml, node) Gets the next node
FS_xml_node_prev(xml, node) Gets the previous node
FS_xml_find_elem(xml, pathstring) Finds an element based on a string0path
FS_xml_find_elem_under(xml, elem,
pathstring
Finds an element under the given element with the
specified path
FS_xml_parent_elem(xml, node) Gets the parent element of the given node
Iterating o'er elements works similar to maps. Mith the main difference that the function do not
return a workable! 'alue (key)# but instead return a handle,id for the element. (Mhich can be
compared for e(uality# or used to get the name,'alue). &he iterating functions also need to know the
parent function.
If you know the name of an child element you can also iterate o'er only the elements with this name
(and if the name is uni(ue# getting the first element with this name ob'iously also gets &A@ element
with the name). &he BnodeB functions work o'er the nodes! where the BelemB functions only iterate
the elements under a certain node. $n example code to read and display below xml file+
$student%
$name%/aul$&name%
$id%7889:;$&id%
$study%.0$&study%
$&student%
var root_element FS_xml_root_element(xml)
var cur_elem FS_xml_child_elem_first(xml, root_elem)<
var num FS_xml_num_child_elem(xml, root_elem)
for (var num FS_xml_num_child_elem(xml, root_elem)< num % 8< ((n) =
var name FS_xml_get_elem_name(xml, cur_elem)<
var value FS_xml_get_elem_data(xml, cur_elem)<
var str ">ode name? " @ name<
if (value A "") =
str @ "B>ode value? " @ value<
C
show_message(str)<

cur_elem FS_xml_child_elem_next(xml, cur_elem)
C
$ complete different manner to get an element is using the FS_xml_child_find_elem(xml,
"athstring) functions. &hese pro'ide a shortway to get uni(ue elements if you know the path. &he
function takes a pathstring# which are the childs separated by dots. to get the name from abo'e
example one would do
FS_xml_child_find_elem(xml, Dstudent6nameE). &he second 'ersion allows a user to pro'ide the root
element where the path starts.
3.). *lement access
Functions Description
FS_xml_get_node_type(xml, node) Gets the type of a node
FS_xml_get_elem_name(xml, elem) Gets the name of an element
FS_xml_get_elem_data(xml, elem) Gets the string data of an element
FS_xml_get_node_raw_data(xml, node)
Gets data of a node3 actual data depends on node
type.
FS_xml_set_elem_name(xml, elem, name) Sets the name of an element
FS_xml_set_elem_data(xml, elem, val) Sets the string data of an element
FS_xml_set_node_raw_data(xml, node, val)
Sets value of a node3 What value actually
represents depends on node type.
FS_xml_get_attribute(xml, elem, name) Gets the attribute of element with the given name
FS_xml_set_attribute(xml, elem, name,
value) Sets,2dds the attribute under element
FS_xml_delete_attribute(xml, elem, name) +eletes the attribute with the given name
Hnce you ha'e an element (or node) handle you can get data from this element using abo'e
functions. &he first function is explained in chapter 0.:. &he second function gets the name of the xml6
tag# and the third function the 'alue it contains. Mhen using nodes# the 9
th
function can be used to
(uickly get the data stored at the node. Mhat the data represents depends on the node type as
following
4alue 4alue is
"#$#%_&'()*(
6
"#$#%_+,$+
&he actual text stored at the node
"#$#%_,%,#,(+
Kame of the node
"#$#%_-).&#,(+
Kame of the xml6file
"#$#%_-,.%/0/+1)(
"#$#%_.)##,(+
*omment text
&he BsetB functions can be used to change this data. Finally the attribute functions can be used to
ha'e a map6like interface to attributes. Setting a non6existing attribute adds it# while an exesiting
attribute will get changed.
3.,. 6$an%in% "ml tree1structure
Functions Description
FS_xml_insert_begin_elem(xml,
parent_elem, name, value) 5nserts a new element at the start under parent4element
FS_xml_insert_end_elem(xml,
parent_elem, name, value) 5nserts a new element at the end under parent4element
FS_xml_insert_elem(xml, parent_elem,
after_node, name, value)
5nserts a new element after the given node under
parent4element
FS_xml_insert_begin_node(xml,
parent_elem, type, value) 5nserts a new node at the start under parent4element
FS_xml_insert_end_node(xml,
parent_elem, type, value) 5nserts a new node at the end under parent4element
FS_xml_insert_node(xml, parent_elem,
after_node, type, value)
5nserts a new node after the given node under
parent4element
FS_xml_delete_node(xml, parent, node) +eletes the given node under parent
FS_xml_clear(xml, parent_node) *lears all subnodes and value etc" from parent4node
$bo'e functions are useful for updating the xml6tree structure. Pou can add child6elements easily# by
gi'ing the name of the element and the 'alue# there are con'enience functions to add elements at the
start# end or after a specific other element.
$lso you can add raw nodes# where the interpretation of the 'alue! (and what actually gets added to
the tree) depends on the gi'en type E see chapter 0.:.
5eleting is e'en more easy# and you can use the same function to both delete elements or nodes. $ll
subnodes will get deleted when you delete the parent. &here is also a con'enience function to delete
all childs at once E notice that this deletes all child KH5@S# so the 'alue (text node) also gets cleared.
3.3. 7ttribute access
Functions Description
FS_xml_get_attribute(xml, elem, name) Gets the attribute of element with the given name
FS_xml_set_attribute(xml, elem,
name, value) Sets,2dds the attribute under element
FS_xml_delete_attribute(xml, elem, name) +eletes the attribute with the given name
FS_xml_num_attributes(xml, elem,) Gets number of attributes for element
FS_xml_attribute_first(xml, elem) Gets handle to first attribute
FS_xml_attribute_last(xml, elem) Gets handle to last attribute
FS_xml_attribute_next(xml, attr) Gets handle to next attribute
FS_xml_attribute_prev(xml, attr) Gets handle to previous attribute
FS_xml_attribute_get_name(xml, attr) Gets name of the given attribute handle
FS_xml_attribute_get_value(xml, attr) Gets value of the given attribute handle
&he first three functions gi'e a con'enience named interface to the attributes. Pou simply gi'e the
name and the attribute handle is found in the function itself. &he latter function re(uire (or return) an
attribute handle used in other functions.
8. Re#erence
FS_file_text_open_read(fname)
Hpens file for reading
!y/e 5escri/tion
Return real File in&e"
7r%uments
fname strin% #ilename
FS_file_text_open_write(fname)
Hpens file for writing
!y/e 5escri/tion
Return real File in&e"
7r%uments
fname strin% #ilename
FS_file_text_open_append(fname)
Hpens file for appending data at end
!y/e 5escri/tion
Return real File in&e"
7r%uments
fname strin% #ilename
FS_file_text_read_string(file)
=eads a string
!y/e 5escri/tion
Return strin% line
7r%uments
file real #ile in&e"
FS_file_text_read_char(file, number)
=eads a number of characters on the current line
!y/e 5escri/tion
Return strin% line
7r%uments
file real #ile in&e"
number real number o# c$aracter to rea&
FS_file_text_read_real(file)
=eads a number
!y/e 5escri/tion
Return real number
7r%uments
file real file index
FS_file_text_readln(file)
=eads to next line
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
FS_file_text_unread(file)
)nreads a character
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
FS_file_text_write_string(file, string)
Mrites a string
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
strin% strin% line to 0rite
FS_file_text_write_real(file, number)
Mrites a numeric 'alue
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
number number number to write
FS_file_text_writeln(file)
Mrites a newline character
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
FS_file_text_eof(file)
Mhether file reached end6of6file
!y/e 5escri/tion
Return bool eo# bit
7r%uments
file real #ile in&e"
FS_file_text_fail(file)
Mhether file has failed
!y/e 5escri/tion
Return bool #ail bit
7r%uments
file real #ile in&e"
FS_file_text_bad(file)
Mhether file has crashed
!y/e 5escri/tion
Return bool ba& bit
7r%uments
file real #ile in&e"
FS_file_text_good(file)
Mhether file can be read
!y/e 5escri/tion
Return bool 9(eo# : ba& : #ail)
7r%uments
file real #ile in&e"
FS_file_text_set_fail(file, fail)
Sets the failbit
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
#ail bool #ailbit
FS_file_text_set_fail(file, bad)
Sets the badbit
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
#ail bool ba&bit
FS_file_bin_open(fname, mode)
Hpens binary file
!y/e 5escri/tion
Return real File in&e"
7r%uments
fname strin% #ilename
mo&e real mo&us (rea&; '< 0rite; 1< bot$; 2)
FS_file_bin_read_byte(file)
=eads a byte
!y/e 5escri/tion
Return real byte1-alue
7r%uments
file real #ile in&e"
FS_file_bin_read_word(file)
=eads a word
!y/e 5escri/tion
Return real 0or&1-alue
7r%uments
file real #ile in&e"
FS_file_bin_read_dword(file)
=eads a dword
!y/e 5escri/tion
Return real &0or&1-alue
7r%uments
file real #ile in&e"
FS_file_bin_write_byte(file, value)
Mrites a byte
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
-alue real byte1-alue
FS_file_bin_write_word(file, value)
Mrites a word
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
-alue real 0or&1-alue
FS_file_bin_write_dword(file, value)
Mrites a dword
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
-alue real &0or&1-alue
FS_file_bin_write_byte(file, value)
Mrites a byte
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
-alue real byte1-alue
FS_file_bin_size(file)
File si7e
!y/e 5escri/tion
Return real #ile size
7r%uments
file real #ile in&e"
FS_file_bin_position(file)
Get current position
!y/e 5escri/tion
Return real /osition
7r%uments
file real #ile in&e"
FS_file_bin_see(file, pos)
Sets the position
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
/os real /osition
FS_file_bin_see(file, offset, rel)
Sets the position relati'e to target
!y/e 5escri/tion
Return -oi&
7r%uments
file real #ile in&e"
o##set real o##set #rom tar%et
rel real tar%et (be%innin%; '< en&; 1< current;2)
FS_directory_exists(dir)
&ests if dir exists
!y/e 5escri/tion
Return bool i# &ir e"ists
7r%uments
dir strin% &irectory
FS_directory_create(dir)
*reates directory dir
!y/e 5escri/tion
Return -oi&
7r%uments
dir strin% &irectory
FS_directory_delete(dir)
deletes directory dir
!y/e 5escri/tion
Return -oi&
7r%uments
dir strin% &irectory
FS_file_exists(filename)
&ests if filename exists
!y/e 5escri/tion
Return bool i# filename e"ists
7r%uments
filename strin% #ile /at$
FS_file_delete(filename)
deletes file filename
!y/e 5escri/tion
Return -oi&
7r%uments
filename strin% #ile /at$
FS_file_rename(filename, newname)
renames file filename to newname
!y/e 5escri/tion
Return -oi&
7r%uments
filename strin% #ile /at$
ne0name strin% ne0 #ile /at$
FS_file_copy(filename, newname)
copies file filename to newname
!y/e 5escri/tion
Return -oi&
7r%uments
filename strin% #ile /at$
ne0name strin% ne0 #ile /at$
FS_file_attributes(filename)
=eturns attributes associated with filename
!y/e 5escri/tion
Return real attributes
7r%uments
filename strin% #ile /at$
FS_file_find_first(mas, attributes)
=eturns first file associated with mask C attributes
!y/e 5escri/tion
Return strin% #ilename
7r%uments
mask strin% #ile mas2
attributes real attribute mas2
FS_file_find_next()
=eturns next file after fsBfileBfindBfirst()
!y/e 5escri/tion
Return strin% #ilename
7r%uments
FS_file_find_close()
Frees memory from fileBfind
!y/e 5escri/tion
Return -oi&
7r%uments
FS_max_open_file()
=eturns maximum opened files by dll
!y/e 5escri/tion
Return real number o# #iles
7r%uments
FS_set_woring_directory(dir)
Sets directory where to store temporary files
!y/e 5escri/tion
Return -oi&
7r%uments
&ir strin% &irectory
FS_set_gm_save_area(dir)
Gi'e GameMaker"s sa'e area
!y/e 5escri/tion
Return -oi&
7r%uments
dir string directory
FS_clean_temporary()
*leans temporary files
!y/e 5escri/tion
Return -oi&
7r%uments
FS_get_uni!ue_filename(dir, ext)
Gets random uni(ue filename in dir with extension ext
!y/e 5escri/tion
Return strin% #ilename
7r%uments
dir string directory
ext string extension of file
FS_sprite_add(fname, numb, removebac, smooth, xorig, yorig)
add sprite from image file
!y/e 5escri/tion
Return real s/it in&e"
7r%uments
fname string filename
numb real number of sub images
remo'eback bool whether to remo'e the background
smooth bool whether to smooth the edges
xorig real xposition of the origin
yorig real yposition of the origin
FS_sprite_replace(ind, fname, numb, removebac, smooth, xorig, yorig)
=eplaces sprite ind with image from fname
!y/e 5escri/tion
Return -oi&
7r%uments
ind real sprite index
fname string filename
numb real number of sub images
remo'eback bool whether to remo'e the background
smooth bool whether to smooth the edges
xorig real xposition of the origin
yorig real yposition of the origin
FS_bacground_replace(ind, fname, removebac, smooth)
=eplaces background ind with image from fname
!y/e 5escri/tion
Return -oi&
7r%uments
ind real background index
fname string filename
remo'eback bool whether to remo'e the background
smooth bool whether to smooth the edges
FS_bacground_add(fname, removebac, smooth)
$dds background from file fname
!y/e 5escri/tion
Return real bac2%roun& in&e"
7r%uments
fname string filename
remo'eback bool whether to remo'e the background
smooth bool whether to smooth the edges
FS_sound_replace(ind, fname, ind, preload)
=eplaces sound ind with sound from fname
!y/e 5escri/tion
Return -oi&
7r%uments
ind real sound index
fname string filename
kind real type of sound
preload bool whether to load sound directly in memory
FS_sound_add(fname, ind, preload)
$dd sound with sound from fname
!y/e 5escri/tion
Return real soun& in&e"
7r%uments
fname string filename
kind real type of sound
preload bool whether to load sound directly in memory
FS_bacground_save(ind, fname)
Sa'es background
!y/e 5escri/tion
Return -oi&
7r%uments
ind real background index
fname string filename
FS_bacground_save_adv(ind, fname, param)
Sa'es background
!y/e 5escri/tion
Return -oi&
7r%uments
ind real background index
fname string filename
param real compression parameters
FS_sprite_save(ind, subimg, fname)
Sa'es sprite
!y/e 5escri/tion
Return -oi&
7r%uments
ind real sprite index
subimg real image index
fname string filename
FS_sprite_save_adv(ind, subimg, fname, param)
Sa'es sprite
!y/e 5escri/tion
Return -oi&
7r%uments
ind real sprite index
subimg real image index
fname string filename
param real compression parameters
FS_screen_save(fname)
Sa'es part of surface
!y/e 5escri/tion
Return -oi&
7r%uments
fname string filename
FS_screen_save_adv(fname, param)
Sa'es part of surface
!y/e 5escri/tion
Return -oi&
7r%uments
fname string filename
param real compression parameters
FS_screen_save_part(fname, x, y, w, h)
Sa'es part of surface
!y/e 5escri/tion
Return -oi&
7r%uments
fname string filename
x real x position
y real y position
w real width
h real height
FS_screen_save_part_adv(fname, x, y, w, h, param)
Sa'es part of surface
!y/e 5escri/tion
Return -oi&
7r%uments
fname string filename
x real x position
y real y position
w real width
h real height
param real compression parameters
FS_surface_save(id, fname)
Sa'es part of surface
!y/e 5escri/tion
Return -oi&
7r%uments
id real surface index
fname string filename
FS_surface_save_adv(id, fname, param)
Sa'es part of surface
!y/e 5escri/tion
Return -oi&
7r%uments
id real surface index
fname string filename
param real compression parameters
FS_surface_save_part(id, fname, x, y, w, h)
Sa'es part of surface
!y/e 5escri/tion
Return -oi&
7r%uments
id real surface index
fname string filename
x real x position
y real y position
w real width
h real height
FS_surface_save_part_adv(id, fname, x, y, w, h, param)
Sa'es part of surface
!y/e 5escri/tion
Return -oi&
7r%uments
id real surface index
fname string filename
x real x position
y real y position
w real width
h real height
param real compression parameters
FS_d2d_model_load(ind, fname)
>oads model into index
!y/e 5escri/tion
Return -oi&
7r%uments
ind real model index
fname string filename
FS_d2d_model_save(ind, fname)
Sa'es model
!y/e 5escri/tion
Return -oi&
7r%uments
id real surface index
fname string filename
FS_ini_open(fname)
Hpens ini file
!y/e 5escri/tion
Return -oi&
7r%uments
fname string filename
FS_ini_close()
*loses ini file
!y/e 5escri/tion
Return -oi&
7r%uments
FS_ini_read_string(section, ey, def)
=eads a string from ini file
!y/e 5escri/tion
Return strin% returns t$e -alue or &e#
7r%uments
section string section
key string key
def string default 'alue
FS_ini_read_real(section, ey, def)
=ead real from ini file
!y/e 5escri/tion
Return real returns t$e -alue or &e#
7r%uments
section string section
key string key
def real default 'alue
FS_ini_write_string(section, ey, val)
Mrites a string to ini file
!y/e 5escri/tion
Return -oi&
7r%uments
section string section
key string key
def string default 'alue
FS_ini_write_real(section, ey, val)
Mrites real to ini file
!y/e 5escri/tion
Return -oi&
7r%uments
section string section
key string key
'al real 'alue
FS_ini_ey_exists(section, ey)
Mhether key exists in ini
!y/e 5escri/tion
Return real 0$et$er t$e 2ey e"ists
7r%uments
section string section
key string key
FS_ini_ey_delete(section, ey)
5eletes the gi'en key from the ini
!y/e 5escri/tion
Return -oi&
7r%uments
section string section
key string key
FS_ini_section_exists(section)
Mhether key exists in ini
!y/e 5escri/tion
Return real 0$et$er t$e section e"ists
7r%uments
section string section
FS_ini_section_delete(section)
5eletes the gi'en key from the ini
!y/e 5escri/tion
Return -oi&
7r%uments
section string section
FS_ini_open_ext(ini, fname)
Hpens ini file with extended options (multiple files can be opened at once)
!y/e 5escri/tion
Return real ini1#ile $an&le
7r%uments
fname string filename
FS_ini_close_ext(ini)
*loses ini file
!y/e 5escri/tion
Return -oi&
7r%uments
ini real ini $an&le
FS_ini_read_string_ext(ini, section, ey, def)
=eads a string from ini file
!y/e 5escri/tion
Return strin% returns t$e -alue or &e#
7r%uments
ini real ini handle
section string section
key string key
def string default 'alue
FS_ini_read_real_ext(ini, section, ey, def)
=ead real from ini file
!y/e 5escri/tion
Return real returns t$e -alue or &e#
7r%uments
ini real ini handle
section string section
key string key
def real default 'alue
FS_ini_write_string_ext(ini, section, ey, val)
Mrites a string to ini file
!y/e 5escri/tion
Return -oi&
7r%uments
ini real ini handle
section string section
key string key
def string default 'alue
FS_ini_write_real_ext(ini, section, ey, val)
Mrites real to ini file
!y/e 5escri/tion
Return -oi&
7r%uments
ini real ini handle
section string section
key string key
'al real 'alue
FS_ini_ey_exists_ext(ini, section, ey)
Mhether key exists in ini
!y/e 5escri/tion
Return real 0$et$er t$e 2ey e"ists
7r%uments
ini real ini handle
section string section
key string key
FS_ini_ey_delete_ext(ini, section, ey)
5eletes the gi'en key from the ini
!y/e 5escri/tion
Return -oi&
7r%uments
ini real ini handle
section string section
key string key
FS_ini_section_exists_ext(ini, section)
Mhether key exists in ini
!y/e 5escri/tion
Return real 0$et$er t$e section e"ists
7r%uments
ini real ini handle
section string section
FS_ini_section_delete_ext(ini, section)
5eletes the gi'en key from the ini
!y/e 5escri/tion
Return -oi&
7r%uments
ini real ini handle
section string section
FS_xml_open(fname)
Hpens xml file
!y/e 5escri/tion
Return -oi& "ml #ile in&e"
7r%uments
fname string filename
FS_xml_open_ext(fname, whatespace)
Hpens xml file with specified whitespace handling
!y/e 5escri/tion
Return real "ml #ile in&e"
7r%uments
fname string filename
whitespace real whitespace handling
FS_xml_close(xml)
*loses xml file
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
FS_xml_get_node_type(xml, node)
Gets the type of the gi'en node
!y/e 5escri/tion
Return real ty/e
7r%uments
xml real xml file
node real node handle
FS_xml_node_mae_element(xml, node)
*on'erts node to element
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
node real node handle
FS_xml_same_node(node_left, node_right)
&ests node or element handles
!y/e 5escri/tion
Return real 0$et$er le#t = ri%$t /oint to same no&e
7r%uments
nodeBright real node handle
nodeBleft real node handle
FS_xml_root_element(xml)
=eturns topmost element in xml file
!y/e 5escri/tion
Return real $an&le to to/most element
7r%uments
xml real xml file
FS_xml_num_elem(xml, parent_node)
=eturns number of child elements
!y/e 5escri/tion
Return real number o# c$il& elements
7r%uments
xml real xml file
parentBnode real node handle
FS_xml_num_node(xml, parent_node)
=eturns number of child nodes
!y/e 5escri/tion
Return real number o# c$il& no&es
7r%uments
xml real xml file
parentBnode real node handle
FS_xml_elem_first(xml, parent_node)
=eturns first child element
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
parentBnode real node handle
FS_xml_elem_last(xml, parent_node)
=eturns last child element
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
parentBnode real node handle
FS_xml_elem_next(xml, elem)
=eturns next element
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
elem real element handle
FS_xml_elem_prev(xml, elem)
=eturns pre'ious element
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
elem real element handle
FS_xml_named_elem_first(xml, parent_node, name)
=eturns first child element
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
parentBnode real node handle
name string element name
FS_xml_named_elem_last(xml, parent_node, name)
=eturns last child element with the gi'en name
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
parentBnode real node handle
name string element name
FS_xml_named_elem_next(xml, elem)
=eturns next element with the same name
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
elem real element handle
FS_xml_named_elem_prev(xml, elem)
=eturns pre'ious element with the same name
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
elem real element handle
FS_xml_node_first(xml, parent_node)
=eturns first child node
!y/e 5escri/tion
Return real no&e $an&le
7r%uments
xml real xml file
parentBnode real node handle
FS_xml_node_last(xml, parent_node)
=eturns last child node
!y/e 5escri/tion
Return real no&e $an&le
7r%uments
xml real xml file
parentBnode real node handle
FS_xml_node_next(xml, node)
=eturns next node
!y/e 5escri/tion
Return real no&e $an&le
7r%uments
xml real xml file
elem real node handle
FS_xml_node_prev(xml, node)
=eturns pre'ious node
!y/e 5escri/tion
Return real no&e $an&le
7r%uments
xml real xml file
node real node handle
FS_xml_find_elem(xml, path)
Finds the element at position path
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
path strin path where to look
FS_xml_find_elem(xml, parent_elem, path)
Finds the element at position path
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
parentBelem real element handle
path string path where to look
FS_xml_parent_elem(xml, node)
=eturns parent element
!y/e 5escri/tion
Return real element $an&le
7r%uments
xml real xml file
node real node handle
FS_xml_get_elem_name(xml, elem)
Gets the name of the gi'en element
!y/e 5escri/tion
Return strin% element name
7r%uments
xml real xml file
elem real element handle
FS_xml_get_elem_data(xml, elem)
Gets the data of the gi'en element
!y/e 5escri/tion
Return strin% element &ata
7r%uments
xml real xml file
elem real element handle
FS_xml_get_node_raw_data(xml, node)
Gets the 'alue of the gi'en node E interpretation depends on node type
!y/e 5escri/tion
Return strin% no&e -alue
7r%uments
xml real xml file
elem real node handle
FS_xml_set_elem_name(xml, elem, name)
Sets the name of the gi'en element
!y/e 5escri/tion
Return strin% element name
7r%uments
xml real xml file
elem real element handle
name string new element name
FS_xml_get_elem_data(xml, elem, val)
Sets the data of the gi'en element
!y/e 5escri/tion
Return strin% element &ata
7r%uments
xml real xml file
elem real element handle
'al string new element 'alue
FS_xml_set_node_raw_data(xml, node, val)
Sets the 'alue of the gi'en node E interpretation depends on node type
!y/e 5escri/tion
Return strin% no&e -alue
7r%uments
xml real xml file
node real node handle
'al string new node 'alue
FS_xml_insert_begin_elem(xml, parent_elem, name, value)
Inserts a new element at the begin under the gi'en parent
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
parentBelem real element handle
name string new element name
'al string new element 'alue
FS_xml_insert_end_elem(xml, parent_elem, name, value)
Inserts a new element at the end under the gi'en parent
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
parentBelem real element handle
name string new element name
'al string new element 'alue
FS_xml_insert_elem(xml, parent_elem, after_node, name, value)
Inserts a new element after the gi'en node# under the gi'en parent
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
parentBelem real element handle
afterBnode real node handle
name string new element name
'al string new element 'alue
FS_xml_insert_begin_node(xml, parent_elem, type, value)
Inserts a new node at the begin under the gi'en parent
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
parentBelem real element handle
type real new node type
'al string new node 'alue
FS_xml_insert_end_node(xml, parent_elem, type, value)
Inserts a new node at the end under the gi'en parent
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
parentBelem real element handle
type real new node type
'al string new node 'alue
FS_xml_insert_elem(xml, parent_elem, after_node, type, value)
Inserts a new node after the gi'en node# under the gi'en parent
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
parentBelem real element handle
afterBnode real node handle
type real new node type
'al string new node 'alue
FS_xml_delete_node(xml, parent_elem, node)
5eletes gi'en node (and all child nodes)
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
parentBelem real element handle
node real node handle
FS_xml_delete_node(xml, parent_node)
*lear all child nodes
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
parentBelem real node handle
FS_xml_num_attributes(xml, elem)
Gets number of attributes of an element
!y/e 5escri/tion
Return strin% attribute -alue
7r%uments
xml real xml file
elem real element handle
FS_xml_get_attribute(xml, elem, name)
Gets attribute 'alue of attribute with gi'en name
!y/e 5escri/tion
Return strin% attribute -alue
7r%uments
xml real xml file
elem real element handle
name string attribute name
FS_xml_set_attribute(xml, elem, name, value)
Sets,$dds attribute with the gi'en name to the gi'en 'alue
!y/e 5escri/tion
Return -oi&
7r%uments
xml real xml file
elem real element handle
name string attribute name
'alue string attribute 'alue
FS_xml_delete_attribute(xml, elem, name)
5eletes attribute with gi'en name
!y/e 5escri/tion
Return strin% attribute -alue
7r%uments
xml real xml file
elem real element handle
name string attribute name
FS_xml_attribute_first(xml, parent_elem)
=eturns first attribute
!y/e 5escri/tion
Return real attribute $an&le
7r%uments
xml real xml file
parentBelem real element handle
FS_xml_attribute_last(xml, parent_elem)
=eturns last attribute
!y/e 5escri/tion
Return real attribute $an&le
7r%uments
xml real xml file
parentBelem real element handle
FS_xml_attribute_next(xml, attribute)
=eturns next attribute
!y/e 5escri/tion
Return real attribute $an&le
7r%uments
xml real xml file
attribute real attribute handle
FS_xml_attribute_prev(xml, attribute)
=eturns pre'ious attribute
!y/e 5escri/tion
Return real attribute $an&le
7r%uments
xml real xml file
attribute real attribute handle
FS_xml_attribute_get_name(xml, attribute)
=eturns name of attribute
!y/e 5escri/tion
Return strin% attribute name
7r%uments
xml real xml file
attribute real attribute handle
FS_xml_attribute_get_value(xml, attribute)
=eturns 'alue of attribute
!y/e 5escri/tion
Return strin% attribute -alue
7r%uments
xml real xml file
attribute real attribute handle

You might also like