Skip to content

Commit

Permalink
Use ElementText fontrenderer for rendering and add support fro dropsh…
Browse files Browse the repository at this point in the history
…adows
  • Loading branch information
bonii-xx committed Apr 10, 2016
1 parent ccc2131 commit 34e251b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Expand Up @@ -15,6 +15,7 @@ public class TextData {
public boolean strikethrough = false;
public boolean obfuscated = false;
public boolean paragraph = false;
public boolean dropshadow = false;
public float scale = 1.F;
public String action = "";
public String[] tooltip = null;
Expand Down
Expand Up @@ -10,18 +10,17 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import javafx.scene.effect.DropShadow;
import slimeknights.mantle.client.book.data.element.TextData;

@SideOnly(Side.CLIENT)
public class TextDataRenderer {

public static String drawText(int x, int y, int boxWidth, int boxHeight, TextData[] data, int mouseX, int mouseY) {
public static String drawText(int x, int y, int boxWidth, int boxHeight, TextData[] data, int mouseX, int mouseY, FontRenderer fr) {
String action = "";

String[] drawLabel = null;

FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;

int atX = x;
int atY = y;

Expand Down Expand Up @@ -77,7 +76,7 @@ public static String drawText(int x, int y, int boxWidth, int boxHeight, TextDat
}

String s = split[i];
drawScaledString(fr, modifiers + s, atX, atY, 0, false, item.scale);
drawScaledString(fr, modifiers + s, atX, atY, 0, item.dropshadow, item.scale);

if(i < split.length - 1) {
atY += fr.FONT_HEIGHT;
Expand Down Expand Up @@ -125,7 +124,7 @@ public static String drawText(int x, int y, int boxWidth, int boxHeight, TextDat
}

if(atY >= y + boxHeight) {
fr.drawString("...", atX, atY, 0, false);
fr.drawString("...", atX, atY, 0, item.dropshadow);
break;
}
y = atY;
Expand Down
Expand Up @@ -26,7 +26,7 @@ public ElementText(int x, int y, int width, int height, TextData[] text) {

@Override
public void draw(int mouseX, int mouseY, float partialTicks) {
String action = TextDataRenderer.drawText(x, y, width, height, text, mouseX, mouseY);
String action = TextDataRenderer.drawText(x, y, width, height, text, mouseX, mouseY, fontRenderer);

if(doAction) {
doAction = false;
Expand Down

0 comments on commit 34e251b

Please sign in to comment.