SFML community forums
General => SFML wiki => Topic started by: FRex on April 09, 2013, 06:56:56 am
-
I've added example code of sf::InputStream that uses PhysicsFS (http://icculus.org/physfs/) to load from disc or some archive(it's all transparent and abstracted away by physics).
Can someone please double check formatting and that I didn't break the main Sources page or something?
https://github.com/SFML/SFML/wiki/Sources
https://github.com/SFML/SFML/wiki/Source%3A-PhysicsFS-Input-Stream
This will be helpful next time someone molests Laurent about SFML needing a filesystem.. :P
-
Looking all good.
-
To be extremely picky, I would add open/close functions to the stream class, rather than giving it directly a PHYSFS_FILE*. This way it is perfectly encapsulated, and has the same interface as other file streams (like std::ifstream).
-
To be extremely picky
>:( ;D
Done, hope I didn't introduce a mistake now..
-
Looks good, but open should return a boolean ;)
-
Nice! :)
I always wanted to look into that, but never got around to do it.
-
Looks good, but open should return a boolean ;)
>:( ;D Done too. Really, it's just to show that it's possible and easy not to be best designed API ever.
-
The code is so small, there's no reason to have it badly designed ;)
-
Sorry for this useless post, but: lol
-
Sorry for this useless post, but: lol
LoL. ;D ;D
The code is so small, there's no reason to have it badly designed ;)
void main(){}
Thanks for re-edit, whoever did it. My style of coding isn't very friendly. ;D
Turns out we forgot to null out file handle when we close so it didn't really look like it closed(we held invalid pointer). ;D Fixed.
-
I've updated it a tiny bit, added C++ to ``` to make code colored, split it into hpp and cpp, added sf::NonCopyable as a base to make it more secure, etc.
-
Decent, need to accomplish something like this with mine.