aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-examples
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2014-08-01 20:46:32 +0200
committerJulien Gouesse <[email protected]>2014-08-01 20:46:32 +0200
commitf713011de90b98020821e61964ea04a2a371d0eb (patch)
treec2a8ff5bc9c674c1af13673a8e436c764fd62fb8 /ardor3d-examples
parent64e8a1e3e1a085ea362cff13f13ea022547d0f16 (diff)
Uses ImageLoaderUtil instead of invoking directly the JOGL image loader
Diffstat (limited to 'ardor3d-examples')
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java16
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java16
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java16
3 files changed, 26 insertions, 22 deletions
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java
index b3778f6..eef28b9 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java
@@ -29,6 +29,7 @@ import com.ardor3d.framework.DisplaySettings;
import com.ardor3d.framework.FrameHandler;
import com.ardor3d.framework.jogl.JoglCanvasRenderer;
import com.ardor3d.framework.jogl.JoglNewtAwtCanvas;
+import com.ardor3d.image.util.ImageLoaderUtil;
import com.ardor3d.image.util.jogl.JoglImageLoader;
import com.ardor3d.input.ControllerWrapper;
import com.ardor3d.input.Key;
@@ -47,6 +48,7 @@ import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.util.Timer;
import com.ardor3d.util.resource.ResourceLocatorTool;
import com.ardor3d.util.resource.SimpleResourceLocator;
+import com.ardor3d.util.resource.URLResourceSource;
/**
* This examples demonstrates how to render OpenGL (via JOGL) on a NEWT AWT canvas. FIXME update the thumbnail and the
@@ -99,9 +101,8 @@ public class JoglNewtAwtExample {
ex.printStackTrace();
}
- final JoglImageLoader joglImageLoader = new JoglImageLoader();
- _cursor1 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/wait_cursor.png");
- _cursor2 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/movedata.gif");
+ _cursor1 = createMouseCursor("com/ardor3d/example/media/input/wait_cursor.png");
+ _cursor2 = createMouseCursor("com/ardor3d/example/media/input/movedata.gif");
addCanvas(frame, scene1, logicalLayer, frameWork);
frame.add(new JLabel(
@@ -139,10 +140,11 @@ public class JoglNewtAwtExample {
System.exit(0);
}
- private static MouseCursor createMouseCursor(final JoglImageLoader joglImageLoader, final String resourceName)
- throws IOException {
- final com.ardor3d.image.Image image = joglImageLoader.load(
- ResourceLocatorTool.getClassPathResourceAsStream(JoglNewtAwtExample.class, resourceName), false);
+ private static MouseCursor createMouseCursor(final String resourceName) throws IOException {
+ final com.ardor3d.image.Image image = ImageLoaderUtil
+ .loadImage(
+ new URLResourceSource(ResourceLocatorTool.getClassPathResource(JoglNewtAwtExample.class,
+ resourceName)), false);
return new MouseCursor("cursor1", image, 0, image.getHeight() - 1);
}
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java
index 59f54b6..460e18a 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java
@@ -39,6 +39,7 @@ import com.ardor3d.framework.DisplaySettings;
import com.ardor3d.framework.FrameHandler;
import com.ardor3d.framework.jogl.JoglCanvasRenderer;
import com.ardor3d.framework.jogl.JoglNewtSwtCanvas;
+import com.ardor3d.image.util.ImageLoaderUtil;
import com.ardor3d.image.util.jogl.JoglImageLoader;
import com.ardor3d.input.ControllerWrapper;
import com.ardor3d.input.GrabbedState;
@@ -59,6 +60,7 @@ import com.ardor3d.renderer.Camera;
import com.ardor3d.util.Timer;
import com.ardor3d.util.resource.ResourceLocatorTool;
import com.ardor3d.util.resource.SimpleResourceLocator;
+import com.ardor3d.util.resource.URLResourceSource;
/**
* This examples demonstrates how to render OpenGL (via JOGL) in a NEWT SWT canvas. FIXME update the thumbnail and the
@@ -248,10 +250,9 @@ public class JoglNewtSwtExample {
}
}));
- final JoglImageLoader joglImageLoader = new JoglImageLoader();
try {
- _cursor1 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/wait_cursor.png");
- _cursor2 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/movedata.gif");
+ _cursor1 = createMouseCursor("com/ardor3d/example/media/input/wait_cursor.png");
+ _cursor2 = createMouseCursor("com/ardor3d/example/media/input/movedata.gif");
} catch (final IOException ioe) {
ioe.printStackTrace();
}
@@ -259,10 +260,11 @@ public class JoglNewtSwtExample {
_showCursor1.put(canvas1, true);
}
- private static MouseCursor createMouseCursor(final JoglImageLoader joglImageLoader, final String resourceName)
- throws IOException {
- final com.ardor3d.image.Image image = joglImageLoader.load(
- ResourceLocatorTool.getClassPathResourceAsStream(JoglNewtSwtExample.class, resourceName), false);
+ private static MouseCursor createMouseCursor(final String resourceName) throws IOException {
+ final com.ardor3d.image.Image image = ImageLoaderUtil
+ .loadImage(
+ new URLResourceSource(ResourceLocatorTool.getClassPathResource(JoglNewtSwtExample.class,
+ resourceName)), false);
return new MouseCursor("cursor1", image, 0, image.getHeight() - 1);
}
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java
index 3026828..7ab0bce 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java
@@ -40,6 +40,7 @@ import com.ardor3d.framework.DisplaySettings;
import com.ardor3d.framework.FrameHandler;
import com.ardor3d.framework.jogl.JoglCanvasRenderer;
import com.ardor3d.framework.jogl.JoglSwtCanvas;
+import com.ardor3d.image.util.ImageLoaderUtil;
import com.ardor3d.image.util.jogl.JoglImageLoader;
import com.ardor3d.input.ControllerWrapper;
import com.ardor3d.input.GrabbedState;
@@ -60,6 +61,7 @@ import com.ardor3d.renderer.Camera;
import com.ardor3d.util.Timer;
import com.ardor3d.util.resource.ResourceLocatorTool;
import com.ardor3d.util.resource.SimpleResourceLocator;
+import com.ardor3d.util.resource.URLResourceSource;
/**
* This examples demonstrates how to render OpenGL (via JOGL) in a SWT canvas.
@@ -251,11 +253,9 @@ public class JoglSwtExample {
: GrabbedState.NOT_GRABBED);
}
}));
-
- final JoglImageLoader joglImageLoader = new JoglImageLoader();
try {
- _cursor1 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/wait_cursor.png");
- _cursor2 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/movedata.gif");
+ _cursor1 = createMouseCursor("com/ardor3d/example/media/input/wait_cursor.png");
+ _cursor2 = createMouseCursor("com/ardor3d/example/media/input/movedata.gif");
} catch (final IOException ioe) {
ioe.printStackTrace();
}
@@ -263,10 +263,10 @@ public class JoglSwtExample {
_showCursor1.put(canvas1, true);
}
- private static MouseCursor createMouseCursor(final JoglImageLoader joglImageLoader, final String resourceName)
- throws IOException {
- final com.ardor3d.image.Image image = joglImageLoader.load(
- ResourceLocatorTool.getClassPathResourceAsStream(JoglSwtExample.class, resourceName), false);
+ private static MouseCursor createMouseCursor(final String resourceName) throws IOException {
+ final com.ardor3d.image.Image image = ImageLoaderUtil.loadImage(
+ new URLResourceSource(ResourceLocatorTool.getClassPathResource(JoglSwtExample.class, resourceName)),
+ false);
return new MouseCursor("cursor1", image, 0, image.getHeight() - 1);
}