Trying to change the AppSettings splash screen in jme3

Hi. I’m trying to change the AppSettings splash screen in jme3 and I can’t seem to load images properly.

This is how I’m trying to do it:



[java]Main app = new Main();

app.settings.setSettingsDialogImage(“assets/Textures/zombie.jpg”);

app.start();[/java]



But i always get error Exception in thread “main” java.lang.NullPointerException

at mygame.Main.main(Main.java:88)



I checked if if java can access this file:

[java]String str = “assets/Textures/zombie.jpg”;

File f = new File(str);

System.out.println(str + " : " + f.exists());[/java]

and it returns assets/Textures/zombie.jpg : true



plz help

try with this

app.settings.setSettingsDialogImage("/Textures/zombie.jpg");

It’s



“Textures/zombie.jpg”



Don’t put “assets”. jME3 knows where the base directory is.



Edit: Bah! Ninja’d!

nehon said:
try with this
app.settings.setSettingsDialogImage("/Textures/zombie.jpg");


tried it still doesnt work and i am still getting error
Exception in thread "main" java.lang.NullPointerException
at mygame.Main.main(Main.java:86)
Java Result: 1

Not with a “/” before Textures



Textures/zombie.jpg between quotes. That’s all.

nehon said:
try with this
app.settings.setSettingsDialogImage("/Textures/zombie.jpg");


@nehon
You should get a "Thumb down" for giving false information! :P Note that I'm not better as I didn't notice and even yelled "Ninja'd". lol ;)
madjack said:
Not with a "/" before Textures
Textures/zombie.jpg between quotes. That's all.

lol still not working X_X
I am still getting same error. Created a whole game and stuck on something so little X_X

Check your path and file names. You might want to try to clean and rebuild although that shouldn’t be necessary.

I just checked my code… and I do have a / at the beginning of mine though I don’t remember if it is required or not.



[java]

settings.setTitle( “Mythruna RCG v0.1” );

settings.setWidth( 1280 );

settings.setHeight( 720 );

settings.setIcons(icons);

settings.setSettingsDialogImage( “/Interface/mythruna-title.png” );

app.setSettings( settings );



app.start();

[/java]

madjack said:
@nehon
You should get a "Thumb down" for giving false information! :P Note that I'm not better as I didn't notice and even yelled "Ninja'd". lol ;)

I never give false informations, especially when I coded the thing. it uses the class.getResource(path) method, you can check the javadoc.

@vshubh123 are you using JMP or eclipse? if it's the latter, your asset folder has to be in your classpath

@nehon, AssetManager was modified at some point to generate nicer error messages for missing assets. I wonder if this is a good case for a better error message also? Better than an NPE, anyway.

yep, also, I should make it load things without the need of the “/” like the asset manager.

Ok in last SVN you don’t need the first “/” anymore, and you’ll get an AssetNotFoundException if…well the asset is not found :stuck_out_tongue:



Though this won’t resolve the OP problem.

Well then hit me with a stick. I never used a slash to start my asset path and it always worked.

For assets, your right, but the splash screen is different.

The splash screen is not loaded with the assetManager, because when the setting dialog window appear the assetManager is not initialized yet.

Anyway, now it should work both ways :wink:

Oh I see. Well, my excuses then to everyone involved.

Thankyou guyz

You guyz rock

Thankyou guyz

You guyz rock