GithubHelp home page GithubHelp logo

Clock in display about gamesense-sdk HOT 2 OPEN

steelseries avatar steelseries commented on September 7, 2024
Clock in display

from gamesense-sdk.

Comments (2)

frillip avatar frillip commented on September 7, 2024

Yes! I wrote this in python3 whilst getting to grips with the SDK. It displays the clock icon along with the time. It will also vibrate the mouse on the hour.

import json
import requests
from time import sleep
import datetime

app = 'CLOCK'
display_name = 'Clock'
time_event = 'TIME'
bzzz_event = 'BZZZ'

corePropsPath = '/ProgramData/SteelSeries/SteelSeries Engine 3/coreProps.json'
gamesense_url = json.load(open(corePropsPath))['address']

def register_clock():
    clock_metadata = {
        'game': app,
        'game_display_name': display_name,
    }
    r = requests.post('http://'+gamesense_url+'/game_metadata', json=clock_metadata)

def bind_clock_event():
    clock_handler = {
        'game': app,
        'event': time_event,
        'icon_id': 15,
        'handlers': [
            {
               'device-type': 'screened',
               'mode': 'screen',
               'zone': 'one',
			   "datas": [
                   {
                       "icon-id": 15,
                       'has-text': True,
                       'length-millis': 1100
                   }
               ]
            }
        ]
    }
    r = requests.post('http://'+gamesense_url+'/bind_game_event', json=clock_handler)

def bind_bzzz_event():
    clock_handler = {
        'game': app,
        'event': bzzz_event,
        'handlers': [
            {
               'device-type': 'tactile',
			   'mode': 'vibrate',
               'zone': 'one',
			   'pattern': [
                   {
                       "type": "ti_predefined_doubleclick_100"
                   }
               ]
            }
        ]
    }
    r = requests.post('http://'+gamesense_url+'/bind_game_event', json=clock_handler)

def send_time(time):
    event_data = {
        'game': app,
        'event': time_event,
        'data': { 'value': time }
    }
    r = requests.post('http://'+gamesense_url+'/game_event', json=event_data)

def send_bzzz(id):
    event_data = {
        'game': app,
        'event': bzzz_event,
        'data': { 'value': id }
    }
    r = requests.post('http://'+gamesense_url+'/game_event', json=event_data)

register_clock()
bind_clock_event()
bind_bzzz_event()

while True:
    now = datetime.datetime.now()
    send_time(now.strftime("%X"))
    if not now.minute and not now.second:
        send_bzzz(now.hour)
    sleep(0.1)

from gamesense-sdk.

cRUSHr2012 avatar cRUSHr2012 commented on September 7, 2024

For macOS you need to change the corePropsPath :
corePropsPath = '/Library/Application Support/SteelSeries Engine 3/coreProps.json'

from gamesense-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.