MCPcopy Create free account
hub / github.com/Card-Forge/forge / setCursor

Method setCursor

forge-gui-mobile/src/forge/Forge.java:460–539  ·  view source on GitHub ↗
(TextureRegion textureRegion, String name)

Source from the content-addressed store, hash-verified

458 }
459
460 public static void setCursor(TextureRegion textureRegion, String name) {
461 if (GuiBase.isAndroid())
462 return;
463 if (isMobileAdventureMode) {
464 if (cursorA0 != null && Objects.equals(name, "0")) {
465 setGdxCursor(cursorA0);
466 return;
467 } else if (cursorA1 != null && Objects.equals(name, "1")) {
468 setGdxCursor(cursorA1);
469 return;
470 } else if (cursorA2 != null && Objects.equals(name, "2")) {
471 setGdxCursor(cursorA2);
472 return;
473 }
474
475 String path = "skin/cursor" + name + ".png";
476 Pixmap pm = new Pixmap(Config.instance().getFile(path));
477
478 if ("0".equals(name)) {
479 cursorA0 = Gdx.graphics.newCursor(pm, 0, 0);
480 setGdxCursor(cursorA0);
481 } else if ("1".equals(name)) {
482 cursorA1 = Gdx.graphics.newCursor(pm, 0, 0);
483 setGdxCursor(cursorA1);
484 } else {
485 cursorA2 = Gdx.graphics.newCursor(pm, 0, 0);
486 setGdxCursor(cursorA2);
487 }
488
489 pm.dispose();
490 return;
491 }
492 if (!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ENABLE_MAGNIFIER) && !"0".equals(name))
493 return; //don't change if it's disabled
494 if (currentScreen != null && !currentScreen.toString().toLowerCase().contains("match") && !"0".equals(name))
495 return; // cursor indicator should be during matches
496 if (textureRegion == null) {
497 return;
498 }
499 if (cursor0 != null && "0".equals(name)) {
500 setGdxCursor(cursor0);
501 return;
502 } else if (cursor1 != null && "1".equals(name)) {
503 setGdxCursor(cursor1);
504 return;
505 } else if (cursor2 != null && "2".equals(name)) {
506 setGdxCursor(cursor2);
507 return;
508 }
509 TextureData textureData = textureRegion.getTexture().getTextureData();
510 if (!textureData.isPrepared()) {
511 textureData.prepare();
512 }
513 Pixmap pm = new Pixmap(
514 textureRegion.getRegionWidth(),
515 textureRegion.getRegionHeight(),
516 textureData.getFormat()
517 );

Callers 13

openAdventureMethod · 0.95
openScreenMethod · 0.95
switchToClassicMethod · 0.95
startArenaMethod · 0.95
beginDuelMethod · 0.95
onActingMethod · 0.95
loadFullMethod · 0.95
finishGameMethod · 0.95
AdventureWinLoseMethod · 0.95
actionOnQuitMethod · 0.95
selectMethod · 0.95
touchUpMethod · 0.95

Calls 15

isAndroidMethod · 0.95
setGdxCursorMethod · 0.95
instanceMethod · 0.95
getPreferencesMethod · 0.95
getPrefBooleanMethod · 0.80
isPreparedMethod · 0.80
disposeMethod · 0.65
containsMethod · 0.65
equalsMethod · 0.45
getFileMethod · 0.45
toStringMethod · 0.45
getTextureMethod · 0.45

Tested by

no test coverage detected