Slick Forums

Discuss the Slick 2D Library
It is currently Mon May 20, 2013 5:02 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Wed Oct 07, 2009 10:12 am 
Offline
User avatar

Joined: Mon Jun 15, 2009 9:01 am
Posts: 25
As the title says; the mousePressed, mouseMoved and mouseReleased methods still activate even when the GameState they're in isn't the active one.

Fix please? ;_; This is pretty urgent for me.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 07, 2009 10:41 am 
Offline
Regular
User avatar

Joined: Thu May 21, 2009 10:25 am
Posts: 161
Location: France
Hi,

I'm not sure but did you try this when leaving your state ?

Code:
container.getInput().clearKeyPressedRecord();
container.getInput().clearMousePressedRecord();
container.getInput().consumeEvent();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 07, 2009 10:44 am 
Offline
User avatar

Joined: Mon Jun 15, 2009 9:01 am
Posts: 25
Do I call those three methods before or after I use the enter() method?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 07, 2009 10:53 am 
Offline
Regular
User avatar

Joined: Thu May 21, 2009 10:25 am
Posts: 161
Location: France
If it's for mouse, use only:

Code:
container.getInput().clearMousePressedRecord();
container.getInput().consumeEvent();


You can use it in the method you want, I use it in the leave method of my "inGameState". When I come back to a menu state.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 07, 2009 8:29 pm 
Offline
User avatar

Joined: Mon Jun 15, 2009 9:01 am
Posts: 25
Doesn't work for me :/

Kevvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!? T_T


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 07, 2009 8:46 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
You need to post more code to explain how you get to that situation. If you try the game state tests you should find that doesn't happen. So, its most likely something to do with your use case which you're going to need to post, ideally with a simple test case rather than all the code.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 08, 2009 1:55 am 
Offline
User avatar

Joined: Mon Jun 15, 2009 9:01 am
Posts: 25
Looks like it's not anything my-app-specific, here's a test I wrote up and the same thing occurs; StateTwo is never entered but the mousePressed, mouseReleased and mouseMoved functions still occur on it.

See MouseOverAreaExtended and see the output it prints.

Download: http://www.mediafire.com/download.php?nmlnmzd55nz

EDIT: Checked out the source code for Slick's Input class; it looks like it only checks to see if the AbstractComponent is accepting input, it doesn't check to see if the current state is the state the component is in. :/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 08, 2009 11:27 am 
Offline
Regular
User avatar

Joined: Thu May 21, 2009 10:25 am
Posts: 161
Location: France
Well,

I try your code and don't find a good solution. You can only test if the state is the good one when mouse moved, pressed etc.

Waiting for Kev next post :D


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 12, 2009 10:12 am 
Offline
User avatar

Joined: Mon Jun 15, 2009 9:01 am
Posts: 25
Well, kev? Waiting for ya. :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 12, 2009 5:59 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
What do you expect me to say? AbstractComponents don't work with GameStates.

Kev


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