1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #include "CAttributes.h"
\r
6 #include "fast_atof.h"
\r
7 #include "ITexture.h"
\r
8 #include "IVideoDriver.h"
\r
16 Basic types, check documentation in IAttribute.h to see how they generally work.
\r
19 // Attribute implemented for boolean values
\r
20 class CBoolAttribute : public IAttribute
\r
24 CBoolAttribute(const char* name, bool value)
\r
30 s32 getInt() const override
\r
32 return BoolValue ? 1 : 0;
\r
35 f32 getFloat() const override
\r
37 return BoolValue ? 1.0f : 0.0f;
\r
40 bool getBool() const override
\r
45 void setInt(s32 intValue) override
\r
47 BoolValue = (intValue != 0);
\r
50 void setFloat(f32 floatValue) override
\r
52 BoolValue = (floatValue != 0);
\r
55 void setBool(bool boolValue) override
\r
57 BoolValue = boolValue;
\r
60 E_ATTRIBUTE_TYPE getType() const override
\r
65 const wchar_t* getTypeString() const override
\r
73 // Attribute implemented for integers
\r
74 class CIntAttribute : public IAttribute
\r
78 CIntAttribute(const char* name, s32 value)
\r
84 s32 getInt() const override
\r
89 f32 getFloat() const override
\r
94 void setInt(s32 intValue) override
\r
99 void setFloat(f32 floatValue) override
\r
101 Value = (s32)floatValue;
\r
104 E_ATTRIBUTE_TYPE getType() const override
\r
109 const wchar_t* getTypeString() const override
\r
117 // Attribute implemented for floats
\r
118 class CFloatAttribute : public IAttribute
\r
122 CFloatAttribute(const char* name, f32 value)
\r
128 s32 getInt() const override
\r
133 f32 getFloat() const override
\r
138 void setInt(s32 intValue) override
\r
140 Value = (f32)intValue;
\r
143 void setFloat(f32 floatValue) override
\r
145 Value = floatValue;
\r
148 E_ATTRIBUTE_TYPE getType() const override
\r
153 const wchar_t* getTypeString() const override
\r
161 } // end namespace io
\r
162 } // end namespace irr
\r