Giter Site home page Giter Site logo

Take Screenshots about jcloisterzone HOT 12 CLOSED

farin avatar farin commented on July 28, 2024
Take Screenshots

from jcloisterzone.

Comments (12)

joelpurra avatar joelpurra commented on July 28, 2024

I like the screenshot functionality.

Often we take screenshots during a game or usually at the very end and taking Print Screens can be laborious.

I do too, but have built-in functionality for saving screenshots in Mac OS X. It names the file Screen Shot 2014-12-17 at 22.50.32.png and puts it on the desktop. I generally don't like saving things directly to the desktop though.

I think it would be beneficial for users to be able to automatically save the GridLayout where tiles are placed.

I guess I kind of see saving a screenshot of the tiles (only) as a mere graphical representation of a saved game state.

@farin has rightly pointed out that most games automatically produce files such as: Screenshot_001.png rather than display a JFileChooser.

This would take part of the labour out of it. Automation is nice.

@joelpurra has also stated that we should not assume the user has write-access to the JCZ directory under screenshot; instead it should write to a default directory such as the user's home folder (like My Documents).

I have mixed opinions on the approach, as a novice JCZ user how will I know where files will be written? The JFileChooser seems to mitigate this.

On Windows, there's an official Saved Games folder (or similar), right?

To add to this last point, I think it would be sensible to introduce a new Config item such as: default_screenshot_folder so that user's can override the default folder.

Not a bad idea. The default probably need to be in code though, as paths are highly operation system system dependent.


