(TextureRegion textureRegion, String name)
| 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 | ); |
no test coverage detected