diff --git a/.gitignore b/.gitignore index 1aa8828b3..21b37972c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ deploy *.ipr *.iws *.iml +.idea .gradle luaj-2.0.3/lib luaj-2.0.3/*.jar diff --git a/src/main/java/dan200/computercraft/client/gui/FixedWidthFontRenderer.java b/src/main/java/dan200/computercraft/client/gui/FixedWidthFontRenderer.java index 91838519d..12335f9f5 100644 --- a/src/main/java/dan200/computercraft/client/gui/FixedWidthFontRenderer.java +++ b/src/main/java/dan200/computercraft/client/gui/FixedWidthFontRenderer.java @@ -8,6 +8,7 @@ package dan200.computercraft.client.gui; import dan200.computercraft.core.terminal.TextBuffer; import dan200.computercraft.shared.util.Colour; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.texture.TextureManager; @@ -35,19 +36,23 @@ public class FixedWidthFontRenderer int column = index % 16; int row = index / 16; Colour colour = Colour.values()[ 15 - color ]; + renderer.pos( x, y, 0.0 ).tex( (double) (column * FONT_WIDTH) / 256.0, (double) (row * FONT_HEIGHT ) / 256.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); + renderer.pos( x, y + FONT_HEIGHT, 0.0 ).tex( (double) (column * FONT_WIDTH) / 256.0, (double) ((row + 1) * FONT_HEIGHT) / 256.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); + renderer.pos( x + FONT_WIDTH, y, 0.0 ).tex( (double) ((column + 1) * FONT_WIDTH) / 256.0, (double) (row * FONT_HEIGHT) / 256.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); + renderer.pos( x + FONT_WIDTH, y, 0.0 ).tex( (double) ((column + 1) * FONT_WIDTH) / 256.0, (double) (row * FONT_HEIGHT) / 256.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); renderer.pos( x, y + FONT_HEIGHT, 0.0 ).tex( (double) (column * FONT_WIDTH) / 256.0, (double) ((row + 1) * FONT_HEIGHT) / 256.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); renderer.pos( x + FONT_WIDTH, y + FONT_HEIGHT, 0.0 ).tex( (double) ((column + 1) * FONT_WIDTH) / 256.0, (double) ((row + 1) * FONT_HEIGHT) / 256.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); - renderer.pos( x + FONT_WIDTH, y, 0.0 ).tex( (double) ((column + 1) * FONT_WIDTH) / 256.0, (double) (row * FONT_HEIGHT) / 256.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); - renderer.pos( x, y, 0.0 ).tex( (double) (column * FONT_WIDTH) / 256.0, (double) (row * FONT_HEIGHT ) / 256.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); } private void drawQuad( VertexBuffer renderer, double x, double y, int color, double width ) { Colour colour = Colour.values()[ 15 - color ]; - 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 + 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, 0.0 ).tex( 1.0, 0.0 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); - 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 ).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 ).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 ).color( colour.getR(), colour.getG(), colour.getB(), 1.0f ).endVertex(); } private boolean isGreyScale( int colour ) @@ -60,7 +65,7 @@ public class FixedWidthFontRenderer // Draw the quads Tessellator tessellator = Tessellator.getInstance(); VertexBuffer renderer = tessellator.getBuffer(); - renderer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR ); + renderer.begin( GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR ); if( leftMarginSize > 0.0 ) { int colour1 = "0123456789abcdef".indexOf( backgroundColour.charAt( 0 ) ); @@ -88,7 +93,9 @@ public class FixedWidthFontRenderer } drawQuad( renderer, x + i * FONT_WIDTH, y, colour, FONT_WIDTH ); } + GlStateManager.disableTexture2D(); tessellator.draw(); + GlStateManager.enableTexture2D(); } public void drawStringTextPart( int x, int y, TextBuffer s, TextBuffer textColour, boolean greyScale ) @@ -96,7 +103,7 @@ public class FixedWidthFontRenderer // Draw the quads Tessellator tessellator = Tessellator.getInstance(); VertexBuffer renderer = tessellator.getBuffer(); - renderer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR ); + renderer.begin( GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX_COLOR ); for( int i = 0; i < s.length(); i++ ) { // Switch colour diff --git a/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java b/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java index 9eb6ddbb4..7325c9944 100644 --- a/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java +++ b/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java @@ -407,23 +407,22 @@ public class WidgetTerminal extends Widget TextBuffer colour = terminal.getTextColourLine( line ); TextBuffer backgroundColour = terminal.getBackgroundColourLine( line ); fontRenderer.drawString( text, x, y, colour, backgroundColour, m_leftMargin, m_rightMargin, greyscale ); - if( tblink && ty == line ) - { - if( tx >= 0 && tx < tw ) - { - TextBuffer cursor = new TextBuffer( '_', 1 ); - TextBuffer cursorColour = new TextBuffer( "0123456789abcdef".charAt( terminal.getTextColour() ), 1 ); - fontRenderer.drawString( - cursor, - x + FixedWidthFontRenderer.FONT_WIDTH * tx, - y, - cursorColour, null, - 0, 0, - greyscale - ); - } - } - y = y + FixedWidthFontRenderer.FONT_HEIGHT; + y += FixedWidthFontRenderer.FONT_HEIGHT; + } + + if( tblink && tx >= 0 && ty >= 0 && tx < tw && ty < th ) + { + TextBuffer cursor = new TextBuffer( '_', 1 ); + TextBuffer cursorColour = new TextBuffer( "0123456789abcdef".charAt( terminal.getTextColour() ), 1 ); + + fontRenderer.drawString( + cursor, + x + FixedWidthFontRenderer.FONT_WIDTH * tx, + startY + m_topMargin + FixedWidthFontRenderer.FONT_HEIGHT * ty, + cursorColour, null, + 0, 0, + greyscale + ); } } } diff --git a/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java b/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java index f6a438eb5..0897cdecd 100644 --- a/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java +++ b/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java @@ -27,6 +27,7 @@ import dan200.computercraft.shared.turtle.blocks.TileTurtle; import dan200.computercraft.shared.turtle.entity.TurtleVisionCamera; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -256,7 +257,7 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon @Override public void deleteDisplayLists( int list, int range ) { - GL11.glDeleteLists( list, range ); + GlStateManager.glDeleteLists( list, range ); } @Override diff --git a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java b/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java index fffdc7b68..9b0129a46 100644 --- a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java @@ -11,7 +11,6 @@ import dan200.computercraft.client.gui.FixedWidthFontRenderer; import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.core.terminal.TextBuffer; import dan200.computercraft.shared.common.ClientTerminal; -import dan200.computercraft.shared.common.ITerminal; import dan200.computercraft.shared.peripheral.monitor.TileMonitor; import dan200.computercraft.shared.util.Colour; import dan200.computercraft.shared.util.DirectionUtil; @@ -21,11 +20,8 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraft.util.math.BlockPos; import org.lwjgl.opengl.GL11; public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer @@ -111,7 +107,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer