com.megacrit.cardcrawl.helpers.FontHelper Java Examples
The following examples show how to use
com.megacrit.cardcrawl.helpers.FontHelper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WrathCardIconPatch.java From jorbs-spire-mod with MIT License | 6 votes |
@SpirePostfixPatch public static void Postfix(SingleCardViewPopup __this, SpriteBatch sb) { AbstractCard card = ReflectionUtils.getPrivateField(__this, SingleCardViewPopup.class, "card"); int wrathCount = WrathField.wrathEffectCount.get(card); if (wrathCount == 0 || card.isLocked || !card.isSeen) { return; } RenderUtils.renderAtlasRegionCenteredAt(sb, wrathIconOverlayImg, WRATH_ICON_OFFSET_X, WRATH_ICON_OFFSET_Y); String text = Integer.toString(wrathCount); BitmapFont font = FontHelper.SCP_cardEnergyFont; float x = WRATH_TEXT_OFFSET_X; if (wrathCount > 9) x -= (20 * Settings.scale); FontHelper.renderFont(sb, font, text, x, WRATH_TEXT_OFFSET_Y, WRATH_TEXT_COLOR); }
Example #2
Source File: CustomJorbsModPower.java From jorbs-spire-mod with MIT License | 6 votes |
@Override public void renderAmount(SpriteBatch sb, float x, float y, Color c) { super.renderAmount(sb, x, y, c); if (this.amount2 > 0) { if (!this.isTurnBased) { this.greenColor2.a = c.a; c = this.greenColor2; } FontHelper.renderFontRightTopAligned(sb, FontHelper.powerAmountFont, Integer.toString(this.amount2), x, y + 15.0F * Settings.scale, this.fontScale, c); } else if (this.amount2 < 0 && this.canGoNegative2) { this.redColor2.a = c.a; c = this.redColor2; FontHelper.renderFontRightTopAligned(sb, FontHelper.powerAmountFont, Integer.toString(this.amount2), x, y + 15.0F * Settings.scale, this.fontScale, c); } }
Example #3
Source File: BottledMemoryRelic.java From jorbs-spire-mod with MIT License | 6 votes |
@Override public void update() { super.update(); if (!this.cardSelected && !AbstractDungeon.gridSelectScreen.selectedCards.isEmpty()) { this.cardSelected = true; this.card = AbstractDungeon.gridSelectScreen.selectedCards.get(0); inBottleMemory.set(card, true); AbstractDungeon.getCurrRoom().phase = AbstractRoom.RoomPhase.COMPLETE; AbstractDungeon.gridSelectScreen.selectedCards.clear(); this.description = this.DESCRIPTIONS[2] + FontHelper.colorString(this.card.name, "y") + this.DESCRIPTIONS[3]; this.tips.clear(); this.tips.add(new PowerTip(this.name, this.description)); this.initializeTips(); } }
Example #4
Source File: RenderHealthBar.java From StSLib with MIT License | 6 votes |
private static void renderTempHPIconAndValue(AbstractCreature creature, SpriteBatch sb, float x, float y) { sb.setColor(Settings.GOLD_COLOR); sb.draw(StSLib.TEMP_HP_ICON, x + getPrivate(AbstractCreature.class, "BLOCK_ICON_X", Float.class) - 16.0f + creature.hb.width, y + getPrivate(AbstractCreature.class, "BLOCK_ICON_Y", Float.class) - 32.0f, 32.0f, 32.0f, 64.0f, 64.0f, Settings.scale, Settings.scale, 0.0f, 0, 0, 64, 64, false, false); FontHelper.renderFontCentered(sb, FontHelper.blockInfoFont, Integer.toString(TempHPField.tempHp.get(creature)), x + getPrivate(AbstractCreature.class, "BLOCK_ICON_X", Float.class) + 16.0f + creature.hb.width, y - 16.0f * Settings.scale, Settings.CREAM_COLOR, 1.0f); }
Example #5
Source File: TwoAmountPower.java From StSLib with MIT License | 6 votes |
@Override public void renderAmount(SpriteBatch sb, float x, float y, Color c) { super.renderAmount(sb, x, y, c); if (amount2 > 0) { if (!isTurnBased) { greenColor2.a = c.a; c = greenColor2; } FontHelper.renderFontRightTopAligned(sb, FontHelper.powerAmountFont, Integer.toString(amount2), x, y + 15 * Settings.scale, fontScale, c); } else if (amount2 < 0 && canGoNegative2) { redColor2.a = c.a; c = redColor2; FontHelper.renderFontRightTopAligned(sb, FontHelper.powerAmountFont, Integer.toString(amount2), x, y + 15 * Settings.scale, fontScale, c); } }
Example #6
Source File: WrathCardIconPatch.java From jorbs-spire-mod with MIT License | 5 votes |
@SpirePostfixPatch public static void Postfix(AbstractCard card, SpriteBatch sb) { int wrathCount = WrathField.wrathEffectCount.get(card); boolean darken = ReflectionUtils.getPrivateField(card, AbstractCard.class, "darken"); if (wrathCount == 0 || darken || card.isLocked || !card.isSeen) { return; } Color renderColor = ReflectionUtils.getPrivateField(card, AbstractCard.class, "renderColor"); RenderUtils.renderAtlasRegionCenteredAt(sb, wrathIconOverlayImg, card.current_x, card.current_y, card.drawScale * Settings.scale, renderColor, card.angle); WRATH_TEXT_COLOR.a = card.transparency; String text = Integer.toString(wrathCount); BitmapFont font = FontHelper.cardEnergyFont_L; font.getData().setScale(card.drawScale); FontHelper.renderRotatedText(sb, font, text, card.current_x, card.current_y, WRATH_TEXT_OFFSET_X * card.drawScale * Settings.scale, WRATH_TEXT_OFFSET_Y * card.drawScale * Settings.scale, card.angle, false, WRATH_TEXT_COLOR); }
Example #7
Source File: ManifestTopPanelItem.java From jorbs-spire-mod with MIT License | 5 votes |
private void renderManifestNumberOverIcon(SpriteBatch sb) { int manifest = AbstractDungeon.player == null ? 0 : ManifestPatch.PlayerManifestField.manifestField.get(AbstractDungeon.player); FontHelper.renderFontRightTopAligned( sb, FontHelper.topPanelAmountFont, Integer.toString(manifest), this.x + 58.0F * Settings.scale, this.y + 25.0F * Settings.scale, Color.WHITE.cpy()); }
Example #8
Source File: TopPanelModList.java From ModTheSpire with MIT License | 5 votes |
@SpireInsertPatch( locator=Locator.class ) public static void Insert(TopPanel __instance, SpriteBatch sb) { FontHelper.renderFontRightTopAligned( sb, FontHelper.cardDescFont_N, MainMenuModList.makeMTSVersionModCount("ModTheSpire " + Loader.MTS_VERSION), Settings.WIDTH - 16 * Settings.scale, Settings.HEIGHT - 104 * Settings.scale, new Color(1, 1, 1, 0.3f) ); }
Example #9
Source File: BottledPlaceholderRelic.java From StS-DefaultModBase with MIT License | 4 votes |
public void setDescriptionAfterLoading() { this.description = DESCRIPTIONS[1] + FontHelper.colorString(card.name, "y") + DESCRIPTIONS[2]; this.tips.clear(); this.tips.add(new PowerTip(this.name, this.description)); this.initializeTips(); }
Example #10
Source File: TheDefault.java From StS-DefaultModBase with MIT License | 4 votes |
@Override public BitmapFont getEnergyNumFont() { return FontHelper.energyNumFontRed; }
Example #11
Source File: DefaultMod.java From StS-DefaultModBase with MIT License | 4 votes |
@Override public void receivePostInitialize() { logger.info("Loading badge image and mod options"); // Load the Mod Badge Texture badgeTexture = TextureLoader.getTexture(BADGE_IMAGE); // Create the Mod Menu ModPanel settingsPanel = new ModPanel(); // Create the on/off button: ModLabeledToggleButton enableNormalsButton = new ModLabeledToggleButton("This is the text which goes next to the checkbox.", 350.0f, 700.0f, Settings.CREAM_COLOR, FontHelper.charDescFont, // Position (trial and error it), color, font enablePlaceholder, // Boolean it uses settingsPanel, // The mod panel in which this button will be in (label) -> {}, // thing??????? idk (button) -> { // The actual button: enablePlaceholder = button.enabled; // The boolean true/false will be whether the button is enabled or not try { // And based on that boolean, set the settings and save them SpireConfig config = new SpireConfig("defaultMod", "theDefaultConfig", theDefaultDefaultSettings); config.setBool(ENABLE_PLACEHOLDER_SETTINGS, enablePlaceholder); config.save(); } catch (Exception e) { e.printStackTrace(); } }); settingsPanel.addUIElement(enableNormalsButton); // Add the button to the settings panel. Button is a go. BaseMod.registerModBadge(badgeTexture, MODNAME, AUTHOR, DESCRIPTION, settingsPanel); // =============== EVENTS ================= // This event will be exclusive to the City (act 2). If you want an event that's present at any // part of the game, simply don't include the dungeon ID // If you want to have a character-specific event, look at slimebound (CityRemoveEventPatch). // Essentially, you need to patch the game and say "if a player is not playing my character class, remove the event from the pool" BaseMod.addEvent(IdentityCrisisEvent.ID, IdentityCrisisEvent.class, TheCity.ID); // =============== /EVENTS/ ================= logger.info("Done loading badge Image and mod options"); }
Example #12
Source File: TheSeeker.java From FruityMod-StS with MIT License | 4 votes |
@Override public BitmapFont getEnergyNumFont() { return FontHelper.energyNumFontRed; }
Example #13
Source File: TheTranquil.java From FruityMod-StS with MIT License | 4 votes |
@Override public BitmapFont getEnergyNumFont() { return FontHelper.energyNumFontRed; }
Example #14
Source File: MainMenuModList.java From ModTheSpire with MIT License | 4 votes |
public static float getSmartHeight(BitmapFont font, String msg, float lineWidth, float lineSpacing) { return -FontHelper.getSmartHeight(font, msg, lineWidth, lineSpacing) + lineSpacing; }
Example #15
Source File: BranchingUpgradesPatch.java From StSLib with MIT License | 4 votes |
public static void Postfix(SingleCardViewPopup __instance, SpriteBatch sb, AbstractCard ___card) { if (___card instanceof BranchingUpgradesCard) { if (uiStrings == null) { uiStrings = CardCrawlGame.languagePack.getUIString("stslib:SingleCardViewPopup"); } Hitbox branchUpgradeHb = BranchUpgradeButton.branchUpgradeHb.get(__instance); sb.setColor(Color.WHITE); sb.draw( ImageMaster.CHECKBOX, branchUpgradeHb.cX - 80f * Settings.scale - 32f, branchUpgradeHb.cY - 32f, 32f, 32f, 64f, 64f, Settings.scale, Settings.scale, 0f, 0, 0, 64, 64, false, false ); Color fontColor = Settings.GOLD_COLOR; if (branchUpgradeHb.hovered) { fontColor = Settings.BLUE_TEXT_COLOR; } FontHelper.renderFont( sb, FontHelper.cardTitleFont, uiStrings.TEXT[0], branchUpgradeHb.cX - 45f * Settings.scale, branchUpgradeHb.cY + 10f * Settings.scale, fontColor ); if (BranchUpgradeButton.isViewingBranchUpgrade.get(__instance)) { sb.setColor(Color.WHITE); sb.draw( ImageMaster.TICK, branchUpgradeHb.cX - 80f * Settings.scale - 32f, branchUpgradeHb.cY - 32f, 32f, 32f, 64f, 64f, Settings.scale, Settings.scale, 0f, 0, 0, 64, 64, false, false ); } BranchUpgradeButton.branchUpgradeHb.get(__instance).render(sb); } }
Example #16
Source File: BranchingUpgradesPatch.java From StSLib with MIT License | 4 votes |
public static SpireReturn Do(GridCardSelectScreen __instance, SpriteBatch sb) { AbstractCard c = getHoveredCard(); if (__instance.forUpgrade && c instanceof BranchingUpgradesCard) { cardList.clear(); AbstractCard branchUpgradedCard = BranchSelectFields.branchUpgradePreviewCard.get(__instance); c.current_x = (Settings.WIDTH * 0.36F); c.current_y = (Settings.HEIGHT / 2.0F); c.target_x = (Settings.WIDTH * 0.36F); c.target_y = (Settings.HEIGHT / 2.0F); c.render(sb); c.updateHoverLogic(); c.hb.resize(0, 0); if (__instance.upgradePreviewCard.hb.hovered) { __instance.upgradePreviewCard.drawScale = 1; } else { __instance.upgradePreviewCard.drawScale = 0.9F; } __instance.upgradePreviewCard.current_x = (Settings.WIDTH * 0.63F); __instance.upgradePreviewCard.current_y = (Settings.HEIGHT * 0.75F - (50 * Settings.scale)); __instance.upgradePreviewCard.target_x = (Settings.WIDTH * 0.63F); __instance.upgradePreviewCard.target_y = (Settings.HEIGHT * 0.75F - (50 * Settings.scale)); __instance.upgradePreviewCard.render(sb); __instance.upgradePreviewCard.updateHoverLogic(); __instance.upgradePreviewCard.renderCardTip(sb); cardList.add(__instance.upgradePreviewCard); if (branchUpgradedCard.hb.hovered) { branchUpgradedCard.drawScale = 1; } else { branchUpgradedCard.drawScale = 0.9F; } branchUpgradedCard.current_x = (Settings.WIDTH * 0.63F); branchUpgradedCard.current_y = (Settings.HEIGHT / 4.0F + (50 * Settings.scale)); branchUpgradedCard.target_x = (Settings.WIDTH * 0.63F); branchUpgradedCard.target_y = (Settings.HEIGHT / 4.0F + (50 * Settings.scale)); branchUpgradedCard.render(sb); branchUpgradedCard.updateHoverLogic(); branchUpgradedCard.renderCardTip(sb); cardList.add(branchUpgradedCard); if ((__instance.forUpgrade) || (__instance.forTransform) || (__instance.forPurge) || (__instance.isJustForConfirming) || (__instance.anyNumber)) { __instance.confirmButton.render(sb); } CardGroup targetGroup = (CardGroup) ReflectionHacks.getPrivate(__instance, GridCardSelectScreen.class, "targetGroup"); String tipMsg = (String) ReflectionHacks.getPrivate(__instance, GridCardSelectScreen.class, "tipMsg"); if ((!__instance.isJustForConfirming) || (targetGroup.size() > 5)) { FontHelper.renderDeckViewTip(sb, tipMsg, 96.0F * Settings.scale, Settings.CREAM_COLOR); } return SpireReturn.Return(null); } return SpireReturn.Continue(); }
Example #17
Source File: BottledMemoryRelic.java From jorbs-spire-mod with MIT License | 4 votes |
public void setDescriptionAfterLoading() { this.description = this.DESCRIPTIONS[2] + FontHelper.colorString(this.card.name, "y") + this.DESCRIPTIONS[3]; this.tips.clear(); this.tips.add(new PowerTip(this.name, this.description)); this.initializeTips(); }
Example #18
Source File: Cull.java From jorbs-spire-mod with MIT License | 4 votes |
@Override public BitmapFont getEnergyNumFont() { return FontHelper.energyNumFontRed; }
Example #19
Source File: JorbsModSettings.java From jorbs-spire-mod with MIT License | 4 votes |
public static ModPanel createSettingsPanel() { String[] MOD_SETTINGS_PANEL_TEXT = CardCrawlGame.languagePack.getUIString(makeID("ModSettingsPanel")).TEXT; ModPanel settingsPanel = new ModPanel(); // Buttons will set the text on this when pressed ModLabel messageLabel = new ModLabel("", 400.0F, 300.0F, Color.GREEN, FontHelper.tipHeaderFont, settingsPanel, (label) -> {}); settingsPanel.addUIElement(messageLabel); ModLabel voiceoverVolumeSliderLabel = new ModLabel( MOD_SETTINGS_PANEL_TEXT[0], 400.0F, 694.0F, Color.WHITE, FontHelper.tipHeaderFont, settingsPanel, (label) -> {}); settingsPanel.addUIElement(voiceoverVolumeSliderLabel); ModSlider voiceoverVolumeSlider = new ModSlider( "", 700.0F, 700.0F, 100, "%", settingsPanel, JorbsModSettings::onVoiceoverVolumeChange); voiceoverVolumeSlider.setValue(VoiceoverMaster.VOICEOVER_VOLUME); settingsPanel.addUIElement(voiceoverVolumeSlider); ModLabeledToggleButton voiceoverSubtitlesToggle = new ModLabeledToggleButton( MOD_SETTINGS_PANEL_TEXT[6], 400.0F, 640.0F, Color.WHITE, FontHelper.tipHeaderFont, isCullEnabled(), settingsPanel, (label) -> {}, JorbsModSettings::onCullToggle); settingsPanel.addUIElement(voiceoverSubtitlesToggle); ModLabeledToggleButton cullToggle = new ModLabeledToggleButton( MOD_SETTINGS_PANEL_TEXT[1], 400.0F, 580.0F, Color.WHITE, FontHelper.tipHeaderFont, isCullEnabled(), settingsPanel, (label) -> {}, JorbsModSettings::onCullToggle); settingsPanel.addUIElement(cullToggle); ModButton resetTipsButton = new ModButton( 370.0F, 460.0F, settingsPanel, (b) -> { JorbsModTipTracker.reset(); messageLabel.text = MOD_SETTINGS_PANEL_TEXT[3]; } ); settingsPanel.addUIElement(resetTipsButton); ModLabel resetTipsLabel = new ModLabel( MOD_SETTINGS_PANEL_TEXT[2], 500.0F, 515.0F, Color.WHITE, FontHelper.tipHeaderFont, settingsPanel, (label) -> {}); settingsPanel.addUIElement(resetTipsLabel); ModButton unlockA20Button = new ModButton( 370.0F, 370.0F, settingsPanel, (b) -> { unlockA20(Wanderer.Enums.WANDERER); unlockA20(Cull.Enums.CULL); messageLabel.text = MOD_SETTINGS_PANEL_TEXT[5]; } ); settingsPanel.addUIElement(unlockA20Button); ModLabel unlockA20Label = new ModLabel( MOD_SETTINGS_PANEL_TEXT[4], 500.0F, 425.0F, Color.WHITE, FontHelper.tipHeaderFont, settingsPanel, (label) -> {}); settingsPanel.addUIElement(unlockA20Label); return settingsPanel; }
Example #20
Source File: CustomPotionDrinkPatch.java From jorbs-spire-mod with MIT License | 4 votes |
@Override public int[] Locate(CtBehavior ctMethodToPatch) throws Exception { final Matcher matcher = new Matcher.MethodCallMatcher(FontHelper.class, "renderFontCenteredWidth"); return LineFinder.findInOrder(ctMethodToPatch, matcher); }