Slick Forums

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

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Sep 05, 2012 1:55 pm 
Offline

Joined: Mon Sep 03, 2012 12:31 pm
Posts: 2
Hello,
I want to build a game with slick and TWL, and I started with the GameStates and the StatesManager.
They look like this:
state/MainMenuState.scala:
Code:
package state
import twlslick.BasicTWLGameState
import org.newdawn.slick.state.StateBasedGame
import org.newdawn.slick.{Graphics, GameContainer}

class MainMenuState extends BasicTWLGameState {
  override def getID() = States.MAIN

  // Implement init
  def init(gc: GameContainer, sbg: StateBasedGame) {

  }

  // Implement update
  def update (gc: GameContainer, sbg: StateBasedGame, delta: Int) {

  }

  def render (gc: GameContainer, sbg: StateBasedGame, g: Graphics) {

  }

}

SaltShaker.scala
Code:
import org.newdawn.slick.util.ResourceLoader
import org.newdawn.slick.{GameContainer, AppGameContainer}
import state.{MainMenuState}
import twlslick.TWLStateBasedGame;


class SaltShakerApp(name: String, val startState: Int) extends TWLStateBasedGame(name: String) {
  def initStatesList(gc: GameContainer) {
    addState(new MainMenuState)
    enterState(startState)
  }

  def getThemeURL = ResourceLoader.getResource("ui/ui.xml")
}

object SaltShakerApp extends App {
  val app = new AppGameContainer(new SaltShakerApp("SaltShaker v0.0.1", state.States.MAIN))
  app.setDisplayMode(800, 600, false)
  app.start()
}

States.MAIN is just an Int value as a easy-to-remember ID for the GameState.
My ui.xml basically contains only this:
Code:
<!DOCTYPE themes PUBLIC "-//www.matthiasmann.de//TWL-Theme//EN" "http://hg.l33tlabs.org/twl/raw-file/tip/src/de/matthiasmann/twl/theme/theme.dtd">
<themes>
    <images file="salzstreuer.png">

    </images>
</themes>

(At the moment I just need a bit of example code cause I havent read much about TWL, but it seems suitable for my project.)

When I want to launch SaltShakerApp, I get the following Stacktrace:
Code:
org.newdawn.slick.SlickException: Could not initialize TWL GUI
   at twlslick.TWLStateBasedGame.initGUI(TWLStateBasedGame.java:145)
   at twlslick.TWLStateBasedGame.setRootPane(TWLStateBasedGame.java:125)
   at twlslick.BasicTWLGameState.enter(BasicTWLGameState.java:80)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:181)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:433)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:357)
   at SaltShakerApp$delayedInit$body.apply(SaltShakerApp.scala:28)
   at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
   at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
   at scala.App$$anonfun$main$1.apply(App.scala:60)
   at scala.App$$anonfun$main$1.apply(App.scala:60)
   at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
   at scala.collection.immutable.List.foreach(List.scala:76)
   at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:30)
   at scala.App$class.main(App.scala:60)
   at SaltShakerApp$.main(SaltShakerApp.scala:25)
   at SaltShakerApp.main(SaltShakerApp.scala)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException
   at twlslick.TWLStateBasedGame.loadTheme(TWLStateBasedGame.java:119)
   at twlslick.TWLStateBasedGame.initGUI(TWLStateBasedGame.java:136)
   ... 21 more
Caused by: java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserException
   at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
   ... 23 more


Is it just a malformed XML file, or am I missing some external libraries?


Top
 Profile  
 
PostPosted: Thu Sep 06, 2012 9:18 am 
Offline

Joined: Mon Sep 03, 2012 12:31 pm
Posts: 2
Ok, I reply cause I have found the solution:
I was missing two jar files, I forgot them because the lwgjl.jar was already included in my project, and I thought these were two, but they werent.
DerWaldschrat


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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