用于与SteelSeries GameSense 3.8.x交互的库

gamesense的Python项目详细描述


游戏感

用于SteelSeries GameSense 3.8.x+的Python库

安装

这个包有两个不同的版本。一个支持普通的同步函数调用,另一个支持python的异步功能。

要安装同步版本,请运行:

pip install gamesense[sync]

要安装异步版本,请运行:

pip install gamesense[async]

或两者皆有:

pip install gamesense[sync,async]

用法

相对简单易用。

对于同步使用:

importgamesense# Create a GameSense object instance to usegs=gamesense.GameSense("SYNC_GAME","Sync Game")# Before you can register or send events, you must register your gamegs.register_game(icon_color_id=gamesense.GS_ICON_GOLD)# Register an event (different than binding an event, see more info in the SteelSeries docs)gs.register_event("DID_STUFF")# Test out the event by sending the eventgs.send_event("DID_STUFF",{"value":22})

对于异步使用:

importasyncioimportgamesense# For example purposes, need an event loop # Inside normal async functions, you'd just use await on the functions provided on AioGameSenseloop=asyncio.get_event_loop()# Create a GameSense object instance to usegs=gamesense.AioGameSense("ASYNC_GAME","Async Game")# Before you can register or send events, you must register your gameloop.run_until_complete(gs.register_game())# Register an event (different than binding an event, see more info in the SteelSeries docs)loop.run_until_complete(gs.register_event('DID_STUFF'))# Test out the event by sending the eventloop.run_until_complete(gs.send_event("DID_STUFF",{"value":23}))

这两个例子做了相对相同的事情。有关SteelSeries GameSense API的更多信息,请参见:https://github.com/SteelSeries/gamesense-sdk/tree/master/doc/api了解更多信息。绑定处理程序之类的东西应该是可能的,但可能有点复杂。为了使这种功能更容易,欢迎提交。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在DoublyLinkedList上实现迭代器   java如何获得ZoneDateTime时区的三个字母首字母缩写?   java Android中使用的PreferenceManager和SharedReference类是什么?   arraylist java宠物名和芯片号   java我可以使用正则表达式从短语中解析单词吗?   java Primefaces信息窗口标题   java Jetpack导航:如何从recyclerview适配器打开新片段?   Spring过滤器作为基于Java注释的bean   java在使用swing后,如何在swing中“X出”窗口?   java iText ColumnText设置矩形中的文本大小   java反射类NotFoundException   数组无法解释的“OutOfMemoryError:Java堆空间”错误和代码行为   java如何在Android中初始化类并将对象传递给构造函数?   java从文件创建2D ArrayList   java存储音乐的最佳位置/方法