您可以创建自己的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