[Home]RobocodeGL/PEZsPatch

Robo Home | RobocodeGL | Changes | Preferences | AllPages

Showing revision 4
OK, this is the patch:
--- TextureCache-old.java       Sun Mar  9 22:38:30 2003
+++ TextureCache-new.java       Mon Mar 10 18:11:33 2003
@@ -5,9 +5,7 @@

 package robocode.robocodeGL.system;

-import javax.imageio.ImageIO;
-import javax.swing.JFrame;
-
+import java.awt.*;
 import java.awt.image.*;
 import java.awt.geom.AffineTransform;
 import java.awt.color.*;
@@ -86,17 +84,19 @@
        }

        private void loadData(String filename) throws IOException {
-               FileInputStream in = new FileInputStream(filename);
-               BufferedImage image = ImageIO.read(in);
-               in.close();
-               loadData(image, image.getWidth(), image.getHeight());
+               Toolkit toolkit = Toolkit.getDefaultToolkit();
+               Image image = toolkit.getImage(filename);
+               BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
+               bufferedImage.getGraphics().drawImage(image, 0, 0, null);
+               loadData(bufferedImage, bufferedImage.getWidth(), bufferedImage.getHeight());
        }

        private void loadData(String filename, int w, int h) throws IOException {
-               FileInputStream in = new FileInputStream(filename);
-               BufferedImage image = ImageIO.read(in);
-               in.close();
-               loadData(image, w, h);
+               Toolkit toolkit = Toolkit.getDefaultToolkit();
+               Image image = toolkit.getImage(filename);
+               BufferedImage bufferedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+               bufferedImage.getGraphics().drawImage(image, 0, 0, null);
+               loadData(bufferedImage, w, h);
        }

        private void loadData(BufferedImage imageA, int w, int h) {

Since you are a Windows dude maybe you are not familiar with Larry Walls' "patch"? The above is a "diff -Naur" output that you can feed directly to "patch". But since it's such a small patch you can just look at it. The rows prepended with "-" should be removed and those with "+" should be added. The other lines give you the context. (Sorry if this was old new to you). I'm not sure it works though. Since I still have the above bug (as you would expect, maybe, it didn't matter if I run 1.3.1 or 1.4.1). -- PEZ

I'm a "Windows dude" by necessity, not choice. I know my way around Linux and BeOS?. :-) --David Alves


Robo Home | RobocodeGL | Changes | Preferences | AllPages
Edit revision 4 of this page | View other revisions | View current revision
Edited March 10, 2003 19:34 EST by David Alves (diff)
Search: