forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigVariableColor.h
More file actions
64 lines (54 loc) · 2.05 KB
/
configVariableColor.h
File metadata and controls
64 lines (54 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file configVariableColor.h
* @author rdb
* @date 2014-02-02
*/
#ifndef CONFIGVARIABLECOLOR_H
#define CONFIGVARIABLECOLOR_H
#include "dtoolbase.h"
#include "config_linmath.h"
#include "config_prc.h"
#include "configVariable.h"
#include "luse.h"
/**
* This is a convenience class to specialize ConfigVariable as a set of
* floating-point types representing a color value.
*
* It interprets the color differently depending on how many words were
* specified: if only one, it is interpreted as a shade of gray with alpha 1.
* If two values were specified, a grayscale and alpha pair. If three, a set
* of R, G, B values with alpha 1, and if four, a complete RGBA color.
*
* This isn't defined in dtool because it relies on the LColor class, which is
* defined in linmath.
*/
class EXPCL_PANDA_LINMATH ConfigVariableColor : public ConfigVariable {
PUBLISHED:
INLINE ConfigVariableColor(const std::string &name);
INLINE ConfigVariableColor(const std::string &name, const LColor &default_value,
const std::string &description = std::string(),
int flags = 0);
INLINE ConfigVariableColor(const std::string &name, const std::string &default_value,
const std::string &description = std::string(),
int flags = 0);
INLINE void operator = (const LColor &value);
INLINE operator const LColor & () const;
INLINE PN_stdfloat operator [] (int n) const;
INLINE void set_value(const LColor &value);
INLINE const LColor &get_value() const;
INLINE LColor get_default_value() const;
private:
void set_default_value(const LColor &default_value);
private:
mutable AtomicAdjust::Integer _local_modified;
mutable LColor _cache;
};
#include "configVariableColor.I"
#endif