|
How to add an icon to the game |
AleX-G Squadron
Member #13,593
October 2011
|
I am trying to make a new icon for a game, but can't find how to add it. www.anothergames.com |
SiegeLord
Member #7,827
October 2006
|
This perhaps: al_set_display_icon ? "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
AleX-G Squadron
Member #13,593
October 2011
|
How can i use it? www.anothergames.com |
Don Freeman
Member #5,110
October 2004
|
I think he means like you click to start the program. It depends on the compiler/platform. If you just mean the icon on the title bar, then use al_set_display_icon. The link SiegeLord gave tells you how to use it. -- |
AleX-G Squadron
Member #13,593
October 2011
|
How can i use this? does it mean? It doesn't work like this.... Tried like this: www.anothergames.com |
AMCerasoli
Member #11,955
May 2010
|
Alex, I think you're way too newbie... You shouldn't start learning a graphic library if you don't know the programming language that it uses first. Have you initialized Allegro, created a display and loaded the image you want to use as an icon?. ALLEGRO_BITMAP *image = "image.ico" That's too crazy man, with Allegro you'll work almost all the time with pointers, that means that you're locating and deallocating memory manually all the time. To allocate memory for an ALLEGRO_BITMAP you need to use al_load_bitmap() which returns a pointer, pointing to the direction recently allocated. And then you need to free that memory with al_destroy_bitmap(). So basically after initialize Allegro, and create a new display. ALLEGRO_BITMAP *icon = al_load_bitmap("youricon.png"); // Note that it's a normal // .png file not an .ico file al_set_display_icon(your_display, icon); // Allegro doesn't support .ico files And that should work. Edit: And BTW why did you put this post in the Allegro Development category?
|
AleX-G Squadron
Member #13,593
October 2011
|
I did it like you said, it shows this: I have already created a game, just want to add an icon. Also, thanks for pointing out pointers, i am a bit of laggy there Also, i didn't know this command al_set_display_icon(display, icon); I wrote in my third post(and tried out in the program), this: Also, created the display the same way (if you think i don't know anything): www.anothergames.com |
Neil Walker
Member #210
April 2000
|
Pointer/string issue aside, I think he's just getting mixed with wanting to use a .ico file for the game icon as embedded in the game, not just when running. In which case, look for windres or you can probably do it directly within visual studio if you are using that. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
AleX-G Squadron
Member #13,593
October 2011
|
Actually, i want to use the icon 32x32 for the windows taskbar, www.anothergames.com |
AMCerasoli
Member #11,955
May 2010
|
AleX-G Squadron said: if you think i don't know anything What I think it doesn't matter, what really matters is that if you show someone this: ALLEGRO_BITMAP *image = "image.ico" Is obvious that you're lacking the basics concepts about the C programming language. I took the time to try to see if there is a problem, but there isn't. This works perfect on my system: 1#include <iostream>
2#include <allegro5/allegro.h>
3#include "allegro5/allegro_image.h"
4
5int main () {
6
9
10 ALLEGRO_DISPLAY *display = al_create_display(800,600);
11 ALLEGRO_BITMAP *icon = al_load_bitmap ("icon.png");
12
13 al_set_display_icon(display, icon);
14
15 al_rest(3);
16
17 al_destroy_bitmap(icon);
18 al_destroy_display(display);
19 return 0;
20}
|
Thomas Fjellstrom
Member #476
June 2000
|
AleX-G Squadron said: Actually, i want to use the icon 32x32 for the windows taskbar, Allegro doesn't support the .ico format. Turn it into a bmp or a png file. AleX-G Squadron said: I have already created a game, I'm not entirely sure how you created a game with such basic misunderstandings. Trying to insert a function declaration as is, is quite odd. -- |
AleX-G Squadron
Member #13,593
October 2011
|
@cerasoli www.anothergames.com |
|