lwjgl custom icon

Posted by melchor629 on Game Development See other posts from Game Development or by melchor629
Published on 2013-06-29T14:12:28Z Indexed on 2013/06/29 16:30 UTC
Read the original article Hit count: 265

Filed under:

I have a little problem with the icon in lwjgl, it doesn't work. I google about it, but i haven't found anything that works for me yet. This is my code for now:

    PNGDecoder imageDecoder = new PNGDecoder(new FileInputStream("res/images/Icon.png"));
    ByteBuffer imageData = BufferUtils.createByteBuffer(4 * imageDecoder.getWidth() * imageDecoder.getHeight());
    imageDecoder.decode(imageData, imageDecoder.getWidth() * 4, PNGDecoder.Format.RGBA);
    imageData.flip();
    System.err.println(Display.setIcon(new ByteBuffer[]{imageData}) == 0 ? "No se ha creado el icono" : "Se ha creado el icono");

The png file is a 128x128px with transparency. PNGDecoder is from the matthiasmann utility (de.matthiasmann.twl.utils). I'm using Mac OS, 10.8.4 with lwjgl 2.9.0.

Thanks :)

© Game Development or respective owner

Related posts about lwjgl