Package org.lwjgl.input

Examples of org.lwjgl.input.Cursor


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


        return Sys.getTime() * LwjglTimer.LWJGL_TIME_TO_NANOS;
    }

    public void setNativeCursor(JmeCursor jmeCursor) {
        try {
            Cursor newCursor = null;
            if (jmeCursor != null) {
                 newCursor = new Cursor(
                        jmeCursor.getWidth(),
                        jmeCursor.getHeight(),
                        jmeCursor.getXHotSpot(),
                        jmeCursor.getYHotSpot(),
                        jmeCursor.getNumImages(),
View Full Code Here

            pixelsARGBflipped[x + ((pixmap.getHeight() - 1 - y) * pixmap.getWidth())] = ((pixel & 0xFF) << 16) | ((pixel & 0xFF0000) >> 16) | (pixel & 0xFF00FF00);
          }
        }
      }

      Mouse.setNativeCursor(new Cursor(pixmap.getWidth(), pixmap.getHeight(), xHotspot, pixmap.getHeight() - yHotspot - 4, 1, IntBuffer.wrap(pixelsARGBflipped), null));
    } catch (LWJGLException e) {
      throw new GdxRuntimeException("Could not set cursor image.", e);
    }
  }
View Full Code Here

     * @see org.newdawn.slick.GameContainer#setMouseCursor(java.lang.String,
     *      int, int)
     */
      public void setMouseCursor(String ref, int hotSpotX, int hotSpotY) throws SlickException {
         try {
            Cursor cursor = CursorLoader.get().getCursor(ref, hotSpotX, hotSpotY);
            Mouse.setNativeCursor(cursor);
         } catch (Exception e) {
            Log.error("Failed to load and apply cursor.", e);
         }
      }
View Full Code Here

             ByteBuffer buffer = BufferUtils.createByteBuffer(temp.getWidth() * temp.getHeight() * 4);
             g.drawImage(image.getFlippedCopy(false, true), 0, 0);
             g.flush();
             g.getArea(0,0,temp.getWidth(),temp.getHeight(),buffer);
            
             Cursor cursor = CursorLoader.get().getCursor(buffer, hotSpotX, hotSpotY,temp.getWidth(),temp.getHeight());
             Mouse.setNativeCursor(cursor);
          } catch (Exception e) {
             Log.error("Failed to load and apply cursor.", e);
          }
       }
View Full Code Here

      /**
       * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
       */
      public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
         try {
            Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
            Mouse.setNativeCursor(cursor);
         } catch (Exception e) {
            Log.error("Failed to load and apply cursor.", 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

  /**
   * @see org.newdawn.slick.GameContainer#setMouseCursor(java.lang.String, int, int)
   */
  public void setMouseCursor(String ref, int hotSpotX, int hotSpotY) throws SlickException {
    try {
      Cursor cursor = CursorLoader.get().getCursor(ref, hotSpotX, hotSpotY);
      Mouse.setNativeCursor(cursor);
    } catch (Exception e) {
      Log.error("Failed to load and apply cursor.", e);
    }
  }
View Full Code Here

  /**
   * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
   */
  public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
    try {
      Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
      Mouse.setNativeCursor(cursor);
    } catch (Exception e) {
      Log.error("Failed to load and apply cursor.", e);
    }
  }
View Full Code Here

      ByteBuffer buffer = BufferUtils.createByteBuffer(temp.getWidth() * temp.getHeight() * 4);
      g.drawImage(image.getFlippedCopy(false, true), 0, 0);
      g.flush();
      g.getArea(0,0,temp.getWidth(),temp.getHeight(),buffer);
     
      Cursor cursor = CursorLoader.get().getCursor(buffer, hotSpotX, hotSpotY,temp.getWidth(),image.getHeight());
      Mouse.setNativeCursor(cursor);
    } catch (Exception e) {
      Log.error("Failed to load and apply cursor.", e);
    }
  }
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.