Difference between revisions of "Chroma"
m |
|||
(9 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | |||
<!-- GIDEROSOBJ:chroma --> | <!-- GIDEROSOBJ:chroma --> | ||
− | ''' | + | '''Supported platforms:''' [[File:Platform html5.png]][[File:Platform pc.png]]<br/> |
− | ''' | + | '''Available since:''' Gideros 2020.7<br/> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | === Description === | ||
+ | An interface for the RΛZΞR Chroma SDK. | ||
+ | |||
+ | Device can be any of: "keyboard", "mouse", "headset", "mousepad", "keypad" or "chromalink". | ||
+ | |||
+ | A special hybrid device called "chars" can be used to light up a key, setting its LED colour to -1 will show the keyboard colour instead. | ||
+ | |||
+ | An emulator for the Chroma devices can be downloaded from here: '''https://developer.razer.com/works-with-chroma/download/''' | ||
+ | |||
+ | [[File:Razer.png|800px]] | ||
+ | |||
+ | '''''Screenshot of the plugin working with Razer Chroma emulator''''' | ||
+ | |||
+ | === Example === | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | pcall(function() require "json" end) | ||
pcall(function() require "chroma" end) | pcall(function() require "chroma" end) | ||
+ | |||
if Chroma then | if Chroma then | ||
print("Chroma successfully loaded") | print("Chroma successfully loaded") | ||
− | |||
chroma=Chroma.new() | chroma=Chroma.new() | ||
− | |||
chroma:clear("keyboard") | chroma:clear("keyboard") | ||
local h=chroma:getHeight("keyboard") | local h=chroma:getHeight("keyboard") | ||
Line 50: | Line 57: | ||
end | end | ||
− | stage:addEventListener(Event.ENTER_FRAME,gameLoop)</ | + | stage:addEventListener(Event.ENTER_FRAME,gameLoop) |
+ | </syntaxhighlight> | ||
+ | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Methods === |
− | [[ | + | [[Chroma.new]] ''initialises the plugin''<br/><!--GIDEROSMTD:Chroma.new(devices,title,description,name,contact,category) initialises the plugin--> |
− | [[ | + | [[Chroma:getSession]] ''gets the session id''<br/><!--GIDEROSMTD:Chroma:getSession() gets the session id--> |
− | [[ | + | [[Chroma:getTicks]] ''gets the number of ticks (seconds) from the razer chroma server that you have been connected''<br/><!-- GIDEROSMTD:Chroma:getTicks() gets the number of ticks (seconds) from the razer chroma server that you have been connected--> |
− | [[ | + | [[Chroma:isReady]] ''returns true if Chroma has started and is ready to accept commands''<br/><!--GIDEROSMTD:Chroma:isReady() returns true if Chroma has started and is ready to accept commands--> |
− | [[ | + | [[Chroma:getLastError]] ''returns the last error number''<br/><!--GIDEROSMTD:Chroma:getLastErrory() returns the last error number--> |
− | [[ | + | [[Chroma:getErrorText]] ''returns the text representation of the error number''<br/><!--GIDEROSMTD:Chroma:getErrorText(number) returns the text representation of the error number--> |
− | [[ | + | [[Chroma:getWidth]] ''returns the number of LED columns''<br/><!--GIDEROSMTD:Chroma:getWidth(device) returns the number of LED columns--> |
− | [[ | + | [[Chroma:getHeight]] ''returns the number of LED rows''<br/><!--GIDEROSMTD:Chroma:getHeight(device) returns the number of LED rows--> |
− | [[ | + | [[Chroma:setKey]] ''sets the LED colour for a specific key''<br/><!--GIDEROSMTD:Chroma:setKey(keys,colors,flush) sets the LED colour for a specific key--> |
− | [[ | + | [[Chroma:setColor]] ''sets the colour for the LED at x,y on the device''<br/><!--GIDEROSMTD:Chroma:setColor(device,x,y,colors,flush) sets the colour for the LED at x,y on the device--> |
− | [[ | + | [[Chroma:getColor]] ''returns the colour of the LED at x,y on the device''<br/><!--GIDEROSMTD:Chroma:getColor(device,x,y) returns the colour of the LED at x,y on the device--> |
− | [[ | + | [[Chroma:clear]] ''sets all the LED colours on the device to a specific colour''<br/><!--GIDEROSMTD:Chroma:clear(device,color,flush) sets all the LED colours on the device to a specific colour--> |
− | [[ | + | [[Chroma:flush]] ''sends the wanted colours of the LEDs to the device''<br/><!--GIDEROSMTD:Chroma:flush(device) sends the wanted colours of the LEDs to the device--> |
− | [[ | + | [[Chroma:color]] ''sets all the LED colours very quickly to a specific colour''<br/><!--GIDEROSMTD:Chroma:color(devices,color) sets all the LED colours very quickly to a specific colour--> |
− | [[ | + | [[Chroma:colorScroll]] ''scrolls the LED colours in a given direction''<br/><!--GIDEROSMTD:Chroma:colorScroll(device,dirX,dirY,flush) scrolls the LED colours in a given direction--> |
− | [[ | + | [[Chroma:effect]] ''sends raw effect data to the Chroma server''<br/><!--GIDEROSMTD:Chroma:effect(device,effect,para) sends raw effect data to the Chroma server--> |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Events === |
− | === | + | === Constants === |
|} | |} | ||
{{GIDEROS IMPORTANT LINKS}} | {{GIDEROS IMPORTANT LINKS}} |
Latest revision as of 21:42, 6 November 2024
Supported platforms:
Available since: Gideros 2020.7
Description
An interface for the RΛZΞR Chroma SDK.
Device can be any of: "keyboard", "mouse", "headset", "mousepad", "keypad" or "chromalink".
A special hybrid device called "chars" can be used to light up a key, setting its LED colour to -1 will show the keyboard colour instead.
An emulator for the Chroma devices can be downloaded from here: https://developer.razer.com/works-with-chroma/download/
Screenshot of the plugin working with Razer Chroma emulator
Example
pcall(function() require "json" end)
pcall(function() require "chroma" end)
if Chroma then
print("Chroma successfully loaded")
chroma=Chroma.new()
chroma:clear("keyboard")
local h=chroma:getHeight("keyboard")
for y=1,h do
for x=1,0xf do
chroma:setColor("keyboard",x,y,(x*16)<<16)
chroma:setColor("keyboard",31-x,y,(x*16)<<16)
end
end
for loop=1,12 do
chroma:setKey("f"..loop,0x100-(loop*0x10))
end
chroma:setKey({"w","up"},0xffffff)
chroma:setKey({"z","down"},0xffffff)
chroma:setKey({"a","left"},0xffffff)
chroma:setKey({"s","right"},0xffffff)
end
frameCounter=0
test1=false
function gameLoop(e)
frameCounter+=1
if chroma and chroma:isReady() then
if not test1 then
chroma:effect("mouse","static",255<<8)
chroma:effect("mousepad","static",255<<16)
test1=true
end
chroma:colorScroll("keyboard",1,0,true)
end
end
stage:addEventListener(Event.ENTER_FRAME,gameLoop)
MethodsChroma.new initialises the plugin |
EventsConstants |