Package org.lwjgl.input

Examples of org.lwjgl.input.Cursor


      int yspot = imageData.getHeight() - y - 1;
      if (yspot < 0) {
        yspot = 0;
      }
     
      return new Cursor(imageData.getTexWidth(), imageData.getTexHeight(), x, yspot, 1, buf.asIntBuffer(), null);
    } catch (Throwable e) {
      Log.info("Chances are you cursor is too small for this platform");
      throw new LWJGLException(e);
    }
  }
View Full Code Here


    try {
      int yspot = height - y - 1;
      if (yspot < 0) {
        yspot = 0;
      }
      return new Cursor(width,height, x, yspot, 1, buf.asIntBuffer(), null);
    } catch (Throwable e) {
      Log.info("Chances are you cursor is too small for this platform");
      throw new LWJGLException(e);
    }
  }
View Full Code Here

    try {
      int yspot = imageData.getHeight() - y - 1;
      if (yspot < 0) {
        yspot = 0;
      }
      return new Cursor(imageData.getTexWidth(), imageData.getTexHeight(), x, yspot, 1, buf.asIntBuffer(), null);
    } catch (Throwable e) {
      Log.info("Chances are you cursor is too small for this platform");
      throw new LWJGLException(e);
    }
  }
View Full Code Here

    cursorDelaysBuffer.flip();

    LoadableImageData imageData = new TGAImageData();
    ByteBuffer buf = imageData.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
         
    return new Cursor(width, height, x, y, cursorDelays.length, buf.asIntBuffer(), cursorDelaysBuffer);
  }
View Full Code Here

    @MainThread
    public void setCursor(final MouseCursor cursor) {
        init();

        try {
            final Cursor lwjglCursor = createLwjglCursor(cursor);

            if (lwjglCursor == null || !lwjglCursor.equals(Mouse.getNativeCursor())) {
                Mouse.setNativeCursor(lwjglCursor);
            }
        } catch (final LWJGLException e) {
            throw new RuntimeException("Unable to set cursor", e);
        }
View Full Code Here

                imageDataCopy.put(index, (a << 24) | (r << 16) | (g << 8) | b);
            }
        }

        return new Cursor(imageWidth, imageHeight, cursor.getHotspotX(), cursor.getHotspotY(), 1, imageDataCopy, null);
    }
View Full Code Here

  public MouseCursor createMouseCursor(final String filename, final int hotspotX, final int hotspotY) throws IOException {
    return new LwjglMouseCursor(loadMouseCursor(filename, hotspotX, hotspotY));
  }

  public void enableMouseCursor(final MouseCursor mouseCursor) {
    Cursor nativeCursor = null;
    if (mouseCursor != null) {
      nativeCursor = ((LwjglMouseCursor) mouseCursor).getCursor();
    }
    try {
      Mouse.setNativeCursor(nativeCursor);
View Full Code Here

    ByteBuffer imageData = imageLoader.loadMouseCursorImage(ResourceLoader.getResourceAsStream(name));
    imageData.rewind();
    int width = imageLoader.getWidth();
    int height = imageLoader.getHeight();
    try {
      return new Cursor(width, height, hotspotX, height - hotspotY - 1, 1, imageData.asIntBuffer(), null);
    } catch (LWJGLException e) {
      throw new IOException(e);
    }
  }
View Full Code Here

   * @throws SlickException Indicates a failure to load the image or a failure to create the hardware cursor
   */
  public void setAnimatedMouseCursor(String ref, int x, int y, int width, int height, int[] cursorDelays) throws SlickException
  {
    try {
      Cursor cursor;
      cursor = CursorLoader.get().getAnimatedCursor(ref, x, y, width, height, cursorDelays);
      setMouseCursor(cursor, x, y);
    } catch (IOException e) {
      throw new SlickException("Failed to set mouse cursor", e);
    } catch (LWJGLException e) {
View Full Code Here

 
  @Override
  public void init() {
    initGL();
        try {
            Cursor cursor = (CursorLoader.get()).getCursor("res/cursor.png",8,8);
      Mouse.setNativeCursor(cursor);
    } catch (Exception e) {
      e.printStackTrace();
    }
        drawLevel();
View Full Code Here

TOP

Related Classes of org.lwjgl.input.Cursor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.