diff options
Diffstat (limited to '')
-rw-r--r-- | src/utils/dimension.cpp | 16 | ||||
-rw-r--r-- | src/utils/dimension.hpp | 13 | ||||
-rw-r--r-- | src/utils/rgb_color.cpp | 9 | ||||
-rw-r--r-- | src/utils/rgb_color.hpp | 1 |
4 files changed, 29 insertions, 10 deletions
diff --git a/src/utils/dimension.cpp b/src/utils/dimension.cpp index 11a1feb3..f83636ff 100644 --- a/src/utils/dimension.cpp +++ b/src/utils/dimension.cpp @@ -28,7 +28,7 @@ namespace usdx { - Dimension::Dimension(float width, float height) : + Dimension::Dimension(unsigned int width, unsigned int height) : width(width), height(height) { } @@ -38,13 +38,23 @@ namespace usdx { } - float Dimension::get_width(void) const + unsigned int Dimension::get_width(void) const { return width; } - float Dimension::get_height(void) const + void Dimension::set_width(unsigned int width) + { + this->width = width; + } + + unsigned int Dimension::get_height(void) const { return height; } + + void Dimension::set_height(unsigned int height) + { + this->height = height; + } }; diff --git a/src/utils/dimension.hpp b/src/utils/dimension.hpp index 656efefb..4518fbb8 100644 --- a/src/utils/dimension.hpp +++ b/src/utils/dimension.hpp @@ -32,14 +32,17 @@ namespace usdx class Dimension { private: - float width; - float height; + unsigned int width; + unsigned int height; public: - Dimension(float width, float height); + Dimension(unsigned int width, unsigned int height); Dimension(const Dimension& dimension); - float get_width(void) const; - float get_height(void) const; + unsigned int get_width(void) const; + void set_width(unsigned int width); + + unsigned int get_height(void) const; + void set_height(unsigned int height); }; }; diff --git a/src/utils/rgb_color.cpp b/src/utils/rgb_color.cpp index 04c10ba5..d470d495 100644 --- a/src/utils/rgb_color.cpp +++ b/src/utils/rgb_color.cpp @@ -28,8 +28,13 @@ namespace usdx { - RgbColor::RgbColor(float red, float green, float blue) : - red(red), green(green), blue(blue) + RgbColor::RgbColor(int red, int green, int blue) + : red(red / 255.0f), green(green / 255.0f), blue(blue / 255.0f) + { + } + + RgbColor::RgbColor(float red, float green, float blue) + : red(red), green(green), blue(blue) { } diff --git a/src/utils/rgb_color.hpp b/src/utils/rgb_color.hpp index f5b36e7a..dbc504cd 100644 --- a/src/utils/rgb_color.hpp +++ b/src/utils/rgb_color.hpp @@ -36,6 +36,7 @@ namespace usdx float green; float blue; public: + RgbColor(int red, int green, int blue); RgbColor(float red, float green, float blue); float get_red(void) const; |