mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Updated LUA Events (markdown)
parent
bd60893084
commit
3a248b86f1
@ -27,17 +27,17 @@ profile profile, profileUpdatingEventArgs eventArgs
|
||||
-- This function will be called after every profile update, before every profile draw.
|
||||
function updateHandler(profile, eventArgs)
|
||||
-- In this example we only want to update once per frame when the keyboard is updated
|
||||
if eventArgs.DeviceType != "keyboard" then
|
||||
return
|
||||
end
|
||||
|
||||
-- The Event Arguments are inside the eventArgs parameter
|
||||
if not (eventArgs.DeviceType == "keyboard") then
|
||||
return
|
||||
end
|
||||
|
||||
-- The Event Arguments are inside the eventArgs parameter
|
||||
-- In a Windows Profile, you could do this:
|
||||
local currentSong = eventArgs.DataModel.Spotify.SongName;
|
||||
local currentSong = eventArgs.DataModel.Spotify.SongName
|
||||
end
|
||||
|
||||
-- Subscribe to the event AFTER defining the function which must be subscribed.
|
||||
Events.DeviceDrawing.add(updateHandler);
|
||||
Events.DeviceDrawing.add(updateHandler)
|
||||
```
|
||||
|
||||
---
|
||||
@ -60,17 +60,17 @@ profile profile, profileDrawingEventArgs eventArgs
|
||||
-- This function will be called after every profile draw.
|
||||
function drawHandler(profile, eventArgs)
|
||||
-- In this example we only want to draw to the keyboard
|
||||
if eventArgs.DeviceType != "keyboard" then
|
||||
return
|
||||
end
|
||||
if not (eventArgs.DeviceType == "keyboard") then
|
||||
return
|
||||
end
|
||||
|
||||
-- The Event Arguments are inside the eventArgs parameter
|
||||
-- The Event Arguments are inside the eventArgs parameter
|
||||
-- In a Windows Profile, you could do this:
|
||||
local currentSong = eventArgs.DataModel.Spotify.SongName;
|
||||
local currentSong = eventArgs.DataModel.Spotify.SongName
|
||||
end
|
||||
|
||||
-- Subscribe to the event AFTER defining the function which must be subscribed.
|
||||
Events.DeviceDrawing.add(drawHandler);
|
||||
Events.DeviceDrawing.add(drawHandler)
|
||||
```
|
||||
|
||||
---
|
||||
@ -89,9 +89,9 @@ profile profile, keyPressEventArgs eventArgs
|
||||
```lua
|
||||
-- This function will be called after every key press.
|
||||
function keyHandler(profile, eventArgs)
|
||||
print("You pressed: " .. eventArgs.Key);
|
||||
print("You pressed: " .. eventArgs.Key)
|
||||
end
|
||||
|
||||
-- Subscribe to the event AFTER defining the function which must be subscribed.
|
||||
Events.KeyboardKeyPressed.add(keyHandler);
|
||||
Events.KeyboardKeyPressed.add(keyHandler)
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user