• <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
            <2007年10月>
            30123456
            78910111213
            14151617181920
            21222324252627
            28293031123
            45678910


            子曾經曰過:編程無他,唯手熟爾!

            常用鏈接

            留言簿(94)

            隨筆分類(649)

            隨筆檔案(505)

            相冊

            BCB

            Crytek

            • crymod
            • Crytek's Offical Modding Portal

            Game Industry

            OGRE

            other

            Programmers

            Qt

            WOW Stuff

            搜索

            •  

            積分與排名

            • 積分 - 911346
            • 排名 - 14

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜

            索性這幾個UI庫都試試 ^_^

            截圖


            重點
             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)


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

            FeedBack:
            # re: 每天30分鐘寫Editor--(2)在CLR窗口里用D3D畫轉動的三角形 2008-11-27 21:39 xoyojank
            # re: 每天30分鐘寫Editor--(2)在CLR窗口里用D3D畫轉動的三角形 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);

            }

              回復  更多評論
              
            # re: 每天30分鐘寫Editor--(2)在CLR窗口里用D3D畫轉動的三角形 2008-11-28 14:21 七星重劍
            這種方式是最好的?
              回復  更多評論
              
            # re: 每天30分鐘寫Editor--(2)在CLR窗口里用D3D畫轉動的三角形 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.

              回復  更多評論
              
            # re: 每天30分鐘寫Editor--(2)在CLR窗口里用D3D畫轉動的三角形 2010-04-19 15:55 七星重劍
            現在見到這種方式,把控件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內容。  回復  更多評論
              
            # re: 每天30分鐘寫Editor--(2)在CLR窗口里用D3D畫轉動的三角形 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;
            }  回復  更多評論
              
            欧美黑人激情性久久| 国产成人无码精品久久久免费 | 久久久久亚洲AV无码去区首| 久久免费的精品国产V∧| 久久精品中文字幕大胸| 蜜桃麻豆www久久国产精品| 精品无码久久久久久久久久| 一本一道久久精品综合| 一本色道久久88加勒比—综合| 国产精品久久成人影院| 色噜噜狠狠先锋影音久久| 久久久久国产精品| 韩国三级大全久久网站| 国产成人久久精品二区三区| 国产午夜电影久久| 亚洲国产成人精品无码久久久久久综合 | 久久精品国内一区二区三区| 国产精品一久久香蕉国产线看| 久久国产精品99国产精| 日韩精品久久久久久| 欧美久久一区二区三区| 久久精品无码一区二区WWW| 蜜臀av性久久久久蜜臀aⅴ| 激情伊人五月天久久综合| 久久无码av三级| 久久婷婷色香五月综合激情| 久久久久久久久无码精品亚洲日韩 | 亚洲精品99久久久久中文字幕 | 免费久久人人爽人人爽av| 久久夜色精品国产网站| 国产精品99久久久久久www| 一本久道久久综合狠狠躁AV| 久久亚洲美女精品国产精品| 国内精品久久久久久久coent| 久久免费视频1| 国产精品伊人久久伊人电影 | 99久久精品这里只有精品| 久久综合久久伊人| 久久丫精品国产亚洲av不卡 | 亚洲午夜无码久久久久小说| 97久久综合精品久久久综合|