com.badlogic.gdx.Graphics.setSystemCursor()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中com.badlogic.gdx.Graphics.setSystemCursor()方法的一些代码示例,展示了Graphics.setSystemCursor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics.setSystemCursor()方法的具体详情如下:
包路径:com.badlogic.gdx.Graphics
类名称:Graphics
方法名:setSystemCursor

Graphics.setSystemCursor介绍

[英]Sets one of the predefined SystemCursors
[中]设置一个预定义的系统游标

代码示例

代码示例来源:origin: kotcrab/vis-ui

private void setCustomCursor () {
  Cursor.SystemCursor targetCursor;
  if (vertical) {
    targetCursor = Cursor.SystemCursor.VerticalResize;
  } else {
    targetCursor = Cursor.SystemCursor.HorizontalResize;
  }
  if (currentCursor != targetCursor) {
    Gdx.graphics.setSystemCursor(targetCursor);
    currentCursor = targetCursor;
  }
}

代码示例来源:origin: kotcrab/vis-ui

@Override
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
  super.enter(event, x, y, pointer, fromActor);
  Gdx.graphics.setSystemCursor(SystemCursor.Hand);
}

代码示例来源:origin: kotcrab/vis-ui

/** Restores currently used cursor to default one. */
  public static void restoreDefaultCursor () {
    if (systemCursorAsDefault) {
      Gdx.graphics.setSystemCursor(defaultSystemCursor);
    } else {
      Gdx.graphics.setCursor(defaultCursor);
    }
  }
}

代码示例来源:origin: mbrlabs/Mundus

@Override
  public boolean mouseMoved(InputEvent event, float x, float y) {
    if (getHandleContaining(x, y) != null) {
      if (vertical) {
        targetCursor = Cursor.SystemCursor.VerticalResize;
      } else {
        targetCursor = Cursor.SystemCursor.HorizontalResize;
      }
      if (currentCursor != targetCursor) {
        Gdx.graphics.setSystemCursor(targetCursor);
        currentCursor = targetCursor;
      }
    } else {
      if (currentCursor != null) {
        CursorManager.restoreDefaultCursor();
        currentCursor = null;
      }
    }
    return false;
  }
});

代码示例来源:origin: kotcrab/vis-ui

@Override
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
  super.enter(event, x, y, pointer, fromActor);
  if (pointer == -1 && isDisabled() == false) {
    Gdx.graphics.setSystemCursor(SystemCursor.Ibeam);
  }
}

代码示例来源:origin: langurmonkey/gaiasky

@Override
protected void accept() {
  boolean first = true;
  // Update setting
  if (dw != null && dw.cbs != null) {
    GlobalConf.data.CATALOG_JSON_FILES = "";
    for (Button b : dw.cbs) {
      if (b.isChecked()) {
        // Add all selected to list
        String candidate = dw.candidates.get(b);
        if (!first) {
          GlobalConf.data.CATALOG_JSON_FILES += "," + candidate;
        } else {
          GlobalConf.data.CATALOG_JSON_FILES += candidate;
          first = false;
        }
      }
    }
  }
  // No change to execute exit event, manually restore cursor to default
  Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
  // Data load can start
  EventManager.instance.post(Events.LOAD_DATA_CMD);
}

代码示例来源:origin: mbrlabs/Mundus

@Override
  public boolean mouseMoved(InputEvent event, float x, float y) {
    if (handleBounds.contains(x, y)) {
      if (vertical) {
        targetCursor = Cursor.SystemCursor.VerticalResize;
      } else {
        targetCursor = Cursor.SystemCursor.HorizontalResize;
      }
      if (currentCursor != targetCursor) {
        Gdx.graphics.setSystemCursor(targetCursor);
        currentCursor = targetCursor;
      }
    } else {
      if (currentCursor != null) {
        CursorManager.restoreDefaultCursor();
        currentCursor = null;
      }
    }
    return false;
  }
});

代码示例来源:origin: langurmonkey/gaiasky

@Override
  public boolean handle(Event event) {
    if (event instanceof InputEvent) {
      Type type = ((InputEvent) event).getType();
      // Click
      if (type == Type.enter) {
        Gdx.graphics.setCursor(Gdx.graphics.newCursor(GlobalResources.linkCursor, 4, 0));
      } else if (type == Type.exit) {
        Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
      }
      return true;
    }
    return false;
  }
});

代码示例来源:origin: langurmonkey/gaiasky

@Override
  public boolean handle(Event event) {
    if (event instanceof InputEvent) {
      Type type = ((InputEvent) event).getType();
      if (type == Type.enter) {
        if (!me.isDisabled())
          Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursor, 4, 0));
        return true;
      } else if (type == Type.exit) {
        Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
        return true;
      }
    }
    return false;
  }
});

代码示例来源:origin: langurmonkey/gaiasky

@Override
  public boolean handle(Event event) {
    if (event instanceof InputEvent) {
      Type type = ((InputEvent) event).getType();
      if (type == Type.enter) {
        if (!me.isDisabled())
          Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursor != null ? cursor : GlobalResources.linkCursor, 4, 0));
        return true;
      } else if (type == Type.exit) {
        Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
        return true;
      }
    }
    return false;
  }
});

代码示例来源:origin: langurmonkey/gaiasky

@Override
  public boolean handle(Event event) {
    if (event instanceof InputEvent) {
      Type type = ((InputEvent) event).getType();
      // Click
      if (type == Type.touchUp && ((InputEvent) event).getButton() == Buttons.LEFT) {
        Gdx.net.openURI(linkURL);
      } else if (type == Type.enter) {
        Gdx.graphics.setCursor(Gdx.graphics.newCursor(GlobalResources.linkCursor, 4, 0));
      } else if (type == Type.exit) {
        Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
      }
      return true;
    }
    return false;
  }
});

代码示例来源:origin: langurmonkey/gaiasky

private void addDownloaderWindow() {
  if (ddw == null) {
    ddw = new DownloadDataWindow(ui, skin);
    ddw.setAcceptRunnable(() -> {
      Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
      displayChooser();
    });
    ddw.setCancelRunnable(() -> {
      Gdx.app.exit();
    });
  }
  ddw.show(ui);
}

代码示例来源:origin: langurmonkey/gaiasky

private void initialize(Skin skin) {
    this.addListener(event -> {
      if (event instanceof InputEvent) {
        InputEvent.Type type = ((InputEvent) event).getType();
        // Click
        if (type == InputEvent.Type.touchUp && ((InputEvent) event).getButton() == Input.Buttons.LEFT) {
          Gdx.net.openURI(linkURL);
        } else if (type == InputEvent.Type.enter) {
          Gdx.graphics.setCursor(Gdx.graphics.newCursor(GlobalResources.linkCursor, 4, 0));
        } else if (type == InputEvent.Type.exit) {
          Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
        }
        return true;
      }
      return false;
    });

    this.addListener(new OwnTextTooltip(linkURL, skin, 10));
  }
}

相关文章