Adds splash screen (#29)

* clock manager: wrap panel to run on swing thread

* Add splash screen to Runelite

Although RuneLite is still fast at loading, it's more user friendly
for at least something to pop up before the client.
There is also an option (-no-splash) to disable the splash screen.
This uses psikoi's design.

* splash screen/client ui: don't set up theme twice

Setting up the look and feel of RuneLite shouldn't happen twice, so
check to see if it has already been set up before setting up the look
and feel.
This commit is contained in:
James
2019-04-20 23:41:48 -07:00
committed by Kyleeld
parent 776734c51c
commit 2a7625f240
8 changed files with 286 additions and 11 deletions

View File

@@ -26,6 +26,7 @@ package net.runelite.client.util;
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Image;
@@ -52,11 +53,15 @@ import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.basic.BasicProgressBarUI;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.components.CustomScrollBarUI;
import net.runelite.client.ui.skin.SubstanceRuneLiteLookAndFeel;
import org.pushingpixels.substance.internal.SubstanceSynapse;
/**
@@ -65,6 +70,8 @@ import org.pushingpixels.substance.internal.SubstanceSynapse;
@Slf4j
public class SwingUtil
{
private static boolean lookAndFeelIsSet = false;
/**
* Sets some sensible defaults for swing.
* IMPORTANT! Needs to be called before main frame creation
@@ -87,6 +94,14 @@ public class SwingUtil
UIManager.put("FormattedTextField.selectionForeground", Color.WHITE);
UIManager.put("TextArea.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
UIManager.put("TextArea.selectionForeground", Color.WHITE);
UIManager.put("ProgressBar.background", ColorScheme.BRAND_ORANGE_TRANSPARENT.darker());
UIManager.put("ProgressBar.foreground", ColorScheme.BRAND_ORANGE);
UIManager.put("ProgressBar.selectionBackground", ColorScheme.BRAND_ORANGE);
UIManager.put("ProgressBar.selectionForeground", Color.BLACK);
UIManager.put("ProgressBar.border", new EmptyBorder(0, 0, 0, 0));
UIManager.put("ProgressBar.verticalSize", new Dimension(12, 10));
UIManager.put("ProgressBar.horizontalSize", new Dimension(10, 12));
UIManager.put("ProgressBarUI", BasicProgressBarUI.class.getName());
// Do not render shadows under popups/tooltips.
// Fixes black boxes under popups that are above the game applet.
@@ -277,4 +292,24 @@ public class SwingUtil
navigationButton.setOnSelect(button::doClick);
return button;
}
/**
* Sets up the RuneLite look and feel. Checks to see if the look and feel
* was already set up before running in case the splash screen has already
* set up the theme.
* This must be run inside the Swing Event Dispatch thread.
*/
public static void setupRuneLiteLookAndFeel()
{
if (!lookAndFeelIsSet)
{
lookAndFeelIsSet = true;
// Set some sensible swing defaults
SwingUtil.setupDefaults();
// Use substance look and feel
SwingUtil.setTheme(new SubstanceRuneLiteLookAndFeel());
// Use custom UI font
SwingUtil.setFont(FontManager.getRunescapeFont());
}
}
}