Skip to content

Commit

Permalink
Added Snowfield sprite to standalone effect factory
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswhocodes committed Dec 22, 2017
1 parent 0da9979 commit d7bec0d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2017 Chris Newland.
* Copyright (c) 2017 Chris Newland.
* Licensed under https://github.com/chriswhocodes/demofx/blob/master/LICENSE-BSD
*/
package com.chrisnewland.demofx.effect.effectfactory;
Expand All @@ -10,7 +10,7 @@
import com.chrisnewland.demofx.DemoConfig;
import com.chrisnewland.demofx.effect.IEffect;
import com.chrisnewland.demofx.effect.fade.FadeOutEffect;
import com.chrisnewland.demofx.effect.fake3d.SnowField;
import com.chrisnewland.demofx.effect.fake3d.SnowfieldSprite;
import com.chrisnewland.demofx.effect.ray.RayTrace;
import com.chrisnewland.demofx.effect.real3d.TexturedCube;
import com.chrisnewland.demofx.effect.text.TextWaveSprite;
Expand Down Expand Up @@ -38,7 +38,7 @@ public List<IEffect> getEffects(DemoConfig config)
long length = 48_000;

addEffect(0, length, new RayTrace(config));
addEffect(0, length, new SnowField(config, 8000, snowflake));
addEffect(0, length, new SnowfieldSprite(config, 8000, snowflake));

addEffect(0, length, new TexturedCube(config, paper, 240, 1, 1, 240, 480, 32, 32));

Expand All @@ -60,4 +60,4 @@ private void addEffect(long start, long duration, IEffect effect)

System.out.println("Adding " + start + " to " + (start + duration) + " " + effect.getClass().getName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.chrisnewland.demofx.effect.fake3d.Sheet;
import com.chrisnewland.demofx.effect.fake3d.Sprite3D;
import com.chrisnewland.demofx.effect.fake3d.Starfield;
import com.chrisnewland.demofx.effect.fake3d.SnowfieldSprite;
import com.chrisnewland.demofx.effect.fake3d.StarfieldSprite;
import com.chrisnewland.demofx.effect.fake3d.Tunnel;
import com.chrisnewland.demofx.effect.fractal.ChristmasTrees;
Expand Down Expand Up @@ -162,6 +163,7 @@ public List<IEffect> getEffects(DemoConfig config)
availableEffectNames.add("squares");
availableEffectNames.add("stars");
availableEffectNames.add("starfield");
availableEffectNames.add("snowfieldsprite");
availableEffectNames.add("starfieldsprite");
availableEffectNames.add("textbounce");
availableEffectNames.add("texcube");
Expand Down Expand Up @@ -202,7 +204,7 @@ private IEffect getEffect(String name, DemoConfig config)

case "binarybackground":
return new BinaryBackground(config);

case "blur":
return new Blur(config);

Expand All @@ -220,7 +222,7 @@ private IEffect getEffect(String name, DemoConfig config)

case "chord":
return new Chord(config);

case "christmastrees":
return new ChristmasTrees(config);

Expand Down Expand Up @@ -271,7 +273,7 @@ private IEffect getEffect(String name, DemoConfig config)

case "gc":
return new GCVisualiser(config);

case "glowboard":
return new Glowboard(config);

Expand Down Expand Up @@ -353,6 +355,9 @@ private IEffect getEffect(String name, DemoConfig config)
case "sierpinski":
return new Sierpinski(config);

case "snowfieldsprite":
return new SnowfieldSprite(config);

case "spin":
return new Spin(config);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016 Chris Newland.
* Copyright (c) 2017 Chris Newland.
* Licensed under https://github.com/chriswhocodes/demofx/blob/master/LICENSE-BSD
*/
package com.chrisnewland.demofx.effect.fake3d;
Expand All @@ -10,7 +10,7 @@

import javafx.scene.image.Image;

public class SnowField extends AbstractEffect
public class SnowfieldSprite extends AbstractEffect
{
private double[] starX;
private double[] starY;
Expand All @@ -23,14 +23,11 @@ public class SnowField extends AbstractEffect

private double sine = 0;

// private static final double SPEED = 0.01;
// private static final double MAX_DEPTH = 5;

private boolean spin = true;

private Image sprite = ImageUtil.loadImageFromResources("starshine.png");
private Image sprite = ImageUtil.loadImageFromResources("flake.png");

public SnowField(DemoConfig config)
public SnowfieldSprite(DemoConfig config)
{
super(config);

Expand All @@ -42,7 +39,7 @@ public SnowField(DemoConfig config)
init();
}

public SnowField(DemoConfig config, int starCount, Image sprite)
public SnowfieldSprite(DemoConfig config, int starCount, Image sprite)
{
super(config);

Expand All @@ -53,7 +50,7 @@ public SnowField(DemoConfig config, int starCount, Image sprite)
init();
}

public SnowField(DemoConfig config, int starCount, long startMillis, long stopMillis)
public SnowfieldSprite(DemoConfig config, int starCount, long startMillis, long stopMillis)
{
super(config);

Expand Down Expand Up @@ -165,4 +162,4 @@ else if (x > width)
gc.drawImage(sprite, x, y, size, size);
}
}
}
}

0 comments on commit d7bec0d

Please sign in to comment.