@Override public void simpleUpdate(float tpf) { long currentTime = System.currentTimeMillis(); if (currentTime - sysTime > 8000) { count++; if (count >= cursors.size()) { count = 0; } sysTime = currentTime; // 8 seconds have passed, // tell jME3 to swith to a different cursor. inputManager.setMouseCursor(cursors.get(count)); } } }
@Override public void simpleInitApp() { flyCam.setEnabled(false); // We need the cursor to be visible. If it is not visible the cursor // will still be "used" and loaded, you just won't see it on the screen. inputManager.setCursorVisible(true); /* * To make jME3 use a custom cursor it is as simple as putting the * .cur/.ico/.ani file in an asset directory. Here we use * "Textures/GUI/Cursors". * * For the purpose of this demonstration we load 3 different cursors and add them * into an array list and switch cursor every 8 seconds. * * The first ico has been made by Sirea and the set can be found here: * http://www.rw-designer.com/icon-set/nyan-cat * * The second cursor has been made by Virum64 and is Public Domain. * http://www.rw-designer.com/cursor-set/memes-faces-v64 * * The animated cursor has been made by Pointer Adic and can be found here: * http://www.rw-designer.com/cursor-set/monkey */ cursors.add((JmeCursor) assetManager.loadAsset("Textures/Cursors/meme.cur")); cursors.add((JmeCursor) assetManager.loadAsset("Textures/Cursors/nyancat.ico")); cursors.add((JmeCursor) assetManager.loadAsset("Textures/Cursors/monkey.ani")); sysTime = System.currentTimeMillis(); inputManager.setMouseCursor(cursors.get(count)); }
protected void updateCursor() { keeperHand.setVisible(false); if (Main.getUserSettings().getSettingBoolean(Settings.Setting.USE_CURSORS)) { if (isOnGui || isInteractable || interactionState.getType() == Type.SPELL) { inputManager.setMouseCursor(CursorFactory.getCursor(CursorFactory.CursorType.POINTER, assetManager)); } else if (selectionHandler.isActive() && isTaggable) { inputManager.setMouseCursor(CursorFactory.getCursor(CursorFactory.CursorType.HOLD_PICKAXE_TAGGING, assetManager)); } else if (isTaggable) { inputManager.setMouseCursor(CursorFactory.getCursor(CursorFactory.CursorType.HOLD_PICKAXE, assetManager)); } else if (keeperHand.getItem() != null) { // Keeper hand item inputManager.setMouseCursor(CursorFactory.getCursor(keeperHand.getItem().getInHandCursor(), assetManager)); keeperHand.setVisible(true); } else { inputManager.setMouseCursor(CursorFactory.getCursor(CursorFactory.CursorType.IDLE, assetManager)); } } else if (keeperHand.getItem() != null) { keeperHand.setVisible(true); } }
/** * Initialize the start menu, sets the menu scene in place & sets the * controls and start screen */ private void initializeMainMenu() { // Set the processors & scene MainMenuState.this.app.setViewProcessors(); rootNode.attachChild(menuNode); app.enqueue(() -> { // Start screen, do this here since another state may have just changed to empty screen -> have to do it like this, delayed MainMenuState.this.screen.goToScreen(MainMenuScreenController.SCREEN_START_ID); return null; }); // Enable cursor app.getInputManager().setCursorVisible(true); if (Main.getUserSettings().getSettingBoolean(Settings.Setting.USE_CURSORS)) { app.getInputManager().setMouseCursor(CursorFactory.getCursor(CursorFactory.CursorType.POINTER, assetManager)); } // Set the camera position loadCameraStartLocation(); }
inputManager.setMouseCursor(CursorFactory.getCursor(CursorFactory.CursorType.POINTER, assetManager));