Slick Forums

Discuss the Slick 2D Library
It is currently Wed Jun 19, 2013 12:33 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: TWL Input and priority
PostPosted: Wed Aug 15, 2012 6:06 pm 
Offline
Game Developer
User avatar

Joined: Wed Feb 17, 2010 12:24 am
Posts: 594
I'm using TWLSlick.zip and have it setup like so:

MyStateBasedGame extends TWLStateBasedGame (which extends [slick's] StateBasedGame)

Then I also have HelloState extends BasicTWLGameState

What I would like is to have is global keyboard shortcuts that work regardless if TWL or Slick picks them up and regardless of which State it is in... For example, if I press 'Print Screen', it should call my printScreen() method (even if a GUI is up, or even if I'm in the main menu state).

In my previous version (with just TWLInputForward, not TWLSlick), I was handling this in MyStateBasedGame; but seems to not get it with TWLSlick (unless I remove input.consume() in the TWLInputForward).

Design wise, where is the best place to handle these global hot keys? I'm thinking maybe MyStateBasedGame , but implementation wise it seems tricky to get the key inputs to pick them up.


Top
 Profile  
 
PostPosted: Wed Aug 15, 2012 6:25 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1188
You can either put it into the RootPane, or you define an <inputMap> and bind an action in the root pane.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Thu Aug 16, 2012 12:27 am 
Offline
Game Developer
User avatar

Joined: Wed Feb 17, 2010 12:24 am
Posts: 594
ok, thanks. I extended RootPane and @Override this protected boolean handleEvent(Event evt)


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