Exemplo n.º 1
0
  @SuppressWarnings("OverridableMethodCallInConstructor")
  public LWJGLRenderer() throws LWJGLException {
    this.ib16 = BufferUtils.createIntBuffer(16);
    this.textureAreas = new ArrayList<TextureArea>();
    this.rotatedTextureAreas = new ArrayList<TextureAreaRotated>();
    this.dynamicImages = new ArrayList<LWJGLDynamicImage>();
    this.tintStateRoot = new TintStack();
    this.tintStack = tintStateRoot;
    this.clipStack = new ClipStack();
    this.clipRectTemp = new Rect();
    syncViewportSize();

    GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE, ib16);
    maxTextureSize = ib16.get(0);

    if (Mouse.isCreated()) {
      int minCursorSize = Cursor.getMinCursorSize();
      IntBuffer tmp = BufferUtils.createIntBuffer(minCursorSize * minCursorSize);
      emptyCursor =
          new Cursor(
              minCursorSize, minCursorSize, minCursorSize / 2, minCursorSize / 2, 1, tmp, null);
    } else {
      emptyCursor = null;
    }

    swCursorAnimState = new SWCursorAnimState();
  }
Exemplo n.º 2
0
  public void initialize() {
    if (!context.isRenderable()) return;

    try {
      Mouse.create();
      logger.fine("Mouse created.");
      supportHardwareCursor = (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0;

      // Recall state that was set before initialization
      Mouse.setGrabbed(!cursorVisible);
    } catch (LWJGLException ex) {
      logger.log(Level.SEVERE, "Error while creating mouse", ex);
    }
  }
Exemplo n.º 3
0
  public LWJGLCursorFactory() {
    setDefaultCursor(new LWJGLCursor(Mouse.getNativeCursor()));

    try {
      IntBuffer ib =
          convertMask(
              enlargeMask(TEXT_CURSOR, Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize()));
      setTextCursor(
          new LWJGLCursor(
              new Cursor(
                  Cursor.getMaxCursorSize(),
                  Cursor.getMaxCursorSize(),
                  3,
                  TEXT_CURSOR.length - 7,
                  1,
                  ib,
                  null)));

      ib =
          convertMask(
              enlargeMask(
                  HORIZONTAL_RESIZE_CURSOR, Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize()));
      setHorizontalResizeCursor(
          new LWJGLCursor(
              new Cursor(
                  Cursor.getMaxCursorSize(),
                  Cursor.getMaxCursorSize(),
                  9,
                  HORIZONTAL_RESIZE_CURSOR.length - 4,
                  1,
                  ib,
                  null)));

      ib =
          convertMask(
              enlargeMask(
                  VERTICAL_RESIZE_CURSOR, Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize()));
      setVerticalResizeCursor(
          new LWJGLCursor(
              new Cursor(
                  Cursor.getMaxCursorSize(),
                  Cursor.getMaxCursorSize(),
                  4,
                  VERTICAL_RESIZE_CURSOR.length - 11,
                  1,
                  ib,
                  null)));

      ib =
          convertMask(
              enlargeMask(NW_RESIZE_CURSOR, Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize()));
      setNWResizeCursor(
          new LWJGLCursor(
              new Cursor(
                  Cursor.getMaxCursorSize(),
                  Cursor.getMaxCursorSize(),
                  7,
                  NW_RESIZE_CURSOR.length - 7,
                  1,
                  ib,
                  null)));

      ib =
          convertMask(
              enlargeMask(SW_RESIZE_CURSOR, Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize()));
      setSWResizeCursor(
          new LWJGLCursor(
              new Cursor(
                  Cursor.getMaxCursorSize(),
                  Cursor.getMaxCursorSize(),
                  7,
                  SW_RESIZE_CURSOR.length - 7,
                  1,
                  ib,
                  null)));

      ib =
          convertMask(
              enlargeMask(HAND_CURSOR, Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize()));
      setHandCursor(
          new LWJGLCursor(
              new Cursor(
                  Cursor.getMaxCursorSize(),
                  Cursor.getMaxCursorSize(),
                  5,
                  HAND_CURSOR.length - 1,
                  1,
                  ib,
                  null)));

      ib =
          convertMask(
              enlargeMask(MOVE_CURSOR, Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize()));
      setMoveCursor(
          new LWJGLCursor(
              new Cursor(
                  Cursor.getMaxCursorSize(),
                  Cursor.getMaxCursorSize(),
                  10,
                  MOVE_CURSOR.length - 10,
                  1,
                  ib,
                  null)));

      ib =
          convertMask(
              enlargeMask(FORBIDDEN_CURSOR, Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize()));
      setMoveCursor(
          new LWJGLCursor(
              new Cursor(Cursor.getMaxCursorSize(), Cursor.getMaxCursorSize(), 3, 3, 1, ib, null)));
    } catch (final LWJGLException e) {
      e.printStackTrace();
    }
  }