Slick Forums

Discuss the Slick 2D Library
It is currently Wed May 22, 2013 8:34 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Jul 10, 2012 1:44 pm 
Offline

Joined: Sat Jun 23, 2012 4:14 pm
Posts: 74
Location: Germany
When using StateBasedGame instead of BasicGame how can I make the following code still work (in every state):
Code:
if (input.isKeyPressed(Input.KEY_F11))
{
   if (gc.isFullscreen())
   {
      app.setDisplayMode(WIDTH, HEIGHT, false);
   }
   else
   {
      app.setDisplayMode(app.getScreenWidth(), app.getScreenHeight(), true);
   }
}


Is there a way for doing global stuff like this?


Top
 Profile  
 
PostPosted: Tue Jul 10, 2012 4:21 pm 
Online
Regular
User avatar

Joined: Thu May 05, 2011 8:35 pm
Posts: 231
Location: Somewhere between the bits and bytes
Just override the preupdatestate, postupdatestate, prerenderstate and postrenderstate methods, in statebasedgame, theyll apply to all states.

_________________
For every new problem, a new source of solutions has come to exist.


Top
 Profile  
 
PostPosted: Tue Jul 10, 2012 6:06 pm 
Offline

Joined: Sat Jun 23, 2012 4:14 pm
Posts: 74
Location: Germany
Magn919 wrote:
Just override the preupdatestate, postupdatestate, prerenderstate and postrenderstate methods, in statebasedgame, theyll apply to all states.


Okay, I overlooked these while checking the source of StateBasedGame. Thank you! :D


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: Google [Bot], Magn919 and 5 guests


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