Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Slick2D Icon problem  (Read 208 times)
0 Members and 1 Guest are viewing this topic.
Offline 04hockey

Junior Member


Medals: 2
Projects: 1
Exp: 2 years


Founder of Fanger Games.


« Posted 2014-04-24 19:57:45 »

Hey guys, I am working on a project for school using Slick2D, and I'm trying to change the icon of the program but no matter what size Icon I try to use none of them work, it just displays the default image for a program.

Here's what I'm trying to change the icon to:


Here's what it's displaying:


My code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   public Main(String name) throws SlickException {
      super(name);
      app = new AppGameContainer(this);
      app.setIcon(texturePath + "icon.png");
      app.setTargetFrameRate(75);
      app.setDisplayMode(600, 700, false);
      app.setForceExit(true);
      app.setShowFPS(false);
      app.setAlwaysRender(true);
      app.start();
   }


I have tried this with x16, x32, x64, x128 images and none of them have worked :/

I know its reading the right image, because if the path is incorrect it throws an error and closes the application.

Thanks!
Offline Gibbo3771
« Reply #1 - Posted 2014-04-24 20:36:49 »

Should it not be a icon.ico? Just an educated guess, never used slick 2d before.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline 04hockey

Junior Member


Medals: 2
Projects: 1
Exp: 2 years


Founder of Fanger Games.


« Reply #2 - Posted 2014-04-24 20:46:16 »

I've seen videos of people using .png files for the icon, I tried the .ico too let me try it again
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline 04hockey

Junior Member


Medals: 2
Projects: 1
Exp: 2 years


Founder of Fanger Games.


« Reply #3 - Posted 2014-04-24 20:48:41 »

Yeah using .ico isnt' working either.
Offline BurntPizza
« Reply #4 - Posted 2014-04-24 21:01:39 »

Changing the file extension won't do anything, the file still contains the same data. (However it might break poorly done decoders)

I'm not sure what's wrong, but you might try passing several images of the different sizes in at once with setIcons(): http://slick.ninjacave.com/javadoc/org/newdawn/slick/AppGameContainer.html#setIcons(java.lang.String[])
Offline 04hockey

Junior Member


Medals: 2
Projects: 1
Exp: 2 years


Founder of Fanger Games.


« Reply #5 - Posted 2014-04-24 21:03:45 »

changed code:

1  
app.setIcons(new String[]{texturePath + "icon.png", texturePath + "icon16.png", texturePath + "icon64.png", texturePath + "icon128.png"});


still not working
Offline 04hockey

Junior Member


Medals: 2
Projects: 1
Exp: 2 years


Founder of Fanger Games.


« Reply #6 - Posted 2014-04-24 21:08:34 »

The guy in this video does the same exact thing and it works perfectly fine:

http://www.youtube.com/watch?v=MCnPaf6TPjw
Offline 04hockey

Junior Member


Medals: 2
Projects: 1
Exp: 2 years


Founder of Fanger Games.


« Reply #7 - Posted 2014-04-24 21:14:32 »

Ah I figured it out! When I saved my PNG in Paint.net I had to make sure it saved as a 32-bit image instead of using Paint.net's auto-detect.
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (15 views)
2014-07-29 12:09:19

Riven (10 views)
2014-07-29 12:08:52

Dwinin (10 views)
2014-07-29 04:59:34

E.R. Fleming (28 views)
2014-07-28 21:07:13

E.R. Fleming (10 views)
2014-07-28 21:06:25

pw (40 views)
2014-07-23 19:59:36

Riven (39 views)
2014-07-23 15:16:32

Riven (27 views)
2014-07-23 15:07:15

Riven (28 views)
2014-07-23 14:56:16

ctomni231 (59 views)
2014-07-18 00:55:21
HotSpot Options
by dleskov
2014-07-07 21:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-13 18:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-13 18:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 05:13:37

HotSpot Options
by Roquen
2014-05-15 03:59:54

HotSpot Options
by Roquen
2014-05-06 09:03:10

Escape Analysis
by Roquen
2014-04-29 16:16:43

Experimental Toys
by Roquen
2014-04-28 07:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!