Add F2 shortcut to take screenshots. Closes GH-119#127
Conversation
|
Works on the web version, but it opens a new window - can the app instead cause a file download, as to not interrupt gameplay? https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a documents the |
|
Now for native support. Could change to render to a texture, but as seen in #89 many platforms don't support drawBuffers() (hmm, but that's on the web, mobile?). http://stackoverflow.com/questions/5844858/how-to-take-screenshot-in-opengl suggests using |
|
miniz's png writer produces .. what looks like a png file: native-build $ file screenshot-netcraft.png
screenshot-netcraft.png: PNG image data, 2048 x 0, 8-bit/color RGBA, non-interlacedbut its 555 KB and I can't render it: pngcrush tells what is wrong: libpng warning: Image height is zero in IHDR
While converting NetCraft/native-build/screenshot-netcraft.png to /tmp/foo:
pngcrush caught libpng error:
Invalid IHDR data
Critical chunk length, method 151 (ws 0 fm 0 zl 0 zs 0) = 0
CPU time decoding 0.000, encoding 0.000, other 0.002, total 0.002 seconds
pngcheck is more specific - somehow it is 2048x0?!: native-build $ pngcheck screenshot-netcraft.png
screenshot-netcraft.png invalid IHDR image dimensions (2048x0)
ERROR: screenshot-netcraft.pngsupposed to be 2048x1536, that's Oh this was already fixed upstream in miniz: https://github.com/richgel999/miniz/pull/65/files - it was a bug in miniz 2.0.5 beta. |
|
Now only needs to have the filename timestamped on native (preferably, share date function from native and web, but if not no big deal), then this is ready to merge. |
* Add F2 to take screenshots. Closes GH-119 * Download named file screenshot.png by clicking <a download> link * Add timestamp to screenshot filenames * Native screenshots: glReadPixels() + miniz png writer * Apply fix from miniz for png header height richgel999/miniz@7ecd1b3 * Fix flipped image in native screenshots png * Use ISO-8601 timestamps for screenshots * Refactor screenshot() into util.c



#119