Mouse input events not generated?

  12 posts   Feedicon  
Replies: 11 - Last Post: October 28, 2009 02:15
by: Logan Barnett
« Older Topic » Newer Topic
showing 1 - 12 of 12
 
Posted: October 21, 2009 05:37 by ltmon
First post! Hopefully someone is listening here.

I realise that jemini is under heavy development and is a moving target etc. etc., but would like to get a basic game going that requires mouse input.

As a test:

src/states/main_state.rb


def load
mouse_checker = create :GameObject, :HandlesEvents
mouse_checker.handle_event :mouse_released do
puts "pressed"
end

game_end_checker = create :GameObject, :HandlesEvents
game_end_checker.handle_event :quit do
quit_game
end
end


src/input/global_input.rb


i.in_order_to :mouse_released do
i.release :mouse_left
end


I know my input handling is (in general) working as the ESC mapping to quit works fine.

However I receive no mouse events. Right click, left click and movement does not produce events. Is there anything obvious I am doing wrong?

I am using Java 1.6, with JRuby 1.4.0RC1, jemini and it's dependent libs from gitorius (cloned today) on Linux 32-bit (Ubuntu).

Thanks in advance,

Luke.

Edit: Testing basic mouse handling just in Slick works fine.
 
Posted: October 21, 2009 07:30 by ltmon
After a bit of source code reading, I found that I had to do the following in state/main_state.rb


use_input :global


It seems that although keyboard listening works fine with the default loading of the global input map, you need to explicity include it to enable mouse events to have a listener. I don't know if this is by design or accident.

Cheers,

L.
 
Posted: October 21, 2009 14:53 by Logan Barnett

Luke,

We just revamped the entire input system, so there's going to be some regressions. Thanks for the patience with us on that (:

Just to help me get to the bottom of this, where are your keyboard mappings? Can you send us some code using Pastie?

You shouldn't have to specify to load the global inputs, so there's definitely a bug there.

Also, I noticed that you have a src/input dir. This should be src/inputs. We just recently made some fixes to enforce this. I wonder if that's part of the problem we're experiencing?

I'll test out our feature demo project again, which does have some mouse support just to make sure it's still working.

And finally, the Gitorious repo is something Jay recently put back to use so we can have a backup. We're trying to shrink the size of the main repo so folks won't have an 800 meg download from all of the jars we've swapped out and several games with data files in them. Our canonical repositories are hosted on Kenai right now. You can see them on the blue panel to the left for "Source Code Repositories".

-Logan

 
Posted: October 22, 2009 00:26 by ltmon
Changing my src/input directory to src/inputs gets the following:


jemini/managers/input_manager.rb:127:in `require': no such file to load -- input/global_input (LoadError)


The jemini project creatoin script created something different to a single "src/input" directory: src/input_maps and src/input_helpers if I recall correctly. I had to make the src/input directory myself in order to prevent the above error.

There seems to be two distinct input declaring styles in the example apps, I am using the one shown on this wiki (and which I believe is most current): http://kenai.com/projects/jemini/pages/InputMapping

My entire input declarations are shown at http://pastie.org/664451. As you can see, exceptionally simple as this is just a skeleton test to demonstrate the problem.

The global_input.rb file is certainly included automatically without the explicit declaration. All keyboard mappings that I define there work without a hitch. However no mouse events at all are generated. I followed this through in the Jemini code, verifying that the SlickInputListener was definitely receiving mouse events. However, these events were not being queued in the MainState's queue manager as there was nothing registered to listen for them. The mouse events started being propagated onto the message queue as soon as I explicitly declared whatever input file contained my mappings (in this case global, but I am able to move them into (e.g.) input/mouse_listener.rb and use that instead or as well).

FYI, the pointer behaviour is broken. I will try and give you a fixed version when I understand the input mapping properly Smile

I'll start using the kenai repo when I have another play around tonight.

Thanks again,

L.
 
Posted: October 22, 2009 08:29 by jaymcgavren
Hi, ltmon, and thanks for your patience during our state of transition. Yes, the input mapping style from the wiki is the current/correct one. We're still working to get all the example games caught up with our API changes. Life-Tank will (almost) always be the most current, so look there first.


i.in_order_to :mouse_move do
i.move :mouse
end


I'm afraid I'm not up to speed on where Logan is with mouse input, but I do note that your block doesn't take an |i| parameter; it probably should.

Pointer is indeed broken; I thought there was an issue filed on it but I guess not. Just added one, though it could use some detail.
 
Posted: October 22, 2009 14:57 by Logan Barnett

Jay, Due to a 1.8 quirk, if we added in |i| for the in_order_to block, it would override i from here on out. You shouldn't need |i| everywhere, or it would be pretty destructive with the syntax we favor.

Pointer needs some love. I want to use Slick's hardware cursor wrappers it has that look pretty simple. Anyone is welcome to work on that. I was considering MouseCursor as the new game object name. Thoughts?

Luke, Did you pull from the Kenai source? I just verified that our code on the head of master is using 'inputs' instead of 'input'. That difference in and of itself my be trivial, but we've made some fixes (particularly to the loading of input) since that backup was created on gitorious.

 
Posted: October 23, 2009 01:21 by ltmon
Hi again,

I'm now using the source from kenai, and that has made "src/input" now be "src/inputs".

Other behavior has not changed: I still need to "use_input :global" to get mouse events propagating.

I did miss the |i| in my mouse input mapper, but adding it makes no difference.

I agree that wrapping the slick cursor for cursor handling would be a better idea than a GameObject (what I am using now).

Cheers,

L.
 
Posted: October 24, 2009 06:46 by Logan Barnett

I couldn't get your use_input :global to work, but my test app only had one state. You may have many?

I was able to produce the bug, and now it's fixed and on head. Give it a spin!

Thanks for the feedback, Luke (:

 
Posted: October 24, 2009 06:52 by Logan Barnett

I forgot. You'll need to build a new Jemini jar and copy it into your project's lib/java dir.

  • jrake -S rawr:clean
  • jrake -S rawr:jar

Find the jemini.jar in package/jar.

 
Posted: October 25, 2009 00:29 by ltmon
This worked fine, thanks. The mouse events are now propagated in the default global input.

Although everything seems to work fine, I do get a lot of:

Failed to poll device: Failed to read next device event (9)

logged.
 
Posted: October 26, 2009 03:39 by Logan Barnett

What do your input files look like? Can you send some pasties (or whatever service you prefer)?

 
Posted: October 28, 2009 02:15 by Logan Barnett

We now have hardware cursor support: http://kenai.com/projects/jemini/pages/Recipies

showing 1 - 12 of 12
Replies: 11 - Last Post: October 28, 2009 02:15
by: Logan Barnett
« Older Topic » Newer Topic
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close