Assets path and fullscreen(swing app)

Hi,
When loading textures with the assetManager I do something like this:
[java]mat.setTexture(“DiffuseMap”, assetManager.loadTexture(“Textures/picture.png”));[/java]
When I want to open and save a file without the assetManager(for example to create textures with BufferedImage while the game is running) I create a file with:
[java]new File(“assets/Textures/picture.png”);[/java]
I can’t do “Textures/picture.png” as I would do with the assetManager, because the path can’t be located then.
This works fine in jmonkey, but when I distribute the game, the path used for the texture creation can’t be found. When I add the whole asset folder to the dist folder it can be found again, but it does not save the textures to the same folder the assetManager is referring to(but the assetManager must load the textures, after they are created).
Is there a way to make the new File("") always locate the same folder as the assetManager does? What other options to I have?

Second question:
The game I’m creating runs in a swing frame but I want the users to also be able to run it in fullscreen mode. But if I do:
[java]AppSettings settings = new AppSettings(true);
settings.setFullscreen(fullscreen);
final MainGame canvasApplication = new MainGame();
canvasApplication.setSettings(settings);[/java]
before starting the game it doesn’t change anything, the game still runs in the JFrame. How can I run the game in fullscreen mode, even if it normally runs in a JFrame?
Thanks for your help :slight_smile:

Do not use java.io.File to save these, in a distributed app they will be packed in a jar and not be accessible like that, on android it will also be a big compressed dex file and on iOS even native binary code, so… don’t use Files :wink: You can get anything the default assetManager has access to (via the same path) via the class loader:
getClass().getResourceAsStream(“Textures/picture.png”) or getClass().getResource(“Textures/picture.png”). You cannot save things like that but thats a given for all assets in the assets folder as explained before.

If you want to save and load data during the games execution you have to get a place where you can do that and add it to the assetManagers root. You can use the JmeSystem class to get a path to a user folder that you can write to in (user home)/.jme3/. To save simple preference info, use java.util.Preferences, they can be saved globally without having to access files.

Edit: If you use a JFrame you cannot enter fullscreen mode, it only works with the native app window.

Thanks for your answer :). How can i add something to the assetManagers root? Is it via assetManager.registerLocator? Is there a way to make and locate a directory which is in the dist folder after distribution? How can I acess the folder after that?

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_asset