Skip to main content

Library for interacting with SteelSeries GameSense 3.8.x

Project description

gamesense

A Python library for use with SteelSeries GameSense 3.8.X+

Installation

There are two different versions of this package. One supports normal synchronous function calls and the other support python's asynchronous functionality.

To install the sync version run:

pip install gamesense[sync]

To install the async version run:

pip install gamesense[async]

Or both:

pip install gamesense[sync,async]

Usage

Relatively simple to use.

For synchronous usage:

import gamesense

# Create a GameSense object instance to use
gs = gamesense.GameSense("SYNC_GAME", "Sync Game")

# Before you can register or send events, you must register your game
gs.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 event
gs.send_event("DID_STUFF", {"value": 22})

For asynchronous usage:

import asyncio
import gamesense

# For example purposes, need an event loop 
# Inside normal async functions, you'd just use await on the functions provided on AioGameSense
loop = asyncio.get_event_loop()

# Create a GameSense object instance to use
gs = gamesense.AioGameSense("ASYNC_GAME", "Async Game")

# Before you can register or send events, you must register your game
loop.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 event
loop.run_until_complete(gs.send_event("DID_STUFF", {"value": 23}))

The two examples do relatively the same thing. For more information about the SteelSeries GameSense API, see: https://github.com/SteelSeries/gamesense-sdk/tree/master/doc/api for more information. Things like binding handlers and such should be possible, but can be a bit complex. Commits are welcome for making such functionality easier.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gamesense, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size gamesense-0.0.3-py3-none-any.whl (5.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size gamesense-0.0.3.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page