AppletLoader: "al_logo" and "al_progress" are now optional parameters, they default to "appletlogo.gif" and "appletprogress.gif". Credit to arielsan for patch.
This commit is contained in:
parent
3b4f843dd4
commit
31dad59c9f
|
@ -15,12 +15,6 @@
|
|||
<!-- Main Applet Class -->
|
||||
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
|
||||
|
||||
<!-- logo to paint while loading, will be centered -->
|
||||
<param name="al_logo" value="appletlogo.gif">
|
||||
|
||||
<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
|
||||
<param name="al_progressbar" value="appletprogress.gif">
|
||||
|
||||
<!-- List of Jars to add to classpath -->
|
||||
<param name="al_jars" value="lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma">
|
||||
|
||||
|
@ -50,6 +44,12 @@
|
|||
<!-- foreground color to paint with, defaults to black -->
|
||||
<!-- <param name="boxfgcolor" value="#ffffff"> -->
|
||||
|
||||
<!-- logo to paint while loading, will be centered, defaults to "appletlogo.gif" -->
|
||||
<!-- <param name="al_logo" value="appletlogo.gif"> -->
|
||||
|
||||
<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done, defaults to "appletprogress.gif" -->
|
||||
<!-- <param name="al_progressbar" value="appletprogress.gif"> -->
|
||||
|
||||
<!-- whether to run in debug mode -->
|
||||
<!-- <param name="al_debug" value="true"> -->
|
||||
|
||||
|
|
|
@ -15,12 +15,6 @@
|
|||
<!-- Main Applet Class -->
|
||||
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
|
||||
|
||||
<!-- logo to paint while loading, will be centered -->
|
||||
<param name="al_logo" value="appletlogo.gif">
|
||||
|
||||
<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
|
||||
<param name="al_progressbar" value="appletprogress.gif">
|
||||
|
||||
<!-- List of Jars to add to classpath -->
|
||||
<param name="al_jars" value="lwjgl_applet.jar, lwjgl.jar, jinput.jar, lwjgl_util.jar">
|
||||
|
||||
|
@ -50,6 +44,12 @@
|
|||
<!-- foreground color to paint with, defaults to black -->
|
||||
<!-- <param name="boxfgcolor" value="#ffffff"> -->
|
||||
|
||||
<!-- logo to paint while loading, will be centered, defaults to "appletlogo.gif" -->
|
||||
<!-- <param name="al_logo" value="appletlogo.gif"> -->
|
||||
|
||||
<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done, defaults to "appletprogress.gif" -->
|
||||
<!-- <param name="al_progressbar" value="appletprogress.gif"> -->
|
||||
|
||||
<!-- whether to run in debug mode -->
|
||||
<!-- <param name="al_debug" value="true"> -->
|
||||
|
||||
|
|
|
@ -99,9 +99,6 @@ import sun.security.util.SecurityConstants;
|
|||
* <li>al_main - [String] Full package and class the applet to instantiate and display when loaded.</li>
|
||||
* <li>al_jars - [String] Comma seperated list of jars to download.</li>
|
||||
* <p>
|
||||
* <li>al_logo - [String Path of of the logo resource to paint while loading.</li>
|
||||
* <li>al_progressbar - [String] Path of the progressbar resource to paint on top of the logo, width clipped by percentage.</li>
|
||||
* <p>
|
||||
* <li>al_windows - [String] Jar containing native files for windows.</li>
|
||||
* <li>al_linux - [String] Jar containing native files for linux.</li>
|
||||
* <li>al_mac - [String] Jar containing native files for mac.</li>
|
||||
|
@ -126,6 +123,9 @@ import sun.security.util.SecurityConstants;
|
|||
* <li>boxbgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as background. <i>Default: #ffffff</i>.</li>
|
||||
* <li>boxfgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as foreground. <i>Default: #000000</i>.</li>
|
||||
* <p>
|
||||
* <li>al_logo - [String Path of of the logo resource to paint while loading.<i>Default: "appletlogo.gif"</i>.</li>
|
||||
* <li>al_progressbar - [String] Path of the progressbar resource to paint on top of the logo, width clipped by percentage.<i>Default: "appletprogress.gif"</i>.</li>
|
||||
* <p>
|
||||
* <li>lwjgl_arguments - </li> [String] used to pass the hidden LWJGL parameters to LWJGL e.g. ("-Dorg.lwjgl.input.Mouse.allowNegativeMouseCoords=true -Dorg.lwjgl.util.Debug=true").</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
|
@ -270,7 +270,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
|||
setState(STATE_INIT);
|
||||
|
||||
// sanity check
|
||||
String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"};
|
||||
String[] requiredArgs = {"al_main", "al_jars"};
|
||||
for ( String requiredArg : requiredArgs ) {
|
||||
if ( getParameter(requiredArg) == null ) {
|
||||
fatalErrorOccured("missing required applet parameter: " + requiredArg, null);
|
||||
|
@ -292,13 +292,9 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
|||
setBackground(bgColor);
|
||||
fgColor = getColor("boxfgcolor", Color.black);
|
||||
|
||||
// load logos, if value is "" then skip
|
||||
if (getParameter("al_logo").length() > 0) {
|
||||
logo = getImage(getParameter("al_logo"));
|
||||
}
|
||||
if (getParameter("al_progressbar").length() > 0) {
|
||||
progressbar = getImage(getParameter("al_progressbar"));
|
||||
}
|
||||
// load logos, if value is "" then an image is not loaded
|
||||
logo = getImage(getStringParameter("al_logo", "appletlogo.gif"));
|
||||
progressbar = getImage(getStringParameter("al_progressbar", "appletprogress.gif"));
|
||||
|
||||
// check for lzma support
|
||||
try {
|
||||
|
@ -1563,6 +1559,9 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
|||
*/
|
||||
protected Image getImage(String s) {
|
||||
|
||||
// if s is "" then don't load an image
|
||||
if (s.length() == 0) return null;
|
||||
|
||||
Image image = null;
|
||||
|
||||
try {
|
||||
|
@ -1688,9 +1687,23 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
|||
return defaultColor;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the String value for the parameter
|
||||
* @param name Name of parameter
|
||||
* @param defaultValue default value to return if no such parameter
|
||||
* @return value of parameter or defaultValue
|
||||
*/
|
||||
protected String getStringParameter(String name, String defaultValue) {
|
||||
String parameter = getParameter(name);
|
||||
if (parameter != null) {
|
||||
return parameter;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the boolean value for the applet
|
||||
* Retrieves the boolean value for the parameter
|
||||
* @param name Name of parameter
|
||||
* @param defaultValue default value to return if no such parameter
|
||||
* @return value of parameter or defaultValue
|
||||
|
|
Loading…
Reference in New Issue