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

The following examples show how to use org.lwjgl.input.Mouse#isCreated() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
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
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
@Override
public void setInputListener(RawInputListener listener) {
    this.listener = listener;
    if (listener != null && Mouse.isCreated()) {
        sendFirstMouseEvent();
    }
}
 
Example 4
/**
 * 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
public final static void setCursorPosition(int x, int y) {
	if (Mouse.isCreated() && !LocalEventQueue.getQueue().getDeterministic().isPlayback())
		Mouse.setCursorPosition(x, y);
}
 
Example 6
private static void resetCursorPos() {
	setCursorPosition(LocalInput.getMouseX(), LocalInput.getMouseY());
	// clear event queue
	while (Mouse.isCreated() && Mouse.next());
}
 
Example 7
@Override
public boolean isInitialized(){
    return Mouse.isCreated();
}
 
Example 8
public boolean isInitialized(){
    return Mouse.isCreated();
}