how do i make mouse like in common strategy games?
i mean i want to select a object from screen with mouse,but the problem is how do i make the mouse visible? and movable?
i have implemented MouseHandler class that extends InputHandler
my setMouse is like this
RelativeMouse mouse = new RelativeMouse("Mouse Input");
mouse.setMouseInput(InputSystem.getMouseInput());
mouse.getMouseInput().setCursorVisible(true);
setMouse(mouse);
and i add cursor like this in SimpleInitGame()
TextureState cursor = display.getRenderer().getTextureState();
cursor.setEnabled(true);
cursor.setTexture(
TextureManager.loadTexture(
Main.class.getClassLoader().getResource("data/cursor/test.png"),
Texture.MM_LINEAR, Texture.FM_LINEAR, true
)
);
mouse = input.getMouse();
input.getMouse().setRenderState(cursor);
input.getMouse().setMouseInput(InputSystem.getMouseInput());
AlphaState as1 = display.getRenderer().getAlphaState();
as1.setBlendEnabled(true);
as1.setSrcFunction(AlphaState.SB_ONE);
as1.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_COLOR);
as1.setTestEnabled(true);
as1.setTestFunction(AlphaState.TF_GREATER);
input.getMouse().setRenderState(as1);
rootNode.attachChild(input.getMouse());
but the mouse cursor is stuck at left(down) in screen,
and if i move mouse,the cursor moves few millimeters and returns back to starting position