Crates.io | bevy_mod_chroma |
lib.rs | bevy_mod_chroma |
version | 0.5.0 |
source | src |
created_at | 2023-05-01 04:22:27.02366 |
updated_at | 2023-07-11 14:08:17.21848 |
description | A plugin for the Bevy game engine to allow control of Razer Chroma devices |
homepage | |
repository | https://github.com/datael/bevy_mod_chroma |
max_upload_size | |
id | 853194 |
size | 94,317 |
Razer Chroma support plugin for Bevy. Uses the Razer Chroma HTTP API to communicate with the Razer Chroma system.
You will need Razer Chroma software installed to properly use this plugin.
If you don't have certain types of hardware devices, Razer also provides an emulator that you can use to test your effects.
General flow is that you need to register effects via Chroma::create_effect
to get an EffectHandle
, and then you can pass that handle to Chroma::apply_effect
to apply.
See the examples directory for more detailed examples.
Add the plugin to your app:
use bevy::prelude::*;
use bevy_mod_chroma::{
Author, Category, ChromaPlugin, ChromaRunnerInitializationSettings, InitRequest, SupportedDevice,
};
fn main() {
App::new()
.add_plugins(ChromaPlugin::new(ChromaRunnerInitializationSettings::new(
InitRequest {
title: "Your Bevy app title goes here",
description: "Your Bevy app description goes here",
author: Author {
name: "Your name",
contact: "Your contact",
},
device_supported: vec![
SupportedDevice::Keyboard,
SupportedDevice::Mouse,
//...
],
category: Category::Application, // or Category::Game
},
)))
//...
.run();
}
NOTE: The information you provide to
ChromaRunnerInitializationSettings
is displayed in the Razer Synapse connect menu!
Use the Chroma
parameter in systems to create and apply effects:
use bevy_mod_chroma::{Chroma, Effect, EffectHandle, MouseEffect};
fn red_mouse(mut chroma: Chroma) {
let red_handle = chroma.create_effect(Effect::Mouse(MouseEffect::Static {
color: Color::RED.into(),
}));
chroma.apply_effect(&red_handle);
}
The main branch is compatible with the latest Bevy release.
Compatibility of bevy_mod_chroma
versions:
bevy_mod_chroma branch |
Compatible Bevy version |
---|---|
develop |
0.11 |
bevy_0.10 |
0.10 |