diff options
author | Stijn Buys <ingar@osirion.org> | 2008-10-06 18:22:32 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-10-06 18:22:32 +0000 |
commit | a14d80f83aebe75241bf63b4f3ffca3a5d952577 (patch) | |
tree | fea36faedd17a0aa620f6d7e781a352327d6065d /src/ui/bitmap.cc | |
parent | 343b0b4298e2d084d5544d3d40a8b7dcb586ce8e (diff) |
libui updates, support menu .ini files
Diffstat (limited to 'src/ui/bitmap.cc')
-rw-r--r-- | src/ui/bitmap.cc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/ui/bitmap.cc b/src/ui/bitmap.cc new file mode 100644 index 0000000..d848a52 --- /dev/null +++ b/src/ui/bitmap.cc @@ -0,0 +1,55 @@ +/* + ui/bitmap.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#include "ui/bitmap.h" +#include "auxiliary/functions.h" +#include "render/primitives.h" +#include "sys/sys.h" + +namespace ui +{ + +Bitmap::Bitmap(Widget *parent, const char *texture) : Widget(parent) +{ + set_border(false); + set_background(true); + set_label("bitmap"); + + set_texture(texture); +} + +Bitmap::~Bitmap() +{} + +void Bitmap::print(size_t indent) +{ + std::string marker(""); + con_print << aux::pad_left(marker, indent*2) << label() << " \"" << texture() << "\"" << std::endl; +} + +void Bitmap::set_texture(std::string const & texture) +{ + bitmap_texture.assign(texture); +} + +void Bitmap::set_texture(const char *texture) +{ + if (texture) + bitmap_texture.assign(texture); + else + bitmap_texture.clear(); +} + +void Bitmap::draw_background() +{ + if (bitmap_texture.size()) { + render::gl::color(1.0f, 1.0f, 1.0f, 1.0f); + render::primitives::bitmap(global_location(), size(), bitmap_texture); + } +} + +} + |