threerings / playn

Legacy 1.x version of PlayN library.
http://playn.io/
Apache License 2.0
195 stars 66 forks source link

Allow java implementation to load assets from filesystem #41

Closed ghost closed 10 years ago

ghost commented 10 years ago

A simple patch to let java version to load assets from one or multiple directories using a new Assets implementation when "assetsDirectories" new setting is set.

jamie-threerings commented 10 years ago

This looks really useful, but I don't see a compelling reason to spin off a subclass for it. Also, how does this interplay with the pathPrefix property?

deadmoose commented 10 years ago

I'll also chime in to ask after assetScale().

It's been long enough that I don't remember the details, but I'd apparently worried about that once upon a time when wrote my own version of this: https://github.com/deadmoose/flumptools/blob/master/playn/src/main/java/com/deadmoose/flumptools/playn/FileAssets.java

@jamie-threerings: you might also nose around inside OOO; I know @mthomas96 had written similar for our editors. I don't remember if we ever reconciled differences between our two implementations.

ghost commented 10 years ago

@jamie-threerings:

I use a subclass to avoid bloating JavaAssets and provides a clean pull request. But they can be merged, if you think it is better.

pathPrefix is still used: it means that if you just set /my/nice/path/ in assetsDirectories, assets will be loaded from /my/nice/path/${pathPrefix}. Do you think pathPrefix should be ignored for file system assets?

ghost commented 10 years ago

@deadmoose

I cannot figure what could go wrong with assetScale. Maybe you ran into issues with previous playn versions?

Where is the mthomas96 implementation?

deadmoose commented 10 years ago

It's been the better part of a year, so I really can't recall the details...possibly I had to do that to very explicitly tell it to open the file that I asked for, not to try to get fancy? Looks like I should have been able to just setAssetScale() from my application instead of hardwiring it. Or, like you say, things might have been different back in 2013.

The @mthomas96 implementation is internal to Three Rings; he'd done it for the various tools (e.g. level editor) for the games we were working on. But since neither he nor I are at OOO any more, have to go through someone like @jamie-threerings to get insight on it.

Which reminds me of the other thing for Jamie to check: at some point, we added a way for either pinkey-game or pinkey-editor to load sounds from an arbitrary location. That may or may not have been built on top of our internal FileAssets... it'd be worth taking a quick peek.

ghost commented 10 years ago

@deadmoose Is there a playn code formatting configuration file for Netbeans/Eclipse/... somewhere?

jamie-threerings commented 10 years ago

I pushed a slightly different approach that implements this in JavaAssets. Please check it out and make comments or raise issues. I haven't tested it thoroughly yet.