gui and text drawing, gui misc

This commit is contained in:
Sen 2025-03-19 21:54:09 +01:00
parent c906760bd4
commit 4ec8affe85
37 changed files with 799 additions and 646 deletions

View file

@ -222,94 +222,94 @@ public abstract class Gui {
elem.drawHover();
}
public static void drawRect(int left, int top, int right, int bottom, int color)
{
if (left < right)
{
int i = left;
left = right;
right = i;
}
if (top < bottom)
{
int j = top;
top = bottom;
bottom = j;
}
float f3 = (float)(color >> 24 & 255) / 255.0F;
float f = (float)(color >> 16 & 255) / 255.0F;
float f1 = (float)(color >> 8 & 255) / 255.0F;
float f2 = (float)(color & 255) / 255.0F;
RenderBuffer worldrenderer = Tessellator.getBuffer();
GlState.enableBlend();
GlState.disableTexture2D();
GlState.tryBlendFuncSeparate(770, 771, 1, 0);
GlState.color(f, f1, f2, f3);
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex();
worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex();
worldrenderer.pos((double)right, (double)top, 0.0D).endVertex();
worldrenderer.pos((double)left, (double)top, 0.0D).endVertex();
Tessellator.draw();
GlState.enableTexture2D();
GlState.disableBlend();
}
// public static void drawRect(int left, int top, int right, int bottom, int color)
// {
// if (left < right)
// {
// int i = left;
// left = right;
// right = i;
// }
//
// if (top < bottom)
// {
// int j = top;
// top = bottom;
// bottom = j;
// }
//
// float f3 = (float)(color >> 24 & 255) / 255.0F;
// float f = (float)(color >> 16 & 255) / 255.0F;
// float f1 = (float)(color >> 8 & 255) / 255.0F;
// float f2 = (float)(color & 255) / 255.0F;
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// GlState.enableBlend();
// GlState.disableTexture2D();
// GlState.tryBlendFuncSeparate(770, 771, 1, 0);
// GlState.color(f, f1, f2, f3);
// worldrenderer.begin(7, DefaultVertexFormats.POSITION);
// worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex();
// worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex();
// worldrenderer.pos((double)right, (double)top, 0.0D).endVertex();
// worldrenderer.pos((double)left, (double)top, 0.0D).endVertex();
// Tessellator.draw();
// GlState.enableTexture2D();
// GlState.disableBlend();
// }
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
{
float f = 0.00390625F;
float f1 = 0.00390625F;
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)(x + 0), (double)(y + height), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + 0), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
worldrenderer.pos((double)(x + 0), (double)(y + 0), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
Tessellator.draw();
}
public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight)
{
float f = 1.0F / tileWidth;
float f1 = 1.0F / tileHeight;
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)vHeight) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)uWidth) * f), (double)((v + (float)vHeight) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)uWidth) * f), (double)(v * f1)).endVertex();
worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
Tessellator.draw();
}
public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
{
float f = (float)(startColor >> 24 & 255) / 255.0F;
float f1 = (float)(startColor >> 16 & 255) / 255.0F;
float f2 = (float)(startColor >> 8 & 255) / 255.0F;
float f3 = (float)(startColor & 255) / 255.0F;
float f4 = (float)(endColor >> 24 & 255) / 255.0F;
float f5 = (float)(endColor >> 16 & 255) / 255.0F;
float f6 = (float)(endColor >> 8 & 255) / 255.0F;
float f7 = (float)(endColor & 255) / 255.0F;
GlState.disableTexture2D();
GlState.enableBlend();
GlState.disableAlpha();
GlState.tryBlendFuncSeparate(770, 771, 1, 0);
GlState.shadeModel(7425);
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos((double)right, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
worldrenderer.pos((double)left, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
worldrenderer.pos((double)left, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
worldrenderer.pos((double)right, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
Tessellator.draw();
GlState.shadeModel(7424);
GlState.disableBlend();
GlState.enableAlpha();
GlState.enableTexture2D();
}
// public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
// {
// float f = 0.00390625F;
// float f1 = 0.00390625F;
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
// worldrenderer.pos((double)(x + 0), (double)(y + height), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
// worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
// worldrenderer.pos((double)(x + width), (double)(y + 0), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
// worldrenderer.pos((double)(x + 0), (double)(y + 0), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
// Tessellator.draw();
// }
//
// public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight)
// {
// float f = 1.0F / tileWidth;
// float f1 = 1.0F / tileHeight;
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
// worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)vHeight) * f1)).endVertex();
// worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)uWidth) * f), (double)((v + (float)vHeight) * f1)).endVertex();
// worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)uWidth) * f), (double)(v * f1)).endVertex();
// worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
// Tessellator.draw();
// }
//
// public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
// {
// float f = (float)(startColor >> 24 & 255) / 255.0F;
// float f1 = (float)(startColor >> 16 & 255) / 255.0F;
// float f2 = (float)(startColor >> 8 & 255) / 255.0F;
// float f3 = (float)(startColor & 255) / 255.0F;
// float f4 = (float)(endColor >> 24 & 255) / 255.0F;
// float f5 = (float)(endColor >> 16 & 255) / 255.0F;
// float f6 = (float)(endColor >> 8 & 255) / 255.0F;
// float f7 = (float)(endColor & 255) / 255.0F;
// GlState.disableTexture2D();
// GlState.enableBlend();
// GlState.disableAlpha();
// GlState.tryBlendFuncSeparate(770, 771, 1, 0);
// GlState.shadeModel(7425);
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
// worldrenderer.pos((double)right, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
// worldrenderer.pos((double)left, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
// worldrenderer.pos((double)left, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
// worldrenderer.pos((double)right, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
// Tessellator.draw();
// GlState.shadeModel(7424);
// GlState.disableBlend();
// GlState.enableAlpha();
// GlState.enableTexture2D();
// }
public void drawMainBackground() {
if(this.gm.theWorld != null) {

View file

@ -77,7 +77,7 @@ public class GuiMenu extends Gui {
}, "Info / Über / Mitwirkende") {
public void drawHover() {
if(GuiMenu.this.hacked == 10) {
Drawing.drawRectColor(this.pos_x, this.pos_y, this.size_x, this.size_y, (this.gm.style.hover & 0xff000000) | 0x7f00ff);
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, (this.gm.style.hover & 0xff000000) | 0x7f00ff);
GuiMenu.this.rand.setSeed(((long)this.gm.mouse_x * 7652657L) ^ ((long)this.gm.mouse_y * 87262826276L));
int width = Drawing.getWidth("Hax!");
for(int z = 0; z < 64; z++) {
@ -314,10 +314,10 @@ public class GuiMenu extends Gui {
int y = 164;
int h = 16;
int n = Drawing.getWidth(this.splashLabel.getText());
Drawing.drawRectColor(0, y, this.gm.fb_x / 2 - n / 2 - 10, h, 0x7f7f00ff);
Drawing.drawRectColor(this.gm.fb_x / 2 + n / 2 + 10, y, this.gm.fb_x - (this.gm.fb_x / 2 + n / 2 + 10), h, 0x7f7f00ff);
Drawing.drawText(this.animBack, this.gm.fb_x - Drawing.getWidth(this.animBack) - 2, this.gm.fb_y - 18, 0xffffffff);
Drawing.drawText(this.animStr, this.gm.fb_x - Drawing.getWidth(this.animStr) - ((this.animWidth - this.animPos - 4) * 10), this.gm.fb_y - 20, 0xffffffff);
Drawing.drawRect(0, y, this.gm.fb_x / 2 - n / 2 - 10, h, 0x7f7f00ff);
Drawing.drawRect(this.gm.fb_x / 2 + n / 2 + 10, y, this.gm.fb_x - (this.gm.fb_x / 2 + n / 2 + 10), h, 0x7f7f00ff);
Drawing.drawText(this.animBack, this.gm.fb_x - Drawing.getWidth(this.animBack), this.gm.fb_y - 18, 0xffffffff);
Drawing.drawText(this.animStr, this.gm.fb_x - Drawing.getWidth(this.animStr) - 3 - ((this.animWidth - this.animPos - 4) * 10), this.gm.fb_y - 20, 0xffffffff);
}
}
}

View file

@ -118,7 +118,7 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
if (/* this.gm.touchscreen || */ hovered)
{
// GuiSkin.this.gm.getTextureManager().bindTexture(SKINS_BUTTONS);
Drawing.drawRectColor(x, y, 64, 64, -1601138544);
Drawing.drawRect(x, y, 64, 64, -1601138544);
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// int k1 = mouseX - x;
// int l1 = mouseY - y;
@ -248,7 +248,7 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
// if(this.dragging) {
//
// }
Drawing.drawRectColor(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x20ffffff);
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x20ffffff);
}
protected void drawForeground(int x1, int y1, int x2, int y2) {

View file

@ -120,16 +120,15 @@ public abstract class GuiContainer extends Gui
public void drawString(String text, int x, int y) {
x = x * 2 + this.container_x;
y = y * 2 + this.container_y;
Drawing.txt_draw(x, y, x, y, x + 440, y + 260, 0xffffffff, text);
Drawing.drawText(text, x, y, 0xffffffff);
}
public int getStringWidth(String text) {
Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, text);
return size.xpos / 2;
return Drawing.getSize(text).xpos / 2;
}
public void rect(int x, int y, int width, int height, int color) {
Drawing.drawRectColor(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | color);
Drawing.drawRect(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | color);
}
public InventoryButton button(int x, int y, int w, int h) {
@ -1087,12 +1086,12 @@ public abstract class GuiContainer extends Gui
s = TextColor.RED + ItemStack.formatAmount(stack.stackSize);
}
// this.drawString(s, , );
Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, s);
int x = xPosition + 34 - size.xpos; // this.getStringWidth(s);
int y = yPosition + 17;
// Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, s);
// int x = - size.xpos; // this.getStringWidth(s);
// int y = ;
// x = x * 2 + this.container_x;
// y = y * 2 + this.container_y;
Drawing.txt_draw(x, y, x, y, x + 440, y + 260, 0xffffffff, s);
Drawing.drawTextRight(s, xPosition + 32, yPosition + 17, 0xffffffff);
}
if (stack.isItemDamaged())
@ -1109,7 +1108,7 @@ public abstract class GuiContainer extends Gui
private static void draw(int x, int y, int width, int height, int red, int green, int blue)
{
// Drawing.gfx_draw_rect_color(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | (red << 16) | (green << 8) | blue);
Drawing.drawRectColor(x, y, width, height, 0xff000000 | (red << 16) | (green << 8) | blue);
Drawing.drawRect(x, y, width, height, 0xff000000 | (red << 16) | (green << 8) | blue);
}
public void drawBackground() {

View file

@ -2,6 +2,7 @@ package game.gui.element;
import game.renderer.Drawing;
import game.util.ExtMath;
import game.util.Util;
public class Bar extends Fill {
private int color = 0x00ff00;
@ -25,7 +26,7 @@ public class Bar extends Fill {
protected void drawBackground() {
Drawing.drawGradient2Border(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.fill_btm, this.gm.style.fill_top, this.gm.style.brdr_top, this.gm.style.brdr_btm);
if(this.progress > 0)
Drawing.drawGradient(this.pos_x + 2, this.pos_y + 2, this.progress, this.size_y - 4, this.color | 0xff000000, Drawing.mixColor(this.color | 0xff000000, 0xff000000));
Drawing.drawGradient(this.pos_x + 2, this.pos_y + 2, this.progress, this.size_y - 4, this.color | 0xff000000, Util.mixColor(this.color | 0xff000000, 0xff000000));
}
protected void drawForeground(int x1, int y1, int x2, int y2) {

View file

@ -23,16 +23,15 @@ public class Dropdown<T> extends Element {
}
public void updateText() {
this.r_dirty = true;
}
protected boolean isTextCenteredX() {
return false;
}
protected boolean isTextCenteredY() {
return false;
}
// protected boolean isTextCenteredX() {
// return false;
// }
//
// protected boolean isTextCenteredY() {
// return false;
// }
public boolean canClick() {
return false;
@ -60,10 +59,7 @@ public class Dropdown<T> extends Element {
public void drawHover() {
int m = ((this.gm.mouse_y - (this.pos_y + this.margin_y1)) * Dropdown.this.values.length / (this.size_y - (this.margin_y1 + this.margin_y2)));
// if((sys.mouse_y - this.pos_y) < (this.size_y - this.margin_y2))
Drawing.drawRectColor(this.pos_x + this.margin_x1,
this.pos_y + this.margin_y1 + ExtMath.clampi(m, 0, Dropdown.this.values.length - 1) * ((this.size_y - (this.margin_y1 + this.margin_y2)) / Dropdown.this.values.length),
this.size_x - (this.margin_x1 + this.margin_x2),
(this.size_y - (this.margin_y1 + this.margin_y2)) / Dropdown.this.values.length, this.gm.style.hover);
Drawing.drawRect(this.pos_x + this.margin_x1, this.pos_y + this.margin_y1 + ExtMath.clampi(m, 0, Dropdown.this.values.length - 1) * ((this.size_y - (this.margin_y1 + this.margin_y2)) / Dropdown.this.values.length), this.size_x - (this.margin_x1 + this.margin_x2), (this.size_y - (this.margin_y1 + this.margin_y2)) / Dropdown.this.values.length, this.gm.style.hover);
}
}

View file

@ -33,8 +33,6 @@ public abstract class Element {
protected int size_y;
protected int text_x = 0;
protected int text_y = 0;
protected int tsize_x = 0;
protected int tsize_y = 0;
protected final int margin_x1 = this.getMargin();
protected final int margin_y1 = this.getMargin();
@ -87,17 +85,17 @@ public abstract class Element {
return this.size_y;
}
protected boolean isTextCenteredX() {
return true;
}
// protected boolean isTextCenteredX() {
// return true;
// }
//
// protected boolean isTextCenteredY() {
// return true;
// }
protected boolean isTextCenteredY() {
return true;
}
protected boolean hasLinebreak() {
return false;
}
// protected boolean hasLinebreak() {
// return false;
// }
public boolean canHover() {
return true;
@ -116,22 +114,9 @@ public abstract class Element {
}
public void updateText() {
Vec2i size = Drawing.txt_size(this.pos_x + this.margin_x1, this.pos_y + this.margin_y1,
this.pos_x + this.margin_x1, this.pos_y + this.margin_y1,
this.hasLinebreak() ? (this.pos_x + (this.size_x - (this.margin_x1 + this.margin_x2))) : Integer.MAX_VALUE, Integer.MAX_VALUE, this.text);
this.tsize_x = size.xpos;
this.tsize_y = size.ypos;
// if(this.type != ElemType.FIELD) {
if(this.isTextCenteredX())
this.text_x = (this.size_x - this.tsize_x) / 2;
if(this.isTextCenteredY())
this.text_y = (this.size_y - this.tsize_y - Font.YGLYPH) / 2;
// }
// logd("DBG", "s = %d %d; o = %d %d", this.tsize_x, this.tsize_y, this.text_x, this.text_y);
// gui_update_dropdown();
if(this.gui != null && this.gui.selected instanceof Handle && this.gui.selected.visible)
this.gui.selected.r_dirty = true;
this.r_dirty = true;
Vec2i size = Drawing.getSize(this.text);
this.text_x = (this.size_x - size.xpos) / 2;
this.text_y = (this.size_y - size.ypos) / 2;
}
public void setText(String str) {
@ -273,11 +258,11 @@ public abstract class Element {
}
public void drawHover() {
Drawing.drawRectColor(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.hover);
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.hover);
}
public void drawPress() {
Drawing.drawRectColor(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.press);
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.press);
}
public void playSound() {

View file

@ -1,5 +1,8 @@
package game.gui.element;
import game.renderer.Drawing;
import game.renderer.Drawing.Vec2i;
public class Fill extends Element {
private final boolean left;
private final boolean top;
@ -36,11 +39,19 @@ public class Fill extends Element {
return false;
}
protected boolean isTextCenteredX() {
return !this.left;
}
// protected boolean isTextCenteredX() {
// return !this.left;
// }
//
// protected boolean isTextCenteredY() {
// return !this.top;
// }
protected boolean isTextCenteredY() {
return !this.top;
public void updateText() {
Vec2i size = Drawing.getSize(this.text);
if(!this.left)
this.text_x = (this.size_x - size.xpos) / 2;
if(!this.top)
this.text_y = (this.size_y - size.ypos) / 2;
}
}

View file

@ -349,7 +349,7 @@ public abstract class GuiList<T extends ListEntry> extends Gui
boolean hover = this.getSlotIndexFromScreenCoords(mouseXIn, mouseYIn) == z;
this.getListEntry(z).draw(x, y1, mouseXIn - x, mouseYIn - y1, hover);
if(hover)
Drawing.drawRectColor(x - 2, y1 - 2, this.getListWidth(), this.getSlotHeight(), this.gm.style.hover);
Drawing.drawRect(x - 2, y1 - 2, this.getListWidth(), this.getSlotHeight(), this.gm.style.hover);
}
}

View file

@ -3,6 +3,7 @@ package game.gui.element;
import org.lwjgl.opengl.GL11;
import game.gui.Font;
import game.gui.element.Dropdown.Handle;
import game.renderer.Drawing;
import game.renderer.Drawing.Offset;
import game.renderer.Drawing.Vec2i;
@ -38,6 +39,8 @@ public class Textbox extends Element {
private int sel_drag = -1;
private int cursorX = 0;
private int cursorY = 0;
private int tsize_x = 0;
private int tsize_y = 0;
private Textbox(int x, int y, int w, int h, int cap, boolean line, boolean editable, Callback callback, CharValidator validator, String text) {
super(x, y, w, h, null);
@ -71,16 +74,24 @@ public class Textbox extends Element {
// this.editable = editable;
// }
protected boolean isTextCenteredX() {
return false;
}
// protected boolean isTextCenteredX() {
// return false;
// }
//
// protected boolean isTextCenteredY() {
// return false;
// }
protected boolean isTextCenteredY() {
return false;
}
// protected boolean hasLinebreak() {
// return this.xbreak;
// }
protected boolean hasLinebreak() {
return this.xbreak;
public void updateText() {
Vec2i size = Drawing.txt_size(this.pos_x + this.margin_x1, this.pos_y + this.margin_y1,
this.pos_x + this.margin_x1, this.pos_y + this.margin_y1,
this.xbreak ? (this.pos_x + (this.size_x - (this.margin_x1 + this.margin_x2))) : Integer.MAX_VALUE, Integer.MAX_VALUE, this.text);
this.tsize_x = size.xpos;
this.tsize_y = size.ypos;
}
public boolean canHover() {
@ -420,7 +431,7 @@ public class Textbox extends Element {
x1 + this.text_x, y1 + this.text_y,
this.xbreak ? (this.pos_x + x2) : Integer.MAX_VALUE, Integer.MAX_VALUE, this.gm.style.text_field, this.text);
if(this.sel_start >= 0 && this.sel_end != this.sel_start)
Drawing.txt_draw_range(this.sel_start, this.sel_end, x1 + (this.xbreak ? 0 : this.text_x), y1 + this.text_y,
Drawing.txt_overlay(this.sel_start, this.sel_end, x1 + (this.xbreak ? 0 : this.text_x), y1 + this.text_y,
x1 + this.text_x, y1 + this.text_y,
this.xbreak ? (this.pos_x + x2) : Integer.MAX_VALUE, Integer.MAX_VALUE, this.gm.style.select, this.text);
}
@ -433,7 +444,7 @@ public class Textbox extends Element {
int y2 = this.size_y - (this.margin_y1 + this.margin_y2);
GL11.glScissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
Drawing.drawRectColor(this.cursorX, this.cursorY, 1, Font.YGLYPH, this.gm.style.cursor);
Drawing.drawRect(this.cursorX, this.cursorY, 1, Font.YGLYPH, this.gm.style.cursor);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
}
}
@ -466,8 +477,11 @@ public class Textbox extends Element {
s = s + this.text.substring(j);
}
this.setText(s);
// this.text = s;
// this.setText(s);
this.text = s;
this.updateText();
this.sel_start = this.sel_end = this.sel_drag = i;
gui_text_update_cur(this.sel_start, true);
//
// if(flag) {
// this.moveCursorBy(num);

View file

@ -608,7 +608,7 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
{
super.drawOverlays();
if(this.warningMessage != null) {
Drawing.drawRectBorder(this.gm.fb_x / 2 - 200, this.gm.fb_y - 84, 400, 18, 0xff000000, 0xff808080);
Drawing.drawBordered(this.gm.fb_x / 2 - 200, this.gm.fb_y - 84, 400, 18, 0xff000000, 0xff808080);
// drawRect(this.gm.fb_x / 2 - 191, this.gm.fb_y - 82, this.gm.fb_x / 2 + 191, this.gm.fb_y - 66, 0xff808080);
// drawRect(this.gm.fb_x / 2 - 190, this.gm.fb_y - 81, this.gm.fb_x / 2 + 190, this.gm.fb_y - 67, 0xff000000);
Drawing.drawTextCentered(this.warningMessage, this.gm.fb_x / 2, this.gm.fb_y - 84, 0xffff0000);