• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 505  文章 - 1034  trackbacks - 0
            <2008年11月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            30123456


            子曾經(jīng)曰過(guò):編程無(wú)他,唯手熟爾!

            常用鏈接

            留言簿(94)

            隨筆分類(649)

            隨筆檔案(505)

            相冊(cè)

            BCB

            Crytek

            • crymod
            • Crytek's Offical Modding Portal

            Game Industry

            OGRE

            other

            Programmers

            Qt

            WOW Stuff

            搜索

            •  

            積分與排名

            • 積分 - 914434
            • 排名 - 14

            最新隨筆

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            索性這幾個(gè)UI庫(kù)都試試 ^_^

            截圖


            重點(diǎn)
             1)取得句柄
                  
            pSystem->InitD3D((HWND)this->Handle.ToPointer());

             2)刷新畫(huà)面也跟Qt一樣靠定時(shí)器:拖個(gè)Timer(注意:默認(rèn)是Enabled:false,改成true),雙擊下,改下面的函數(shù)
                 
                private: System::Void timerRender_Tick(System::Object^  sender, System::EventArgs^  e) {
                             
            if (pSystem)
                             {
                                 pSystem
            ->Render();
                             }
                         }

                   本來(lái)我是打Run的主意的
            Application::Run(gcnew MainForm());
            寫(xiě)個(gè)類繼承自Application,然后override這個(gè)Run,在其中調(diào)用Render(),試了下,編譯出錯(cuò)
            錯(cuò)誤    1    error C3246: “EditorApplication”: 無(wú)法從“System::Windows::Forms::Application”繼承,因?yàn)樗驯宦暶鳛?#8220;sealed”    f:\Practise\Practise_2005\WorldEditor\WorldEditor.cpp    9    
            Application類不能被繼承!!!

            看了下xoyojank寫(xiě)的 原創(chuàng) DirectX in C++/CLI ,也用定時(shí)器好了。

            3)項(xiàng)目配置: 公共語(yǔ)言運(yùn)行庫(kù)支持(/clr)    多線程調(diào)試 DLL (/MDd)


            posted on 2008-11-26 23:35 七星重劍 閱讀(1223) 評(píng)論(6)  編輯 收藏 引用 所屬分類: PL--c/c++Game GraphicsIDE -- visual c++

            FeedBack:
            # re: 每天30分鐘寫(xiě)Editor--(2)在CLR窗口里用D3D畫(huà)轉(zhuǎn)動(dòng)的三角形 2008-11-27 21:39 xoyojank
            # re: 每天30分鐘寫(xiě)Editor--(2)在CLR窗口里用D3D畫(huà)轉(zhuǎn)動(dòng)的三角形 2008-11-28 14:20 七星重劍
             
            protected override void WndProc(ref Message m)

            {

               
            if (m.Msg == 0x000F)

               {

                  Frame();

                  
            this.Invalidate();

               }

               
            else

                  
            base.WndProc(ref m);

            }

             
            [DllImport("user32.dll")]

            public static extern int SendNotifyMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); 



            protected override void WndProc(ref Message m)

            {

            if (m.Msg == 0x000F)

            {

               Frame();

               SendNotifyMessage(
            this.Handle, 0x000F, IntPtr.Zero, IntPtr.Zero);

            }

            else

               
            base.WndProc(ref m);

            }

              回復(fù)  更多評(píng)論
              
            # re: 每天30分鐘寫(xiě)Editor--(2)在CLR窗口里用D3D畫(huà)轉(zhuǎn)動(dòng)的三角形 2008-11-28 14:21 七星重劍
            這種方式是最好的?
              回復(fù)  更多評(píng)論
              
            # re: 每天30分鐘寫(xiě)Editor--(2)在CLR窗口里用D3D畫(huà)轉(zhuǎn)動(dòng)的三角形 2010-04-19 15:46 七星重劍
            http://blogs.msdn.com/tmiller/archive/2005/05/05/415008.aspx

            My last post on render loops (hopefully)..
            The most common topic on my blog returns again. This time it will be brief as all I'm going to to do now is show you the render loop the June'05 SDK will be using. A coworker in another group came up with this markedly simple, yet deceptively effective loop for that groups projects. I liked it so much, i'm sharing it with everyone else. =)

            The basic loop (slightly modified from his original version and the version in the new SDK for ease of reading):

            public void MainLoop()
            {
            // Hook the application's idle event
            System.Windows.Forms.Application.Idle += new EventHandler(OnApplicationIdle);
            System.Windows.Forms.Application.Run(myForm);
            }

            private void OnApplicationIdle(object sender, EventArgs e)
            {
            while (AppStillIdle)
            {
            // Render a frame during idle time (no messages are waiting)
            UpdateEnvironment();
            Render3DEnvironment();
            }
            }

            private bool AppStillIdle
            {
            get
            {
            NativeMethods.Message msg;
            return !NativeMethods.PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
            }
            }


            And the declarations for those two native methods members:

            [StructLayout(LayoutKind.Sequential)]
            public struct Message
            {
            public IntPtr hWnd;
            public WindowMessage msg;
            public IntPtr wParam;
            public IntPtr lParam;
            public uint time;
            public System.Drawing.Point p;
            }

            [System.Security.SuppressUnmanagedCodeSecurity] // We won't use this maliciously
            [DllImport("User32.dll", CharSet=CharSet.Auto)]
            public static extern bool PeekMessage(out Message msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);


            ------

            Simple, elegant, effective. No extra allocations, no extra collections, it just works.. The Idle event fires when there's no messages in the queue, and then the handler keeps looping continuously until a message does appear, in which case it stops.. Once all the messages are handled, the idle event is fired again, and the process starts over.

              回復(fù)  更多評(píng)論
              
            # re: 每天30分鐘寫(xiě)Editor--(2)在CLR窗口里用D3D畫(huà)轉(zhuǎn)動(dòng)的三角形 2010-04-19 15:55 七星重劍
            現(xiàn)在見(jiàn)到這種方式,把控件invalidate了讓其重新繪制。

            Application.Idle += new EventHandler(form.Application_Idle);
            Application.Run(form);

            Invalidator.Shutdown();
            MFramework.Shutdown();
            }

            private void Application_Idle(object sender, EventArgs e)
            {
            if (this.Visible &&
            this.WindowState != FormWindowState.Minimized &&
            Form.ActiveForm == this)
            {
            Invalidator.Instance.Update(true);
            }
            }

            在控件的protected override void OnPaint(PaintEventArgs e)里繪制3D內(nèi)容。  回復(fù)  更多評(píng)論
              
            # re: 每天30分鐘寫(xiě)Editor--(2)在CLR窗口里用D3D畫(huà)轉(zhuǎn)動(dòng)的三角形 2010-10-31 18:42 funcman
            Void OnIdle(Object^ sender, EventArgs^ e) {
            MSG msg;
            while( !PeekMessage(&msg, 0, 0, 0, 0) ) {
            Render();
            }
            }

            //...

            int main(array<System::String^>^ args) {
            //...

            EventHandler^ idle = gcnew EventHandler(OnIdle);
            Application::Idle += idle;
            Application::Run(gcnew MainForm());
            Application::Idle -= idle;

            return 0;
            }  回復(fù)  更多評(píng)論
              
            欧美与黑人午夜性猛交久久久| 日韩美女18网站久久精品| 国产亚洲精品美女久久久| 亚洲国产精品久久久久久| 亚洲国产成人久久综合区| 久久久精品人妻一区二区三区四 | 麻豆精品久久精品色综合| 亚洲国产精品婷婷久久| 久久精品青青草原伊人| 久久青青草原综合伊人| 久久99热这里只有精品国产| 国产成人精品久久一区二区三区av| 久久精品aⅴ无码中文字字幕不卡| 热久久国产精品| 无码精品久久久天天影视| 久久高潮一级毛片免费| 丰满少妇人妻久久久久久| 久久亚洲熟女cc98cm| 久久婷婷五月综合97色直播| 精品国产一区二区三区久久| 亚洲AV无码久久寂寞少妇| 无码任你躁久久久久久老妇| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 超级碰久久免费公开视频| 亚洲AV无码久久精品狠狠爱浪潮| 亚洲精品97久久中文字幕无码| 久久中文娱乐网| 久久精品国产亚洲麻豆| 99久久777色| 国产精品美女久久久久| 欧洲人妻丰满av无码久久不卡 | 久久www免费人成看片| 少妇被又大又粗又爽毛片久久黑人 | 久久婷婷色综合一区二区| 国产2021久久精品| 国产精品久久久亚洲| 久久成人国产精品| 99久久无色码中文字幕| 99久久无码一区人妻a黑| 国产高潮国产高潮久久久| 人妻少妇久久中文字幕|