summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/VideoWall.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/scape/VideoWall.java')
-rw-r--r--NET/worlds/scape/VideoWall.java263
1 files changed, 263 insertions, 0 deletions
diff --git a/NET/worlds/scape/VideoWall.java b/NET/worlds/scape/VideoWall.java
new file mode 100644
index 0000000..4b79bde
--- /dev/null
+++ b/NET/worlds/scape/VideoWall.java
@@ -0,0 +1,263 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.core.IniFile;
+/* */ import NET.worlds.network.URL;
+/* */ import java.io.IOException;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class VideoWall
+/* */ extends Rect
+/* */ {
+/* 17 */ VideoSurface _surface = null;
+/* */ Texture[] _textures;
+/* 19 */ Material _material = null;
+/* */
+/* */
+/* 22 */ String _textureURL = "http://dev.worlds.net/rr-worlds/video/fatboy.asf";
+/* */
+/* */
+/* 25 */ String _defTextureURL = IniFile.override().getIniString("defaultAd",
+/* 26 */ "adworlds.cmp");
+/* */
+/* */
+/* 29 */ int _xSurface = 140; int _ySurface = 104;
+/* */
+/* */
+/* 32 */ boolean _autoPlay = true;
+/* */
+/* */
+/* */
+/* */
+/* 37 */ int _autoPlayRepeats = 1;
+/* */
+/* */
+/* 40 */ int _rows = 1;
+/* */
+/* */
+/* */
+/* */ private void rebuild()
+/* */ {
+/* 46 */ unbuild();
+/* 47 */ int xTex = this._xSurface / 128 + 1;
+/* */
+/* 49 */ int yTex = this._ySurface / 128 + 1;
+/* */
+/* */
+/* 52 */ this._surface = null;
+/* */
+/* 54 */ this._rows = yTex;
+/* */
+/* 56 */ this._material = new Material(URL.make(this._defTextureURL),
+/* 57 */ xTex, yTex);
+/* 58 */ setMaterial(this._material);
+/* */
+/* 60 */ this._textures = this._material.getTextures();
+/* 61 */ this._surface = VideoManager.get(this._textureURL, yTex, this._xSurface,
+/* 62 */ this._ySurface);
+/* */
+/* 64 */ if (this._autoPlay) {
+/* 65 */ this._surface.play(1);
+/* */ }
+/* */ }
+/* */
+/* */ public void finalize() {
+/* 70 */ unbuild();
+/* 71 */ super.finalize();
+/* */ }
+/* */
+/* */ public void detach()
+/* */ {
+/* 76 */ unbuild();
+/* 77 */ super.detach();
+/* */ }
+/* */
+/* */ private void unbuild()
+/* */ {
+/* 82 */ if (this._surface != null)
+/* */ {
+/* 84 */ this._surface.stop();
+/* 85 */ VideoManager.release(this._surface);
+/* 86 */ this._surface = null;
+/* */ }
+/* */ }
+/* */
+/* */ public void changeURL(String newURL, int width, int height)
+/* */ {
+/* 92 */ this._textureURL = new String(newURL);
+/* 93 */ this._xSurface = width;
+/* 94 */ this._ySurface = height;
+/* 95 */ rebuild();
+/* */ }
+/* */
+/* */ public boolean handle(FrameEvent f)
+/* */ {
+/* 100 */ getState();
+/* 101 */ if (this.visible)
+/* 102 */ draw();
+/* 103 */ return false;
+/* */ }
+/* */
+/* */ public void prerender(Camera cam)
+/* */ {
+/* 108 */ Point3Temp p = inCamSpace(cam);
+/* */
+/* */
+/* */
+/* 112 */ boolean v = (p != null) && (p.z > 1.0F) && (p.x < p.z) && (-p.x < p.z);
+/* */
+/* 114 */ if (v) this.visible = true;
+/* */ }
+/* */
+/* 117 */ public VideoSurface getVideoSurface() { return this._surface; }
+/* */
+/* */ public synchronized void draw()
+/* */ {
+/* 121 */ if (this._surface != null)
+/* */ {
+/* 123 */ this._surface.draw(this._material.getTextures(), this._rows);
+/* */ }
+/* */ }
+/* */
+/* */ public int getState()
+/* */ {
+/* 129 */ if (this._surface != null) {
+/* 130 */ return this._surface.tick();
+/* */ }
+/* 132 */ return 0;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 141 */ Object ret = null;
+/* 142 */ switch (index - offset)
+/* */ {
+/* */ case 0:
+/* 145 */ if (mode == 0) {
+/* 146 */ ret = StringPropertyEditor.make(
+/* 147 */ new Property(this, index, "Video URL"));
+/* 148 */ } else if (mode == 1) {
+/* 149 */ ret = this._textureURL;
+/* 150 */ } else if (mode == 2)
+/* */ {
+/* 152 */ this._textureURL = ((String)value);
+/* 153 */ rebuild();
+/* */ }
+/* 155 */ break;
+/* */ case 1:
+/* 157 */ if (mode == 0) {
+/* 158 */ ret = IntegerPropertyEditor.make(
+/* 159 */ new Property(this, index, "Video Width (pixels)"),
+/* 160 */ 0, 1024);
+/* 161 */ } else if (mode == 1) {
+/* 162 */ ret = new Integer(this._xSurface);
+/* 163 */ } else if (mode == 2)
+/* */ {
+/* 165 */ this._xSurface = ((Integer)value).intValue();
+/* 166 */ rebuild();
+/* */ }
+/* 168 */ break;
+/* */ case 2:
+/* 170 */ if (mode == 0) {
+/* 171 */ ret = IntegerPropertyEditor.make(
+/* 172 */ new Property(this, index, "Video Height (pixels)"),
+/* 173 */ 0, 1024);
+/* 174 */ } else if (mode == 1) {
+/* 175 */ ret = new Integer(this._ySurface);
+/* 176 */ } else if (mode == 2)
+/* */ {
+/* 178 */ this._ySurface = ((Integer)value).intValue();
+/* 179 */ rebuild();
+/* */ }
+/* 181 */ break;
+/* */ case 3:
+/* 183 */ if (mode == 0) {
+/* 184 */ ret = BooleanPropertyEditor.make(
+/* 185 */ new Property(this, index, "Auto-play?"),
+/* 186 */ "No", "Yes");
+/* 187 */ } else if (mode == 1) {
+/* 188 */ ret = new Boolean(this._autoPlay);
+/* 189 */ } else if (mode == 2)
+/* */ {
+/* 191 */ this._autoPlay = ((Boolean)value).booleanValue();
+/* 192 */ rebuild();
+/* */ }
+/* 194 */ break;
+/* */ case 4:
+/* 196 */ if (mode == 0) {
+/* 197 */ ret = IntegerPropertyEditor.make(
+/* 198 */ new Property(this, index, "Repeats for Autoplay (-1 = infinite)"),
+/* 199 */ -1, 1024);
+/* 200 */ } else if (mode == 1) {
+/* 201 */ ret = new Integer(this._autoPlayRepeats);
+/* 202 */ } else if (mode == 2)
+/* */ {
+/* 204 */ this._autoPlayRepeats = ((Integer)value).intValue();
+/* 205 */ rebuild();
+/* */ }
+/* 207 */ break;
+/* */
+/* */ default:
+/* 210 */ ret = super.properties(index, offset + 5, mode, value);
+/* */ }
+/* */
+/* 213 */ return ret;
+/* */ }
+/* */
+/* */
+/* 217 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 221 */ s.saveVersion(1, classCookie);
+/* 222 */ super.saveState(s);
+/* */
+/* 224 */ s.saveString(this._textureURL);
+/* 225 */ s.saveInt(this._xSurface);
+/* 226 */ s.saveInt(this._ySurface);
+/* 227 */ s.saveBoolean(this._autoPlay);
+/* 228 */ s.saveInt(this._autoPlayRepeats);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException
+/* */ {
+/* 233 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 0:
+/* 235 */ super.restoreState(r);
+/* 236 */ this._textureURL = r.restoreString();
+/* 237 */ this._xSurface = r.restoreInt();
+/* 238 */ this._ySurface = r.restoreInt();
+/* 239 */ this._autoPlay = r.restoreBoolean();
+/* 240 */ break;
+/* */
+/* */ case 1:
+/* 243 */ super.restoreState(r);
+/* 244 */ this._textureURL = r.restoreString();
+/* 245 */ this._xSurface = r.restoreInt();
+/* 246 */ this._ySurface = r.restoreInt();
+/* 247 */ this._autoPlay = r.restoreBoolean();
+/* 248 */ this._autoPlayRepeats = r.restoreInt();
+/* 249 */ break;
+/* */
+/* */ default:
+/* 252 */ throw new TooNewException();
+/* */ }
+/* */
+/* 255 */ rebuild();
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\VideoWall.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file