16
DotNet / Question: How to setup icon for SFML window
« on: March 17, 2009, 10:51:57 pm »
This is what my status bar looks like
This is the icon i am trying to load
This is the icon i am trying to load
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
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();
using G = SFML.Graphics;I am aliasing the namespace as G
text = new G.String2D("God is Good");
G.FloatRect rect = text.GetRect();
//Create Render Window
MyRenderWindow.EnableKeyRepeat(false);
//Start Render Loop
while(true){
MyRenderWindow..DispatchEvents();
MyRenderWindow.Clear();
.....
if(MyRenderWindow.Input.IsKeyDown(KeyCode.A)){
//To something
}
MyRenderWindow.Display();
}
Image img = new Image.new("file.png");
byte[] data = img.Pixels;
Stream s = new MemoryStream(data);
System.Drawing.Image dotNetImage = System.Drawing.Image.FromStream(s);// It crashes stating paramater is not valid
img.Dispose();
s.Close();