|
From: <ka...@us...> - 2011-03-06 01:34:12
|
Revision: 3494
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3494&view=rev
Author: kappa1
Date: 2011-03-06 01:34:06 +0000 (Sun, 06 Mar 2011)
Log Message:
-----------
AppletLoader: "al_logo" and "al_progress" are now optional parameters, they default to "appletlogo.gif" and "appletprogress.gif". Credit to arielsan for patch.
Modified Paths:
--------------
trunk/LWJGL/applet/advance/appletloader.html
trunk/LWJGL/applet/basic/basicapplet.html
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/applet/advance/appletloader.html
===================================================================
--- trunk/LWJGL/applet/advance/appletloader.html 2011-02-20 20:26:17 UTC (rev 3493)
+++ trunk/LWJGL/applet/advance/appletloader.html 2011-03-06 01:34:06 UTC (rev 3494)
@@ -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"> -->
Modified: trunk/LWJGL/applet/basic/basicapplet.html
===================================================================
--- trunk/LWJGL/applet/basic/basicapplet.html 2011-02-20 20:26:17 UTC (rev 3493)
+++ trunk/LWJGL/applet/basic/basicapplet.html 2011-03-06 01:34:06 UTC (rev 3494)
@@ -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"> -->
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-02-20 20:26:17 UTC (rev 3493)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-06 01:34:06 UTC (rev 3494)
@@ -99,9 +99,6 @@
* <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 @@
* <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 @@
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 @@
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 @@
*/
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 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|