Panda3D
 All Classes Functions Variables Enumerations
configVariableColor.h
1 // Filename: configVariableColor.h
2 // Created by: rdb (02Feb14)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CONFIGVARIABLECOLOR_H
16 #define CONFIGVARIABLECOLOR_H
17 
18 #include "dtoolbase.h"
19 #include "config_linmath.h"
20 #include "config_prc.h"
21 #include "configVariable.h"
22 #include "luse.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : ConfigVariableColor
26 // Description : This is a convenience class to specialize
27 // ConfigVariable as a set of floating-point types
28 // representing a color value.
29 //
30 // It interprets the color differently depending on
31 // how many words were specified: if only one, it
32 // is interpreted as a shade of gray with alpha 1.
33 // If two values were specified, a grayscale and
34 // alpha pair. If three, a set of R, G, B values
35 // with alpha 1, and if four, a complete RGBA color.
36 //
37 // This isn't defined in dtool because it relies on
38 // the LColor class, which is defined in linmath.
39 ////////////////////////////////////////////////////////////////////
40 class EXPCL_PANDA_LINMATH ConfigVariableColor : public ConfigVariable {
41 PUBLISHED:
42  INLINE ConfigVariableColor(const string &name);
43  INLINE ConfigVariableColor(const string &name, const LColor &default_value,
44  const string &description = string(),
45  int flags = 0);
46  INLINE ConfigVariableColor(const string &name, const string &default_value,
47  const string &description = string(),
48  int flags = 0);
49 
50  INLINE void operator = (const LColor &value);
51  INLINE operator const LColor & () const;
52 
53  INLINE PN_stdfloat operator [] (int n) const;
54 
55  INLINE void set_value(const LColor &value);
56  INLINE const LColor &get_value() const;
57  INLINE LColor get_default_value() const;
58 
59 private:
60  void set_default_value(const LColor &default_value);
61 
62 private:
63  mutable AtomicAdjust::Integer _local_modified;
64  mutable LColor _cache;
65 };
66 
67 #include "configVariableColor.I"
68 
69 #endif
This is a convenience class to specialize ConfigVariable as a set of floating-point types representin...
const ConfigDeclaration * get_default_value() const
Returns the default variable specified for this variable.
This is a generic, untyped ConfigVariable.
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111