BufferedImage icon128 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_128.png")); Display.setIcon(new ByteBuffer[]{ TextureUtil.convertToByteBuffer(icon16), TextureUtil.convertToByteBuffer(icon32),
pixmap.dispose(); Display.setIcon(icons);
pixmap.dispose(); Display.setIcon(icons);
Display.setIcon(imagesToByteBuffers(settings.getIcons()));
public static void loadIconsOnFrames() { try { // Load icon from disk final File smallIcon = new File(Launch.assetsDir, "icons/icon_16x16.png"); final File bigIcon = new File(Launch.assetsDir, "icons/icon_32x32.png"); System.out.println("Loading current icons for window from: " + smallIcon + " and " + bigIcon); Display.setIcon(new ByteBuffer[]{ loadIcon(smallIcon), loadIcon(bigIcon) }); Frame[] frames = Frame.getFrames(); if (frames != null) { final List<Image> icons = Arrays.<Image>asList(ImageIO.read(smallIcon), ImageIO.read(bigIcon)); for (Frame frame : frames) { try { frame.setIconImages(icons); } catch (Throwable throwable) { throwable.printStackTrace(); } } } } catch (IOException e) { e.printStackTrace(); } }
/** * @see org.newdawn.slick.GameContainer#setIcons(java.lang.String[]) */ public void setIcons(String[] refs) throws SlickException { ByteBuffer[] bufs = new ByteBuffer[refs.length]; for (int i=0;i<refs.length;i++) { LoadableImageData data; boolean flip = true; if (refs[i].endsWith(".tga")) { data = new TGAImageData(); } else { flip = false; data = new ImageIOImageData(); } try { bufs[i] = data.loadImage(ResourceLoader.getResourceAsStream(refs[i]), flip, false, null); } catch (Exception e) { Log.error(e); throw new SlickException("Failed to set the icon"); } } Display.setIcon(bufs); }
public void setIcon(final Image[] iconImages) { final ByteBuffer[] iconData = new ByteBuffer[iconImages.length]; for (int i = 0; i < iconData.length; i++) { // Image.Format.RGBA8 is the format that LWJGL requires, so try to convert if it's not. if (iconImages[i].getDataType() != PixelDataType.UnsignedByte) { throw new Ardor3dException( "Your icon is in a format that could not be converted to UnsignedByte - RGBA"); } if (iconImages[i].getDataFormat() != ImageDataFormat.RGBA) { if (iconImages[i].getDataFormat() != ImageDataFormat.RGB) { throw new Ardor3dException( "Your icon is in a format that could not be converted to UnsignedByte - RGBA"); } iconImages[i] = _RGB888_to_RGBA8888(iconImages[i]); } iconData[i] = iconImages[i].getData(0); iconData[i].rewind(); } Display.setIcon(iconData); }
pixmap.dispose(); Display.setIcon(icons);
Display.setIcon(imagesToByteBuffers(settings.getIcons()));