1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-26 08:56:54 +00:00

Remove texture coordinates from text background part

This commit is contained in:
Lignum 2017-05-04 23:49:08 +02:00
parent 2d5d5e3a9e
commit 7e71045c7b
No known key found for this signature in database
GPG Key ID: E4DE8F54CA0912BA

View File

@ -8,6 +8,7 @@ package dan200.computercraft.client.gui;
import dan200.computercraft.core.terminal.TextBuffer; import dan200.computercraft.core.terminal.TextBuffer;
import dan200.computercraft.shared.util.Colour; import dan200.computercraft.shared.util.Colour;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
@ -46,12 +47,12 @@ public class FixedWidthFontRenderer
private void drawQuad( VertexBuffer renderer, double x, double y, int color, double width ) private void drawQuad( VertexBuffer renderer, double x, double y, int color, double width )
{ {
Colour colour = Colour.values()[ 15 - color ]; Colour colour = Colour.values()[ 15 - color ];
renderer.pos( x, y, 0.0 ).tex( 0.0, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); renderer.pos( x, y, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex();
renderer.pos( x, y + FONT_HEIGHT, 0.0 ).tex( 0.0, 1.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); renderer.pos( x, y + FONT_HEIGHT, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex();
renderer.pos( x + width, y, 0.0 ).tex( 1.0, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); renderer.pos( x + width, y, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex();
renderer.pos( x + width, y, 0.0 ).tex( 1.0, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); renderer.pos( x + width, y, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex();
renderer.pos( x, y + FONT_HEIGHT, 0.0 ).tex( 0.0, 1.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); renderer.pos( x, y + FONT_HEIGHT, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex();
renderer.pos( x + width, y + FONT_HEIGHT, 0.0 ).tex( 1.0, 1.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); renderer.pos( x + width, y + FONT_HEIGHT, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex();
} }
private boolean isGreyScale( int colour ) private boolean isGreyScale( int colour )
@ -64,7 +65,7 @@ public class FixedWidthFontRenderer
// Draw the quads // Draw the quads
Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
VertexBuffer renderer = tessellator.getBuffer(); VertexBuffer renderer = tessellator.getBuffer();
renderer.begin( GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX_COLOR ); renderer.begin( GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR );
if( leftMarginSize > 0.0 ) if( leftMarginSize > 0.0 )
{ {
int colour1 = "0123456789abcdef".indexOf( backgroundColour.charAt( 0 ) ); int colour1 = "0123456789abcdef".indexOf( backgroundColour.charAt( 0 ) );
@ -92,7 +93,9 @@ public class FixedWidthFontRenderer
} }
drawQuad( renderer, x + i * FONT_WIDTH, y, colour, FONT_WIDTH ); drawQuad( renderer, x + i * FONT_WIDTH, y, colour, FONT_WIDTH );
} }
GlStateManager.disableTexture2D();
tessellator.draw(); tessellator.draw();
GlStateManager.enableTexture2D();
} }
public void drawStringTextPart( int x, int y, TextBuffer s, TextBuffer textColour, boolean greyScale ) public void drawStringTextPart( int x, int y, TextBuffer s, TextBuffer textColour, boolean greyScale )