-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
49 lines (36 loc) · 1.36 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Example of usage
display.setDefault( "background", 0.333 )
local ponysense = require "com.ponywolf.ponysense"
if ponysense.initialize() then
ponysense.addGame("SKIPCHASER", "SKIPCHASER", "Ponywolf", ponysense.colors.RED)
ponysense.registerEvent({ event = "HEALTH"}) -- optional
-- This example uses the function keys to make a health bar that can be updated
-- with ponysense.sendEventValue()
-- See more handler examples at https://github.com/SteelSeries/gamesense-sdk/blob/master/doc/api/json-handlers-color.md
local healthHandler = {
device = "keyboard",
zone = "function-keys",
color = {
gradient = {
zero = ponysense.RGB(255,0,0),
hundred = ponysense.RGB(0,255,0),
}
},
mode = "percent",
}
ponysense.bindEvent({ event = "HEALTH", handler = healthHandler})
else
print("WARNING: Can't Find GameSense installation")
end
local function updateHealth()
ponysense.sendEventValue("HEALTH", math.random(1,99))
end
-- update health on a 1/2 second timer
timer.performWithDelay(500, updateHealth, -1)
timer.performWithDelay(1000, function () ponysense.key("w","a","s","d","space") end)
-- That's about it, enjoy