Java Code Examples for org.lwjgl.input.Mouse#isCreated()

The following examples show how to use org.lwjgl.input.Mouse#isCreated() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LwjglCanvas.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void pauseCanvas(){
    if (Mouse.isCreated()){
        if (Mouse.isGrabbed()){
            Mouse.setGrabbed(false);
            mouseWasGrabbed = true;
        }
        mouseWasCreated = true;
        Mouse.destroy();
    }
    if (Keyboard.isCreated()){
        keyboardWasCreated = true;
        Keyboard.destroy();
    }

    renderable.set(false);
    destroyContext();
}
 
Example 2
Source File: LwjglCanvas.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void pauseCanvas(){
    if (Mouse.isCreated()){
        if (Mouse.isGrabbed()){
            Mouse.setGrabbed(false);
            mouseWasGrabbed = true;
        }
        mouseWasCreated = true;
        Mouse.destroy();
    }
    if (Keyboard.isCreated()){
        keyboardWasCreated = true;
        Keyboard.destroy();
    }

    renderable.set(false);
    destroyContext();
}
 
Example 3
Source File: LwjglMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void setInputListener(RawInputListener listener) {
    this.listener = listener;
    if (listener != null && Mouse.isCreated()) {
        sendFirstMouseEvent();
    }
}
 
Example 4
Source File: SeventhGame.java    From seventh with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hide the Mouse cursor
 * 
 * @param visible
 */
private void setHWCursorVisible(boolean visible) {
    if (Gdx.app.getType() != ApplicationType.Desktop && Gdx.app instanceof LwjglApplication) {
        return;
    }

    try {
        /* make sure the mouse doesn't move off the screen */
        seventh.client.gfx.Cursor cursor = this.uiManager.getCursor();
        cursor.setClampEnabled(config.getVideo().isFullscreen());
        Gdx.input.setCursorCatched(config.getVideo().isFullscreen());
        
        //Gdx.input.setCursorCatched(true);
        //Gdx.input.setCursorPosition(getScreenWidth()/2, getScreenHeight()/2);
        
        Cursor emptyCursor = null;
        if (Mouse.isCreated()) {
            int min = org.lwjgl.input.Cursor.getMinCursorSize();
            IntBuffer tmp = BufferUtils.createIntBuffer(min * min);
            emptyCursor = new org.lwjgl.input.Cursor(min, min, min / 2, min / 2, 1, tmp, null);
        } else {
            Cons.println("Could not create empty cursor before Mouse object is created");
        }
    
        if (/*Mouse.isInsideWindow() &&*/ emptyCursor != null) {
            Mouse.setNativeCursor(visible ? null : emptyCursor);
        }
    }
    catch(LWJGLException e) {
        Cons.println("*** Unable to hide cursor: " + e);
    }
}
 
Example 5
Source File: PointerInput.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
public final static void setCursorPosition(int x, int y) {
	if (Mouse.isCreated() && !LocalEventQueue.getQueue().getDeterministic().isPlayback())
		Mouse.setCursorPosition(x, y);
}
 
Example 6
Source File: PointerInput.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
private static void resetCursorPos() {
	setCursorPosition(LocalInput.getMouseX(), LocalInput.getMouseY());
	// clear event queue
	while (Mouse.isCreated() && Mouse.next());
}
 
Example 7
Source File: LwjglMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean isInitialized(){
    return Mouse.isCreated();
}
 
Example 8
Source File: LwjglMouseInput.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public boolean isInitialized(){
    return Mouse.isCreated();
}