SFML community forums
Bindings - other languages => DotNet => Topic started by: thoniel on July 23, 2009, 12:09:55 am
-
hi
is there a good way to use sfml in qt or smiliar as a widget?
i saw a way for c++ in the wiki, but c# does not support multiple inheritance as c++ does.
-
I have no idea. I guess it should work if you are able to retrieve the internal Win32 handle of your target window, and pass it to SFML.
-
thanks. you are right. (should work with qt as well. i will try)
Windows Form
public partial class Form1 : Form
{
UnitTestMitForm game;
public Form1() {
InitializeComponent();
game = new UnitTestMitForm(this.Handle);
game.Run();
}
public void RenderFrame() {
game.RenderFrame();
}
}
Game.RenderFrame()
public void RenderFrame() {
float deltaTime = window.GetFrameTime();
// Events feuern
window.DispatchEvents();
// spiel aktualisieren
Update(deltaTime);
// spiel malen
window.Clear();
Draw(gameDrawer, deltaTime);
window.Display();
}
Program
Form1 form = new Form1();
form.Show();
while(form.Created) {
form.RenderFrame();
Application.DoEvents();
}
seems to work. i will try to use it and i will see if there is something wrong i cant see right now.