每天30分钟写Editor--(2)在CLR窗口里用D3D画转动的三角形

每天30分钟写Editor--(2)在CLR窗口里用D3D画转动的三角形
索性这几个UI库都试试 ^_^

截图
每天30分钟写Editor--(2)在CLR窗口里用D3D画转动的三角形_第1张图片

重点
 1)取得句柄
      
pSystem -> InitD3D((HWND) this -> Handle.ToPointer());

 2)刷新画面也跟Qt一样靠定时器:拖个Timer(注意:默认是Enabled:false,改成true),双击下,改下面的函数
     
     private : System::Void timerRender_Tick(System::Object ^   sender, System::EventArgs ^   e) {
                 
if  (pSystem)
                 {
                     pSystem
-> Render();
                 }
             }

       本来我是打Run的主意的
Application::Run(gcnew MainForm());
写个类继承自Application,然后override这个Run,在其中调用Render(),试了下,编译出错
错误     1     error C3246: “EditorApplication”: 无法从“System::Windows::Forms::Application”继承,因为它已被声明为“ sealed ”    f:\Practise\Practise_2005\WorldEditor\WorldEditor.cpp     9     
Application类不能被继承!!!

看了下xoyojank写的   DirectX in C++/CLI ,也用定时器好了。

3)项目配置: 公共语言运行库支持(/clr)    多线程调试 DLL (/MDd)


你可能感兴趣的:(每天30分钟写Editor--(2)在CLR窗口里用D3D画转动的三角形)