自批:读者注意,以下都是肤浅之谈,诚不足作为参考。

今天查了一下Managed DirectX 9.0的情况。据我所知现在有三种DirectX开发方式:C-C++/COM Raw-Interface、VB/COM Component、.Net/Managed DirectX;其中当然是使用COM的原始接口方式最快,其实目前我并不看好Managed DirectX,总体感觉其接口目前还处于不稳定状态,简直就是一片一片的subject to change/deprecated--! 使用这种方式的商业游戏也几乎没有,而且托管方式又为程序的加速增加了一层额外的burden,尤其是在现在普遍对托管方式执行效率不是那么了解的环境下,但是我还是很好奇号称未来DirectX开发潮流的Managed DirectX究竟能有多快,至少应该要比GDI+快吧,至少应该要比Flash快吧,汗.... 小试了一把2D的,M$现在推荐大家使用Direct3D里面的2D渲染接口,也就是Texture + Sprite + Direct3DDevice方式,M$到底是M$,果然有够激进的: )  而传统的DirectDraw接口在DX7.0之后已经开始被M$亮黄牌了——has been deprecated,9.0c SDK里面的资料已严重不全,但还是有Managed的接口支持,下面是个Managed DirectDraw的简明实例,C#写的,保证稳定: ) 需要Managed DirectX的Assembly。至于使用感受么...hmmm....原有的DDraw有的缺点Managed DDraw都有,对错误流程控制要求高、消息循环交互性要求高、多任务友好程度需要额外注意(100% CPU占有率)、需要进行Surface Lost控制.....中个痛苦,试试便知: ) 据说Direct3D里这些方面都是由DX自动管理的,不知效果如何,过两天我再写个Direct3D方式的2D实例。

BTW,罗嗦一句,经试验发现,Managed DirectX 9里面的GraphicsStream类数据操作效率不要太高,显然是经过刻意优化的,像我这种又喜欢直接改写显存又懒的人总算找到救命稻草了,哈哈

Concise Sample of Managed DirectDraw (9.0c)#define FULLSCREEN
Concise Sample of Managed DirectDraw (9.0c)
Concise Sample of Managed DirectDraw (9.0c)
using System;
Concise Sample of Managed DirectDraw (9.0c)
using System.Drawing;
Concise Sample of Managed DirectDraw (9.0c)
using System.Collections;
Concise Sample of Managed DirectDraw (9.0c)
using System.ComponentModel;
Concise Sample of Managed DirectDraw (9.0c)
using System.Windows.Forms;
Concise Sample of Managed DirectDraw (9.0c)
using System.Threading;
Concise Sample of Managed DirectDraw (9.0c)
Concise Sample of Managed DirectDraw (9.0c)
using Microsoft.DirectX.DirectDraw;
Concise Sample of Managed DirectDraw (9.0c)
Concise Sample of Managed DirectDraw (9.0c)
namespace MDDraw
}

相关文章: