| 1 |
/*************************************************************************** |
| 2 |
* Copyright (C) 2005-2019 by the FIFE team * |
| 3 |
* http://www.fifengine.net * |
| 4 |
* This file is part of FIFE. * |
| 5 |
* * |
| 6 |
* FIFE is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Lesser General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2.1 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 14 |
* Lesser General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Lesser General Public * |
| 17 |
* License along with this library; if not, write to the * |
| 18 |
* Free Software Foundation, Inc., * |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
| 20 |
***************************************************************************/ |
| 21 |
|
| 22 |
|
| 23 |
// Standard C++ library includes |
| 24 |
|
| 25 |
// Platform specific includes |
| 26 |
#include "util/base/fife_stdint.h" |
| 27 |
|
| 28 |
// 3rd party library includes |
| 29 |
|
| 30 |
// FIFE includes |
| 31 |
// These includes are split up in two parts, separated by one empty line |
| 32 |
// First block: files included from the FIFE root src directory |
| 33 |
// Second block: files included from the same folder |
| 34 |
|
| 35 |
#include "color.h" |
| 36 |
|
| 37 |
namespace FIFE { |
| 38 |
Color::Color(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) |
| 39 |
: |
| 40 |
m_r(r), |
| 41 |
m_g(g), |
| 42 |
m_b(b), |
| 43 |
m_a(alpha) { |
| 44 |
} |
| 45 |
|
| 46 |
Color::~Color() { |
| 47 |
} |
| 48 |
|
| 49 |
void Color::set(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) { |
| 50 |
m_r = r; |
| 51 |
m_g = g; |
| 52 |
m_b = b; |
| 53 |
m_a = alpha; |
| 54 |
} |
| 55 |
|
| 56 |
void Color::setR(uint8_t r) { |
| 57 |
m_r = r; |
| 58 |
} |
| 59 |
|
| 60 |
void Color::setG(uint8_t g) { |
| 61 |
m_g = g; |
| 62 |
} |
| 63 |
|
| 64 |
void Color::setB(uint8_t b) { |
| 65 |
m_b = b; |
| 66 |
} |
| 67 |
|
| 68 |
void Color::setAlpha(uint8_t alpha) { |
| 69 |
m_a = alpha; |
| 70 |
} |
| 71 |
|
| 72 |
uint8_t Color::getR() const { |
| 73 |
return m_r; |
| 74 |
} |
| 75 |
|
| 76 |
uint8_t Color::getG() const { |
| 77 |
return m_g; |
| 78 |
} |
| 79 |
|
| 80 |
uint8_t Color::getB() const { |
| 81 |
return m_b; |
| 82 |
} |
| 83 |
|
| 84 |
uint8_t Color::getAlpha() const { |
| 85 |
return m_a; |
| 86 |
} |
| 87 |
} |