[changed] Exception msgs for missing files.
try {\r
in = new FileInputStream(sdcard + fileName);\r
} catch (FileNotFoundException ex) {\r
- throw new GdxRuntimeException("Couldn't open file '" + fileName + "'", ex);\r
+ throw new GdxRuntimeException("File not found: " + fileName + " (" + FileType.External + ")", ex);\r
}\r
\r
return in;\r
try {\r
in = assets.open(fileName);\r
} catch (Exception ex) {\r
- throw new GdxRuntimeException("Couldn't load file '" + fileName + "'", ex);\r
+ throw new GdxRuntimeException("Unable to read file: " + fileName + " (" + FileType.Internal + ")", ex);\r
}\r
\r
return in;\r
try {\r
out = new FileOutputStream(sdcard + filename);\r
} catch (FileNotFoundException ex) {\r
- throw new GdxRuntimeException("Couldn't open file '" + filename + "'", ex);\r
+ throw new GdxRuntimeException("File not found: " + filename + " (" + FileType.External + ")", ex);\r
}\r
\r
return out;\r
}\r
\r
- private InputStream readAbsolutFile (String filename) {\r
+ private InputStream readAbsoluteFile (String filename) {\r
FileInputStream in = null;\r
\r
try {\r
in = new FileInputStream(filename);\r
} catch (FileNotFoundException ex) {\r
- throw new GdxRuntimeException("Couldn't open file '" + filename + "'", ex);\r
+ throw new GdxRuntimeException("File not found: " + filename + " (" + FileType.Absolute + ")", ex);\r
}\r
\r
return in;\r
}\r
\r
if (!exists)\r
- throw new GdxRuntimeException("Couldn't open file '" + filename + "'");\r
+ throw new GdxRuntimeException("File not found: " + filename + " (" + type + ")");\r
else\r
return new AndroidFileHandle(assets, filename);\r
}\r
\r
if (type == FileType.External) {\r
if (new File(sdcard + filename).exists() == false)\r
- throw new GdxRuntimeException("Couldn't open file '" + filename + "'");\r
+ throw new GdxRuntimeException("File not found: " + filename + " (" + type + ")");\r
else\r
return new AndroidFileHandle(null, sdcard + filename);\r
} else {\r
if (new File(filename).exists() == false)\r
- throw new GdxRuntimeException("Couldn't open file '" + filename + "'");\r
+ throw new GdxRuntimeException("File not found: " + filename + " (" + type + ")");\r
else\r
return new AndroidFileHandle(null, filename);\r
}\r
try {\r
return assets.list(directory);\r
} catch (Exception ex) {\r
- throw new GdxRuntimeException("Couldn't open directory '" + directory + "'");\r
+ throw new GdxRuntimeException("Unable to open directory: " + directory);\r
}\r
}\r
\r
if (type == FileType.External) {\r
if (new File(sdcard + directory).exists() == false)\r
- throw new GdxRuntimeException("Couldn't open directory '" + directory + "'");\r
+ throw new GdxRuntimeException("Unable to open directory: " + directory);\r
else\r
return new File(sdcard + directory).list();\r
} else {\r
if (new File(directory).exists() == false)\r
- throw new GdxRuntimeException("Couldn't open directory '" + directory + "'");\r
+ throw new GdxRuntimeException("Unable to open directory: " + directory);\r
else\r
return new File(directory).list();\r
}\r
if (type == FileType.External)\r
return readExternalFile(fileName);\r
else\r
- return readAbsolutFile(fileName);\r
+ return readAbsoluteFile(fileName);\r
}\r
\r
/**\r
try {\r
out = new FileOutputStream(filename);\r
} catch (FileNotFoundException ex) {\r
- throw new GdxRuntimeException("Couldn't open file '" + filename + "'", ex);\r
+ throw new GdxRuntimeException("File not found: " + filename + " (" + type + ")", ex);\r
}\r
\r
return out;\r
File file = new File(fileName);\r
\r
if (JoglFileHandle.class.getResource("/" + fileName) == null && file.exists() == false)\r
- throw new GdxRuntimeException("File '" + fileName + "' doesn't exist");\r
+ throw new GdxRuntimeException("File not found: " + fileName + " (" + type + ")");\r
else\r
return new JoglFileHandle(file, type);\r
}\r
if (type == FileType.External) directory = this.externalPath + directory;\r
File file = new File(directory);\r
\r
- if (file.exists() == false) throw new GdxRuntimeException("Directory '" + directory + "' does not exist");\r
+ if (file.exists() == false) throw new GdxRuntimeException("Directory not found: " + directory + " (" + type + ")");\r
\r
return file.list();\r
}\r
}\r
}\r
\r
- public OutputStream writeFile (String filename, FileType type) {\r
+ public OutputStream writeFile (String fileName, FileType type) {\r
if (type == FileType.Internal) return null;\r
\r
File file = null;\r
if (type == FileType.Absolute)\r
- file = new File(filename);\r
+ file = new File(fileName);\r
else\r
- file = new File(this.externalPath + filename);\r
+ file = new File(this.externalPath + fileName);\r
\r
try {\r
return new FileOutputStream(file);\r
} catch (FileNotFoundException e) {\r
- throw new GdxRuntimeException("File '" + file + "' does not exist");\r
+ throw new GdxRuntimeException("File not found: " + fileName + " (" + type + ")");\r
}\r
}\r
}\r
File file = new File(fileName);\r
\r
if (LwjglFileHandle.class.getResource("/" + fileName) == null && file.exists() == false)\r
- throw new GdxRuntimeException("File '" + fileName + "' doesn't exist");\r
+ throw new GdxRuntimeException("File not found: " + fileName + " (" + type + ")");\r
else\r
return new LwjglFileHandle(file, type);\r
}\r
if (type == FileType.External) directory = this.externalPath + directory;\r
File file = new File(directory);\r
\r
- if (file.exists() == false) throw new GdxRuntimeException("Directory '" + directory + "' does not exist");\r
+ if (file.exists() == false) throw new GdxRuntimeException("Directory not found: " + directory + " (" + type + ")");\r
\r
return file.list();\r
}\r
}\r
}\r
\r
- public OutputStream writeFile (String filename, FileType type) {\r
+ public OutputStream writeFile (String fileName, FileType type) {\r
if (type == FileType.Internal) return null;\r
\r
File file = null;\r
if (type == FileType.Absolute)\r
- file = new File(filename);\r
+ file = new File(fileName);\r
else\r
- file = new File(this.externalPath + filename);\r
+ file = new File(this.externalPath + fileName);\r
\r
try {\r
return new FileOutputStream(file);\r
} catch (FileNotFoundException e) {\r
- throw new GdxRuntimeException("File '" + file + "' does not exist");\r
+ throw new GdxRuntimeException("File not found: " + fileName + " (" + type + ")");\r
}\r
}\r
}\r
public Texture newUnmanagedTexture (int width, int height, Pixmap.Format format, TextureFilter minFilter,\r
TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) {\r
if (!MathUtils.isPowerOfTwo(width) || !MathUtils.isPowerOfTwo(height))\r
- throw new GdxRuntimeException("Texture dimensions must be a power of two");\r
+ throw new GdxRuntimeException("Texture dimensions must be a power of two: " + width + "x" + height);\r
\r
if (format == Format.Alpha)\r
return new LwjglTexture(width, height, BufferedImage.TYPE_BYTE_GRAY, minFilter, magFilter, uWrap, vWrap, false);\r
public Texture newUnmanagedTexture (Pixmap pixmap, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
TextureWrap vWrap) {\r
if (!MathUtils.isPowerOfTwo(pixmap.getHeight()) || !MathUtils.isPowerOfTwo(pixmap.getWidth()))\r
- throw new GdxRuntimeException("Texture dimensions must be a power of two");\r
+ throw new GdxRuntimeException("Texture dimensions must be a power of two: " + width + "x" + height);\r
\r
return new LwjglTexture((BufferedImage)pixmap.getNativePixmap(), minFilter, magFilter, uWrap, vWrap, false);\r
}\r
TextureWrap vWrap) {\r
Pixmap pixmap = newPixmap(file);\r
if (!MathUtils.isPowerOfTwo(pixmap.getHeight()) || !MathUtils.isPowerOfTwo(pixmap.getWidth()))\r
- throw new GdxRuntimeException("Texture dimensions must be a power of two: " + file);\r
+ throw new GdxRuntimeException("Texture dimensions must be a power of two: " + file + " (" + pixmap.getWidth() + "x"\r
+ + pixmap.getHeight() + ")");\r
\r
return new LwjglTexture(file, minFilter, magFilter, uWrap, vWrap, false);\r
}\r
if (this.screen != null) this.screen.hide();\r
this.screen = screen;\r
screen.show();\r
+ screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());\r
}\r
\r
public Screen getScreen () {\r
protected float invTexWidth = 0;\r
protected float invTexHeight = 0;\r
\r
- /** whether to use the blend mode for text or for sprites **/\r
- protected boolean useTextBlend = false;\r
-\r
/** blend function src & target **/\r
private int blendSrcFunc = GL11.GL_SRC_ALPHA;\r
private int blendDstFunc = GL11.GL_ONE_MINUS_SRC_ALPHA;\r
invTexHeight = 1.0f / texture.getHeight();\r
}\r
\r
- useTextBlend = false;\r
-\r
// bottom left and top right corner points relative to origin\r
final float worldOriginX = x + originX;\r
final float worldOriginY = y + originY;\r
invTexHeight = 1.0f / texture.getHeight();\r
}\r
\r
- useTextBlend = false;\r
-\r
float u = srcX * invTexWidth;\r
float v = (srcY + srcHeight) * invTexHeight;\r
float u2 = (srcX + srcWidth) * invTexWidth;\r
invTexHeight = 1.0f / texture.getHeight();\r
}\r
\r
- useTextBlend = false;\r
-\r
final float u = srcX * invTexWidth;\r
final float v = (srcY + srcHeight) * invTexHeight;\r
final float u2 = (srcX + srcWidth) * invTexWidth;\r
invTexHeight = 1.0f / texture.getHeight();\r
}\r
\r
- useTextBlend = false;\r
-\r
final float fx2 = x + srcWidth;\r
final float fy2 = y + srcHeight;\r
\r
invTexHeight = 1.0f / texture.getHeight();\r
}\r
\r
- useTextBlend = false;\r
-\r
if (idx + length >= vertices.length) renderMesh();\r
\r
System.arraycopy(spriteVertices, offset, vertices, idx, length);\r
mesh.setVertices(vertices, 0, idx);\r
\r
if (Gdx.graphics.isGL20Available()) {\r
- if (useTextBlend) {\r
- GL20 gl20 = Gdx.gl20;\r
- gl20.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);\r
- gl20.glEnable(GL20.GL_BLEND);\r
- } else if (blendingDisabled) {\r
+ if (blendingDisabled) {\r
Gdx.gl20.glDisable(GL20.GL_BLEND);\r
} else {\r
GL20 gl20 = Gdx.gl20;\r
\r
mesh.render(shader, GL10.GL_TRIANGLES, 0, idx / 20 * 6);\r
} else {\r
- if (useTextBlend) {\r
- GL10 gl10 = Gdx.gl10;\r
- gl10.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);\r
- gl10.glEnable(GL10.GL_BLEND);\r
- } else if (blendingDisabled) {\r
+ if (blendingDisabled) {\r
Gdx.gl10.glDisable(GL10.GL_BLEND);\r
} else {\r
GL10 gl10 = Gdx.gl10;\r
}\r
\r
/**\r
- * Sets the blending function to be used when rendering sprites. This will have no effect on the blend function used for text\r
- * rendering!\r
+ * Sets the blending function to be used when rendering sprites.\r
* \r
* @param srcFunc the source function, e.g. GL11.GL_SRC_ALPHA\r
* @param dstFunc the destination function, e.g. GL11.GL_ONE_MINUS_SRC_ALPHA\r