Custom Cursor and JMEDesktopState

I'm trying to add a custom cursor to a JMEDesktopState. I attached the cursor (AbsoluteMouse) to the rootNode, but then noticed it doesn't render (because the rootNode is not being drawn in JMEDesktopState). If I draw the cursor manually in the state's render loop it shows, but this seemed kind of kludgy and I wanted to make sure I wasn't missing something. BTW, attaching the cursor to the guiNode does render it, but it's offset out of position by about half a screen's distance.



Any advice is appreciated.

Since a few weeks ago jMEDesktopState is derived from BasicGameState and with that the root node should be rendered for you.

But there is a bug in jMEDesktop right now :frowning: because the render Method isn't calling render() from BasicGameState.



But I would think that attaching the cursor to the guiNode would be the correct way, since the guiNode is drawn in the ortho queue.



The following patch calls render from BaseGameState and also removes the creation of the rootNode in jMEDesktopState (its already created in BaseGamestate).



Index: src/com/jmex/awt/swingui/JMEDesktopState.java
===================================================================
RCS file: /cvs/jme/src/com/jmex/awt/swingui/JMEDesktopState.java,v
retrieving revision 1.8
diff -u -r1.8 JMEDesktopState.java
--- src/com/jmex/awt/swingui/JMEDesktopState.java   6 Apr 2008 18:30:46 -0000   1.8
+++ src/com/jmex/awt/swingui/JMEDesktopState.java   30 Apr 2008 05:54:16 -0000
@@ -83,8 +83,6 @@
       guiNode.setCullMode(SceneElement.CULL_NEVER);
         guiNode.setLightCombineMode(LightState.OFF);
        
-        rootNode = new Node("RootNode");
-       
         guiInput = new InputHandler();
         guiInput.setEnabled(true);
        
@@ -129,6 +127,7 @@
    }
    
    public void render(float tpf) {
+       super.render(tpf);
       DisplaySystem.getDisplaySystem().getRenderer().draw(guiNode);
    }
    

Irrisor should probably eval this first, but looks ok to me.

I didn't write JMEDesktopState (only JMEDesktop), but rootNode = new RootNode() sounds really evil to me :P, and a super call is nice, too.

Core-Dump said:

Since a few weeks ago jMEDesktopState is derived from BasicGameState and with that the root node should be rendered for you.
But there is a bug in jMEDesktop right now :( because the render Method isn't calling render() from BasicGameState.

But I would think that attaching the cursor to the guiNode would be the correct way, since the guiNode is drawn in the ortho queue.

The following patch calls render from BaseGameState and also removes the creation of the rootNode in jMEDesktopState (its already created in BaseGamestate).



Yeah, was wondering why there was no super.render(tpf). Very good. The patch fixed it. Many thanks.

Did this every get checked in? I just grabbed the stable 2.0.1 version and this problem still exists unless the above patch is applied.