FlightGear next
FGColor.cxx
Go to the documentation of this file.
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#endif
4
5#include "FGColor.hxx"
6
7#include <iostream>
8
9#include <simgear/props/props.hxx>
10
12// FGColor class.
14
15void
17 std::cerr << "red=" << _red << ", green=" << _green
18 << ", blue=" << _blue << ", alpha=" << _alpha << std::endl;
19}
20
21bool
22FGColor::merge(const SGPropertyNode *node)
23{
24 if (!node)
25 return false;
26
27 bool dirty = false;
28 const SGPropertyNode * n;
29 if ((n = node->getNode("red")))
30 _red = n->getFloatValue(), dirty = true;
31 if ((n = node->getNode("green")))
32 _green = n->getFloatValue(), dirty = true;
33 if ((n = node->getNode("blue")))
34 _blue = n->getFloatValue(), dirty = true;
35 if ((n = node->getNode("alpha")))
36 _alpha = n->getFloatValue(), dirty = true;
37 return dirty;
38}
39
40bool
42{
43 bool dirty = false;
44 if (color && color->_red >= 0.0)
45 _red = color->_red, dirty = true;
46 if (color && color->_green >= 0.0)
47 _green = color->_green, dirty = true;
48 if (color && color->_blue >= 0.0)
49 _blue = color->_blue, dirty = true;
50 if (color && color->_alpha >= 0.0)
51 _alpha = color->_alpha, dirty = true;
52 return dirty;
53}
54
bool merge(const SGPropertyNode *prop)
Definition FGColor.cxx:22
void print() const
Definition FGColor.cxx:16
float _alpha
Definition FGColor.hxx:43
FGColor()
Definition FGColor.hxx:9
float _blue
Definition FGColor.hxx:43
float _green
Definition FGColor.hxx:43
float _red
Definition FGColor.hxx:43