v5stable
Ondřej Hruška 10 years ago
parent 7011184c88
commit 74c11dcec9
  1. 6
      src/mightypork/gamecore/render/fonts/impl/CachedFont.java
  2. 14
      src/mightypork/test/TestCoords.java
  3. 6
      src/mightypork/test/TestVec.java
  4. 6
      src/mightypork/utils/files/FileTreeDiff.java
  5. 6
      src/mightypork/utils/files/FileUtils.java
  6. 5
      src/mightypork/utils/files/ZipUtils.java

@ -294,7 +294,8 @@ public class CachedFont implements GLFont {
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder()).put(newI);
} else {
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder()).put(((DataBufferByte) (bufferedImage.getData().getDataBuffer())).getData());
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder())
.put(((DataBufferByte) (bufferedImage.getData().getDataBuffer())).getData());
}
byteBuffer.flip();
@ -411,7 +412,8 @@ public class CachedFont implements GLFont {
chtx = chars.get(charCurrent);
if (chtx != null) {
drawQuad((totalwidth), 0, (totalwidth + chtx.width), (chtx.height), chtx.texPosX, chtx.texPosY, chtx.texPosX + chtx.width, chtx.texPosY + chtx.height);
drawQuad((totalwidth), 0, (totalwidth + chtx.width), (chtx.height), chtx.texPosX, chtx.texPosY, chtx.texPosX + chtx.width, chtx.texPosY
+ chtx.height);
totalwidth += chtx.width;
}
}

@ -12,13 +12,13 @@ public class TestCoords {
public static void main(String[] args)
{
{
VectVar a = Vect.makeVar();
VectVar b = Vect.makeVar();
final VectVar a = Vect.makeVar();
final VectVar b = Vect.makeVar();
Vect cross = a.cross(b);
Num dot = a.dot(b);
Vect sum = a.add(b);
Num dist = a.dist(b);
final Vect cross = a.cross(b);
final Num dot = a.dot(b);
final Vect sum = a.add(b);
final Num dist = a.dist(b);
a.setTo(0, 10, 0);
b.setTo(0, 6, 7);
@ -32,7 +32,7 @@ public class TestCoords {
}
{
NumVar a = Num.makeVar();
final NumVar a = Num.makeVar();
Num end = a;

@ -10,16 +10,16 @@ public class TestVec {
public static void main(String[] args)
{
VectVar a = Vect.makeVar(-100, 12, 6);
final VectVar a = Vect.makeVar(-100, 12, 6);
VectConst b = a.freeze();
final VectConst b = a.freeze();
a.setTo(400, 400, 300);
System.out.println(a);
System.out.println(b);
Vect c = a.abs().neg();
final Vect c = a.abs().neg();
System.out.println(c);

@ -72,9 +72,11 @@ public class FileTreeDiff {
ck1.reset();
ck2.reset();
try (FileInputStream in1 = new FileInputStream(pair.a); FileInputStream in2 = new FileInputStream(pair.b)) {
try(FileInputStream in1 = new FileInputStream(pair.a);
FileInputStream in2 = new FileInputStream(pair.b)) {
try (CheckedInputStream cin1 = new CheckedInputStream(in1, ck1); CheckedInputStream cin2 = new CheckedInputStream(in2, ck2)) {
try(CheckedInputStream cin1 = new CheckedInputStream(in1, ck1);
CheckedInputStream cin2 = new CheckedInputStream(in2, ck2)) {
while (true) {
final int read1 = cin1.read(BUFFER);

@ -95,7 +95,8 @@ public class FileUtils {
public static void copyFile(File source, File target) throws IOException
{
try (InputStream in = new FileInputStream(source); OutputStream out = new FileOutputStream(target)) {
try(InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(target)) {
copyStream(in, out);
}
@ -481,7 +482,8 @@ public class FileUtils {
*/
public static void resourceToFile(String resname, File file) throws IOException
{
try (InputStream in = FileUtils.getResource(resname); OutputStream out = new FileOutputStream(file)) {
try(InputStream in = FileUtils.getResource(resname);
OutputStream out = new FileOutputStream(file)) {
FileUtils.copyStream(in, out);
}

@ -133,7 +133,10 @@ public class ZipUtils {
{
if (!destFile.getParentFile().mkdirs()) throw new IOException("Could not create output directory.");
try (InputStream in = zip.getInputStream(entry); BufferedInputStream is = new BufferedInputStream(in); FileOutputStream fos = new FileOutputStream(destFile); BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE)) {
try(InputStream in = zip.getInputStream(entry);
BufferedInputStream is = new BufferedInputStream(in);
FileOutputStream fos = new FileOutputStream(destFile);
BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE)) {
FileUtils.copyStream(is, dest);
}

Loading…
Cancel
Save