mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 09:03:57 -07:00
Made QColor wrapper class so that Servatrice will compile without QtGui
This commit is contained in:
parent
ee0a010add
commit
b1d8c7bda0
19 changed files with 226 additions and 184 deletions
27
common/color.h
Normal file
27
common/color.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
#include <QColor>
|
||||
#endif
|
||||
|
||||
class Color {
|
||||
private:
|
||||
int value;
|
||||
public:
|
||||
Color(int _value = 0) : value(_value) { }
|
||||
Color(int r, int g, int b) : value(r * 65536 + g * 256 + b) { }
|
||||
int getValue() const { return value; }
|
||||
#ifdef QT_GUI_LIB
|
||||
Color(const QColor &_color)
|
||||
{
|
||||
value = _color.red() * 65536 + _color.green() * 256 + _color.blue();
|
||||
}
|
||||
QColor getQColor() const
|
||||
{
|
||||
return QColor(value / 65536, (value % 65536) / 256, value % 256);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue