SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.63k stars 1.11k forks source link

Screenshot storage and numbering #45

Closed TheJJ closed 9 years ago

TheJJ commented 9 years ago

Currently, each screenshot is put to /tmp/openage_00.png. This should be updated to ~/.openage/screenshots/openage_xxxx.png, where xxxx is incremented automatically (start counting at 0!).

For debugging purposes, the game version described in #27 should be included on the screenshots when it's not disabled by the user.

franciscod commented 9 years ago

Hello! A little progress here: https://github.com/franciscod/openage/commit/6b5ab1dc6b03e7c17c5099f8ebd7cb96f03b04d8

As far as I could tell, there is currently no way of saving to a file in the codebase. So, for now the numbering restarts on each run.

Also, when should we create the ~/.openage and ~/.openage/screenshot directories? Should the engine create them as needed on each screenshot, or fail silently?

edit: maybe a ScreenshotManager is too much? :stuck_out_tongue_closed_eyes:

a few screenshots

TheJJ commented 9 years ago

I lol'd at the screenshot :smile:

I'd say a screenshot manager is just fine! Next idea: You could check what files are there and chose the next free filename, when having many screenshots, this may fail though. Better idea: Store the screenshot with the timestamp in the filename, openage_2014-10-30_14:18:20_xx.png. As people can take n screenshots per second, we still need a counter :wink:, but the number of existence checks should probably fall down to 0.

Don't worry about ~/.openage yet, some other subsystem will create it sooner or later, especially when #28 is finished.

franciscod commented 9 years ago

lol, lord gaben is praised :sun_with_face:

Yeah, I thought about the timestamp in the filename since that's what scrot and minecraft do, but since you stated _xxxx I went on that idea.

Should I also move the screenshot taking code (the SDL masking/copying and finally saving the PNG) to the ScreenshotManager?

TheJJ commented 9 years ago

Yeah, will be a lot more modular that way.

franciscod commented 9 years ago

code moved: https://github.com/franciscod/openage/compare/screenshot