OpenGpad

General

Category
Free
Tag
Gamepads
License
MIT License
Registered
Nov 5, 2016
Favorites
0
Link
https://github.com/gavinliu/OpenGpad
See also
JoyStick
Bugstick
JoystickView
AndroidJoyStickView

Additional

Language
N/A
Version
1.0 (Mar 4, 2016)
Created
Feb 6, 2016
Updated
Mar 4, 2016 (Retired)
Owner
Liu Yunlong (gavinliu)
Contributor
Liu Yunlong (gavinliu)
1
Activity
Badge
Generate
Download
Source code

OpenGpad

这是个基于测试框架(UiAutomator)做的一款:使用电脑键盘玩手机游戏的软件。

初衷

本职工作是做Android开发,电脑环境为Linux Mint,没有好的娱乐方式,手机也是长时间插在电脑上的,所以就寻思着,用电脑键盘当手柄,控制手机玩游戏,于是就有了这个项目。

体验视频

查看视频

软件使用

  1. 下载软件
  2. 手机连接电脑并打开调试模式
  3. 打开PC端程序
  4. 选择你的手机
  5. 等待PC端安装手机端程序
  6. 在手机端编辑映射规则
  7. PC端获取规则
  8. 选择规则点击开始
  9. 回到你的游戏界面, enjoy it~

步骤文字看起来有点繁琐, 推荐看体验视频

原理

PC通过adb命令启动一个UiAutomator测试用例,测试用例死循环等待接受指令,接受到指令后,根据指令对手机进行操作,操作手机采取注入屏幕点击事件的方式,这样做的好处是,可以支持所有手机软件。

开源

项目分为两个部分

  1. OpenGpad-PyQT: PC端控制程序

  2. OpenGpad-Android: Android辅助程序,用于编辑映射规则 + UiAutomator程序,用于注入事件

QT属于现学现卖写的, 代码风格很混乱, 质量不佳, BUG肯定巨多 各路大神轻拍啊...

从这个项目可以看出基于测试框架能做很多事情, 对于游戏手柄来说, 完全可以搞个arm板+几个按钮 就能自己搞出一个智能手柄了, 还能适配所有游戏.

TODO

  • 实现摇杆事件
  • 实现PC端编辑映射规则

相关技术

PyQt:

Python - Mac下PyQt5环境搭建

Android:

Android - adb forward实现PC和App的Socket通讯
Android - 测试框架之 UI Testing - UiAutomator
Android - 测试框架之 UI Testing - 实现多点触控事件

License

The MIT License (MIT)

Copyright (c) 2016 Liu Yunlong(gavin6liu@gmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.