diff --git a/ClassicalSharp/2D/Screens/ClickableScreen.cs b/ClassicalSharp/2D/Screens/ClickableScreen.cs index f70faf1d4..a7d12c55a 100644 --- a/ClassicalSharp/2D/Screens/ClickableScreen.cs +++ b/ClassicalSharp/2D/Screens/ClickableScreen.cs @@ -8,6 +8,16 @@ namespace ClassicalSharp.Gui.Screens { public abstract class ClickableScreen : Screen { public ClickableScreen(Game game) : base(game) { + } + + // 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 topBackCol = new FastColour(24, 24, 24, 105); + static FastColour bottomBackCol = new FastColour(51, 51, 98, 162); + + protected void RenderMenuBounds() { + gfx.Draw2DQuad(0, 0, game.Width, game.Height, topBackCol, bottomBackCol); } protected bool HandleMouseClick(Widget[] widgets, int mouseX, int mouseY, MouseButton button) { diff --git a/ClassicalSharp/2D/Screens/Menu/FilesScreen.cs b/ClassicalSharp/2D/Screens/Menu/FilesScreen.cs index 8f15e4821..93ae6c73e 100644 --- a/ClassicalSharp/2D/Screens/Menu/FilesScreen.cs +++ b/ClassicalSharp/2D/Screens/Menu/FilesScreen.cs @@ -132,7 +132,7 @@ namespace ClassicalSharp.Gui.Screens { } public override void Render(double delta) { - gfx.Draw2DQuad(0, 0, game.Width, game.Height, new FastColour(60, 60, 60, 160)); + RenderMenuBounds(); gfx.Texturing = true; title.Render(delta); RenderWidgets(buttons, delta); diff --git a/ClassicalSharp/2D/Screens/MenuScreen.cs b/ClassicalSharp/2D/Screens/MenuScreen.cs index 472ed3c7c..467f3a048 100644 --- a/ClassicalSharp/2D/Screens/MenuScreen.cs +++ b/ClassicalSharp/2D/Screens/MenuScreen.cs @@ -12,13 +12,7 @@ namespace ClassicalSharp.Gui.Screens { } protected Widget[] widgets; protected Font titleFont, regularFont; - - // 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 topBackCol = new FastColour(24, 24, 24, 105); - static FastColour bottomBackCol = new FastColour(51, 51, 98, 162); - + protected int IndexOfWidget(Widget w) { for (int i = 0; i < widgets.Length; i++) { if (widgets[i] == w) return i; @@ -26,10 +20,6 @@ namespace ClassicalSharp.Gui.Screens { return -1; } - protected void RenderMenuBounds() { - gfx.Draw2DQuad(0, 0, game.Width, game.Height, topBackCol, bottomBackCol); - } - public override void Render(double delta) { RenderMenuBounds(); gfx.Texturing = true; diff --git a/src/Client/Screens.c b/src/Client/Screens.c index 92e05bc78..74209d40f 100644 --- a/src/Client/Screens.c +++ b/src/Client/Screens.c @@ -2,6 +2,7 @@ #include "Widgets.h" #include "Game.h" #include "Events.h" +#include "GraphicsCommon.h" void Screen_FreeWidgets(Widget** widgets, UInt32 widgetsCount) { if (widgets == NULL) return; @@ -32,6 +33,17 @@ void Screen_RenderWidgets(Widget** widgets, UInt32 widgetsCount, Real64 delta) { } + +/* 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 */ +PackedCol Menu_TopBackCol = PACKEDCOL_CONST(24, 24, 24, 105); +PackedCol Menu_BottomBackCol = PACKEDCOL_CONST(51, 51, 98, 162); + +void ClickableScreen_RenderMenuBounds(void) { + GfxCommon_Draw2DGradient(0, 0, Game_Width, Game_Height, Menu_TopBackCol, Menu_BottomBackCol); +} + void ClickableScreen_DefaultWidgetSelected(GuiElement* elem, Widget* widget) { } bool ClickableScreen_HandlesMouseDown(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {