2022-11-26 18:56:43 +01:00
|
|
|
#pragma once
|
|
|
|
#include "../defines.hpp"
|
2022-12-16 18:17:31 +01:00
|
|
|
#include <vector>
|
2022-11-26 18:56:43 +01:00
|
|
|
|
2022-12-31 17:31:33 +01:00
|
|
|
enum eConfigValueDataTypes {
|
2022-12-16 18:17:31 +01:00
|
|
|
CVD_TYPE_INVALID = -1,
|
2022-11-26 18:56:43 +01:00
|
|
|
CVD_TYPE_GRADIENT = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
interface ICustomConfigValueData {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2022-11-26 18:56:43 +01:00
|
|
|
virtual ~ICustomConfigValueData() = 0;
|
|
|
|
|
|
|
|
virtual eConfigValueDataTypes getDataType() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CGradientValueData : public ICustomConfigValueData {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2022-11-26 18:56:43 +01:00
|
|
|
CGradientValueData(CColor col) {
|
2022-12-31 17:31:33 +01:00
|
|
|
m_vColors.push_back(col * (1.f / 255.f));
|
2022-11-26 18:56:43 +01:00
|
|
|
};
|
2022-12-16 18:17:31 +01:00
|
|
|
virtual ~CGradientValueData(){};
|
2022-11-26 18:56:43 +01:00
|
|
|
|
|
|
|
virtual eConfigValueDataTypes getDataType() {
|
|
|
|
return CVD_TYPE_GRADIENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
void reset(CColor col) {
|
|
|
|
m_vColors.clear();
|
2022-12-31 17:31:33 +01:00
|
|
|
m_vColors.emplace_back(col * (1.f / 255.f));
|
2022-11-26 18:56:43 +01:00
|
|
|
m_fAngle = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Vector containing the colors */
|
|
|
|
std::vector<CColor> m_vColors;
|
|
|
|
|
|
|
|
/* Float corresponding to the angle (rad) */
|
2022-12-16 18:17:31 +01:00
|
|
|
float m_fAngle = 0;
|
2022-11-26 18:56:43 +01:00
|
|
|
|
2022-12-20 03:18:47 +01:00
|
|
|
bool operator==(const CGradientValueData& other) {
|
2022-12-31 17:31:33 +01:00
|
|
|
if (other.m_vColors.size() != m_vColors.size() || m_fAngle != other.m_fAngle)
|
2022-11-26 18:56:43 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < m_vColors.size(); ++i)
|
2022-12-16 18:17:31 +01:00
|
|
|
if (m_vColors[i] != other.m_vColors[i])
|
|
|
|
return false;
|
2022-11-26 18:56:43 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|