Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sfml in widget (qt or whatever)  (Read 3736 times)

0 Members and 1 Guest are viewing this topic.

thoniel

  • Newbie
  • *
  • Posts: 21
    • ICQ Messenger - 157157736
    • View Profile
sfml in widget (qt or whatever)
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sfml in widget (qt or whatever)
« Reply #1 on: July 23, 2009, 12:38:03 am »
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.
Laurent Gomila - SFML developer

thoniel

  • Newbie
  • *
  • Posts: 21
    • ICQ Messenger - 157157736
    • View Profile
sfml in widget (qt or whatever)
« Reply #2 on: July 23, 2009, 01:16:08 pm »
thanks. you are right. (should work with qt as well. i will try)

Windows Form
Code: [Select]
public partial class Form1 : Form
{
UnitTestMitForm game;
public Form1() {
InitializeComponent();

game = new UnitTestMitForm(this.Handle);
game.Run();
}

public void RenderFrame() {
game.RenderFrame();
}
}


Game.RenderFrame()

Code: [Select]
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
Code: [Select]
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.