No mouse cursor

hello all,



i have looking for many topic for found my answer but it not answer at my trouble and many topics i found talke about old class who doesnt exist anymore like AbsoluteMouse.



i havnt got any cursor of my mouse anywhere , no cursor un 3d render et no cursor by nifty’s menu.



i want to know the different’s way to get one and the best way for get a cursor in nifty gui (if they are many way)

cause for the moment the only cursor i can see is the default windows’s cursor when i put the command :

Engine.APP.getInputManager().setCursorVisible(true);

ok… no reply at simple question thanks.

if i get Contributor behind my nickname , this can help me to get an answer ???

cause it’s seems they are not support here… i’m little pissed off to fight alone for discover class to use or class to not use than the tuto said !

a quick forum search gave this :

http://hub.jmonkeyengine.org/groups/gui/forum/topic/set-native-cursor-image/

yes , i saw this one , i saw many topic on this forum about this , don’t think i post without search before.



but it’s not answer to my question.



is there a best way for manage a cursor in 3d render and in nifty gui ? or use default native cursor is same result ?

in simpleInitApp()



add:



inputManager.setCursorVisible(true);



That will make the mouse cursor visible.

yes i know all of this , but its not my question again,





i want to know what is the best in jmonkey or in game to have a cursor native or create class to manage it , (the best for nifty gui interact and in game 3d)

System.exit(0);

1 Like

If that’s not what you want then I give up.



http://hub.jmonkeyengine.org/groups/gui/forum/topic/set-native-cursor-image/



If it is, I found it using search…

Create a quad, texture it with the picture of your mouse pointer, put it in the guiNode. You may have to offset its position a bit so that the pointers position match.



implement RawInputListener and on the onMouseMotionEvent set the local translation of the quad to event.getX(), event.getY(),0

then do inputManager.addRawInputListener(yourListener)



here is a basic example with a BitmapText as pointer

[java]

import com.jme3.app.SimpleApplication;

import com.jme3.font.BitmapText;

import com.jme3.input.RawInputListener;

import com.jme3.input.event.JoyAxisEvent;

import com.jme3.input.event.JoyButtonEvent;

import com.jme3.input.event.KeyInputEvent;

import com.jme3.input.event.MouseButtonEvent;

import com.jme3.input.event.MouseMotionEvent;

import com.jme3.input.event.TouchEvent;



/**

*

  • @author Nehon

    */

    public class CustomMousePointer extends SimpleApplication implements RawInputListener {



    private BitmapText cursor;



    public static void main(String[] args) {

    CustomMousePointer app = new CustomMousePointer();

    app.start();

    }



    @Override

    public void simpleInitApp() {



    guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");

    cursor = new BitmapText(guiFont, false);

    cursor.setSize(guiFont.getCharSet().getRenderedSize());

    cursor.setText("->");

    cursor.setLocalTranslation(0, 0, 0);

    guiNode.attachChild(cursor);



    inputManager.addRawInputListener(this);

    inputManager.setCursorVisible(false);



    }



    public void beginInput() {

    }



    public void endInput() {

    }



    public void onJoyAxisEvent(JoyAxisEvent evt) {

    }



    public void onJoyButtonEvent(JoyButtonEvent evt) {

    }



    public void onMouseMotionEvent(MouseMotionEvent evt) {

    cursor.setLocalTranslation(evt.getX(), evt.getY(), 0);

    }



    public void onMouseButtonEvent(MouseButtonEvent evt) {

    }



    public void onKeyEvent(KeyInputEvent evt) {

    }



    public void onTouchEvent(TouchEvent evt) {

    }

    }

    [/java]

yep i tried this solution , it’s work fine , but after this how can i have an interaction with all GUI ?

(should i looking for position of my cursor when a mouseEvent is activated and search if it’s on gui component ? )

Yeah this can’t work with Nifty, i’m sorry.

But it seems Nifty has its own way of doing it check the comment on this bug report

http://sourceforge.net/tracker/index.php?func=detail&aid=3024993&group_id=223898&atid=1059825

that’s available in Nifty 1.3

Its available in nifty but not implemented in jme3

it’s available in nifty 1.3 ?

on bug report’s comment i can see how they did in XML but do you know if it’s support by nifty java builder ?

nobody know if it’s support by nifty java builder or not ?



cause nifty doc is poor.