mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-19 12:37:52 -05:00
* Reorganize and clean up RGBController API functions
* Add functions to get protected RGBController member values
* Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
* Protected previously-public RGBController members
* Information strings (name, vendor, description, version, serial location)
* Device type
* Active mode
* Flags
* LEDs vector
* LED alternate names vector
* Modes vector
* Colors vector
* Zones vector
* Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
* Add update reason codes to RGBController update callback and signal updates on more RGBController events
* Add loop zone types and segmented zone type
* Add matrix map field to segments
* Rework matrix_map_type from using pointers to vector to prevent memory leaks
* Rework KeyboardLayoutManager to return new matrix_map_type
* Add access mutex to RGBController API
* Add per-zone modes ot RGBController API
* Add JSON description functions to RGBController API
99 lines
2.8 KiB
C++
99 lines
2.8 KiB
C++
/*---------------------------------------------------------*\
|
|
| RGBController_MadCatzCyborg.cpp |
|
|
| |
|
|
| RGB Controller for MadCatz Cyborg Gaming Light |
|
|
| |
|
|
| This file is part of the OpenRGB project |
|
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
\*---------------------------------------------------------*/
|
|
|
|
#include "RGBController_MadCatzCyborg.h"
|
|
|
|
/**--------------------------------------------------------*\
|
|
@name MadCatz Cyborg Gaming Light
|
|
@category Accessory
|
|
@type USB
|
|
@save :x:
|
|
@direct :white_check_mark:
|
|
@effects :x:
|
|
@detectors DetectMadCatzCyborgControllers
|
|
@comment The MadCatz Cyborg Gaming Light is an ambient lighting device.
|
|
\*---------------------------------------------------------*/
|
|
|
|
RGBController_MadCatzCyborg::RGBController_MadCatzCyborg(MadCatzCyborgController* controller_ptr)
|
|
{
|
|
controller = controller_ptr;
|
|
|
|
name = "MadCatz Cyborg Gaming Light";
|
|
vendor = "MadCatz";
|
|
type = DEVICE_TYPE_ACCESSORY;
|
|
description = "MadCatz Cyborg Gaming Light";
|
|
location = controller->GetDeviceLocation();
|
|
serial = controller->GetSerialString();
|
|
|
|
mode Direct;
|
|
Direct.name = "Direct";
|
|
Direct.value = 0;
|
|
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
Direct.color_mode = MODE_COLORS_PER_LED;
|
|
Direct.brightness_min = 0;
|
|
Direct.brightness_max = 100;
|
|
Direct.brightness = 100;
|
|
modes.push_back(Direct);
|
|
|
|
SetupZones();
|
|
|
|
controller->SetIntensity(modes[active_mode].brightness);
|
|
}
|
|
|
|
RGBController_MadCatzCyborg::~RGBController_MadCatzCyborg()
|
|
{
|
|
delete controller;
|
|
}
|
|
|
|
void RGBController_MadCatzCyborg::SetupZones()
|
|
{
|
|
zone cyborg_zone;
|
|
|
|
cyborg_zone.name = "Cyborg";
|
|
cyborg_zone.type = ZONE_TYPE_SINGLE;
|
|
cyborg_zone.leds_min = 1;
|
|
cyborg_zone.leds_max = 1;
|
|
cyborg_zone.leds_count = 1;
|
|
|
|
zones.push_back(cyborg_zone);
|
|
|
|
led cyborg_led;
|
|
cyborg_led.name = "LED";
|
|
leds.push_back(cyborg_led);
|
|
|
|
SetupColors();
|
|
}
|
|
|
|
void RGBController_MadCatzCyborg::DeviceUpdateLEDs()
|
|
{
|
|
if(colors.size() > 0)
|
|
{
|
|
RGBColor color = colors[0];
|
|
controller->SetLEDColor(RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color));
|
|
}
|
|
}
|
|
|
|
void RGBController_MadCatzCyborg::DeviceUpdateZoneLEDs(int /*zone*/)
|
|
{
|
|
DeviceUpdateLEDs();
|
|
}
|
|
|
|
void RGBController_MadCatzCyborg::DeviceUpdateSingleLED(int /*led*/)
|
|
{
|
|
DeviceUpdateLEDs();
|
|
}
|
|
|
|
void RGBController_MadCatzCyborg::DeviceUpdateMode()
|
|
{
|
|
if(modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS)
|
|
{
|
|
controller->SetIntensity(modes[active_mode].brightness);
|
|
}
|
|
}
|