google rss rss

          doneykoo [Ouditian]

          DKzone- Ouditian Technology

          2009年10月14日 #

          [share] 我的針對批處理文件bat,cmd的UltraEdit語法高亮wordfile



            1 
            2 /L18"BAT_FILE" BAT_FILE_LANG Line Comment = rem Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = " File Extensions = bat cmd
            3 /Delimiters = ~!@^&*()-+=|/\{}[]:;"`'<> ,    .?
            4 /Function String = "call"
            5 /Function String 1 = "start"
            6 /Function String 2 = "%:"
            7 /Variable String = "^%[1-9a-zA-Z]++[12345^%]"
            8 /Indent Strings = "(" "if" "else"
            9 /Unindent Strings = ")"
           10 /Open Brace Strings =  "{" "(" "%"
           11 /Close Brace Strings = "}" ")" "%"
           12 /Open Fold Strings = "("
           13 /Close Fold Strings = ")"
           14 /C1"Keywords" STYLE_KEYWORD
           15 assoc    
           16 at       
           17 attrib   
           18 break    
           19 cacls    
           20 call     
           21 cd       
           22 chcp     
           23 chdir    
           24 chkdsk   
           25 chkntfs  
           26 cls      
           27 cmd      
           28 color    
           29 comp     
           30 compact  
           31 convert  
           32 copy     
           33 date     
           34 del      
           35 dir      
           36 diskcomp 
           37 diskcopy 
           38 doskey   
           39 echo     
           40 endlocal 
           41 erase    
           42 exit     
           43 fc       
           44 find     
           45 findstr  
           46 for      
           47 format   
           48 ftype    
           49 goto     
           50 graftabl 
           51 help     
           52 if       
           53 label    
           54 md       
           55 mkdir    
           56 mode     
           57 more     
           58 move     
           59 path     
           60 pause    
           61 popd     
           62 print    
           63 prompt   
           64 pushd    
           65 rd       
           66 recover  
           67 rem      
           68 ren      
           69 rename   
           70 replace  
           71 rmdir    
           72 set      
           73 setlocal 
           74 shift    
           75 sort     
           76 start    
           77 subst    
           78 time     
           79 title    
           80 tree     
           81 type     
           82 ver      
           83 verify   
           84 vol      
           85 xcopy    
           86 /C2"C++ Keywords" STYLE_KEYWORD
           87 /C3"Microsoft C extensions" STYLE_EXTENSION
           88 @
           89 %
           90 (
           91 )
           92 /C5"COLOR5" STYLE_COLOR5
           93 !
           94 %
           95 &
           96 *
           97 +
           98 -
           99 // /
          100 <
          101 = ==
          102 >
          103 ^
          104 |
          105 ~
          106 /C6"COLOR6" STYLE_COLOR6
          107 /C7"Variables"
          108 ** % x%
          109 /C8"Constant/Global/Symbol"
          110 ** WII DEB FIN REL

          posted @ 2009-10-14 11:14 DoNeY 閱讀(1531) | 評論 (0)編輯 收藏

          2008年12月31日 #

          游戲開發學習過程(連載中...)(轉自 威爾弗的空間)

          轉自 : http://hi.baidu.com/welflau/blog/item/1b17032320bb05499358075e.html

          http://hi.baidu.com/welflau/希望能保留原創作者鏈接,謝謝!

          2008-12-02

          第1講【創建框架】

           


          1 新建MFC exe / dialog based
          2 刪除dialog類的顯示代碼
          3 添加WelflGameFrm類
          4 在app類的InitInstance 函數中 添加http://hi.baidu.com/welflau/希望能保留原創作者鏈接,謝謝!
          m_pMainWnd = new CWelflGameFrm;
          m_pMainWnd->ShowWindow( m_nCmdShow );
          m_pMainWnd->UpdateWindow();
          5 將CWelflGameFrm()構造函數改為public 成員
          6 在構造函數CWelflGameFrm中添加:
          RECT rect;
          Create(NULL,"ch07-1: ミDirectGraphics");
          CClientDC dc(this);
          int width = dc.GetDeviceCaps(HORZRES);
          int height = dc.GetDeviceCaps(VERTRES);
          GetWindowRect( &rect );
          width = ( width - ( rect.right - rect.left ))/2 ;
          height = (height - (rect.bottom - rect.top ))/2 ;
          MoveWindow( width , height , (rect.right - rect.left ) , (rect.bottom - rect.top ) ,true);

          7 為CWelfGameFrm類添加WindowProc函數,并加入代碼:http://hi.baidu.com/welflau/希望能保留原創作者鏈接,謝謝!
          switch( message )
          {
          case WM_CREATE :
             if( !d3dCreate( m_hWnd , 640 , 480 , true ))
              PostMessage( WM_CLOSE );
             return 0 ;
          case WM_DESTROY :
             d3dRelease();
             return 0 ;
          }

          8 為工程添加兩個文件
          myd3d.cpp, myd3d.h

          9 編譯出現
          fatal error C1010: unexpected end of file while looking for precompiled header directive
          解決方案:在Project Settings里C++頁面的Precomplie Header里把出錯源文件設置為不使用預編譯頭就可以了,詳見視頻

          10 將BOOL CWelfGameApp::InitInstance()中的
          return FALSE;改為 return TRUE;

          11 為CWelfGameFrm類添加OnPaint響應
          添加如下代碼:
          d3dClear(0);
          //
          d3d_Device->Present( NULL , NULL , NULL , NULL );




          第2講【繪制文字和圖像】

          目錄
          【一】、從DirectGraphic中獲取DC(GDI)
          【二】、2D圖像繪制


          【一】、從DirectGraphic中獲取DC(GDI)
          1 添加類d3dHdc 在 myd3d.h文件中
          class d3dHdc
          {
          private :
          HDC m_hdc ;
          LPDIRECT3DSURFACE9 m_Surface ;

          public :
          void Release();
          inline operator HDC(){ return m_hdc ;};
          public :
          d3dHdc();
          ~d3dHdc();
          };

          2在myd3d.cpp中添加函數定義
          d3dHdc::d3dHdc()
          {
          m_hdc = 0 ;
          m_Surface = 0 ;
          // 獲得設備
          if( !d3d_Device )
             return ;
          if( d3d_Device->GetBackBuffer( 0 , 0 , D3DBACKBUFFER_TYPE_MONO , &m_Surface ) != D3D_OK )
             return ;

          m_Surface->GetDC( &m_hdc );
          }

          d3dHdc::~d3dHdc()
          {
          Release();
          }

          void d3dHdc::Release()
          {
          if( m_Surface )
          {
             if( m_hdc )
              m_Surface->ReleaseDC( m_hdc );
             m_Surface->Release();
            
             m_hdc = NULL ;
             m_Surface = NULL ;
          }

          }

          3 現在就可以使用他了
          在繪制函數中添加:
          d3dHdc hdc ;
             SetTextColor( hdc , RGB( 255 , 255 , 255 ));
             SetBkMode( hdc , 1 );
             TextOut( hdc , 0 , 0 , str , strlen( str ));
          hdc.Release();


          【二】、2D圖像繪制
          1 新建d3dTexture類
          class d3dTexture
          {
          private :
          int      m_Width ;
          int      m_Height ;
          LPDIRECT3DTEXTURE9 m_Texture ;
          public :
          void BltFast( int x , int y );
          void BltFast( int l , int t , int r , int b );
          public :
          BOOL Create( LPCTSTR file );
          void Release();
          inline operator LPDIRECT3DTEXTURE9(){ return m_Texture ;};
          public :
          d3dTexture();
          ~d3dTexture();
          };

          2 并添加定義:

          /*////////////////////////////////////////////////
          3D 紋理類d3dTexture 函數定義 2008-12-02

          /*////////////////////////////////////////////////

          d3dTexture::d3dTexture()
          {
          m_Texture = NULL ;
          }

          d3dTexture::~d3dTexture()
          {
          Release();
          }

          void d3dTexture::Release()
          {
          if( m_Texture )
             m_Texture->Release();
          m_Texture = NULL ;
          }

          BOOL d3dTexture::Create( LPCTSTR file )
          {
          D3DXIMAGE_INFO in ;
          memset( &in , 0 , sizeof( in ));
          // ﹍て
          Release();
          //更
          D3DXCreateTextureFromFileEx( d3d_Device ,
             file , D3DX_DEFAULT , D3DX_DEFAULT ,
             0 , 0 , D3DFMT_UNKNOWN , D3DPOOL_MANAGED ,
             D3DX_DEFAULT ,
             D3DX_DEFAULT , 0 , &in , NULL , &m_Texture );
          if( m_Texture == NULL )
             return false ;
          // 眔戈
          m_Width = in.Width ;
          m_Height = in.Height ;

          return true ;
          }

          void d3dTexture::BltFast(int x, int y)
          {
          BltFast( x , y , x + m_Width , y + m_Height );
          }

          void d3dTexture::BltFast(int l , int t , int r , int b )
          {
          D3DTLVERTEX v[4] ;
          //郴翴 擋篶
          memset( v , 0 , sizeof( v ));
          v[0].x = v[3].x = (float)(l) ;
          v[1].x = v[2].x = (float)(r);
          v[0].y = v[1].y = (float)(t);
          v[2].y = v[3].y = (float)(b);

          v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw =
             v[0].z = v[1].z = v[2].z = v[3].z = 0.5f ;

          v[0].diffuse = v[1].diffuse = v[2].diffuse = v[3].diffuse = -1 ;

          v[1].tu = v[2].tu = 1.0f ;
          v[2].tv = v[3].tv = 1.0f ;
          //砞酶瓜家Α
          d3d_Device->SetTexture( 0 , m_Texture );
          d3d_Device->SetFVF( D3DFVF_TLVERTEX );
          d3d_Device->DrawPrimitiveUP( D3DPT_TRIANGLEFAN , 2 , (LPVOID)v , sizeof( D3DTLVERTEX ));


          }

          3 編譯時會出錯
          解決方法:
          在myd3d.h文件中添加
          #include "d3dx9tex.h"

          #pragma comment(lib,"d3dx9.lib")
          以及
          const DWORD D3DFVF_TLVERTEX = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1 );
          typedef struct _D3DTLVERTEX
          {
          float x , y , z , rhw ;
          D3DCOLOR diffuse , specular;
          float tu, tv;
          }D3DTLVERTEX ;

          4 在WelfGameFrm中添加兩個成員
          d3dTexture m_Bk ;
          d3dTexture m_Role ;

          5 在WelfGameFrm的Create響應添加:
             m_Bk.Create( "背景.tga" );
             m_Role.Create( "娃娃.tga" );

          6 調用BltFast進行繪制
          //開始繪制
          d3d_Device->BeginScene();
          d3d_Device->SetRenderState( D3DRS_CULLMODE , D3DCULL_NONE );
          d3d_Device->SetRenderState( D3DRS_ZENABLE , D3DZB_FALSE );
          m_Bk.BltFast( 0 , 0 );
          m_Role.BltFast( 0 , 0 );
          d3d_Device->EndScene();

          7 將BltFast函數改進




          第3講 WelfGame【圖像透明及顏色】

          http://hi.baidu.com/welflau/希望能保留原創作者鏈接,

          【一】、實現透明圖像

          1 RenderScene()中添加設置代碼

          在背景繪制前添加:

                        d3d_Device->SetRenderState( D3DRS_CULLMODE , D3DCULL_NONE );

                        d3d_Device->SetRenderState( D3DRS_ZENABLE , D3DZB_FALSE );

                        d3d_Device->SetRenderState( D3DRS_SHADEMODE , D3DSHADE_FLAT );

                        d3d_Device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );

          在前景繪制的前面添加

                 d3d_Device->SetRenderState( D3DRS_SRCBLEND , D3DBLEND_SRCALPHA );

                 d3d_Device->SetRenderState( D3DRS_DESTBLEND , D3DBLEND_INVSRCALPHA );

                 d3d_Device->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );//開啟混色

           

           

           

          效果

           

          2 d3dTexture添加BltFast函數

          void d3dTexture::BltFast(int l , int t , int r , int b , DWORD diffuse )

          {

                 D3DTLVERTEX v[4] ;

                 //郴翴 擋篶

                 memset( v , 0 , sizeof( v ));

                 v[0].x = v[3].x = (float)(l) ;

                 v[1].x = v[2].x = (float)(r);

                 v[0].y = v[1].y = (float)(t);

                 v[2].y = v[3].y = (float)(b);

                 v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw =

                 v[0].z = v[1].z = v[2].z = v[3].z = 0.5f ;

                 //肅︹

                 v[0].diffuse = v[1].diffuse = v[2].diffuse = v[3].diffuse = diffuse ;

                 v[1].tu = v[2].tu = 1.0f ;

                 v[2].tv = v[3].tv = 1.0f ;

                 //砞酶瓜家Α

                 d3d_Device->SetTexture( 0 , m_Texture );

                 d3d_Device->SetFVF( D3DFVF_TLVERTEX );

                 d3d_Device->DrawPrimitiveUP( D3DPT_TRIANGLEFAN , 2 , (LPVOID)v , sizeof( D3DTLVERTEX ));

          }

          添加以下幾句:

                 d3d_Device->SetTextureStageState( 0 , D3DTSS_ALPHAARG1 , D3DTA_TEXTURE );

                 d3d_Device->SetTextureStageState( 0 , D3DTSS_ALPHAARG2 , D3DTA_DIFFUSE );

                 d3d_Device->SetTextureStageState( 0 , D3DTSS_COLORARG1 , D3DTA_TEXTURE );

                 d3d_Device->SetTextureStageState( 0 , D3DTSS_COLORARG2 , D3DTA_DIFFUSE );

                 d3d_Device->SetTextureStageState( 0 , D3DTSS_COLOROP , D3DTOP_SELECTARG1 );

                 d3d_Device->SetTextureStageState( 0 , D3DTSS_ALPHAOP , D3DTOP_MODULATE );

                 //以下為前景

                 m_Role.BltFast( 100, 100, 250 ,250 ,D3DCOLOR_ARGB( 128 , 255 , 255 , 255 ));//最后一個參數為顏色,包括透明度

          效果圖

           

          posted @ 2008-12-31 18:04 DoNeY 閱讀(421) | 評論 (0)編輯 收藏

          JavaScript 仿LightBox內容顯示效果、拖放效果和漸變效果

          JavaScript 仿LightBox內容顯示效果

          詳解定位與定位應用

          拖放效果漸變效果

          posted @ 2008-12-31 17:59 DoNeY 閱讀(277) | 評論 (0)編輯 收藏

          CString,int,string,char*之間的轉換(轉)

          轉自http://www.cppblog.com/ACM-Boy/archive/2008/12/31/70843.html

          string 轉 CString  
          CString.format("%s", string.c_str());  

          char 轉 CString  
          CString.format("%s", char*);  

          char 轉 string  
          string s(char *);  

          string 轉 char *  
          char *p = string.c_str();  

          CString 轉 string  
          string s(CString.GetBuffer());  

          1,string -> CString  
          CString.format("%s", string.c_str());  
          用c_str()確實比data()要好.  
          2,char -> string  
          string s(char *);  
          你的只能初始化,在不是初始化的地方最好還是用assign().  
          3,CString -> string  
          string s(CString.GetBuffer());  
          GetBuffer()后一定要ReleaseBuffer(),否則就沒有釋放緩沖區所占的空間. 

          posted @ 2008-12-31 17:43 DoNeY 閱讀(241) | 評論 (0)編輯 收藏

          2008年10月21日 #

          [FW] 在UltraEdit里正確顯示Lua的塊注釋(語法著色)

           

          Origin Link http://blog.2ndboy.net/?p=116#comment-3104
          Thanks to 2ndboy


          在 UltraEdit 里正確顯示 Lua 的塊注釋(DoNeY注:語法著色問題)

            我算得上是 UltraEdit 的鐵桿用戶啦(雖然是 D 版用戶:)),所以寫 Lua 程序當然用 UltraEdit 啦!讓 UltraEdit 支持 Lua 的語法高亮很簡單,去 UE 的官網,下載 Lua 的語法文件集成在自帶的語法高亮文件里就可以啦。

            但是 UE 官網上這個語法文件貌似比較舊,是 02 年 8 月發布的,塊注釋居然用的是“[[”和“]]”:“Block Comment On = [[ Block Comment Off = ]]”。于是手工改成“Block Comment On = –[[ Block Comment Off = –]]”保存,結果發現行注釋“–”是可以正確顯示的,但是塊注釋就只能顯示快注釋開始標記所在的那一行。貌似是 UE 的 bug?估計跟行注釋有沖突,因為語法文件里是這么寫的“Line Comment = — Block Comment On = –[[ Block Comment Off = –]]”。試了一下把行注釋放在塊注釋后面也不行,開動 Google,結果在 UE 的論壇上找到了答案

            把 Lua 的語法文件第一行改成如下這個樣子就可以啦:

           

          /L12″Lua” Block Comment On = --[[ Block Comment Off = ]] Block Comment On Alt = -- Escape Char = \ String Chars = “‘ File Extensions = LUA



          (DoNeY注:哈,終于有了解決方案,下面聽作者講一下這一微小滴奧妙所在)

            查了一下 UE 的幫助文檔,上面對“Block Comment On Alt”的描述是這樣的“The second set of block comments are in the form “Block Comment On Alt = ” and “Block Comment Off Alt = ” followed by up to five characters each that define the comment designators. If a Block Comment On Alt is defined but the Block Comment Off Alt is not defined the commenting will stop at the end of the line.”。看來塊注釋指示器有兩種,這個辦法還真是比較巧妙,但是要熟讀 UE 文檔才能想的到呀。
          (DoNeY注:意即如果ultraedit在wordfile中對某個語言的語法著色只定義其Block Comment On Alt =作為第二種塊注釋的起始符號,而不定義第二種塊注釋的結束符號Block Comment Off Alt =,那么這個Block Comment On Alt 所定義的符號將會只注釋掉從符號開始至行尾的部分,也就相當于換一個方法定義了行注釋的符號了)

            改完以后再看 Lua 代碼里的塊注釋,現在已經可以完美顯示啦:D

          posted @ 2008-10-21 17:35 DoNeY 閱讀(3404) | 評論 (0)編輯 收藏

          Making Draggable Frames 【為wow插件編寫可拖動的Frame】


          FW: http://www.wowwiki.com/Making_Draggable_Frames

          XML Declarations

          First, the XML tags movable="true" and enableMouse="true" must be in the frames declaration. Note: Some frame templates like 'button' already include enableMouse="true".

          Example:


          <Frame name="TellTrackFrame" enableMouse="true" movable="true" resizable="true" parent="UIParent" hidden="true">

          Simple Dragging

          One simple way to detect drag is to add OnDragStart and OnDragStop script elements to the frame:
          <Scripts>
          <OnLoad>
           this:RegisterForDrag("LeftButton");
          </OnLoad>
          <OnDragStart>
           this:StartMoving();
           this.isMoving = true;
          </OnDragStart>
          <OnDragStop>
           this:StopMovingOrSizing();
           this.isMoving = false;
          </OnDragStop>
          </Scripts>

          Advanced Dragging

          Another way, which is more responsive but requires an onhide element so that the frame wont get stuck to the mouse:
          <Scripts>
          <OnMouseUp>
           if ( this.isMoving ) then
            this:StopMovingOrSizing();
            this.isMoving = false;
           end
          </OnMouseUp>
          <OnMouseDown>
           if ( ( ( not this.isLocked ) or ( this.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then
            this:StartMoving();
            this.isMoving = true;
           end
          </OnMouseDown>
          <OnHide>
           if ( this.isMoving ) then
            this:StopMovingOrSizing();
            this.isMoving = false;
           end
          </OnHide>
          </Scripts>

          Note: this method also demonstrates an optional isLocked parameter to determine whether you can drag the frame or not.

          Parent Dragging

          Some advanced dragging addons use overlays that make default Blizzard frames draggable. This is possible by using GetParent when starting and stopping drag. To do this, one must make the parent frame movable through the use of the SetMovable widget function, i.e. frame:SetMovable(true). One drawback with overlay frames that are mouse enabled is that they will prevent the parent frame's click script tags from being called so you often have to simulate their click events.

          Quick Dragging Code

          While somewhat untested there is an easier and more automatic way to activate dragging. If you have your <Frame> delcaration attributes "enableMouse" and "movable" set to true, dragging may be accomplished by adding a <TitleRegion> tag inside of your <Frame>
          <Frame name="myname" frameStrata="HIGH" toplevel="true" enableMouse="true" movable="true" parent="UIParent">
           
          <TitleRegion setAllPoints="true"/>
           
          </Frame>

          I haven't discovered any adverse side effects to doing this yet, I am not even sure if this is the intended use for it.

          Using this method can result in the frame not responding to other mouse events, also both mouse buttons will drag the frame.


          You can also specify <Size> and <Anchors> within <TitleRegion>, e.g.

          <Frame name="myname" frameStrata="HIGH" toplevel="true" enableMouse="true" movable="true" parent="UIParent">
           
          <TitleRegion>
            
          <Size>
             
          <AbsDimension x="200" y="20"/>
            
          </Size>
            
          <Anchors>
             
          <Anchor point="TOP"/>
            
          </Anchors>
           
          </TitleRegion>
           
          </Frame>

          This way, your <Frame> can still receive mouse events, and you can only drag it by clicking within its <TitleRegion>.

          Lua Only Approach

          If your frame is called MyFrame -
          MyFrame:SetMovable(true)
          MyFrame
          :EnableMouse(true)
          MyFrame
          :SetScript("OnMouseDown",function()
            MyFrame
          :StartMoving()
          end)
          MyFrame
          :SetScript("OnMouseUp",function()
            MyFrame
          :StopMovingOrSizing()
          end)








          posted @ 2008-10-21 16:11 DoNeY 閱讀(743) | 評論 (0)編輯 收藏

          僅列出標題  
            doneykoo blogjava
            
          主站蜘蛛池模板: 津南区| 雅安市| 巢湖市| 宝丰县| 耒阳市| 湘潭县| 漳浦县| 四会市| 大洼县| 集贤县| 浮梁县| 齐河县| 晋州市| 开原市| 饶阳县| 共和县| 奇台县| 朝阳市| 台南县| 砚山县| 屯留县| 子长县| 台山市| 黎川县| 济阳县| 乌兰县| 孟津县| 秦皇岛市| 渭南市| 茂名市| 木里| 雷州市| 祥云县| 永和县| 清远市| 西吉县| 临漳县| 普兰店市| 大悟县| 儋州市| 小金县|