C ++/Windows形式的Xinput/directinput [英] Xinput/directinput in c++/Windows forms

查看:245
本文介绍了C ++/Windows形式的Xinput/directinput的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人能帮我,我用c ++制作一个Windows窗体项目,我用OpenGL显示3d图形,我想添加一个游戏手柄来控制该程序,但是我找不到有关使用Xinput/直接输入的任何帮助在Windows窗体中使用c ++.

我也得到了一个非托管代码,我试图用#Pragmaunmanaged进行编译,但出现以下错误:

Hi, I hope someone can help me, Im making a Windows forms project in c++ Im displaying 3d Graphics with OpenGL and i want to add a gamepad to control the program, But I cant find any help on using Xinput/direct input in windows forms in c++.

also I got an unmanaged code which im trying to compile with #Pragmaunmanaged but I get the following errors:

>GamePadDInput.obj : error LNK2020: unresolved token (0A000039) IID_IDirectInputJoyConfig8
1>GamePadDInput.obj : error LNK2020: unresolved token (0A000050) IID_IDirectInput8W
1>GamePadDInput.obj : error LNK2001: unresolved external symbol _IID_IDirectInputJoyConfig8
1>GamePadDInput.obj : error LNK2001: unresolved external symbol _IID_IDirectInput8W
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_POV
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_Slider
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_RzAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_RyAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_RxAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_ZAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_YAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_XAxis

推荐答案

我的猜测是您使用的是2010年6月发布的最新DirectXSDK.DirectInput库已移出该版本的SDK. dinput8.lib的链接器错误是因为Microsoft不推荐使用DirectInput,并且正在将开发人员推向WM_INPUT和XInput的原始输入处理,以与XBox控制器一起使用.

我不知道使用Windows窗体进行处理将如何影响这一切,但是代码项目上有两篇不错的文章可以帮助您开始使用这两种输入形式:

XInput:
带有XInput的C ++中的Xbox 360控制器输入 [使用Raw Input API处理操纵杆输入 [
My guess is you are using the latest DirectX SDK that was released in June 2010. The DirectInput libraries have been moved out of this version of the SDK. Your linker errors for dinput8.lib are because Microsoft has deprecated DirectInput and is pushing developers towards Raw input handling with WM_INPUT and XInput for use with the XBox controller.

I do not know how processing working with Windows Forms would affect any of this, but there are two decent article here on code project to help you get started with both of these forms of input:

XInput:
Xbox 360 Controller Input in C++ with XInput[^]

Raw Input API:
Using the Raw Input API to Process Joystick Input[^]


这篇关于C ++/Windows形式的Xinput/directinput的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