al_set_display_icon() from executable
Desmond Taylor

Okay, I've added the icon to the executable using a resource file and don't want to also include it as a png. Is there a way I can get the icon from the executable file and use al_set_display_icon() on it?

Evert

Why do you need to call al_set_display_icon() if the icon is already embedded in the executable?

Desmond Taylor

To set the window icon :) I want my game to run in both fullscreen and windoed mode and in windowed I need the icon to be attached to the window.

Evert

Shouldn't it automatically set the icon to the one that's associated with the program? That's what I'd expect anyway.
I guess you're using Windows though, and I have no idea how this works there...

Desmond Taylor

No it doesn't :( And yea I'm using Windows 7 32bit.

Elias

The problem is likely this line: http://allefant.com/gtags/S/2046.html#L868

If someone knows how to instead set the .exe icon there that would be nice of course. For now it should be easy enough providing the icon as a .png file and setting with al_set_display_icon though.

Thomas Fjellstrom

A4 has a mechanism that let you include an "allegro_icon" resource that it would load and set for the window initially. We should probably do something similar for A5.

Desmond Taylor
Elias said:

For now it should be easy enough providing the icon as a .png file and setting with al_set_display_icon though.

I really want to try and avoid that.

A4 has a mechanism that let you include an "allegro_icon" resource that it would load and set for the window initially. We should probably do something similar.

Did that use the icon from the executable?

Trent Gamblin

The allegro_icon thing is the executable icon. Windows has two different icons you want to set. The first one is the executable icon that will show in Explorer. The window titlebar icon is set with al_set_display_icon.

Edit: If you don't want to include a png file you could use the memfile addon to load a png from a binary dump (into a header file).

Desmond Taylor

If you don't want to include a png file you could use the memfile addon to load a png from a binary dump (into a header file).

I really have no idea where to start with that. Any chance you can give me an example?

Elias

A4 has this in the same line instead of NULL:

wnd_class.hIcon = LoadIcon(allegro_inst, "allegro_icon");

Thread #607514. Printed from Allegro.cc