Questions

  • Would it be possible to have it both in a menu and bound to the print screen key? (I don't have a print screen key on my Macbook.)
  • Would it also be possible to include the current/final score?
  • Would it be possible to re-use the functionality to save a screenshot My save game name.png next to any game the user saves? It would be a great feature, especially if paired with a preview when finding a particular save game for loading.

from jcloisterzone.

Decar avatar Decar commented on July 28, 2024

Thanks for the input @joelpurra!

Not a bad idea. The default probably need to be in code though, as paths are highly operation system system dependent.

How about this flow?:

  • If there is a default_screenshot_folder in the config.yaml then it will try and use it.
    • If one is not specified, or write permissions fail, it will attempt the default user's directory.
    • If that also fails it then loads the JFileChooser to ask the user.

Would it be possible to have it both in a menu and bound to the print screen key? (I don't have a print screen key on my Macbook.)

I like to see shortcuts and menu items; otherwise I might not know there is a shortcut.

Would it also be possible to include the current/final score?

My build yesterday does this; so the current score is displayed.
3

Would it be possible to re-use the functionality to save a screenshot My save game name.png next to any game the user saves? It would be a great feature, especially if paired with a preview when finding a particular save game for loading.

I'm not precisely sure how that would work - but the screenshot could be embedded into the .jcz file with the game state. I'm guessing JCZ would need to have it's own JFileChooser in order to view the thumbnail and that might be OS specific too. Seems like a nice enhancement to the gui.

from jcloisterzone.

farin avatar farin commented on July 28, 2024

just name it screenshot_folder please, if not specified try to write it without path -
it means game working dir, same as is not error.log write implemented (there is not solved real only dir yet, so let's keep finding fallback dir as separate story, which handles also default config and logs)

ok let's keep menu item

there is still option compose file name from players name and time (but must be not so long)
I don't have idea now how to easily bound it with save game.
(ideal solution can be something like include screenshot to save file and show game previews in a custom load dialog - but it's out of scope now)

from jcloisterzone.

Decar avatar Decar commented on July 28, 2024

Great, I'll add a new config item - screenshot_folder
Directory screenshot is written to will either be: user.dir OR screenshot_folder
File name will be generated: screenshot_clientname_HH_mm_ss.png - do we think that is too long?

I'm not sure about listening for PRINTSCREEN event - Windows for example doesn't implement a KEY_DOWN event for Print Screen, so Swing's Accelerator is useless so will have to implement a KeyListener for KEY_UP events. It seems a bit clunky.

from jcloisterzone.

Decar avatar Decar commented on July 28, 2024

Created a Pull Request for this: #78

Implementing Print Screen seems very OS specific; I have gone with F12 (like steam).

I'm contemplating changing screenshot_clientname_time.png to: JCloisterzone_time.png - If someone takes a screenshot they know it's them so having their name isn't that beneficial and 'snapshot' is somewhat redundant.

from jcloisterzone.

joelpurra avatar joelpurra commented on July 28, 2024

Tested the code, and it seems to work well.

Implementing Print Screen seems very OS specific; I have gone with F12 (like steam).

It seems screenshots are written to the game directory by default. Yes, JCZ developers may use a writeable location, but it's both bad practice to write there and assume that it's writeable for others. Would still prefer a more standardized per-user storage location.

Keep in mind that Windows did a move against users having write access to program folders several years ago - "old programs that don't know better" now write to a virtual folder structure that is hidden in a completely different place (per user). Unix-based systems have had non-writeable application locations longer than that.

In lack of proper multi-platform "My Documents"/"My Save Games" path usage (unless there's a good library), System.getProperty("user.home") seems like a good start. There's also String DefaultFolder=new JFileChooser().getFileSystemView().getDefaultDirectory().toString(); and (for windows) System.getenv("USERPROFILE"). Some strings seem Windows language dependent, like %USERPROFILE%\Saved Games
http://stackoverflow.com/questions/9677692/getting-my-documents-path-in-java
http://stackoverflow.com/questions/5590040/cross-platform-way-to-ask-for-the-users-documents-folder
https://en.wikipedia.org/wiki/Special_folder

I'm contemplating changing screenshot_clientname_time.png to: JCloisterzone_time.png - If someone takes a screenshot they know it's them so having their name isn't that beneficial and 'snapshot' is somewhat redundant.

Wasn't the thought more like JCloisterZone_time_remotehumanplayer1_remotehumanplayer2_localhumanplayer1_localhumanplayer2_aiplayer1_aiplayer3.png?

  • The string could have a (OS/file system dependent?) max length.
  • Prefer time first for sortability. That is the way I think of games; "the game we played last weekend" before "when I played with my friend XYZ."
  • Prefer human player names first, as they're more relevant.
  • Remote humans are more likely to change than local player(s).
  • Local players may also change, as there can be multiple local players as well as several (a family, for example) players sharing a computer over time.
  • The seating order is probably less important than the names of humans. These groups of names could be internally sorted alphabetically by name, for recognizability.
  • AI player names could also be written as _and_3_ai_players or similar. The string could be chosen if it's shorter than the full list of AI names, or as the default to distinguish humans from AIs.

Note: I consider ISO 8601 the gold standard for date formats. I usually skip the : for use in filenames.

Example name based on an actual game: JCloisterZone_2014-12-17T225032_jetthe_deathrow1_1_ai.png

from jcloisterzone.

Decar avatar Decar commented on July 28, 2024

Thanks @joelpurra !

I think the default folder is acceptable for now, because this is the same for error.log and game saves. I think we should raise a new issue to make sure a correct directory is chosen.

I've never understood ISO 8601 for file names - it uses : to separate date time which isn't a valid file name character. Either way I've omitted the :.

AS for the player name, think i misread players' names as: player's name. LOL - I've changed it now, currently it's producing a file name as follows:

JCloisterZone_2014-12-21-111350_localTom_localJo_and_1aiplayers.png

it's pretty unwieldy; and I need to think about how to concatenate long file names - perhaps, if it is longer than a safe threshold, it should:

JCloisterZone_2014-12-21-111350_2local_2remote_and_2aiplayers.png

Edit

  • Just saw your edit -> I'll remove the local and the _and_aiplayers

from jcloisterzone.

joelpurra avatar joelpurra commented on July 28, 2024

I think the default folder is acceptable for now, because this is the same for error.log and game saves. I think we should raise a new issue to make sure a correct directory is chosen.

Done: #79.

I've never understood ISO 8601 for file names - it uses : to separate date time which isn't a valid file name character. Either way I've omitted the :.

Sure, filenames wasn't the original intention - but it's a standard that embraces sortability. I'd either use a T as the date/time separator (it's the official separator), or perhaps _, instead of - though, as it'd be less confusing.

Just saw your edit -> I'll remove the local and the _and_aiplayers

=)

from jcloisterzone.

Decar avatar Decar commented on July 28, 2024

I think this should be ok:
JCloisterZone_2014-12-21T111350_Tom_Jo_1AI.png

Only problem is if a user has an underscore in there name, eg: that's Tom_123 vs Jo
JCloisterZone_2014-12-21T111350_Tom_123_Jo_1AI.png

from jcloisterzone.

joelpurra avatar joelpurra commented on July 28, 2024

Only problem is if a user has an underscore in there name, eg: that's Tom_123 vs Jo

Luckily the screenshot filename doesn't have to be parsed back to player names ;)

from jcloisterzone.

Eldenroot avatar Eldenroot commented on July 28, 2024

@farin - is possible to add a feature - automatically take a screenshot after game (with score table)

from jcloisterzone.

farin avatar farin commented on July 28, 2024

@CU8ER I want to keep automatically result of each online game available under private url. Than it should be linkable and it will contain also screenshot

from jcloisterzone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.