当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTINPUTDEVICE8W::GetDeviceState方法代码示例

本文整理汇总了C++中LPDIRECTINPUTDEVICE8W::GetDeviceState方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTINPUTDEVICE8W::GetDeviceState方法的具体用法?C++ LPDIRECTINPUTDEVICE8W::GetDeviceState怎么用?C++ LPDIRECTINPUTDEVICE8W::GetDeviceState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTINPUTDEVICE8W的用法示例。


在下文中一共展示了LPDIRECTINPUTDEVICE8W::GetDeviceState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetDeviceState

 HRESULT _stdcall GetDeviceState(THIS_ DWORD a,LPVOID b) {
     //This needs to be modified to use b instead of bytes - it would save one copymemory
     BYTE bytes[256];
     HRESULT hr=RealDevice->GetDeviceState(sizeof(bytes),bytes);
     //push escape to skip the intro
     if(SkipIntro) {
         if(SkipIntro2) {
             bytes[0x01]=0x80;
             SkipIntro2=false;
         } else {
             SkipIntro2=true;
         }
     } else if(FinishedFake) {
         FinishedFake=false;
         bytes[0x29]=0x80;
     } else if(UseFakeBuffer==0) {
         //Only want to respond to keypresses if the buffer is empty
         for(BYTE b=0;b<32;b++) {
             if(FakeKeys[b].KeyCode==0) break;
             if(KEYDOWN(bytes,FakeKeys[b].KeyCode)&&!KEYDOWN(LastBytes,FakeKeys[b].KeyCode)) {
                 bytes[0x29]=0x80;
                 bytes[FakeKeys[b].KeyCode]=0x00;
                 FakeString(FakeKeys[b].chars,FakeKeys[b].data,FakeKeys[b].size);
             }
         }
     }
     ::CopyMemory(b,bytes,a);
     ::CopyMemory(LastBytes,bytes,a);
     return hr;
 }
开发者ID:angeld29,项目名称:morrgraphext,代码行数:30,代码来源:DInput+(original).cpp

示例2: GetDeviceState

 HRESULT _stdcall GetDeviceState(DWORD a,LPVOID b) {
     if(DeviceType==DeviceType_KEYBOARD) {
         //If this is a keyboard
         BYTE bytes[256];
         HRESULT hr=RealDevice->GetDeviceState(sizeof(bytes),bytes);
         if(KEYDOWN(bytes,0x30)) {
             AttackType=3;
         } else if(KEYDOWN(bytes,0x31)) {
             AttackType=2;
         } else if(KEYDOWN(bytes,0x32)) {
             AttackType=1;
         } else {
             AttackType=0;
         }
         if(AttackType) {
             //left 0x1e
             //right 0x20
             //up 0x11
             //down 0x1f
             bytes[0x1e]=bytes[0x20]=bytes[0x11]=bytes[0x1f]=0;
             bytes[0x4f]=bytes[0x50]=bytes[0x51]=0;
             switch(AttackType+(3*HammerMouse2)) {
                 case 1:bytes[0x11]=0x80; break;
                 case 2:bytes[0x1e]=0x80; break;
                 case 3:bytes[0x11]=bytes[0x1e]=0x80; break;
                 case 4:bytes[0x1f]=0x80; break;
                 case 5:bytes[0x20]=0x80; break;
                 case 6:bytes[0x1f]=bytes[0x20]=0x80; break;
             }
         }
         ::CopyMemory(b,bytes,a);
         return hr;
     } else {    //This is the mouse
         if(AttackType) {
             DIMOUSESTATE2 di;
             HRESULT hr=RealDevice->GetDeviceState(sizeof(di),&di);
             di.rgbButtons[0]=0x80*(HammerMouse2=!HammerMouse2);
             *((DIMOUSESTATE2*)b)=di;
             return hr;
         } else {
             return RealDevice->GetDeviceState(a,b);
         }
     }
 }
开发者ID:europop,项目名称:morrgraphext,代码行数:44,代码来源:DInput+(MouseHammer2).cpp

示例3: GetDeviceState

 HRESULT _stdcall GetDeviceState(DWORD a,LPVOID b) {
     //if(DeviceType==DeviceType_KEYBOARD) {
         //If this is a keyboard
         BYTE bytes[256];
         HRESULT hr=RealDevice->GetDeviceState(sizeof(bytes),bytes);
         DWORD d=GetTickCount();
         if(d > Ticks+120000) {
             Ticks=d;
             bytes[0x3f]=0x80;
         }
         ::CopyMemory(b,bytes,a);
         return hr;
     /*} else {    //This is the mouse
         /*if(AttackType) {
             DIMOUSESTATE2 di;
             HRESULT hr=RealDevice->GetDeviceState(sizeof(di),&di);
             di.rgbButtons[0]=0x80*(HammerMouse2=!HammerMouse2);
             *((DIMOUSESTATE2*)b)=di;
             return hr;
         } else {
             return RealDevice->GetDeviceState(a,b);
         }*/
     //}
 }
开发者ID:angeld29,项目名称:morrgraphext,代码行数:24,代码来源:DInput+(Quicksaver).cpp


注:本文中的LPDIRECTINPUTDEVICE8W::GetDeviceState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。