您可以創建自己的sdl.net窗口類,該窗口類將在創建時使用SdlDotNet.Graphics.Video.SetVideoMode()
方法,在內部處理圖形操作並提供從winform應用程序調用的公共方法。
類似的東西:
using System.Drawing;
using SdlDotNet.Graphics;
public class SdlWindow
{
private Surface screen; // the display Surface
/* ctor */
public SdlWindow(Size size)
{
screen = Video.SetVideoMode(size.Width, size.Height); // create a new sdl Surface and its own window container
Video.WindowCaption = "Sdl Window";
}
/* your methods */
public void DrawRectangle(Rectangle rect)
{
screen.Fill(rect, Color.Red);
screen.Update();
}
/* cleanup a bit */
public void Dispose()
{
if (screen != null)
Video.Close();
}
}
不要忘記參考在你的項目添加到SdlDotNet.dll庫。
希望這會有所幫助!
請記住,你必須運行在不同的線程 – CallumDev 2013-03-03 08:24:00
Ichiru,自然是,但我不知道該怎麼做。你能提供一個線索嗎? – user2015532 2013-03-03 11:34:06