Skip to content

Commit 04a7113

Browse files
committed
完了, 有bug
1 parent 009a0ab commit 04a7113

File tree

15 files changed

+1366
-1214
lines changed

15 files changed

+1366
-1214
lines changed

GamepadPlusGUI/GamepadPlusGUI.pro.user

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE QtCreatorProject>
3-
<!-- Written by QtCreator 4.11.0, 2020-12-20T21:44:11. -->
3+
<!-- Written by QtCreator 4.11.0, 2020-12-23T13:53:50. -->
44
<qtcreator>
55
<data>
66
<variable>EnvironmentId</variable>
@@ -67,7 +67,7 @@
6767
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.9.9 MSVC2017 64bit</value>
6868
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.9.9 MSVC2017 64bit</value>
6969
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.599.win64_msvc2017_64_kit</value>
70-
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
70+
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
7171
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
7272
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
7373
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
@@ -119,7 +119,7 @@
119119
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
120120
</valuemap>
121121
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
122-
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/GitHub/GamepadPlusGUI/debug</value>
122+
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/GitHub/GamepadPlus/withGUI/GamepadPlus/build-GamepadPlusGUI-Desktop_Qt_5_9_9_MSVC2017_64bit-Debug</value>
123123
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
124124
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
125125
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -287,9 +287,8 @@
287287
</valuelist>
288288
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
289289
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
290-
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">GamepadPlusGUI2</value>
291-
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/GitHub/GamepadPlusGUI/GamepadPlusGUI/GamepadPlusGUI.pro</value>
292-
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/GitHub/GamepadPlusGUI/GamepadPlusGUI/GamepadPlusGUI.pro</value>
290+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/GitHub/GamepadPlus/withGUI/GamepadPlus/GamepadPlusGUI/GamepadPlusGUI.pro</value>
291+
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/GitHub/GamepadPlus/withGUI/GamepadPlus/GamepadPlusGUI/GamepadPlusGUI.pro</value>
293292
<value type="QString" key="RunConfiguration.Arguments"></value>
294293
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
295294
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
@@ -300,7 +299,7 @@
300299
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
301300
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
302301
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
303-
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/GitHub/GamepadPlusGUI/build-GamepadPlusGUI-Desktop_Qt_5_9_9_MSVC2017_64bit-Debug</value>
302+
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/GitHub/GamepadPlus/withGUI/GamepadPlus/build-GamepadPlusGUI-Desktop_Qt_5_9_9_MSVC2017_64bit-Debug</value>
304303
</valuemap>
305304
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
306305
</valuemap>

GamepadPlusGUI/widget.cpp

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "widget.h"
22

33
#include "globalconfig.h"
4-
#include <QDebug.h>
54
#include <QPainter>
65
#include <cmath>
76

@@ -266,6 +265,40 @@ int Widget::keyboardStep()
266265
}
267266

268267
// Reset
268+
if(state != 0) {
269+
switch (state) {
270+
case 4:{
271+
if(!Gamepad.getDPad(GamepadDpadEX::left)) {
272+
Keyboard.keyboardPress(keyDirection/40 % 26 + 'A');
273+
state = 0;
274+
}
275+
break;
276+
}
277+
case 2:{
278+
if(!Gamepad.getDPad(GamepadDpadEX::down)) {
279+
Keyboard.keyboardPress(DOWN_KEY_CODE[keyDirection/80 % 4]);
280+
state = 0;
281+
}
282+
break;
283+
}
284+
case 6:{
285+
if(!Gamepad.getDPad(GamepadDpadEX::right)) {
286+
Keyboard.keyboardPress(RIGHT_KEY_CODE[keyDirection/40 % 15]);
287+
state = 0;
288+
}
289+
break;
290+
}
291+
case 8:{
292+
if(!Gamepad.getDPad(GamepadDpadEX::up)) {
293+
Keyboard.keyboardPress(UP_KEY_CODE[keyDirection/60 % 8]);
294+
state = 0;
295+
}
296+
break;
297+
}
298+
}
299+
}
300+
301+
return 0;
269302
}
270303

271304
int Widget::xyToDirection(int x, int y)

0 commit comments

Comments
 (0)