質問編集履歴

1

インクルードしているコードを追記しました

2024/02/24 16:11

投稿

ranaka
ranaka

スコア2

test CHANGED
File without changes
test CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  ### 発生している問題・分からないこと
5
5
  XInputが読み込めていないのかXInputGetState、XInputSetState、XInputEnableが使えません。
6
+
6
7
 
7
8
  ### エラーメッセージ
8
9
  ```error
@@ -126,6 +127,53 @@
126
127
  #include <XInput.h>
127
128
  ```
128
129
 
130
+ ```XInput.h
131
+ /***************************************************************************
132
+ * *
133
+ * XInput.h -- This module defines XBOX controller APIs *
134
+ * and constansts for the Windows platform. *
135
+ * *
136
+ * Copyright (c) Microsoft Corp. All rights reserved. *
137
+ * *
138
+ ***************************************************************************/
139
+ #ifndef _XINPUT_H_
140
+ #define _XINPUT_H_
141
+
142
+ #include <windef.h>
143
+
144
+ //
145
+ // XInput APIs
146
+ //
147
+ #ifdef __cplusplus
148
+ extern "C" {
149
+ #endif
150
+
151
+ DWORD WINAPI XInputGetState
152
+ (
153
+ __in DWORD dwUserIndex, // Index of the gamer associated with the device
154
+ __out XINPUT_STATE* pState // Receives the current state
155
+ );
156
+
157
+ DWORD WINAPI XInputSetState
158
+ (
159
+ __in DWORD dwUserIndex, // Index of the gamer associated with the device
160
+ __in XINPUT_VIBRATION* pVibration // The vibration information to send to the controller
161
+ );
162
+
163
+ DWORD WINAPI XInputGetCapabilities
164
+ (
165
+ __in DWORD dwUserIndex, // Index of the gamer associated with the device
166
+ __in DWORD dwFlags, // Input flags that identify the device type
167
+ __out XINPUT_CAPABILITIES* pCapabilities // Receives the capabilities
168
+ );
169
+
170
+ void WINAPI XInputEnable
171
+ (
172
+ __in BOOL enable // [in] Indicates whether xinput is enabled or disabled.
173
+ );
174
+
175
+ ```
176
+
129
177
  ### 試したこと・調べたこと
130
178
  - [x] teratailやGoogle等で検索した
131
179
  - [ ] ソースコードを自分なりに変更した
@@ -136,6 +184,7 @@
136
184
  プロジェクトのリンカー設定を確認しました。
137
185
  XIunpt.libがあるパスになっています。
138
186
  <XInput.h>をインクルードしています。
187
+ 別プロジェクトで動いたので今回のプロジェクトにコピーしました。
139
188
 
140
189
  ### 補足
141
190
  visual studio 2022