JTalton's picture

Issue: GameWindow Icon Support

Project:The Open Toolkit library
Category:feature request

I am getting to the point in my project where it would be nice to post screen shots. It would be nice to have Icon support for the GameWindow.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ghiboz's picture


but maybe I write a stupid thing, but WinGLNative class have the public Icon property, and if this property is set, the icon will be updated...
is not possible make a Icon property also for GameWindow class and go down into the class tree to set the Icon into the winglnative class??


the Fiddler's picture


Yes, it is!

I just wanted to see if it is possible to do this automatically, so that you don't have to set the Application Icon from the project properties once and then go and set it through code again. Ideally, you could just set the Application Icon and the GameWindow would pick and use it in the taskbar and the window itself automatically - but this may not be possible (still working on it).

rakkarage's picture


rakkarage's picture


rakkarage's picture


rakkarage's picture


try { return Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().Location);  }

your code works with Location instead of CodeBase

of course the client (is that the right term) or QuickStart in this case... must select something other then (Default Icon) in project settings... because the default setting of (Default Icon) does not embed any icon in the exe (Right click on any shortcut in windows and choose change icon and browse to any dll or exe) and just relies on the operating system to display a default icon

the Fiddler's picture


Status:confirmed» in progress (review)

Rev. 2347 implements icon support. This is not automatic - you need to add an icon resource (or load an icon via other means) and assign it to the Icon property.

It is not possible to add automatic icon support in a cross-platform manner (i.e. via the /win32icon compiler switch), as this method embeds the icon directly to the PE executable (rather than a .Net resource).

The implementation should also work correctly on Linux, but this needs testing. Mac OS X support is not available at this point.

rakkarage's picture


i think you misunderstood my last post?

you don't need to use the /win32icon compiler switch (projects settings) you can just read the icon (if any) that was set with it? and your code try { return Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().CodeBase);  } does that... if you use the Location property instead of the CodeBase property

the Fiddler's picture


Actually, the issue is that Icon.ExtractAssociatedIcon is not implemented on Mono, so this approach won't work in a cross-platform manner.

The only solution is to take the WinForms approach and provide an Icon property that must be set on its own.

rakkarage's picture


ah... thanks and thanks for property :)