From cd06b13f66006bf9c9413fc9b01f50891e6b0de1 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 11 Dec 2016 02:33:50 +0100 Subject: [PATCH] tooltip with description --- src/yugecin/opsudance/ui/OptionsOverlay.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/yugecin/opsudance/ui/OptionsOverlay.java b/src/yugecin/opsudance/ui/OptionsOverlay.java index cf4c0d21..3d82158b 100644 --- a/src/yugecin/opsudance/ui/OptionsOverlay.java +++ b/src/yugecin/opsudance/ui/OptionsOverlay.java @@ -120,8 +120,24 @@ public class OptionsOverlay { // options renderOptions(g); + // UI UI.getBackButton().draw(); UI.draw(g); + + // tooltip + renderTooltip(g, mouseX, mouseY); + } + + private void renderTooltip(Graphics g, int mouseX, int mouseY) { + if (hoverOption != null) { + String optionDescription = hoverOption.getDescription(); + float textWidth = Fonts.SMALL.getWidth(optionDescription); + Color.black.a = 0.7f; + g.setColor(Color.black); + g.fillRoundRect(mouseX + 10, mouseY + 10, 10 + textWidth, 10 + Fonts.SMALL.getLineHeight(), 4); + Fonts.SMALL.drawString(mouseX + 15, mouseY + 15, optionDescription, Color.white); + Color.black.a = 1f; + } } private void renderOptions(Graphics g) {