Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  I'm having problems with Rebirth...  (Read 1690 times)
0 Members and 1 Guest are viewing this topic.
Offline Sickan

Senior Devvie


Medals: 9



« Posted 2012-06-27 22:49:13 »

I'm currently using the Rebirth library, and I'm getting the following error message.

Exception in thread "main" java.lang.NullPointerException
   at nordgren.silas.happyisles.HappyIsles.init(HappyIsles.java:35)
   at nordgren.silas.happyisles.HappyIsles.main(HappyIsles.java:51)

The code is as follows:

1  
2  
3  
4  
5  
public static ResourceHandle<AudioUtilities> audioUtilitiesHandle;
   public static ResourceHandle<VideoUtilities> videoUtilitiesHandle;
   public static ResourcePool resources = Resources.createPool(USER_DIRECTORY
         + FILE_SEPARATOR + "content", DecoderGroup.CORE, true, false,
         new AudioDecoder(), new VideoDecoder());


1  
2  
3  
4  
5  
6  
7  
8  
9  
resources.parse("resources.xml");

      audioUtilitiesHandle = resources.forceCreate(
            AudioUtilities.class, "main");
      videoUtilitiesHandle = resources.forceCreate(
            VideoUtilities.class, "main");

      audioUtilities = audioUtilitiesHandle.get(); //I get a nullpointer exception here, I believe it is because audioUtilitiesHandle is null.
      videoUtilities = videoUtilitiesHandle.get();


Thank you for your time assisting this initiate to Rebirth.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



« Reply #1 - Posted 2012-06-28 00:36:29 »

ReBirth, get over here...the library is named after you Grin
Offline Sickan

Senior Devvie


Medals: 9



« Reply #2 - Posted 2012-06-28 08:33:15 »

It's wierd because I've never got errors with Rebirth before, and I've done the same thing on other projects with no problems. Here are the XML files in case there's anything wrong with them.

Resources.xml
1  
2  
3  
4  
<resources>
   <include path="resources/AudioUtilities.xml" />
   <include path="resources/VideoUtilities.xml" />
</resources>


resources/AudioUtilities.xml
1  
2  
3  
4  
5  
<resources>
   <map name="AudioUtilities" class="nordgren.silas.happyisles.utilities.AudioUtilities" />
   <AudioUtilities name="main"
   />
</resources>


resources/VideoUtilities.xml
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
<resources>
   <map name="VideoUtilities" class="nordgren.silas.happyisles.utilities.VideoUtilities" />
   <VideoUtilities name="main"
   bitsPerPixel="32"
   monitorFrequency="60"
   windowHeight="600"
   windowTitle="Happy Isles"
   windowWidth="800"
   />
</resources>
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ReBirth
« Reply #3 - Posted 2012-06-28 11:40:08 »

ReBirth, get over here...the library is named after you Grin
I thought someone is going to pick fight with me, oh well *hides scope*

I don't know if it's problem to let AudioUtilities's property to empty, but do you call resources.update()? First exception appeared before VideoUtilities, so maybe it'll suffer same problem.

Offline Sickan

Senior Devvie


Medals: 9



« Reply #4 - Posted 2012-06-28 16:48:48 »

ReBirth, get over here...the library is named after you Grin
I thought someone is going to pick fight with me, oh well *hides scope*

I don't know if it's problem to let AudioUtilities's property to empty, but do you call resources.update()? First exception appeared before VideoUtilities, so maybe it'll suffer same problem.
Thank you! The error was gone when I commented out the AudioUtilities loading part. Currently it's just a placeholder for the variables I'm going to place there soon enough.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #5 - Posted 2012-06-28 17:14:49 »

resources/AudioUtilities.xml
1  
2  
3  
4  
5  
<resources>
   <map name="AudioUtilities" class="nordgren.silas.happyisles.utilities.AudioUtilities" />
   <AudioUtilities name="main"
   />
</resources>


resources/VideoUtilities.xml
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
<resources>
   <map name="VideoUtilities" class="nordgren.silas.happyisles.utilities.VideoUtilities" />
   <VideoUtilities name="main"
   bitsPerPixel="32"
   monitorFrequency="60"
   windowHeight="600"
   windowTitle="Happy Isles"
   windowWidth="800"
   />
</resources>


Resource names need to be globally unique, and you have two resources with different types both called "main". I should probably put some code in to barf on loading if you try and reuse a name.

I generally put an extension of the type at the end of resource names (eg. "main.audioUtils" and "main.videoUtils").

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #6 - Posted 2012-06-28 17:15:56 »

ReBirth, get over here...the library is named after you Grin
I thought someone is going to pick fight with me, oh well *hides scope*

Rebirth the lib was here first.  Tongue

This topic is kinda funny because I've heard so little feedback about Rebirth (the library) that I'd kinda assumed no-one was using it other than me.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Sickan

Senior Devvie


Medals: 9



« Reply #7 - Posted 2012-06-28 18:52:25 »

ReBirth, get over here...the library is named after you Grin
I thought someone is going to pick fight with me, oh well *hides scope*

Rebirth the lib was here first.  Tongue

This topic is kinda funny because I've heard so little feedback about Rebirth (the library) that I'd kinda assumed no-one was using it other than me.
I didn't really realize it at the time I made this topic, but the title isn't really optimal when you have a member with the name ReBirth. Anyway, thanks for the help. Also, loving the library.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #8 - Posted 2012-06-29 07:31:18 »

Btw could you post your AudioDecoder and VideoDecoder classes? I suspect you could do things in a cleaner way. (Also I'm just nosy how people like to use the api).

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Sickan

Senior Devvie


Medals: 9



« Reply #9 - Posted 2012-06-29 07:33:55 »

Btw could you post your AudioDecoder and VideoDecoder classes? I suspect you could do things in a cleaner way. (Also I'm just nosy how people like to use the api).
I just use the plastic solution of specifying the name of the texture or sound I want to load and then let Slick do the rest.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ReBirth
« Reply #10 - Posted 2012-06-29 14:15:08 »

I didn't really realize it at the time I made this topic, but the title isn't really optimal when you have a member with the name ReBirth. Anyway, thanks for the help. Also, loving the library.
I guess many members were deceived.

Rebirth the lib was here first.  Tongue

This topic is kinda funny because I've heard so little feedback about Rebirth (the library) that I'd kinda assumed no-one was using it other than me.
Yeah I know Grin I already read how to use it but never really use it. Maybe because I have small amount of resources so I just type them one by one.

Offline h3ckboy

JGO Coder


Medals: 5



« Reply #11 - Posted 2012-06-29 17:42:54 »

hahahahaha, I don't know why, but it never clicked for me that ReBirth didnt write reberth.

Which is surprising considering I was hear when orangy tang posted it the first time.

I guess my mind is just failing on me Tongue
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (45 views)
2014-11-29 21:32:03

toopeicgaming1999 (113 views)
2014-11-26 15:22:04

toopeicgaming1999 (100 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!