SFML community forums
Help => General => Topic started by: GabrielS on September 25, 2013, 09:00:09 pm
-
Hello,
Currently developing a game in SFML where levels are saved as XML file, I would like to add to my GUI a button that displays a window to let the user choose the file level.xml he wants to chose.
Is it possible to do so ? Like letting the user browse a repertory to select the level he wants to load.
Please let me know if you have any idea on how to implement this properly ;)
Thanks !
-
Of course it's possible, but implementation wise there are thousand of different ways.
First you'll have to decide where to locate the xml files, simplest way would be to have one directory with all the files.
Next you'll have to decide how to grab the files. If you want to list all the files in the directory, you'll most likely have a look at boost::filesystem, otherwise you could just load an text file where you'd list all the existing xml files.
For the UI you can use rectangles and/or sprites, to create something nice looking. Keep in mind though, UI programming is quite difficult. ;)
-
It's entirely possible but outside the scope of SFML. If you want a button and a file open dialog without doing all the implementation/learning the system calls yourself, you'll need a GUI library.
-
It's outside of the scope of SFML but there are other 3rd party libraries you can integrate to create this functionality. For the GUI side you may want to look into SFGUI (http://sfgui.sfml-dev.de/). For file system exploration and the like, boost::filesystem (http://www.boost.org/doc/libs/1_54_0/libs/filesystem/doc/index.htm) is a good bet.
-
Ok great thanks for your ideas, that helps =)
I am currently looking on boost::filesystem !
Thanks ! ;)