[added] allowCompletion to ParticleEmitter to allow the emitter to be restarted with continuous respected.
dialog.setVisible(true);\r
String fileName = dialog.getFile();\r
if (fileName == null) return;\r
+ if (!fileName.endsWith(".hiero")) fileName += ".hiero";\r
File file = new File(dialog.getDirectory(), fileName);\r
try {\r
save(file);\r
file = Gdx.files.classpath(imagePath);\r
else\r
file = Gdx.files.absolute(imagePath);\r
- emitter.setSprite(new Sprite(Gdx.graphics.newTexture(file, TextureFilter.Linear, TextureFilter.Linear,\r
+ emitter.setSprite(new Sprite(Gdx.graphics.newTexture(file, TextureFilter.Nearest, TextureFilter.Nearest,\r
TextureWrap.ClampToEdge, TextureWrap.ClampToEdge)));\r
} catch (GdxRuntimeException ex) {\r
ex.printStackTrace();\r
public GdxTexture (GdxRenderer renderer, FileHandle textureFile) {
this.renderer = renderer;
- texture = Gdx.graphics.newTexture(textureFile, TextureFilter.Linear, TextureFilter.Linear, TextureWrap.ClampToEdge,
+ texture = Gdx.graphics.newTexture(textureFile, TextureFilter.Nearest, TextureFilter.Nearest, TextureWrap.ClampToEdge,
TextureWrap.ClampToEdge);
}
* @param flip If true, the glyphs will be flipped for use with a perspective where 0,0 is the upper left corner.\r
*/\r
public BitmapFont (FileHandle fontFile, FileHandle imageFile, boolean flip) {\r
- region = new TextureRegion(Gdx.graphics.newTexture(imageFile, TextureFilter.Linear, TextureFilter.Linear,\r
+ region = new TextureRegion(Gdx.graphics.newTexture(imageFile, TextureFilter.Nearest, TextureFilter.Nearest,\r
TextureWrap.ClampToEdge, TextureWrap.ClampToEdge));\r
init(fontFile, region, flip);\r
}\r
if (!page[2].startsWith("file=")) throw new GdxRuntimeException("Invalid font file: " + fontFile);\r
String imgFilename = page[2].substring(6, page[2].length() - 1);\r
FileHandle imageFile = fontFile.parent().child(imgFilename);\r
- region = new TextureRegion(Gdx.graphics.newTexture(imageFile, TextureFilter.Linear, TextureFilter.Linear,\r
+ region = new TextureRegion(Gdx.graphics.newTexture(imageFile, TextureFilter.Nearest, TextureFilter.Nearest,\r
TextureWrap.ClampToEdge, TextureWrap.ClampToEdge));\r
}\r
\r
x += g.xadvance * scaleX;\r
}\r
}\r
- spriteBatch.setColor(batchColor); \r
+ spriteBatch.setColor(batchColor);\r
textBounds.width = (int)(x - startX);\r
textBounds.height = (int)capHeight;\r
return textBounds;\r
numLines++;\r
}\r
spriteBatch.setColor(batchColor);\r
- \r
+\r
textBounds.width = maxWidth;\r
textBounds.height = (int)(capHeight + (numLines - 1) * lineHeight);\r
return textBounds;\r
y += down;\r
numLines++;\r
}\r
- spriteBatch.setColor(batchColor); \r
+ spriteBatch.setColor(batchColor);\r
textBounds.width = maxWidth;\r
textBounds.height = (int)(capHeight + (numLines - 1) * lineHeight);\r
return textBounds;\r
private ArrayList<ParticleEmitter> emitters = new ArrayList();\r
\r
public void start () {\r
- for (ParticleEmitter emitter : emitters)\r
- emitter.start();\r
+ for (int i = 0, n = emitters.size(); i < n; i++)\r
+ emitters.get(i).start();\r
}\r
\r
public void draw (SpriteBatch spriteBatch, float delta) {\r
}\r
\r
public void allowCompletion () {\r
- for (int i = 0, n = emitters.size(); i < n; i++) {\r
- ParticleEmitter emitter = emitters.get(i);\r
- emitter.setContinuous(false);\r
- emitter.durationTimer = emitter.duration;\r
- }\r
+ for (int i = 0, n = emitters.size(); i < n; i++)\r
+ emitters.get(i).allowCompletion();\r
}\r
\r
public boolean isComplete () {\r
}\r
\r
protected Texture loadTexture (FileHandle file) {\r
- return Gdx.graphics.newTexture(file, TextureFilter.Linear, TextureFilter.Linear, TextureWrap.ClampToEdge,\r
+ return Gdx.graphics.newTexture(file, TextureFilter.Nearest, TextureFilter.Nearest, TextureWrap.ClampToEdge,\r
TextureWrap.ClampToEdge);\r
}\r
}\r
private boolean firstUpdate;\r
private boolean flipX, flipY;\r
private int updateFlags;\r
+ private boolean allowCompletion;\r
\r
private int emission, emissionDiff, emissionDelta;\r
private int lifeOffset, lifeOffsetDiff;\r
if (durationTimer < duration)\r
durationTimer += deltaMillis;\r
else {\r
- if (!continuous) return;\r
+ if (!continuous || allowCompletion) return;\r
restart();\r
}\r
\r
\r
public void start () {\r
firstUpdate = true;\r
+ allowCompletion = false;\r
restart();\r
}\r
\r
}\r
}\r
\r
+ /**\r
+ * Ignores the {@link #setContinuous(boolean) continuous} setting until the emitter is started again. This allows the emitter\r
+ * to stop smoothly.\r
+ */\r
+ public void allowCompletion () {\r
+ allowCompletion = true;\r
+ durationTimer = duration;\r
+ }\r
+\r
public Sprite getSprite () {\r
return sprite;\r
}\r