Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Physics Filesystem  (Read 4446 times)

0 Members and 1 Guest are viewing this topic.

FRex

  • Hero Member
  • *****
  • Posts: 1842
    • View Profile
    • My GitHub Page
    • Email
Physics Filesystem
« on: April 09, 2013, 06:56:56 am »
I've added example code of sf::InputStream that uses PhysicsFS 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
ZipSavings, script to count rar/7z/zip savings: https://goo.gl/vvBj5M
LuaConsole: https://goo.gl/X4kRUk
FoxRaycaster: https://goo.gl/27nVS8
Small Games - Heart, Routing and Snek: https://goo.gl/15ZGWE https://goo.gl/k5gwWD https://goo.gl/4nKPnT
Botes - a notes app in Pascal: https://goo.gl/bzTqsi

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1491
    • View Profile
    • Tank's Blog
    • Email
Re: Physics Filesystem
« Reply #1 on: April 09, 2013, 08:08:47 am »
Looking all good.
SFGUI: Simple and Fast GUI library for SFML
Game Development Design articles
IRC: #sfml @ irc.boxbox.org

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32123
    • View Profile
    • SFML's website
    • Email
Re: Physics Filesystem
« Reply #2 on: April 09, 2013, 08:14:55 am »
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).
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1842
    • View Profile
    • My GitHub Page
    • Email
Re: Physics Filesystem
« Reply #3 on: April 09, 2013, 09:05:58 am »
Quote
To be extremely picky
>:( ;D
Done, hope I didn't introduce a mistake now..
ZipSavings, script to count rar/7z/zip savings: https://goo.gl/vvBj5M
LuaConsole: https://goo.gl/X4kRUk
FoxRaycaster: https://goo.gl/27nVS8
Small Games - Heart, Routing and Snek: https://goo.gl/15ZGWE https://goo.gl/k5gwWD https://goo.gl/4nKPnT
Botes - a notes app in Pascal: https://goo.gl/bzTqsi

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32123
    • View Profile
    • SFML's website
    • Email
Re: Physics Filesystem
« Reply #4 on: April 09, 2013, 09:19:03 am »
Looks good, but open should return a boolean ;)
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9300
    • View Profile
    • development blog
    • Email
Re: Physics Filesystem
« Reply #5 on: April 09, 2013, 09:26:12 am »
Nice! :)
I always wanted to look into that, but never got around to do it.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

FRex

  • Hero Member
  • *****
  • Posts: 1842
    • View Profile
    • My GitHub Page
    • Email
Re: Physics Filesystem
« Reply #6 on: April 09, 2013, 11:02:51 am »
Quote
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.
ZipSavings, script to count rar/7z/zip savings: https://goo.gl/vvBj5M
LuaConsole: https://goo.gl/X4kRUk
FoxRaycaster: https://goo.gl/27nVS8
Small Games - Heart, Routing and Snek: https://goo.gl/15ZGWE https://goo.gl/k5gwWD https://goo.gl/4nKPnT
Botes - a notes app in Pascal: https://goo.gl/bzTqsi

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32123
    • View Profile
    • SFML's website
    • Email
Re: Physics Filesystem
« Reply #7 on: April 09, 2013, 11:07:39 am »
The code is so small, there's no reason to have it badly designed ;)
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1491
    • View Profile
    • Tank's Blog
    • Email
Re: Physics Filesystem
« Reply #8 on: April 09, 2013, 03:54:06 pm »
Sorry for this useless post, but: lol
SFGUI: Simple and Fast GUI library for SFML
Game Development Design articles
IRC: #sfml @ irc.boxbox.org

FRex

  • Hero Member
  • *****
  • Posts: 1842
    • View Profile
    • My GitHub Page
    • Email
Re: Physics Filesystem
« Reply #9 on: April 09, 2013, 09:10:09 pm »
Quote
Sorry for this useless post, but: lol
LoL. ;D ;D
Quote
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.
« Last Edit: April 11, 2013, 06:57:47 pm by FRex »
ZipSavings, script to count rar/7z/zip savings: https://goo.gl/vvBj5M
LuaConsole: https://goo.gl/X4kRUk
FoxRaycaster: https://goo.gl/27nVS8
Small Games - Heart, Routing and Snek: https://goo.gl/15ZGWE https://goo.gl/k5gwWD https://goo.gl/4nKPnT
Botes - a notes app in Pascal: https://goo.gl/bzTqsi

FRex

  • Hero Member
  • *****
  • Posts: 1842
    • View Profile
    • My GitHub Page
    • Email
Re: Physics Filesystem
« Reply #10 on: February 06, 2018, 02:07:32 pm »
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.
ZipSavings, script to count rar/7z/zip savings: https://goo.gl/vvBj5M
LuaConsole: https://goo.gl/X4kRUk
FoxRaycaster: https://goo.gl/27nVS8
Small Games - Heart, Routing and Snek: https://goo.gl/15ZGWE https://goo.gl/k5gwWD https://goo.gl/4nKPnT
Botes - a notes app in Pascal: https://goo.gl/bzTqsi

GRAHAMO

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Physics Filesystem
« Reply #11 on: July 31, 2019, 02:51:13 pm »
Decent, need to accomplish something like this with mine.