Slick Forums

Discuss the Slick 2D Library
It is currently Sat May 18, 2013 10:00 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Feb 07, 2012 6:23 am 
Offline

Joined: Sun Jan 29, 2012 3:35 am
Posts: 17
Hi, just getting into particles and having a hell of a time getting my JAR to find the xml files i'm using,

I'm using code like this to send the file to the component i use to make particles:

File file = new File("data/particles/explosion.xml");
e.AddComponent(new ParticlesRenderComponent("explosion", file, 60, 60)); -> where 60, 60 is the x and y offset respectively

which works in Eclipse but not in the JAR i make using JarSplice. Images and animations use the exact same referencing system but come up fine in the JAR, and I have used a variety of try...catch -> print statements to make sure finding the XML is the problem.

I've tried a lot of combinations of / in the filepath, as well as referencing a fixed C:/ location (which works), but is there some kind of special format one has to use for referencing files? Or any kind of workaround? Thanks


Top
 Profile  
 
PostPosted: Tue Feb 07, 2012 6:41 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1467
Don't use File for resources inside of a JAR. If you can, avoid loading with File altogether and instead utilize Slick's ResourceLoader:
http://slick.cokeandcode.com/javadoc/or ... oader.html

Also, check out the ParticleIO class for loading/saving Slick particles -- you can pass a string (instead of input stream) and Slick will use the ResourceLoader for you.
http://slick.cokeandcode.com/javadoc/or ... cleIO.html


Top
 Profile  
 
PostPosted: Tue Feb 07, 2012 9:36 am 
Offline

Joined: Sun Jan 29, 2012 3:35 am
Posts: 17
thanks a lot, i was using ParticleIO but missed the string constructor. Works perfectly now


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group