-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
creatoy
committed
Jul 8, 2023
1 parent
d43074b
commit 6f92fe7
Showing
3 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
## A hidapi extension for godot | ||
|
||
> WIP | ||
* Written by rust with gdext | ||
|
||
> How to use it: Download the release archive and decompress it to your godot project root directory. | ||
|
||
Example: | ||
``` | ||
func _ready(): | ||
# List all connected HID devices. | ||
var devices = Hid.list_devices() | ||
print(devices) | ||
var hid = Hid.new() | ||
# Open by vender id and product id | ||
hid.open(vid, pid) | ||
# Or open by device path | ||
#hid.open_path(path) | ||
# Or open by serial number | ||
#hid.open_serial(vid, pid, serial_number) | ||
# Then you can read HID report data from device. | ||
var report_recv = hid.read(64) | ||
#var report_recv = hid.read_timeout(64, 10) | ||
# And write report data to HID | ||
hid.write(report_send) | ||
``` |