Slick Forums

Discuss the Slick 2D Library
It is currently Thu Jun 20, 2013 12:16 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Feb 13, 2012 6:54 pm 
Offline

Joined: Mon Feb 13, 2012 6:31 pm
Posts: 40
Hi. I tried to use TWL with my game which runs in slick's canvas game container but I can't seem to get it to work. I've done exactly as slick integration section of the wiki says and while my game runs without an error, there's nothing drawn in the game screen when it runs. The game is coded to show some graphics and its shown without TWL, but when applying the code below it turns into black screen.

Code:
lwjglRenderer = new LWJGLRenderer()
theme = ThemeManager.createThemeManager(this.getClass().getResource("simple.xml"), lwjglRenderer)


I'm guessing it has something to do with getting right renderer for canvas game container? I'm sorry, I'm really new to both slick and java(scala) and I have no idea what to fix. Can anyone give me a hint? Thanks.


Top
 Profile  
 
PostPosted: Tue Feb 21, 2012 3:33 pm 
Offline

Joined: Mon Feb 13, 2012 6:31 pm
Posts: 40
Hello, I still can't figure out how to run TWL on slick canvas game mode :( here are some codes from my game, am I doing something wrong? I will really appreciate it if someone can guide me to the right path. My game runs with those comment outs but when I remove them it shows plain black screen without an error message.

Code:
object Client extends BasicGame(""){
   // Variables to create frame and canvas with slick Basic Game
   val frame = new JFrame"")
   val canvas = new CanvasGameContainer(this)   
         
      // For TWL GUI
   var theme:ThemeManager=null
    var gui:GUI=null
    var root:Widget=null
    var twlInputAdapter:TWLInputAdapter=null
   var lwjglRenderer:LWJGLRenderer=null

   def start(path:String,isPrototype:Boolean){
      frame.add(canvas)
      frame.setSize( new Dimension(800, 600))
      frame.setVisible(true)
      canvas.start() 
   }



Code:
   def init(gc:GameContainer){
      gc.setAlwaysRender(true)
      gc.setVSync(false)
   
         root = new Widget();
        root.setTheme("");
      GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS)

        lwjglRenderer = new LWJGLRenderer();
//        theme = ThemeManager.createThemeManager(this.getClass().getResource("simple.xml"), lwjglRenderer);
//        gui = new GUI(root, lwjglRenderer);
//        gui.applyTheme(theme);
   
        GL11.glPopAttrib();

//      twlInputAdapter = new TWLInputAdapter(gui, gc.getInput());
//       gc.getInput().addPrimaryListener(twlInputAdapter);

   }


Top
 Profile  
 
PostPosted: Tue Feb 21, 2012 7:36 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1190
Others use TWL inside Slick and don't seem to have this issue - and you also have the glPushAttrib around it - not sure what is causing this. Maybe you could try some OpenGL state debugger/tracer?

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Tue Feb 21, 2012 11:35 pm 
Offline

Joined: Mon Feb 13, 2012 6:31 pm
Posts: 40
Thank you for the reply. I got it running today, it seems I was missing files related to simple.xml theme(bleh sorry).


Top
 Profile  
 
PostPosted: Tue Feb 21, 2012 11:44 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1190
That should have resulted in an IOException.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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:  
cron
Powered by phpBB® Forum Software © phpBB Group