Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
SCUT-RobotIC
Robocon2023-RemoteControl
Repository navigation
Code
Pull requests
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
Robocon2023-RemoteControl
/
joystick.cpp
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
39 lines (34 loc) · 1.3 KB
main
Breadcrumbs
Robocon2023-RemoteControl
/
joystick.cpp
Copy path
Top
File metadata and controls
Code
Blame
39 lines (34 loc) · 1.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "joystick.h"
#include <QMessageBox>
#include <QDebug>
static joyinfoex_tag now_act;
//加载多媒体库
QLibrary mylib("Winmm.dll");
//解析游戏杆捕获函数joySetCapture
MyPrototype qJoySetCapture = (MyPrototype)mylib.resolve("joySetCapture");
//游戏杆数获得函数
MyPrototype1 qJoyReleaseCapture = (MyPrototype1)mylib.resolve("joyReleaseCapture");
//返回游戏杆位置及按钮活动函数
MyPrototype2 qJoyGetPosEx = (MyPrototype2)mylib.resolve("joyGetPosEx");
//返回游戏杆位置及按钮活动函数
MyPrototype0 qJoyGetPos = (MyPrototype0)mylib.resolve("joyGetPos");
//读取操纵杆移动阈值
MyPrototype3 qJoyGetThreshold = (MyPrototype3)mylib.resolve("joyGetThreshold");
//获取操纵杆属性信息,以结构体JoyCaps接收
MyPrototype4 qJoyGetDevCaps = (MyPrototype4)mylib.resolve("joyGetDevCapsW");
//有多少个游戏杆可以用
MyPrototype5 qJoyGetNumDevs = (MyPrototype5)mylib.resolve("joyGetNumDevs");
//打开手柄,开启对手柄的检测功能
void openJoy()
{
JOYCAPS joycaps;
qJoyGetDevCaps(JSX, &joycaps, sizeof(joycaps));
}
//轮询检测手柄按键函数
struct joyinfoex_tag joyRead_row()
{
now_act.dwSize = sizeof(typeof(joyinfoex_tag));
now_act.dwFlags = (int)JOY_RETURNBUTTONS;
qJoyGetPosEx(JSX, &now_act);
return now_act;
}
You can’t perform that action at this time.