Permalink
Browse files

Define color constants per compilation unit to avoid static initializ…

…ation order problem
  • Loading branch information...
slipher committed Jan 31, 2016
1 parent 5e212f5 commit 2fb9c0eda71373a772f46f1c2949ebf0d613050e
Showing with 12 additions and 25 deletions.
  1. +0 −13 daemon/src/common/Color.cpp
  2. +12 −12 daemon/src/common/Color.h
@@ -34,19 +34,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Color {
Color Black = { 0.00, 0.00, 0.00, 1.00 };
Color Red = { 1.00, 0.00, 0.00, 1.00 };
Color Green = { 0.00, 1.00, 0.00, 1.00 };
Color Blue = { 0.00, 0.00, 1.00, 1.00 };
Color Yellow = { 1.00, 1.00, 0.00, 1.00 };
Color Orange = { 1.00, 0.50, 0.00, 1.00 };
Color Magenta = { 1.00, 0.00, 1.00, 1.00 };
Color Cyan = { 0.00, 1.00, 1.00, 1.00 };
Color White = { 1.00, 1.00, 1.00, 1.00 };
Color LtGrey = { 0.75, 0.75, 0.75, 1.00 };
Color MdGrey = { 0.50, 0.50, 0.50, 1.00 };
Color LtOrange = { 0.50, 0.25, 0.00, 1.00 };
static Color g_color_table[ 32 ] =
{
{ 0.20f, 0.20f, 0.20f, 1.00f }, // 0 - black 0
View
@@ -352,18 +352,18 @@ enum {
}; // enum
} // namespace Constants
extern Color Black;
extern Color Red;
extern Color Green;
extern Color Blue;
extern Color Yellow;
extern Color Orange;
extern Color Magenta;
extern Color Cyan;
extern Color White;
extern Color LtGrey;
extern Color MdGrey;
extern Color LtOrange;
const Color Black = { 0.00, 0.00, 0.00, 1.00 };
const Color Red = { 1.00, 0.00, 0.00, 1.00 };
const Color Green = { 0.00, 1.00, 0.00, 1.00 };
const Color Blue = { 0.00, 0.00, 1.00, 1.00 };
const Color Yellow = { 1.00, 1.00, 0.00, 1.00 };
const Color Orange = { 1.00, 0.50, 0.00, 1.00 };
const Color Magenta = { 1.00, 0.00, 1.00, 1.00 };
const Color Cyan = { 0.00, 1.00, 1.00, 1.00 };
const Color White = { 1.00, 1.00, 1.00, 1.00 };
const Color LtGrey = { 0.75, 0.75, 0.75, 1.00 };
const Color MdGrey = { 0.50, 0.50, 0.50, 1.00 };
const Color LtOrange = { 0.50, 0.25, 0.00, 1.00 };
/*
* Token for parsing colored strings

0 comments on commit 2fb9c0e

Please sign in to comment.