mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Splash screen now loaded from skin (theme).
This commit is contained in:
@@ -35,7 +35,8 @@ public class FSkin {
|
|||||||
public ImageIcon btnRover = null;
|
public ImageIcon btnRover = null;
|
||||||
public ImageIcon btnLdown = null;
|
public ImageIcon btnLdown = null;
|
||||||
public ImageIcon btnMdown = null;
|
public ImageIcon btnMdown = null;
|
||||||
public ImageIcon btnRdown = null;
|
public ImageIcon btnRdown = null;
|
||||||
|
public ImageIcon splash = null;
|
||||||
|
|
||||||
public Color bg1a = Color.red;
|
public Color bg1a = Color.red;
|
||||||
public Color bg1b = Color.red;
|
public Color bg1b = Color.red;
|
||||||
@@ -68,6 +69,7 @@ public class FSkin {
|
|||||||
private final String btnLdownfile = "btnLdown.png";
|
private final String btnLdownfile = "btnLdown.png";
|
||||||
private final String btnMdownfile = "btnMdown.png";
|
private final String btnMdownfile = "btnMdown.png";
|
||||||
private final String btnRdownfile = "btnRdown.png";
|
private final String btnRdownfile = "btnRdown.png";
|
||||||
|
private final String splashfile = "bg_splash.jpg";
|
||||||
|
|
||||||
private ImageIcon tempImg;
|
private ImageIcon tempImg;
|
||||||
private Font tempFont;
|
private Font tempFont;
|
||||||
@@ -165,6 +167,7 @@ public class FSkin {
|
|||||||
btnLdown = retrieveImage(dirName + btnLdownfile);
|
btnLdown = retrieveImage(dirName + btnLdownfile);
|
||||||
btnMdown = retrieveImage(dirName + btnMdownfile);
|
btnMdown = retrieveImage(dirName + btnMdownfile);
|
||||||
btnRdown = retrieveImage(dirName + btnRdownfile);
|
btnRdown = retrieveImage(dirName + btnRdownfile);
|
||||||
|
splash = retrieveImage(dirName + splashfile);
|
||||||
|
|
||||||
// Color palette
|
// Color palette
|
||||||
File file= new File(dirName + paletteFile);
|
File file= new File(dirName + paletteFile);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class FModel {
|
|||||||
private final transient PrintStream oldSystemOut;
|
private final transient PrintStream oldSystemOut;
|
||||||
private final transient PrintStream oldSystemErr;
|
private final transient PrintStream oldSystemErr;
|
||||||
private BuildInfo buildInfo;
|
private BuildInfo buildInfo;
|
||||||
private ForgePreferences preferences;
|
public ForgePreferences preferences;
|
||||||
private FGameState gameState;
|
private FGameState gameState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -37,14 +37,14 @@ public class ApplicationView implements FView {
|
|||||||
* The splashFrame field is guaranteed to exist when this constructor
|
* The splashFrame field is guaranteed to exist when this constructor
|
||||||
* exits.
|
* exits.
|
||||||
*/
|
*/
|
||||||
public ApplicationView() {
|
public ApplicationView(final FSkin skin) {
|
||||||
|
|
||||||
// We must use invokeAndWait here to fulfill the constructor's
|
// We must use invokeAndWait here to fulfill the constructor's
|
||||||
// contract.
|
// contract.
|
||||||
|
|
||||||
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { // NOPMD by Braids on 8/18/11 11:37 PM
|
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { // NOPMD by Braids on 8/18/11 11:37 PM
|
||||||
public void run() {
|
public void run() {
|
||||||
splashFrame = new SplashFrame();
|
splashFrame = new SplashFrame(skin);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package forge.view.swing;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.error.ErrorViewer;
|
import forge.error.ErrorViewer;
|
||||||
import forge.error.ExceptionHandler;
|
import forge.error.ExceptionHandler;
|
||||||
|
import forge.gui.skin.FSkin;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.view.FView;
|
import forge.view.FView;
|
||||||
|
|
||||||
@@ -27,10 +28,13 @@ public final class Main {
|
|||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
ExceptionHandler.registerErrorHandling();
|
ExceptionHandler.registerErrorHandling();
|
||||||
try {
|
try {
|
||||||
final FView view = new ApplicationView();
|
|
||||||
Singletons.setView(view);
|
|
||||||
final FModel model = new FModel(null);
|
final FModel model = new FModel(null);
|
||||||
Singletons.setModel(model);
|
Singletons.setModel(model);
|
||||||
|
|
||||||
|
FSkin skin = new FSkin(model.preferences.skin);
|
||||||
|
final FView view = new ApplicationView(skin);
|
||||||
|
Singletons.setView(view);
|
||||||
|
|
||||||
|
|
||||||
// Need this soon after card factory is loaded
|
// Need this soon after card factory is loaded
|
||||||
OldGuiNewGame.loadDynamicGamedata();
|
OldGuiNewGame.loadDynamicGamedata();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
import forge.gui.skin.FSkin;
|
||||||
|
|
||||||
import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
|
import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
|
||||||
|
|
||||||
@@ -24,9 +25,7 @@ import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class SplashFrame extends JFrame {
|
public class SplashFrame extends JFrame {
|
||||||
|
|
||||||
// Inits: Visual changes can be made here.
|
// Inits: Visual changes can be made here.
|
||||||
private static final String BG_ADDRESS = "res/images/ui/forgeSplash.jpg";
|
|
||||||
|
|
||||||
private static final int BAR_PADDING_X = 20;
|
private static final int BAR_PADDING_X = 20;
|
||||||
private static final int BAR_PADDING_Y = 20;
|
private static final int BAR_PADDING_Y = 20;
|
||||||
private static final int BAR_HEIGHT = 57;
|
private static final int BAR_HEIGHT = 57;
|
||||||
@@ -54,17 +53,17 @@ public class SplashFrame extends JFrame {
|
|||||||
* Throws {@link IllegalStateException} if not called from an event
|
* Throws {@link IllegalStateException} if not called from an event
|
||||||
* dispatch thread.
|
* dispatch thread.
|
||||||
*/
|
*/
|
||||||
public SplashFrame() {
|
public SplashFrame(FSkin skin) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (!SwingUtilities.isEventDispatchThread()) {
|
if (!SwingUtilities.isEventDispatchThread()) {
|
||||||
throw new IllegalStateException("SplashFrame() must be called from an event dispatch thread.");
|
throw new IllegalStateException("SplashFrame() must be called from an event dispatch thread.");
|
||||||
}
|
}
|
||||||
|
|
||||||
setUndecorated(true);
|
setUndecorated(true);
|
||||||
|
|
||||||
// Load icon and set preferred JFrame properties.
|
// Set preferred JFrame properties.
|
||||||
final ImageIcon bgIcon = new ImageIcon(BG_ADDRESS);
|
final ImageIcon bgIcon = skin.splash;
|
||||||
final int splashWidthPx = bgIcon.getIconWidth();
|
final int splashWidthPx = bgIcon.getIconWidth();
|
||||||
final int splashHeightPx = bgIcon.getIconHeight();
|
final int splashHeightPx = bgIcon.getIconHeight();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user