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


C++ LPDIRECTINPUTDEVICE8类代码示例

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


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

示例1: PsychHIDOSKbCheck

PsychError PsychHIDOSKbCheck(int deviceIndex, double* scanList)
{
    psych_uint8 keys[1024];
    LPDIRECTINPUTDEVICE8 kb;
    unsigned int i, j;
    double* buttonStates;
    int keysdown;
    double timestamp;
    DWORD cbSize;

    if (deviceIndex == INT_MAX) {
        deviceIndex = PsychHIDGetDefaultKbQueueDevice();
        // Ok, deviceIndex now contains our default keyboard to use - The first suitable keyboard.
    }

    if ((deviceIndex < 0) || (deviceIndex >= ndevices)) {
        // Out of range index:
        PsychErrorExitMsg(PsychError_user, "Invalid 'deviceIndex' specified. No such device!");
    }

    // Get DirectInput keyboard device:
    kb = GetXDevice(deviceIndex);

    // Keyboard queue for this deviceIndex already exists?
    if (NULL == psychHIDKbQueueFirstPress[deviceIndex]) {
        // No. Create one which accepts all keys:
        PsychHIDOSKbQueueCreate(deviceIndex, 0, NULL);
    }

    // Keyboard queue for this device active? If not, we need
    // to start it:
    if (!psychHIDKbQueueActive[deviceIndex]) {
        // Keyboard idle: Need to start it:
        PsychHIDOSKbQueueStart(deviceIndex);

        // Startup to first key delivery takes time. Wait for
        // 50 msecs to be on the safe side:
        PsychYieldIntervalSeconds(0.050);
    }

    // Size of state structure is device dependent:
    switch (info[deviceIndex].dwDevType & 0xff) {
    case DI8DEVTYPE_KEYBOARD:
        cbSize = 256;
        break;

    case DI8DEVTYPE_MOUSE:
    case DI8DEVTYPE_SCREENPOINTER:
        cbSize = sizeof(DIMOUSESTATE2);
        break;

    case DI8DEVTYPE_JOYSTICK:
        cbSize = sizeof(DIJOYSTATE2);
        break;

    default: // Unkown device. Fail.
        cbSize = 0;
    }


    // Query current state snapshot of keyboard:
    memset(keys, 0, sizeof(keys));
    if (DI_OK != kb->GetDeviceState(cbSize, (LPVOID) &keys[0])) {
        printf("PsychHID-ERROR: KbCheck for deviceIndex %i failed, because query of device failed!\n", deviceIndex);
        PsychErrorExitMsg(PsychError_user, "KbCheck failed!");
    }

    // Request current time of query:
    PsychGetAdjustedPrecisionTimerSeconds(&timestamp);

    // Reset overall key state to "none pressed":
    keysdown = 0;

    // Copy out timestamp:
    PsychCopyOutDoubleArg(2, kPsychArgOptional, timestamp);

    // Copy keyboard state:
    PsychAllocOutDoubleMatArg(3, kPsychArgOptional, 1, 256, 1, &buttonStates);
    for (i = 0; i < 256; i++) buttonStates[i] = 0;

    // Keyboard?
    if (cbSize == 256) {
        // Copy button state to output vector, apply scanlist mask, compute
        // resulting overall keysdown state. We ignore keyboard scancode zero and
        // start with 1 instead. We also ignore code 255. These are borderline codes
        // which may do weird things...
        for (i = 1; i < 255; i++) {
            // Compute target key slot for this scancode i:
            j = PsychHIDOSMapKey(i);

            // This key down?
            buttonStates[j] += (keys[i] > 0) ? 1 : 0;
            // Apply scanList mask, if any provided:
            if (scanList && (scanList[j] <= 0)) buttonStates[j] = 0;
            keysdown += (unsigned int) buttonStates[j];
        }
    }

    // Joystick?
    if (cbSize == sizeof(DIJOYSTATE2)) {
//.........这里部分代码省略.........
开发者ID:NxNiki,项目名称:Psychtoolbox-3,代码行数:101,代码来源:PsychHIDStandardInterfaces.cpp

示例2: PsychHIDOSKbQueueStop

void PsychHIDOSKbQueueStop(int deviceIndex)
{
    LPDIRECTINPUTDEVICE8 kb;
    psych_bool queueActive;
    int i;

    if (deviceIndex < 0) {
        deviceIndex = PsychHIDGetDefaultKbQueueDevice();
        // Ok, deviceIndex now contains our default keyboard to use - The first suitable keyboard.
    }

    if ((deviceIndex < 0) || (deviceIndex >= ndevices)) {
        // Out of range index:
        PsychErrorExitMsg(PsychError_user, "Invalid 'deviceIndex' specified. No such device!");
    }

    // Keyboard queue for this deviceIndex already exists?
    if (NULL == psychHIDKbQueueFirstPress[deviceIndex]) {
        // No. Nothing to do then.
        return;
    }

    // Keyboard queue already stopped?
    if (!psychHIDKbQueueActive[deviceIndex]) return;

    // Get device:
    kb = GetXDevice(deviceIndex);

    // Queue is active. Stop it:
    PsychLockMutex(&KbQueueMutex);

    // Release the device:
    if (DI_OK != kb->Unacquire()) {
        PsychUnlockMutex(&KbQueueMutex);
        printf("PsychHID-ERROR: Tried to stop processing on keyboard queue for deviceIndex %i, but releasing device failed!\n", deviceIndex);
        PsychErrorExitMsg(PsychError_user, "Stopping keyboard queue failed!");
    }

    // Disable state-change event notifications:
    if (DI_OK != kb->SetEventNotification(NULL)) {
        PsychUnlockMutex(&KbQueueMutex);
        printf("PsychHID-ERROR: Tried to stop processing on keyboard queue for deviceIndex %i, but disabling device state notifications failed!\n", deviceIndex);
        PsychErrorExitMsg(PsychError_user, "Stopping keyboard queue failed!");
    }

    // Mark queue logically stopped:
    psychHIDKbQueueActive[deviceIndex] = FALSE;

    PsychUnlockMutex(&KbQueueMutex);

    // Was this the last active queue?
    queueActive = FALSE;
    for (i = 0; i < PSYCH_HID_MAX_DEVICES; i++) {
        queueActive |= psychHIDKbQueueActive[i];
    }

    // If more queues are active then we're done:
    if (queueActive) return;

    // No more active queues. Shutdown the common processing thread:
    PsychLockMutex(&KbQueueMutex);

    KbQueueThreadTerminate = TRUE;

    // Done.
    PsychUnlockMutex(&KbQueueMutex);

    // Shutdown the thread, wait for its termination:
    PsychDeleteThread(&KbQueueThread);
    KbQueueThreadTerminate = FALSE;

    // printf("DEBUG: THREAD JOINED.\n"); fflush(NULL);

    return;
}
开发者ID:NxNiki,项目名称:Psychtoolbox-3,代码行数:75,代码来源:PsychHIDStandardInterfaces.cpp

示例3: Update

void CJoystick::Update()
{
  if (!IsEnabled())
    return;

  int buttonId    = -1;
  int axisId      = -1;
  int hatId       = -1;
  int numhat      = -1;
  int numj        = m_pJoysticks.size();
  if (numj <= 0)
    return;

  // go through all joysticks
  for (int j = 0; j<numj; j++)
  {
    LPDIRECTINPUTDEVICE8 pjoy = m_pJoysticks[j];
    HRESULT hr;
    DIJOYSTATE2 js;           // DInput joystick state

    m_NumAxes = (m_devCaps[j].dwAxes > MAX_AXES) ? MAX_AXES : m_devCaps[j].dwAxes;
    numhat    = (m_devCaps[j].dwPOVs > 4) ? 4 : m_devCaps[j].dwPOVs;

    hr = pjoy->Poll();
    if( FAILED( hr ) )
    {
      int i=0;
      // DInput is telling us that the input stream has been
      // interrupted. We aren't tracking any state between polls, so
      // we don't have any special reset that needs to be done. We
      // just re-acquire and try again.
      hr = pjoy->Acquire();
      while( (hr == DIERR_INPUTLOST) && (i++ < 10)  )
          hr = pjoy->Acquire();

      // hr may be DIERR_OTHERAPPHASPRIO or other errors.  This
      // may occur when the app is minimized or in the process of
      // switching, so just try again later
      return;
    }

    // Get the input's device state
    if( FAILED( hr = pjoy->GetDeviceState( sizeof( DIJOYSTATE2 ), &js ) ) )
      return; // The device should have been acquired during the Poll()

    // get button states first, they take priority over axis
    for( int b = 0; b < 128; b++ )
    {
      if( js.rgbButtons[b] & 0x80 )
      {
        m_JoyId = j;
        buttonId = b+1;
        j = numj-1;
        break;
      }
    }

    // get hat position
    m_HatState = SDL_HAT_CENTERED;
    for (int h = 0; h < numhat; h++)
    {
      if((LOWORD(js.rgdwPOV[h]) == 0xFFFF) != true)
      {
        m_JoyId = j;
        hatId = h + 1;
        j = numj-1;
        if ( (js.rgdwPOV[0] > JOY_POVLEFT) || (js.rgdwPOV[0] < JOY_POVRIGHT) )
          m_HatState |= SDL_HAT_UP;

        if ( (js.rgdwPOV[0] > JOY_POVFORWARD) && (js.rgdwPOV[0] < JOY_POVBACKWARD) )
          m_HatState |= SDL_HAT_RIGHT;

        if ( (js.rgdwPOV[0] > JOY_POVRIGHT) && (js.rgdwPOV[0] < JOY_POVLEFT) )
          m_HatState |= SDL_HAT_DOWN;

        if ( js.rgdwPOV[0] > JOY_POVBACKWARD )
          m_HatState |= SDL_HAT_LEFT;
        break;
      }
    }

    // get axis states
    m_Amount[0] = 0;
    m_Amount[1] = js.lX;
    m_Amount[2] = js.lY;
    m_Amount[3] = js.lZ;
    m_Amount[4] = js.lRx;
    m_Amount[5] = js.lRy;
    m_Amount[6] = js.lRz;

    m_AxisId = GetAxisWithMaxAmount();
    if (m_AxisId)
    {
      m_JoyId = j;
      j = numj-1;
      break;
    }
  }

  if(hatId==-1)
//.........这里部分代码省略.........
开发者ID:7orlum,项目名称:xbmc,代码行数:101,代码来源:WINJoystick.cpp

示例4: ConvertACPToUTF8

bool DIDevice::Open()
{
	m_sName = ConvertACPToUTF8( JoystickInst.tszProductName );

	LOG->Trace( "Opening device '%s'", m_sName.c_str() );
	buffered = true;

	LPDIRECTINPUTDEVICE8 tmpdevice;

	// load joystick
	HRESULT hr = g_dinput->CreateDevice( JoystickInst.guidInstance, &tmpdevice, NULL );
	if ( hr != DI_OK )
	{
		LOG->Info( hr_ssprintf(hr, "OpenDevice: IDirectInput_CreateDevice") );
		return false;
	}
	hr = tmpdevice->QueryInterface( IID_IDirectInputDevice8, (LPVOID *) &Device );
	tmpdevice->Release();
	if ( hr != DI_OK )
	{
		LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice::QueryInterface", m_sName.c_str()) );
		return false;
	}

	int coop = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
	if( type == KEYBOARD )
		coop = DISCL_NONEXCLUSIVE | DISCL_FOREGROUND;

	hr = Device->SetCooperativeLevel( GraphicsWindow::GetHwnd(), coop );
	if ( hr != DI_OK )
	{
		LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetCooperativeLevel", m_sName.c_str()) );
		return false;
	}

	switch(type)
	{
		case KEYBOARD:
			hr = Device->SetDataFormat( &c_dfDIKeyboard );
			break;
		case JOYSTICK:
			hr = Device->SetDataFormat( &c_dfDIJoystick );
			break;
		case MOUSE:
			hr = Device->SetDataFormat( &c_dfDIMouse );
			break;
	}
	if ( hr != DI_OK )
	{
		LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetDataFormat", m_sName.c_str()) );
		return false;
	}

	switch( type )
	{
		case JOYSTICK:
			Device->EnumObjects( DIJoystick_EnumDevObjectsProc, this, DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV);
			break;
		case KEYBOARD:
			// Always 256-button.
			for( int b = 0; b < 256; ++b )
			{
				input_t in;
				in.type = in.KEY;

				in.num = ConvertScancodeToKey(b);
				in.ofs = b;
				buttons++;
				Inputs.push_back(in);
			}
			break;
		case MOUSE:
			Device->EnumObjects( DIMouse_EnumDevObjectsProc, this, DIDFT_BUTTON | DIDFT_AXIS | DIDFT_ANYINSTANCE );
			break;
	}

	{
		DIPROPDWORD dipdw;
		memset(&dipdw, 0, sizeof(dipdw));
		dipdw.diph.dwSize = sizeof(dipdw);
		dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
		dipdw.diph.dwObj = 0;
		dipdw.diph.dwHow = DIPH_DEVICE;
		dipdw.dwData = INPUT_QSIZE;
		hr = Device->SetProperty( DIPROP_BUFFERSIZE, &dipdw.diph );
		if ( hr == DI_POLLEDDEVICE )
		{
			/* This device doesn't support buffering, so we're forced
			 * to use less reliable polling. */
			buffered = false;
		}
		else if ( hr != DI_OK )
		{
			LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetProperty", m_sName.c_str()) );
			return false;
		}
	}

	return true;
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:100,代码来源:InputHandler_DirectInputHelper.cpp

示例5: GetDIAxisRange

//=======================================================================
// get range for an axis
static HRESULT	GetDIAxisRange(LPDIRECTINPUTDEVICE8 device, uint offset, DWORD type, sint &min, sint &max)
{
	DIPROPRANGE diprg;
    diprg.diph.dwSize       = sizeof(DIPROPRANGE);
    diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
    diprg.diph.dwHow        = DIPH_BYOFFSET;
    diprg.diph.dwObj        = offset;

	// Set the range for the axis
	HRESULT r = device->GetProperty(DIPROP_RANGE, &diprg.diph);

	if (r == DIERR_OBJECTNOTFOUND)
	{
		// try from its ID
		diprg.diph.dwHow        = DIPH_BYID;
		diprg.diph.dwObj        = type;

		// Set the range for the axis
		HRESULT r = device->GetProperty(DIPROP_RANGE, &diprg.diph);
		if (r !=  DI_OK)
		{
			// setup default values ...
			min = 0;
			max = 65535;
			return r;
		}
	}
	else if (r != DI_OK)
	{
		min = 0;
		max = 65535;
		return r;
	}


/*	switch (r)
	{
		default:
			nlinfo("ok");
		break;
		case DIERR_INVALIDPARAM:
			nlinfo("invalid param");
		break;
		case DIERR_NOTEXCLUSIVEACQUIRED:
			nlinfo("DIERR_NOTEXCLUSIVEACQUIRED");
		break;
		case DIERR_NOTINITIALIZED:
			nlinfo("DIERR_NOTINITIALIZED");
		break;
		case DIERR_OBJECTNOTFOUND:
			nlinfo("DIERR_OBJECTNOTFOUND");
		break;
		case DIERR_UNSUPPORTED:
			nlinfo("DIERR_UNSUPPORTED");
		break;
	}*/


	min = (sint) diprg.lMin;
	max = (sint) diprg.lMax;

	return r;
}
开发者ID:mixxit,项目名称:solinia,代码行数:65,代码来源:di_game_device.cpp

示例6: Game_Init

int Game_Init(void *parms,  int num_parms)
{
// this function is where you do all the initialization 
// for your game

int index;         // looping var
char filename[80]; // used to build up files names

// initialize directdraw
DDraw_Init(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);

// first create the direct input object
DirectInput8Create(main_instance,DIRECTINPUT_VERSION,IID_IDirectInput8, (void **)&lpdi,NULL);

// create a mouse device  /////////////////////////////////////
lpdi->CreateDevice(GUID_SysMouse, &lpdimouse, NULL);

// set cooperation level
lpdimouse->SetCooperativeLevel(main_window_handle, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);

// set data format
lpdimouse->SetDataFormat(&c_dfDIMouse);

// acquire the mouse
lpdimouse->Acquire();

/////////////////////////////////////////////////////////////////

// set the global mouse position
mouse_x = screen_height/2;
mouse_y = screen_height/2;

// load the master bitmap in with all the graphics
Load_Bitmap_File(&bitmap8bit, "PAINT.BMP");
Set_Palette(bitmap8bit.palette);

// make sure all the surfaces are clean before starting
DDraw_Fill_Surface(lpddsback, 0);
DDraw_Fill_Surface(lpddsprimary, 0);

// create the pointer bob
Create_BOB(&pointer,mouse_x,mouse_y,32,34,1,
           BOB_ATTR_VISIBLE | BOB_ATTR_SINGLE_FRAME,DDSCAPS_SYSTEMMEMORY);    

// load the image for the pointer in
Load_Frame_BOB(&pointer,&bitmap8bit,0,0,2,BITMAP_EXTRACT_MODE_CELL);  

// create the button bob
Create_BOB(&buttons,0,0,32,34,8,
           BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_FRAME,DDSCAPS_SYSTEMMEMORY);    

// load buttons in, two banks of 4, all the off's, then all the on's
for (index=0; index<8; index++)
     Load_Frame_BOB(&buttons,&bitmap8bit,index, index%4,index/4,BITMAP_EXTRACT_MODE_CELL);  

// create the bitmap to hold the control panel
Create_Bitmap(&cpanel,500,0,104,424);
Load_Image_Bitmap(&cpanel, &bitmap8bit,150,0,BITMAP_EXTRACT_MODE_ABS);

// create the drawing canvas bitmap
Create_Bitmap(&canvas,0,0,500,SCREEN_HEIGHT);
memset(canvas.buffer,0,canvas.width*canvas.height);
canvas.attr = BITMAP_ATTR_LOADED;

// clear out the canvas
// memset(canvas.buffer,0,canvas.width*canvas.height);

// set clipping rectangle to screen extents so mouse cursor
// doens't mess up at edges
RECT screen_rect = {0,0,screen_width,screen_height};
lpddclipper = DDraw_Attach_Clipper(lpddsback,1,&screen_rect);

// hide the mouse
ShowCursor(FALSE);

// return success
return(1);

} // end Game_Init
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:79,代码来源:demo9_2.cpp

示例7: InitForceFeedback

    HRESULT InitForceFeedback()
    {

        HRESULT hr;
        DWORD rgdwAxes[2] = { DIJOFS_X, DIJOFS_Y };
        LONG rglDirection[2] = { 0, 0 };

        if (FAILED(hr = g_pJoystick->SetCooperativeLevel(GetActiveWindow(), DISCL_EXCLUSIVE | DISCL_BACKGROUND)))
            return hr;

        if (FAILED(hr = g_pJoystick->Acquire()))
            return hr;

        // Autocenter
        ZeroMemory(&g_sAutoCenterConfig, sizeof(g_sAutoCenterConfig));

        g_sAutoCenterConfig.dwStartDelay = 0;

        g_sAutoCenterConfig.dwSize = sizeof(DIEFFECT);
        g_sAutoCenterConfig.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
        g_sAutoCenterConfig.dwDuration = INFINITE;
        g_sAutoCenterConfig.dwSamplePeriod = 0;
        g_sAutoCenterConfig.dwGain = DI_FFNOMINALMAX;
        g_sAutoCenterConfig.dwTriggerButton = DIEB_NOTRIGGER;
        g_sAutoCenterConfig.dwTriggerRepeatInterval = 0;
        g_sAutoCenterConfig.cAxes = 1;
        g_sAutoCenterConfig.rgdwAxes = rgdwAxes;
        g_sAutoCenterConfig.rglDirection = rglDirection;

        g_sAutoCenterConfig.lpEnvelope = 0;
        g_sAutoCenterConfig.dwStartDelay = 0;

        DICONSTANTFORCE cf = { 0 };

        g_sAutoCenterConfig.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
        g_sAutoCenterConfig.lpvTypeSpecificParams = &cf;

        if (FAILED(hr = g_pJoystick->CreateEffect(GUID_ConstantForce, &g_sAutoCenterConfig, &g_pAutoCenterHandle, nullptr)))
            return hr;

        if (FAILED(hr = g_pAutoCenterHandle->Start(INFINITE, 0)))
            return hr;

        // Rumble
        ZeroMemory(&g_sWheelRumbleConfig, sizeof(g_sWheelRumbleConfig));

        g_sWheelRumbleConfig.dwStartDelay = 0;

        g_sWheelRumbleConfig.dwSize = sizeof(DIEFFECT);
        g_sWheelRumbleConfig.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
        g_sWheelRumbleConfig.dwDuration = INFINITE;
        g_sWheelRumbleConfig.dwSamplePeriod = 0;
        g_sWheelRumbleConfig.dwGain = DI_FFNOMINALMAX;
        g_sWheelRumbleConfig.dwTriggerButton = DIEB_NOTRIGGER;
        g_sWheelRumbleConfig.dwTriggerRepeatInterval = 0;
        g_sWheelRumbleConfig.cAxes = 1;
        g_sWheelRumbleConfig.rgdwAxes = rgdwAxes;
        g_sWheelRumbleConfig.rglDirection = rglDirection;

        g_sWheelRumbleConfig.lpEnvelope = 0;
        g_sWheelRumbleConfig.dwStartDelay = 0;

        DIPERIODIC pf = { 0,0,0,0.08 };

        g_sWheelRumbleConfig.cbTypeSpecificParams = sizeof(DIPERIODIC);
        g_sWheelRumbleConfig.lpvTypeSpecificParams = &pf;

        if (FAILED(hr = g_pJoystick->CreateEffect(GUID_Sine, &g_sWheelRumbleConfig, &g_pWheelRumbleHandle, nullptr)))
            return hr;

        if (FAILED(hr = g_pWheelRumbleHandle->Start(INFINITE, 0)))
            return hr;

        return S_OK;
    }
开发者ID:Jinwei1,项目名称:AirSim,代码行数:75,代码来源:DirectInputJoyStick.cpp

示例8: DInput_Init_Joystick

int DInput_Init_Joystick(int min_x, int max_x, int min_y, int max_y, int dead_zone)
{
// this function initializes the joystick, it allows you to set
// the minimum and maximum x-y ranges 

// first find the fucking GUID of your particular joystick
lpdi->EnumDevices(DI8DEVCLASS_GAMECTRL, 
                  DInput_Enum_Joysticks, 
                  &joystickGUID, 
                  DIEDFL_ATTACHEDONLY); 

// create a temporary IDIRECTINPUTDEVICE (1.0) interface, so we query for 2
LPDIRECTINPUTDEVICE lpdijoy_temp = NULL;

if (lpdi->CreateDevice(joystickGUID, &lpdijoy, NULL)!=DI_OK)
   return(0);

// set cooperation level
if (lpdijoy->SetCooperativeLevel(main_window_handle, 
	                 DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)!=DI_OK)
   return(0);

// set data format
if (lpdijoy->SetDataFormat(&c_dfDIJoystick)!=DI_OK)
   return(0);

// set the range of the joystick
DIPROPRANGE joy_axis_range;

// first x axis
joy_axis_range.lMin = min_x;
joy_axis_range.lMax = max_x;

joy_axis_range.diph.dwSize       = sizeof(DIPROPRANGE); 
joy_axis_range.diph.dwHeaderSize = sizeof(DIPROPHEADER); 
joy_axis_range.diph.dwObj        = DIJOFS_X;
joy_axis_range.diph.dwHow        = DIPH_BYOFFSET;

lpdijoy->SetProperty(DIPROP_RANGE,&joy_axis_range.diph);

// now y-axis
joy_axis_range.lMin = min_y;
joy_axis_range.lMax = max_y;

joy_axis_range.diph.dwSize       = sizeof(DIPROPRANGE); 
joy_axis_range.diph.dwHeaderSize = sizeof(DIPROPHEADER); 
joy_axis_range.diph.dwObj        = DIJOFS_Y;
joy_axis_range.diph.dwHow        = DIPH_BYOFFSET;

lpdijoy->SetProperty(DIPROP_RANGE,&joy_axis_range.diph);


// and now the dead band
DIPROPDWORD dead_band; // here's our property word

// scale dead zone by 100
dead_zone*=100;

dead_band.diph.dwSize       = sizeof(dead_band);
dead_band.diph.dwHeaderSize = sizeof(dead_band.diph);
dead_band.diph.dwObj        = DIJOFS_X;
dead_band.diph.dwHow        = DIPH_BYOFFSET;

// deadband will be used on both sides of the range +/-
dead_band.dwData            = dead_zone;

// finally set the property
lpdijoy->SetProperty(DIPROP_DEADZONE,&dead_band.diph);

dead_band.diph.dwSize       = sizeof(dead_band);
dead_band.diph.dwHeaderSize = sizeof(dead_band.diph);
dead_band.diph.dwObj        = DIJOFS_Y;
dead_band.diph.dwHow        = DIPH_BYOFFSET;

// deadband will be used on both sides of the range +/-
dead_band.dwData            = dead_zone;


// finally set the property
lpdijoy->SetProperty(DIPROP_DEADZONE,&dead_band.diph);

// acquire the joystick
if (lpdijoy->Acquire()!=DI_OK)
   return(0);

// set found flag
joystick_found = 1;

// return success
return(1);

} // end DInput_Init_Joystick
开发者ID:jinshizi,项目名称:rushcodes,代码行数:92,代码来源:t3dlib2.cpp

示例9: Game_Init

int Game_Init(void *parms,  int num_parms)
{
// this function is where you do all the initialization 
// for your game

int index;         // looping var
char filename[80]; // used to build up files names

// initialize directdraw
DDraw_Init(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);


#if 0 // directinput7 method

// first create the direct input object
if (DirectInputCreateEx(main_instance,DIRECTINPUT_VERSION,IID_IDirectInput7, (void **)&lpdi,NULL)!=DI_OK)
   return(0);

// create a keyboard device  //////////////////////////////////
if (lpdi->CreateDeviceEx(GUID_SysKeyboard, IID_IDirectInputDevice7, (void **)&lpdikey, NULL)!=DI_OK)
   return(0);

#endif


// first create the direct input object
if (DirectInput8Create(main_instance,DIRECTINPUT_VERSION,IID_IDirectInput8, (void **)&lpdi,NULL)!=DI_OK)
   return(0);

// create a keyboard device  //////////////////////////////////
if (lpdi->CreateDevice(GUID_SysKeyboard, &lpdikey, NULL)!=DI_OK)
   return(0);


// set cooperation level
if (lpdikey->SetCooperativeLevel(main_window_handle, 
                 DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)!=DI_OK)
    return(0);

// set data format
if (lpdikey->SetDataFormat(&c_dfDIKeyboard)!=DI_OK)
   return(0);

// acquire the keyboard
if (lpdikey->Acquire()!=DI_OK)
   return(0);

///////////////////////////////////////////////////////////

// load the background
Load_Bitmap_File(&bitmap8bit, "REACTOR.BMP");

// set the palette to background image palette
Set_Palette(bitmap8bit.palette);

// create and load the reactor bitmap image
Create_Bitmap(&reactor, 0,0, 640, 480);
Load_Image_Bitmap(&reactor,&bitmap8bit,0,0,BITMAP_EXTRACT_MODE_ABS);
Unload_Bitmap_File(&bitmap8bit);

// now let's load in all the frames for the skelaton!!!

// create skelaton bob
if (!Create_BOB(&skelaton,0,0,56,72,32,
           BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_ANIM,DDSCAPS_SYSTEMMEMORY))
   return(0);

// load the frames in 8 directions, 4 frames each
// each set of frames has a walk and a fire, frame sets
// are loaded in counter clockwise order looking down
// from a birds eys view or the x-z plane
for (int direction = 0; direction < 8; direction++)
    { 
    // build up file name
    sprintf(filename,"SKELSP%d.BMP",direction);

    // load in new bitmap file
    Load_Bitmap_File(&bitmap8bit,filename);
 
    Load_Frame_BOB(&skelaton,&bitmap8bit,0+direction*4,0,0,BITMAP_EXTRACT_MODE_CELL);  
    Load_Frame_BOB(&skelaton,&bitmap8bit,1+direction*4,1,0,BITMAP_EXTRACT_MODE_CELL);  
    Load_Frame_BOB(&skelaton,&bitmap8bit,2+direction*4,2,0,BITMAP_EXTRACT_MODE_CELL);  
    Load_Frame_BOB(&skelaton,&bitmap8bit,3+direction*4,0,1,BITMAP_EXTRACT_MODE_CELL);  

    // unload the bitmap file
    Unload_Bitmap_File(&bitmap8bit);

    // set the animation sequences for skelaton
    Load_Animation_BOB(&skelaton,direction,4,skelaton_anims[direction]);

    } // end for direction

// set up stating state of skelaton
Set_Animation_BOB(&skelaton, 0);
Set_Anim_Speed_BOB(&skelaton, 4);
Set_Vel_BOB(&skelaton, 0,0);
Set_Pos_BOB(&skelaton, 0, 128);

// set clipping rectangle to screen extents so mouse cursor
// doens't mess up at edges
//.........这里部分代码省略.........
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:101,代码来源:demo9_1.cpp

示例10: CatchAll

//	this will catch all input keyboard and mouse
//	i may try to make a thread which continuously catches input
void TSRInputSubSystem::CatchAll()
{
#if defined( PLATFORM_MACOSX ) || defined( WIN32 )|| defined( WIN64 )
#if defined( WIN32 )|| defined( WIN64 ) 

	//	this will hold mouse state and position, global for external use
	DIMOUSESTATE		dInputMouseState;

	if ( FAILED( m_lpdimouse->GetDeviceState( sizeof( DIMOUSESTATE ), ( LPVOID ) &dInputMouseState ) ) )
	{
        TSRFatalError( "Error reading mouse" );
    }

	Mouse()->m_DeltaZ = dInputMouseState.lZ;

#endif
    
	int iMouseX = 0;
	int iMouseY = 0;
	bool bLButtonPrevious = Mouse()->m_bLButtonDown;

#ifdef TSR_SDL_ENABLED

	uint8 sdlMouseButtons = SDL_GetMouseState( &iMouseX, &iMouseY ); 
	iMouseY = TSRSystem()->m_DisplayMode.m_uiHeight - iMouseY;

	//	update mouse buttons states
	Mouse()->m_bLButtonDown = ( sdlMouseButtons & SDL_BUTTON( 1 ) ) != 0;
	Mouse()->m_bRButtonDown = ( sdlMouseButtons & SDL_BUTTON( 3 ) ) != 0;
	Mouse()->m_bMButtonDown = ( sdlMouseButtons & SDL_BUTTON( 2 ) ) != 0;

	SDL_GetRelativeMouseState( &Mouse()->m_DeltaX, &Mouse()->m_DeltaY );

#endif

#if defined( WIN32 )|| defined( WIN64 )

	//Mouse()->UpdateLocation( iMouseX, iMouseY );

	Mouse()->m_bLButtonDown = dInputMouseState.rgbButtons[ 0 ] != 0;
	Mouse()->m_bRButtonDown = dInputMouseState.rgbButtons[ 1 ] != 0;
	Mouse()->m_bMButtonDown = dInputMouseState.rgbButtons[ 2 ] != 0;

	Mouse()->m_DeltaX = dInputMouseState.lX;
	Mouse()->m_DeltaY = dInputMouseState.lY;

#endif

	if ( Mouse()->m_bLButtonDown && ( Mouse()->m_DeltaX || Mouse()->m_DeltaY ) )
	{
		TSRSystem()->GetCallBacks()->OnTouchDelta( ( float ) Mouse()->m_DeltaX, ( float ) Mouse()->m_DeltaY, 3 );
	}
	
	if ( Mouse()->m_bLButtonDown && !bLButtonPrevious )
	{
		TSRSystem()->GetCallBacks()->OnTouchEvent( iMouseX, iMouseY, 0 );
	}

	if ( !Mouse()->m_bLButtonDown && bLButtonPrevious )
	{
		TSRSystem()->GetCallBacks()->OnTouchEvent( iMouseX, iMouseY, 1 );
	}

#endif 
}
开发者ID:ShadyEM,项目名称:Twister3D,代码行数:67,代码来源:TSRInputSubSystem.cpp

示例11: INPMouseUpdate

/////////////////////////////////////
// Name:	INPMouseUpdate
// Purpose:	update mouse device, we
//			require hMain to get the
//			actual location of the mouse
//			(this is not used in
//			 exclusive mode)
// Output:	mouse updated
// Return:	
/////////////////////////////////////
s32 F_API INPMouseUpdate(void *hMain)
{
	if(!g_pDMouse)
		return RETCODE_SUCCESS;

	u8 i;
	DIMOUSESTATE2 mouseDat={0};

	//update released buttons
	for(i = 0; i < MAXMOUSEBTN; i++)
	{
		if(g_mouseBtn[i] == INPUT_RELEASED)
			g_mouseBtn[i] = INPUT_UP;
	}

	HRESULT hr;

	hr = g_pDMouse->Poll();

	if(FAILED(hr))
	{
		// DInput is telling us that the input stream has been
        // interrupted. We aren't tracking any state between polls, so
        // we don't have any special reset that needs to be done. We
        // just re-acquire and try again.
        hr = g_pDMouse->Acquire();
        while( hr == DIERR_INPUTLOST ) 
            hr = g_pDMouse->Acquire();

        // hr may be DIERR_OTHERAPPHASPRIO or other errors.  This
        // may occur when the app is minimized or in the process of 
        // switching, so just try again later 
        return RETCODE_SUCCESS; 
	}

	// Get the input's device state
    if(FAILED(hr = g_pDMouse->GetDeviceState(sizeof(DIMOUSESTATE2), &mouseDat)))
	{ DInputError(hr, L"INPMouseUpdate"); return RETCODE_FAILURE; }

	//check the buttons
	for(i = 0; i < MAXMOUSEBTN; i++)
    {
		if(mouseDat.rgbButtons[i] & INPUT_DOWN)
			g_mouseBtn[i] = INPUT_DOWN;
		else if(g_mouseBtn[i] == INPUT_DOWN)
			g_mouseBtn[i] = INPUT_RELEASED;
	}

	//check location
	if(!g_bExclusive)
	{
		GetCursorPos((LPPOINT)&g_mouseLoc);
		ScreenToClient((HWND)hMain, (LPPOINT)&g_mouseLoc);
	}
	else
	{
		g_mouseLoc.x += mouseDat.lX;

		if(g_mouseLoc.x < 0) g_mouseLoc.x = 0;
		else if(g_mouseLoc.x > g_bound.x) g_mouseLoc.x = g_bound.x;

		g_mouseLoc.y += mouseDat.lY;

		if(g_mouseLoc.y < 0) g_mouseLoc.y = 0;
		else if(g_mouseLoc.y > g_bound.y) g_mouseLoc.y = g_bound.y;
	}

	g_mouseRelX = mouseDat.lX;
	g_mouseRelY = mouseDat.lY;
	g_mouseRelZ = mouseDat.lZ;

	return RETCODE_SUCCESS;
}
开发者ID:ddionisio,项目名称:Mahatta,代码行数:83,代码来源:inputdx8_mouse.cpp

示例12: InitMouse

//=============================================================================
// マウスの初期化
//=============================================================================
HRESULT InitMouse(HINSTANCE hInstance, HWND hWnd)
{
	HRESULT hr;

	// 入力処理の初期化
	hr = InitInput(hInstance, hWnd);
	if(FAILED(hr))
	{
		MessageBox(hWnd, "DirectInputオブジェクトが作れねぇ!", "警告!", MB_ICONWARNING);
		return hr;
	}

	// デバイスオブジェクトを作成
	hr = g_pInput->CreateDevice(GUID_SysMouse, &g_pDevMouse, NULL);
	if(FAILED(hr))
	{
		MessageBox(hWnd, "マウスがねぇ!", "警告!", MB_ICONWARNING);
		return hr;
	}

	// データフォーマットを設定
	hr = g_pDevMouse->SetDataFormat(&c_dfDIMouse2);
	if(FAILED(hr))
	{
		MessageBox(hWnd, "マウスのデータフォーマットを設定できませんでした。", "警告!", MB_ICONWARNING);
		return hr;
	}

	// 協調モードを設定(フォアグラウンド&非排他モード)
	hr = g_pDevMouse->SetCooperativeLevel(hWnd, (DISCL_FOREGROUND | DISCL_NONEXCLUSIVE));
	if(FAILED(hr))
	{
		MessageBox(hWnd, "マウスの協調モードを設定できませんでした。", "警告!", MB_ICONWARNING);
		return hr;
	}

	// デバイスのプロパティを設定
	{
		DIPROPDWORD dipdw;

		dipdw.diph.dwSize = sizeof(dipdw);
		dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
		dipdw.diph.dwObj = 0;
		dipdw.diph.dwHow = DIPH_DEVICE;
		dipdw.dwData = DIPROPAXISMODE_REL;

		hr = g_pDevMouse->SetProperty(DIPROP_AXISMODE, &dipdw.diph);
		if(FAILED(hr))
		{
			MessageBox(hWnd, "マウスのデバイスのプロパティを設定できませんでした。", "警告!", MB_ICONWARNING);
			return hr;
		}
	}

	// マウスへのアクセス権を獲得(入力制御開始)
	g_pDevMouse->Acquire();

	//初期化
	ZeroMemory(&g_mouseState, sizeof DIMOUSESTATE2);
	ZeroMemory(&g_mouseStateTrigger, sizeof DIMOUSESTATE2);

	return S_OK;
}
开发者ID:minamiliu,项目名称:Time_To_Shoot,代码行数:66,代码来源:input.cpp

示例13: ReadJoystick

bool ReadJoystick(F32 axes[MaxJoystickAxes], U32 &buttonMask, U32 &hatMask)
{
    // mark: it's ok
    // mark: it's called "winJoystick"
    // mark: it's supposed to be gross.

    DIJOYSTATE2 js;       // DInput joystick state

    if(!gJoystick)
        return false;

    if(FAILED(gJoystick->Poll() ) )
    {
        HRESULT hr;
        hr = gJoystick->Acquire();

        while( hr == DIERR_INPUTLOST )
            hr = gJoystick->Acquire();
        return false;
    }

    // Get the input's device state
    if(FAILED(gJoystick->GetDeviceState( sizeof(DIJOYSTATE2), &js ) ) )
        return false; // The device should have been acquired during the Poll()

    F32 scale = 1 / 32768.0f;
    axes[0] = (F32(js.lX) - 32768.0f) * scale;
    axes[1] = (F32(js.lY) - 32768.0f) * scale;
    axes[2] = (F32(js.lZ) - 32768.0f) * scale;
    axes[3] = (F32(js.lRx) - 32768.0f) * scale;
    axes[4] = (F32(js.lRy) - 32768.0f) * scale;
    axes[5] = (F32(js.lRz) - 32768.0f) * scale;
    axes[6] = (F32(js.rglSlider[0]) - 32768.0f) * scale;
    axes[7] = (F32(js.rglSlider[1]) - 32768.0f) * scale;
    axes[8] = 0;
    axes[9] = 0;
    axes[10] = 0;
    axes[11] = 0;

    // check the state of the buttons:
    buttonMask = 0;
    U32 pov = js.rgdwPOV[0];

    for( U32 i = 0; i < 12; i++ )
        if((js.rgbButtons[i] & 0x80) != 0)
            buttonMask |= BIT(i);

    switch(pov)
    {
    case 0:
        hatMask |= ControllerButtonDPadUp;
        break;
    case 4500:
        hatMask |= ControllerButtonDPadUp | ControllerButtonDPadRight;
        break;
    case 9000:
        hatMask |= ControllerButtonDPadRight;
        break;
    case 13500:
        hatMask |= ControllerButtonDPadRight | ControllerButtonDPadDown;
        break;
    case 18000:
        hatMask |= ControllerButtonDPadDown;
        break;
    case 22500:
        hatMask |= ControllerButtonDPadDown | ControllerButtonDPadLeft;
        break;
    case 27000:
        hatMask |= ControllerButtonDPadLeft;
        break;
    case 31500:
        hatMask |= ControllerButtonDPadLeft | ControllerButtonDPadUp;
        break;
    }
    return true;
}
开发者ID:nardo,项目名称:torque_network_library_1_5,代码行数:76,代码来源:winJoystick.cpp

示例14: Game_Main

int Game_Main(void *parms, int num_parms)
{
// this is the workhorse of your game it will be called
// continuously in real-time this is like main() in C
// all the calls for you game go here!

int index; // looping var


// check of user is trying to exit
if (KEY_DOWN(VK_ESCAPE) || KEY_DOWN(VK_SPACE))
    PostMessage(main_window_handle, WM_DESTROY,0,0);

// start the timing clock
Start_Clock();

// clear the drawing surface
DDraw_Fill_Surface(lpddsback, 0);

// get the input from the mouse
lpdimouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mouse_state);

// move the mouse cursor
mouse_x+=(mouse_state.lX);
mouse_y+=(mouse_state.lY);

// test bounds

// first x boundaries
if (mouse_x >= screen_width)
   mouse_x = screen_width-1;
else
if (mouse_x < 0)
   mouse_x = 0;

// now the y boundaries
if (mouse_y >= screen_height)
   mouse_y= screen_height-1;
else
if (mouse_y < 0)
   mouse_y = 0;

// position the pointer bob to the mouse coords
pointer.x = mouse_x - 16;
pointer.y = mouse_y - 16;

// test what the user is doing with the mouse
if ((mouse_x > 3) && (mouse_x < 500-3) && 
    (mouse_y > 3) && (mouse_y < SCREEN_HEIGHT-3))
   {
   // mouse is within canvas region

   // if left button is down then draw
   if (mouse_state.rgbButtons[0])
      {
      // test drawing mode
      if (buttons_state[BUTTON_PENCIL])
         {
         // draw a pixel 
         Draw_Pixel(mouse_x, mouse_y, mouse_color, canvas.buffer, canvas.width);
         Draw_Pixel(mouse_x+1, mouse_y, mouse_color, canvas.buffer, canvas.width);
         Draw_Pixel(mouse_x, mouse_y+1, mouse_color, canvas.buffer, canvas.width);
         Draw_Pixel(mouse_x+1, mouse_y+1, mouse_color, canvas.buffer, canvas.width);
         }
      else
         {
         // draw spray
         for (index=0; index<10; index++)
             {
             // get next particle
             int sx=mouse_x-8+rand()%16;
             int sy=mouse_y-8+rand()%16;
            
             // make sure particle is in bounds
             if (sx > 0 && sx < 500 && sy > 0 && sy < screen_height)
                Draw_Pixel(sx, sy, mouse_color, canvas.buffer, canvas.width);
             } // end for index

         } // end else

      } // end if left button
    else // right button is eraser
    if (mouse_state.rgbButtons[1])
       {
       // test drawing mode
       if (buttons_state[BUTTON_PENCIL]) 
          {
          // erase a pixel 
          Draw_Pixel(mouse_x, mouse_y, 0, canvas.buffer, canvas.width);
          Draw_Pixel(mouse_x+1, mouse_y, 0, canvas.buffer, canvas.width);
          Draw_Pixel(mouse_x, mouse_y+1, 0, canvas.buffer, canvas.width);
          Draw_Pixel(mouse_x+1, mouse_y+1, 0, canvas.buffer, canvas.width);
          } // end if
       else
          {
          // erase spray
          for (index=0; index<20; index++)
              {
              // get next particle
              int sx=mouse_x-8+rand()%16;
//.........这里部分代码省略.........
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:101,代码来源:demo9_2.cpp

示例15: OnLeftButtonDown

//-----------------------------------------------------------------------------
// Name: OnLeftButtonDown()
// Desc: If we are drawing a curve, then read buffered data and draw
//      lines from point to point.  By reading buffered data, we can
//      track the motion of the mouse accurately without coalescing.
//
//      This function illustrates how a non-message-based program can
//      process buffered data directly from a device, processing
//      messages only occasionally (as required by Windows).
//
//      This function also illustrates how an application can piece
//      together buffered data elements based on the sequence number.
//      A single mouse action (e.g., moving diagonally) is reported
//      as a series of events, all with the same sequence number.
//      Zero is never a valid DirectInput sequence number, so it is
//      safe to use it as a sentinel value.
//-----------------------------------------------------------------------------
VOID OnLeftButtonDown( HWND hWnd )
{
    HRESULT             hr;
    LEFTBUTTONINFO      lbInfo;
    BOOL                bDone;
    DIDEVICEOBJECTDATA  od;
    DWORD               dwElements;
    MSG                 msg;

    // For performance, draw directly onto the window's DC instead of
    // invalidating and waiting for the WM_PAINT message.  Of course,
    // we always draw onto our bitmap, too, since that's what really
    // counts.

    // hide cursor and initialize button info with cursor position
    StartPenDraw( hWnd, &lbInfo );
    InvalidateCursorRect( hWnd );
    UpdateWindow( hWnd );

    // Keep reading data elements until we see a "mouse button up" event.
    bDone = FALSE;
    while( !bDone ) 
    {
        dwElements = 1;
        hr = g_pMouse->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), 
                                      &od, &dwElements, 0 );
        if( FAILED(hr) )       
            break;

        // If theres no data available, finish the element 
        // we have been collecting, and then process our message 
        // queue so the system doesn't think the app has hung.
        if( dwElements == 0 ) 
        {
            // if there is a partial motion, flush it out 
            OnLeftButtonDown_FlushMotion( &lbInfo );

            while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) 
            {
                // If it's a quit message, we're outta here 
                if( msg.message == WM_QUIT ) 
                {
                    // Re-post the quit message so the
                    // outer loop will see it and exit.
                    PostQuitMessage( (int)msg.wParam );
                    bDone = TRUE;                    
                    break;
                } 
                else 
                {
                    TranslateMessage( &msg );
                    DispatchMessage( &msg );
                }
            }
            continue;
        }

        // If this is the start of a new event, flush out the old one 
        if( od.dwSequence != lbInfo.dwSeqLastSeen ) 
        {
            OnLeftButtonDown_FlushMotion( &lbInfo );
            lbInfo.dwSeqLastSeen = od.dwSequence;
        }

        // Look at the element to see what happened 
        switch( od.dwOfs ) 
        {
            case DIMOFS_X:      // Mouse horizontal motion 
                UpdateCursorPosition( od.dwData, 0 );
                lbInfo.bMoved = TRUE;
                break;

            case DIMOFS_Y:      // Mouse vertical motion 
                UpdateCursorPosition( 0, od.dwData );
                lbInfo.bMoved = TRUE;
                break;

            case DIMOFS_BUTTON0: // Button 0 pressed or released 
            case DIMOFS_BUTTON1: // Button 1 pressed or released 
                if( ( g_bSwapMouseButtons  && DIMOFS_BUTTON1 == od.dwOfs ) ||
                    ( !g_bSwapMouseButtons && DIMOFS_BUTTON0 == od.dwOfs ) )
                {
                    if( !(od.dwData & 0x80) ) 
//.........这里部分代码省略.........
开发者ID:grakidov,项目名称:Render3D,代码行数:101,代码来源:scrawl.cpp


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