From f15f0134c1b582b52337690e085f13aeceaff4fd Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 26 May 2016 17:03:05 +1000 Subject: [PATCH] Use the original classic inventory table colours. --- .../2D/Screens/Inventory/InventoryScreen.cs | 10 ++++++---- ClassicalSharp/Game/Inventory.cs | 1 - ClassicalSharp/GraphicsAPI/IGraphicsApi.cs | 13 ++++++++++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ClassicalSharp/2D/Screens/Inventory/InventoryScreen.cs b/ClassicalSharp/2D/Screens/Inventory/InventoryScreen.cs index a9f4ac65f..60c141283 100644 --- a/ClassicalSharp/2D/Screens/Inventory/InventoryScreen.cs +++ b/ClassicalSharp/2D/Screens/Inventory/InventoryScreen.cs @@ -31,14 +31,16 @@ namespace ClassicalSharp.Gui { int TableWidth { get { return blocksPerRow * blockSize + 10 + 10; } } int TableHeight { get { return Math.Min( rows, maxRows ) * blockSize + 10 + 30; } } - static FastColour normBackCol = new FastColour( 30, 30, 30, 200 ); - static FastColour classicBackCol = new FastColour( 48, 48, 96, 192 ); + // These were sourced by taking a screenshot of vanilla + // Then using paint to extract the colour components + // Then using wolfram alpha to solve the glblendfunc equation + static FastColour topCol = new FastColour( 34, 34, 34, 168 ); + static FastColour bottomCol = new FastColour( 57, 57, 104, 202 ); static VertexP3fT2fC4b[] vertices = new VertexP3fT2fC4b[8 * 10 * (4 * 4)]; int vb; public override void Render( double delta ) { - FastColour backCol = game.ClassicMode ? classicBackCol : normBackCol; - api.Draw2DQuad( TableX, TableY, TableWidth, TableHeight, backCol ); + api.Draw2DQuad( TableX, TableY, TableWidth, TableHeight, topCol, bottomCol ); if( rows > maxRows ) DrawScrollbar(); api.Texturing = true; diff --git a/ClassicalSharp/Game/Inventory.cs b/ClassicalSharp/Game/Inventory.cs index 6cc0cdcd0..1170a7ccf 100644 --- a/ClassicalSharp/Game/Inventory.cs +++ b/ClassicalSharp/Game/Inventory.cs @@ -81,7 +81,6 @@ namespace ClassicalSharp { void MakeMap() { for( int i = 0; i < map.Length; i++ ) map[i] = (Block)i; - if( !game.ClassicMode ) return; // First row map[(byte)Block.Dirt] = Block.Cobblestone; diff --git a/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs b/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs index 545400857..49be83f5e 100644 --- a/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs +++ b/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs @@ -253,7 +253,8 @@ namespace ClassicalSharp.GraphicsAPI { internal VertexP3fC4b[] quadVerts = new VertexP3fC4b[4]; internal int quadVb; - public virtual void Draw2DQuad( float x, float y, float width, float height, FastColour col ) { + public virtual void Draw2DQuad( float x, float y, float width, float height, + FastColour col ) { quadVerts[0] = new VertexP3fC4b( x, y, 0, col ); quadVerts[1] = new VertexP3fC4b( x + width, y, 0, col ); quadVerts[2] = new VertexP3fC4b( x + width, y + height, 0, col ); @@ -262,6 +263,16 @@ namespace ClassicalSharp.GraphicsAPI { UpdateDynamicIndexedVb( DrawMode.Triangles, quadVb, quadVerts, 4, 6 ); } + public virtual void Draw2DQuad( float x, float y, float width, float height, + FastColour topCol, FastColour bottomCol ) { + quadVerts[0] = new VertexP3fC4b( x, y, 0, topCol ); + quadVerts[1] = new VertexP3fC4b( x + width, y, 0, topCol ); + quadVerts[2] = new VertexP3fC4b( x + width, y + height, 0, bottomCol ); + quadVerts[3] = new VertexP3fC4b( x, y + height, 0, bottomCol ); + SetBatchFormat( VertexFormat.P3fC4b ); + UpdateDynamicIndexedVb( DrawMode.Triangles, quadVb, quadVerts, 4, 6 ); + } + internal VertexP3fT2fC4b[] texVerts = new VertexP3fT2fC4b[4]; internal int texVb; public virtual void Draw2DTexture( ref Texture tex, FastColour col ) {