SFML community forums
Bindings - other languages => DotNet => Topic started by: rpgmaker on March 17, 2009, 03:00:19 am
-
As the question stated, how do i do it. When ever i try to setup the icon, it always comes out wierd. Below is my code that i use
System.Drawing.Icon icon = new System.Drawing.Icon("Game.ico");
MemoryStream ms = new MemoryStream();
icon.Save(ms);
byte[] data = ms.ToArray();
Render.SetIcon((uint)icon.Width, (uint)icon.Height, data);
icon.Dispose();
ms.Close();
-
What output do you get? Do you have a screenshot?
Are you sure that Icon.Save only outputs pixels, and no header or metadata?
-
This is what my status bar looks like
(http://img23.imageshack.us/img23/5190/statusbar.png)
This is the icon i am trying to load
(http://img23.imageshack.us/img23/2594/gameicon.png)
-
What about the last question:
Are you sure that Icon.Save only outputs pixels, and no header or metadata?
I couldn't find accurate information about that in the MSDN. If you don't know, maybe you can just check if data.Length == Width * Height * 4.
Also make sure that the output format is 32 bits ARGB, and that the components are not swapped.
In other words, we have to know what icon.Save actually does :)
-
I will check that and get back. I tried the icon in sdl window and it works fine.
-
I checked it and the icon is 32 bits. Is there any other option to load the icon to the title bar?
This is a link to the icon file, if you want to check it out.
http://www.iomegatrix.net/download/Game.ico
-
What about that
maybe you can just check if data.Length == Width * Height * 4
and that
ARGB
?
-
When i check the length of the btye array it is 6518. And the width * height * 4 is 4096. Basically meaning that it was not equal. The icon have Format32bppArgb according to C#, so it ARGB.
-
So it seems the output includes something else in addition to the array of pixels. I still couldn't find useful information about this, so maybe you should post on a .Net forum, as the problem is no longer related to SFML.
Sorry I couldn't help you more.