@Override public void drawOnlyImageAt(GLDrawContext gl, float x, float y, float z, Color torsoColor, float fow) { try { if(nullGeometry == null || !nullGeometry.isValid()) nullGeometry = gl.storeGeometry(nullData, EGeometryFormatType.VertexOnly2D, false, "placeholder/null"); gl.draw2D(nullGeometry, null, EGeometryType.Quad, 0, 4, x, y, z, 1, 1, 1, null, NULL_IMAGE_ALPHA); gl.draw2D(nullGeometry, null, EGeometryType.LineLoop, 0, 4, x, y, z, 1, 1, 1, Color.RED, 1); } catch (IllegalBufferException e) { e.printStackTrace(); } }
@Override public void drawAt(GLDrawContext gl) { super.drawAt(gl); TextDrawer drawer = gl.getTextDrawer(EFontSize.NORMAL); float textHeight = drawer.getHeight(inputString.toString() + "X"); float y = getPosition().getCenterY() - textHeight / 2; float x = getPosition().getMinX() + 2; drawer.drawString(x, y, inputString.toString()); if(geometry == null || !geometry.isValid()) geometry = gl.storeGeometry(new float[] {0, 0, 0, 1}, EGeometryFormatType.VertexOnly2D, false, "uiinput-line"); float carretX = x + drawer.getWidth(inputString.substring(0, carret) + "X") - drawer.getWidth("X"); try { gl.draw2D(geometry, null, EGeometryType.LineStrip, 0, 2, carretX, y, 0, 0, textHeight, 0, null, 1); } catch (IllegalBufferException e) { e.printStackTrace(); } }
try { if(geometry == null || !geometry.isValid()) { geometry = context.storeGeometry( new float[] {0, 0, 0, 0, width, 0, 1, 0,(stride + 1) * width, height, 1, 1, stride * width, height, 0, 1,}, EGeometryFormatType.Texture2D, false, "minimap"); lineGeometry = context.generateGeometry(6, EGeometryFormatType.VertexOnly2D, true, "minimap-frame");
private void drawDebugColors() { GLDrawContext gl = this.context.getGl(); if(shapeHandle == null || !shapeHandle.isValid()) shapeHandle = gl.storeGeometry(shape, EGeometryFormatType.VertexOnly2D, false, "debugshape"); int drawX = context.getOffsetX(); int drawY = context.getOffsetY(); context.getScreenArea().stream().filterBounds(width, height).forEach((x, y) -> { try { int argb = map.getDebugColorAt(x, y, debugColorMode); if (argb != 0) { int height = context.getHeight(x, y); float dx = drawX+context.getConverter().getViewX(x, y, height); float dy = drawY+context.getConverter().getViewY(x, y, height); gl.draw2D(shapeHandle, null, EGeometryType.Quad, 0, 4, dx, dy, .5f, 1, 1, 1, Color.fromShort((short) argb), 1); } } catch (IllegalBufferException e) { // TODO: Create a crash report // This should never happen since we only use texture 0 (no texture) } }); }