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 -->
|
<!-- Main Applet Class -->
|
||||||
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
|
<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 -->
|
<!-- 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">
|
<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 -->
|
<!-- foreground color to paint with, defaults to black -->
|
||||||
<!-- <param name="boxfgcolor" value="#ffffff"> -->
|
<!-- <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 -->
|
<!-- whether to run in debug mode -->
|
||||||
<!-- <param name="al_debug" value="true"> -->
|
<!-- <param name="al_debug" value="true"> -->
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,6 @@
|
||||||
<!-- Main Applet Class -->
|
<!-- Main Applet Class -->
|
||||||
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
|
<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 -->
|
<!-- List of Jars to add to classpath -->
|
||||||
<param name="al_jars" value="lwjgl_applet.jar, lwjgl.jar, jinput.jar, lwjgl_util.jar">
|
<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 -->
|
<!-- foreground color to paint with, defaults to black -->
|
||||||
<!-- <param name="boxfgcolor" value="#ffffff"> -->
|
<!-- <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 -->
|
<!-- whether to run in debug mode -->
|
||||||
<!-- <param name="al_debug" value="true"> -->
|
<!-- <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_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>
|
* <li>al_jars - [String] Comma seperated list of jars to download.</li>
|
||||||
* <p>
|
* <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_windows - [String] Jar containing native files for windows.</li>
|
||||||
* <li>al_linux - [String] Jar containing native files for linux.</li>
|
* <li>al_linux - [String] Jar containing native files for linux.</li>
|
||||||
* <li>al_mac - [String] Jar containing native files for mac.</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>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>
|
* <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>
|
* <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>
|
* <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>
|
* </ul>
|
||||||
* </p>
|
* </p>
|
||||||
|
@ -270,7 +270,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
||||||
setState(STATE_INIT);
|
setState(STATE_INIT);
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"};
|
String[] requiredArgs = {"al_main", "al_jars"};
|
||||||
for ( String requiredArg : requiredArgs ) {
|
for ( String requiredArg : requiredArgs ) {
|
||||||
if ( getParameter(requiredArg) == null ) {
|
if ( getParameter(requiredArg) == null ) {
|
||||||
fatalErrorOccured("missing required applet parameter: " + requiredArg, null);
|
fatalErrorOccured("missing required applet parameter: " + requiredArg, null);
|
||||||
|
@ -292,13 +292,9 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
||||||
setBackground(bgColor);
|
setBackground(bgColor);
|
||||||
fgColor = getColor("boxfgcolor", Color.black);
|
fgColor = getColor("boxfgcolor", Color.black);
|
||||||
|
|
||||||
// load logos, if value is "" then skip
|
// load logos, if value is "" then an image is not loaded
|
||||||
if (getParameter("al_logo").length() > 0) {
|
logo = getImage(getStringParameter("al_logo", "appletlogo.gif"));
|
||||||
logo = getImage(getParameter("al_logo"));
|
progressbar = getImage(getStringParameter("al_progressbar", "appletprogress.gif"));
|
||||||
}
|
|
||||||
if (getParameter("al_progressbar").length() > 0) {
|
|
||||||
progressbar = getImage(getParameter("al_progressbar"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for lzma support
|
// check for lzma support
|
||||||
try {
|
try {
|
||||||
|
@ -1563,6 +1559,9 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
||||||
*/
|
*/
|
||||||
protected Image getImage(String s) {
|
protected Image getImage(String s) {
|
||||||
|
|
||||||
|
// if s is "" then don't load an image
|
||||||
|
if (s.length() == 0) return null;
|
||||||
|
|
||||||
Image image = null;
|
Image image = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1690,7 +1689,21 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the boolean value for the applet
|
* 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 parameter
|
||||||
* @param name Name of parameter
|
* @param name Name of parameter
|
||||||
* @param defaultValue default value to return if no such parameter
|
* @param defaultValue default value to return if no such parameter
|
||||||
* @return value of parameter or defaultValue
|
* @return value of parameter or defaultValue
|
||||||
|
|
Loading…
Reference in New Issue