StandardGame FengGUI no mouse

Hi,



I've been playing around with StandardGame and FengGUI using the FengGUI tutorial and managed to get it to work. But I loose the mouse cursor as soon as the window loads so I can't click on any FengFUI widgets  :cry:



I'm calling MouseInput.get().setCursorVisible(true). I've tried changing the mouse provider to AWT, this kinda works! I can see the mouse but I can't click on any FengGUI widgets still!



Thanks

You're right, it does default to turn the mouse cursor off, so you need to manually set the mouse cursor on after you've called game.start().

Thanks, its working now  :slight_smile:

Make sure you're calling setCursorVisible(true) in the OpenGL thread…this can cause wacky issues if you don't.

In StandardGame it used to/does override the mouse and sets it to false.



Thats your prob…  you should take a good long look at StandardGame so that you understand how it works well, threading can be tricky.

wolfgang said:

Thanks, its working now  :)


I couldnt get it works really  :'(  Could you show me how ?
Here is what I have done


public class MyGame {
   
   public static void main(String[] args) throws Exception {

      StandardGame myGame = new StandardGame("Test");

      myGame.getSettings().setWidth(800);
      myGame.getSettings().setHeight(800);

      myGame.start();

      //WHY IT DOESNT WORK !!!


      MouseInput.get().setCursorVisible(true);

      MainMenuState mainMenu = new MainMenuState("MainMenu", myGame
            .getSettings());

      GameStateManager.getInstance().attachChild(mainMenu);

      mainMenu.setActive(true);
      }
   }

hiya,

as Darkfrog said, you need to execute this call inside the OpenGl thread.

To do this, you create a callable object and insert it into the GameTaskQueue:



        .....
        myGame.start();

        Callable < ? > exe = new Callable() {
            public Object call() {
                MouseInput.get().setCursorVisible(true);
                return null;
            }
        };
        GameTaskQueueManager.getManager().getQueue(GameTaskQueue.RENDER).enqueue(exe);

Core-Dump said:

hiya,
as Darkfrog said, you need to execute this call inside the OpenGl thread.
To do this, you create a callable object and insert it into the GameTaskQueue:


        .....
        myGame.start();

        Callable < ? > exe = new Callable() {
            public Object call() {
                MouseInput.get().setCursorVisible(true);
                return null;
            }
        };
        GameTaskQueueManager.getManager().getQueue(GameTaskQueue.RENDER).enqueue(exe);




Yes, it works. Thanks heaps  XD