Hi JME Gurus,
I have got a problem with JMECanvas and AbsoluteMouse. I know that many of you only use the fullscreen apps of JME and don't use JMECanvas within a Swing application. However, perhaps someone of you knows a solution to this problem.
My JMECanvas is somewhere in my Netbeans platform. It is not full screen. It starts somewhere at a location and has a special width and height. I got the AbsoluteMouse working primitively, what means, that there is a mouse cursor, it is updated and it also moves. The problem is, how it moves.
If I enter my JMECanvas, let's say from the left, I want the AbsoluteMouse cursor exactly where my hardware cursor has been before (of course), i.e. a continuous transfer from the hardware cursor to the AbsoluteMouse cursor. This is the first problem. The AbsoluteMouse starts anywhere. Now, when it has the "focus", it moves, but not as fast or slow as I want it to move. In other words, the pixel speed pf the hardware cursor is not correctly transformed to the speed the AbsoluteMouse has to have to follow the hardware cursor position. If I change the speed of the AbsoluteMouse, of course, it can be faster or slower. I thought that there should be an automatic 1:1 speed correlation.
The second problem is that the AbsoluteMouse suddenly stops to move in, let's say, the center of the JMECanvas what tells me that JME thinks that there is the end of the JMECanvas.
Once, I also had the problem that the y-axis has been switched. When I moved down the AbsoluteMouse moved up and vice versa but the x-axis was ok. This does not happen now anymore. Don't know why.
It's really strange. In short words: How can I program my software so that I can move the mouse cursor from the swing to the JMECanvas and vice versa as if there would be no difference?
Thanks a lot for help.
Hi JME Gurus,
Do you need the software cursor? I think using only the hardware one should be enough. I think you are mixing mouse functions for fullscreen and mouse functions for canvas.
You should be able to simply use the awt mouse events, of course you have to care for threading issues then.
thanks for fast reply.
I want to use the JME libraries using InputHandlers and so on. And, of course, I want to display the mouseCursor using a Spatial so thta I have a nice texture.
I do not really understand what you mean with "software cursor" and "hardware cursor"? I simply want to implement the AbsoluteMouse cursor like in the little tutorial. The main reason of ccourse is to use picking. If I would only use the normal mouseListeners which I add to my JMECanvas, of course, I could also program rotation, scaling and translation operations but I would not have access to picking.
Hope I explained it right now.
Why would you not have access to picking? Picking is checking the screen coords, getting world coords from that and then casting a ray from that spot. Doesnt matter where the screen coords came from, jme or awt…
The cursor you see in the window is rendered by opengl, thats the software cursor. The hardware cursor is the "normal" desktop cursor you have.
ahhh. Thank you. I got it. I can use the hardware mouse cursor and use normal picking capabilities within a MouseInputAction. Now I have got it. My problem was that I programmed the picking capabilities within a MouseListener which I added to the JMECanvas but MouseInput.get().isButtonDown(0) always returned 0. Now I understand that everything has to be handled with an InputAction which is added to an InputHandler which is added to a node.