diff options
author | Stijn Buys <ingar@osirion.org> | 2010-09-19 19:44:13 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-09-19 19:44:13 +0000 |
commit | cc18095cded14f5e7e3f049e47fca2224134b647 (patch) | |
tree | 2a057f4836925083a19988d571dc0664925c9e48 /src/ui | |
parent | badfb31888a6bd62e0a019b3f3dec517df4121ec (diff) |
text rendering cleanups, inventory capacity & cargo volume
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/Makefile.am | 13 | ||||
-rw-r--r-- | src/ui/bitmap.cc | 4 | ||||
-rw-r--r-- | src/ui/button.cc | 12 | ||||
-rw-r--r-- | src/ui/console.cc | 4 | ||||
-rw-r--r-- | src/ui/container.cc | 4 | ||||
-rw-r--r-- | src/ui/iconbutton.cc | 12 | ||||
-rw-r--r-- | src/ui/inputbox.cc | 18 | ||||
-rw-r--r-- | src/ui/label.cc | 4 | ||||
-rw-r--r-- | src/ui/label.h | 4 | ||||
-rw-r--r-- | src/ui/listitem.cc | 16 | ||||
-rwxr-xr-x | src/ui/modelview.cc | 24 | ||||
-rwxr-xr-x | src/ui/modelview.h | 10 | ||||
-rw-r--r-- | src/ui/paint.cc | 96 | ||||
-rw-r--r-- | src/ui/paint.h | 58 | ||||
-rw-r--r-- | src/ui/plaintext.cc | 58 | ||||
-rw-r--r-- | src/ui/plaintext.h | 63 | ||||
-rw-r--r-- | src/ui/ui.cc | 19 | ||||
-rw-r--r-- | src/ui/widget.cc | 12 | ||||
-rw-r--r-- | src/ui/window.cc | 4 |
19 files changed, 284 insertions, 151 deletions
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am index d12571d..e62a5dd 100644 --- a/src/ui/Makefile.am +++ b/src/ui/Makefile.am @@ -8,13 +8,14 @@ noinst_LTLIBRARIES = libui.la endif noinst_HEADERS = bitmap.h button.h console.h container.h definitions.h font.h \ - iconbutton.h inputbox.h label.h listitem.h listview.h menu.h modelview.h paint.h \ - palette.h scrollpane.h toolbar.h ui.h widget.h \ - window.h + iconbutton.h inputbox.h label.h listitem.h listview.h \ + menu.h modelview.h paint.h palette.h plaintext.h scrollpane.h \ + toolbar.h ui.h widget.h window.h -libui_la_SOURCES = bitmap.cc button.cc console.cc container.cc \ - font.cc iconbutton.cc inputbox.cc label.cc listitem.cc listview.cc \ - menu.cc modelview.cc paint.cc palette.cc scrollpane.cc \ +libui_la_SOURCES = bitmap.cc button.cc console.cc container.cc font.cc \ + iconbutton.cc inputbox.cc label.cc listitem.cc listview.cc \ + menu.cc modelview.cc paint.cc palette.cc plaintext.cc scrollpane.cc \ toolbar.cc ui.cc widget.cc window.cc + libui_la_LDFLAGS = -avoid-version -no-undefined diff --git a/src/ui/bitmap.cc b/src/ui/bitmap.cc index 4af7714..5e19435 100644 --- a/src/ui/bitmap.cc +++ b/src/ui/bitmap.cc @@ -51,8 +51,8 @@ void Bitmap::set_color(const math::Color & color) void Bitmap::draw_background() { if (bitmap_texture.size()) { - paint::color(bitmap_color); - paint::bitmap(global_location(), size(), bitmap_texture); + Paint::set_color(bitmap_color); + Paint::draw_bitmap(global_location(), size(), bitmap_texture); } } diff --git a/src/ui/button.cc b/src/ui/button.cc index 9196b90..95158a2 100644 --- a/src/ui/button.cc +++ b/src/ui/button.cc @@ -56,11 +56,11 @@ void Button::draw_border() if (t > 0.5) t = 1 - t; color.a = 0.5f + t; - paint::color(color); + Paint::set_color(color); } else - paint::color(palette()->border()); + Paint::set_color(palette()->border()); - paint::border(global_location(), size()); + Paint::draw_border(global_location(), size()); } void Button::draw() @@ -69,11 +69,11 @@ void Button::draw() return; if (has_mouse_focus()) - paint::color(palette()->highlight()); + Paint::set_color(palette()->highlight()); else - paint::color(palette()->foreground()); + Paint::set_color(palette()->foreground()); - paint::label(global_location(), size(), font(), text(), alignment()); + Paint::draw_label(global_location(), size(), font(), text(), alignment()); } bool Button::on_keypress(const int key, const unsigned int modifier) diff --git a/src/ui/console.cc b/src/ui/console.cc index 6ce3593..7bd308e 100644 --- a/src/ui/console.cc +++ b/src/ui/console.cc @@ -194,13 +194,13 @@ void Console::draw() math::Color fancy(palette()->fancy()); fancy.a = 0.5f; - paint::color(fancy); + Paint::set_color(fancy); std::string version(core::name() + ' ' + core::version()); s.assign(version.size() * font()->width(), font()->height()); math::Vector2f l(global_location()); l[0] += width() - s.width() - 4; l[1] += height() - s.height() - 4; - paint::text(l, s, font(), version); + Paint::draw_text(l, font(), version); } void Console::save_history() diff --git a/src/ui/container.cc b/src/ui/container.cc index 31d7549..d252c73 100644 --- a/src/ui/container.cc +++ b/src/ui/container.cc @@ -45,8 +45,8 @@ void Container::resize() void Container::draw_border() { - paint::color(palette()->foreground()); - paint::border(global_location(), size()); + Paint::set_color(palette()->foreground()); + Paint::draw_border(global_location(), size()); } } diff --git a/src/ui/iconbutton.cc b/src/ui/iconbutton.cc index ffdafe0..87203ee 100644 --- a/src/ui/iconbutton.cc +++ b/src/ui/iconbutton.cc @@ -79,14 +79,14 @@ void IconButton::draw() return; if (disabled()) { - paint::color(palette()->disabled()); + Paint::set_color(palette()->disabled()); } else if (has_mouse_focus()) { - paint::color(palette()->highlight()); + Paint::set_color(palette()->highlight()); } else { - paint::color(palette()->foreground()); + Paint::set_color(palette()->foreground()); } - paint::bitmap(location(), size(), icon()); + Paint::draw_bitmap(location(), size(), icon()); } void IconButton::draw_border() @@ -98,8 +98,8 @@ void IconButton::draw_border() if (t > 0.5) t = 1 - t; color.a = 0.5f + t; - paint::color(color); - paint::border(global_location(), size()); + Paint::set_color(color); + Paint::draw_border(global_location(), size()); } } diff --git a/src/ui/inputbox.cc b/src/ui/inputbox.cc index 6f493e2..5656cb9 100644 --- a/src/ui/inputbox.cc +++ b/src/ui/inputbox.cc @@ -71,14 +71,14 @@ void InputBox::draw() size_t text_width = (size_t) floorf(width() / font()->width()); size_t prompt_width = aux::text_length(input_prompt); math::Vector2f v(global_location()); - paint::color(palette()->text()); + Paint::set_color(palette()->text()); // draw the prompt if (prompt_width) { - paint::text(v, size(), font(), input_prompt); + Paint::draw_text(v, font(), input_prompt); v[0] += prompt_width * font()->width(); } - paint::color(palette()->text()); + Paint::set_color(palette()->text()); // draw the part before the cursor std::string firstpart(input_text.substr(0, input_pos)); @@ -98,7 +98,7 @@ void InputBox::draw() while (*c && draw_width > text_width - prompt_width - 1) { if (aux::is_color_code(c)) { c++; - paint::color_code(*c); + Paint::set_system_color(*c); } else { draw_width--; } @@ -106,14 +106,14 @@ void InputBox::draw() } if (*c) { - paint::text(v, size(), font(), std::string(c)); + Paint::draw_text(v, font(), std::string(c)); } // draw the part behind the cursor v[0] += draw_width * font()->width(); if (input_pos < input_text.size()) { if (input_pos > 1 && aux::is_color_code(input_text.c_str() + input_pos - 1)) { - paint::color_code(input_text[input_pos]); + Paint::set_system_color(input_text[input_pos]); } // limit to width std::string secondpart; @@ -128,18 +128,18 @@ void InputBox::draw() c++; } - paint::text(v, size(), font(), secondpart); + Paint::draw_text(v, font(), secondpart); } // draw the cursor if (has_input_focus() && (core::application()->time() - ::floorf(core::application()->time())) < 0.5f) { std::string cursor("^B"); cursor += (char) 11; - paint::text(v, size(), font(), cursor); + Paint::draw_text(v, font(), cursor); } // reset color - paint::color(palette()->foreground()); + Paint::set_color(palette()->foreground()); } bool InputBox::on_keypress(const int key, const unsigned int modifier) diff --git a/src/ui/label.cc b/src/ui/label.cc index b6f72c7..ef5b14f 100644 --- a/src/ui/label.cc +++ b/src/ui/label.cc @@ -58,8 +58,8 @@ void Label::draw() if (!label_text.size()) return; - paint::color(palette()->foreground()); - paint::label(global_location(), size(), font(), text(), alignment()); + Paint::set_color(palette()->foreground()); + Paint::draw_label(global_location(), size(), font(), text(), alignment()); } } diff --git a/src/ui/label.h b/src/ui/label.h index 2a38273..f187520 100644 --- a/src/ui/label.h +++ b/src/ui/label.h @@ -13,7 +13,9 @@ namespace ui { -/// a widget displaying centered text +/** + * @brief a widget displaying a single line of text + */ class Label : public Widget { public: diff --git a/src/ui/listitem.cc b/src/ui/listitem.cc index 601d5a8..ff9ad18 100644 --- a/src/ui/listitem.cc +++ b/src/ui/listitem.cc @@ -30,11 +30,11 @@ void ListItem::draw_border() if (t > 0.5) t = 1 - t; color.a = 0.5f + t; - paint::color(color); - paint::border(global_location(), size()); + Paint::set_color(color); + Paint::draw_border(global_location(), size()); } else if ((static_cast<ListView *>(parent()))->selected() == this) { - paint::color(palette()->border()); - paint::border(global_location(), size()); + Paint::set_color(palette()->border()); + Paint::draw_border(global_location(), size()); } } @@ -44,11 +44,11 @@ void ListItem::draw() return; if ( has_mouse_focus() || ((static_cast<ListView *>(parent()))->selected() == this)) { - paint::color(palette()->highlight()); + Paint::set_color(palette()->highlight()); } else { - paint::color(palette()->foreground()); + Paint::set_color(palette()->foreground()); } - paint::label(global_location(), size(), font(), text(), alignment()); + Paint::draw_label(global_location(), size(), font(), text(), alignment()); } bool ListItem::on_keypress(const int key, const unsigned int modifier) @@ -64,4 +64,4 @@ bool ListItem::on_keypress(const int key, const unsigned int modifier) return false; } -} // namespace ui
\ No newline at end of file +} // namespace ui diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc index 18cc091..c00cb07 100755 --- a/src/ui/modelview.cc +++ b/src/ui/modelview.cc @@ -35,17 +35,14 @@ void ModelView::print(const size_t indent) const con_print << aux::pad_left(marker, indent*2) << label() << " \"" << modelname() << "\"" << std::endl; } -void ModelView::set_modelname(const std::string & modelname) -{ - modelview_modelname.assign(modelname); -} - void ModelView::set_modelname(const char *modelname) { if (modelname) modelview_modelname.assign(modelname); else modelview_modelname.clear(); + + set_background(false); } void ModelView::set_color(const math::Color & color) @@ -76,16 +73,23 @@ bool ModelView::on_keypress(const int key, const unsigned int modifier) return false; } +void ModelView::draw_background() +{ + Paint::set_color(1.0f, 1.0f, 1.0f); + Paint::draw_bitmap(global_location(), size(), "textures/common/notex"); +} + void ModelView::draw() { if (!modelview_modelname.size()) { return; } - paint::color(1.0f, 1.0f, 1.0f); + Paint::set_color(1.0f, 1.0f, 1.0f); model::Model *model = model::Model::load(modelview_modelname); if (!model) { - paint::bitmap(global_location(), size(), "bitmaps/notex"); + modelview_modelname.clear(); + set_background(true); return; } @@ -102,6 +106,8 @@ void ModelView::draw() gl::enable(GL_CULL_FACE); // enable culling gl::enable(GL_COLOR_MATERIAL); // enable color tracking + + // FIXME - initialize lights gl::enable(GL_LIGHTING); // enable vertex arrays @@ -130,8 +136,8 @@ void ModelView::draw() void ModelView::draw_border() { - paint::color(palette()->foreground()); - paint::border(global_location(), size()); + Paint::set_color(palette()->foreground()); + Paint::draw_border(global_location(), size()); } } diff --git a/src/ui/modelview.h b/src/ui/modelview.h index 54799f3..89b6554 100755 --- a/src/ui/modelview.h +++ b/src/ui/modelview.h @@ -26,8 +26,11 @@ public: return modelview_color; } - void set_modelname(const std::string & modelname); void set_modelname(const char *modelname); + + inline void set_modelname(const std::string & modelname) { + set_modelname(modelname.c_str()); + } void set_color(const math::Color &color); @@ -47,7 +50,10 @@ protected: virtual void draw(); /// draw border - void draw_border(); + virtual void draw_border(); + + /// draw border + virtual void draw_background(); /// keypress event handler virtual bool on_keypress(const int key, const unsigned int modifier); diff --git a/src/ui/paint.cc b/src/ui/paint.cc index b3d6197..6531b0e 100644 --- a/src/ui/paint.cc +++ b/src/ui/paint.cc @@ -11,90 +11,100 @@ #include "render/textures.h" #include "ui/paint.h" -namespace ui -{ - -// contains the interface between the user interface and the render library -namespace paint -{ +namespace ui { -void assign_color(const char c, const math::Color &color) +void Paint::set_color(float r, float g, float b, float a) { - render::Text::assign_color(c, color); + gl::color(r, g, b, a); } -void color(float r, float g, float b, float a) +void Paint::set_color(math::Color const & color) { - gl::color(r, g, b, a); + gl::color(color); } -void color(math::Color const & color) +void Paint::assign_system_color(const char c, const math::Color &color) { - gl::color(color); + render::Text::assign_color(c, color); } -void color_code(const char c) +void Paint::set_system_color(const char c) { render::Text::setcolor(c); } -void border(const math::Vector2f &location, const math::Vector2f &size) +void Paint::draw_border(const math::Vector2f &global_location, const math::Vector2f &size) { using namespace gl; begin(LineLoop); - vertex(location.x(), location.y()); - vertex(location.x() + size.width(), location.y()); - vertex(location.x() + size.width(), location.y() + size.height()); - vertex(location.x(), location.y() + size.height()); + vertex(global_location.x(), global_location.y()); + vertex(global_location.x() + size.width(), global_location.y()); + vertex(global_location.x() + size.width(), global_location.y() + size.height()); + vertex(global_location.x(), global_location.y() + size.height()); end(); } -void rectangle(const math::Vector2f &location, const math::Vector2f &size) +void Paint::draw_rectangle(const math::Vector2f &global_location, const math::Vector2f &size) { using namespace gl; begin(Quads); - vertex(location.x(), location.y()); - vertex(location.x() + size.width(), location.y()); - vertex(location.x() + size.width(), location.y() + size.height()); - vertex(location.x(), location.y() + size.height()); + vertex(global_location.x(), global_location.y()); + vertex(global_location.x() + size.width(), global_location.y()); + vertex(global_location.x() + size.width(), global_location.y() + size.height()); + vertex(global_location.x(), global_location.y() + size.height()); end(); } // draw a bitmap -void bitmap(const math::Vector2f &location, const math::Vector2f &size, std::string const &texture) +void Paint::draw_bitmap(const math::Vector2f &global_location, const math::Vector2f &size, const std::string &texture) { - render::Textures::bind("bitmaps/" + texture); + render::Textures::bind(texture); gl::enable(GL_TEXTURE_2D); gl::begin(gl::Quads); glTexCoord2f(0.0f, 0.0f); - gl::vertex(location.x(), location.y()); + gl::vertex(global_location.x(), global_location.y()); glTexCoord2f(1.0f, 0.0f); - gl::vertex(location.x() + size.width(), location.y()); + gl::vertex(global_location.x() + size.width(), global_location.y()); glTexCoord2f(1.0f, 1.0f); - gl::vertex(location.x() + size.width(), location.y() + size.height()); + gl::vertex(global_location.x() + size.width(), global_location.y() + size.height()); glTexCoord2f(0.0f, 1.0f); - gl::vertex(location.x(), location.y() + size.height()); + gl::vertex(global_location.x(), global_location.y() + size.height()); gl::end(); gl::disable(GL_TEXTURE_2D); } + +// draw unaligned text +void Paint::draw_text(const math::Vector2f &global_location, const Font *font, const std::string &text) +{ + render::Text::setfont(font->name().c_str(), font->width(), font->height()); + + // enable OpenGL textures + gl::enable(GL_TEXTURE_2D); + + render::Text::draw(global_location.x(), global_location.y(), text); + + // disable OpenGL textures + gl::disable(GL_TEXTURE_2D); +} + // draw aligned text -void label(const math::Vector2f &location, const math::Vector2f &size, const Font *font, const std::string &text, unsigned int align) +void Paint::draw_label(const math::Vector2f &global_location, const math::Vector2f &size, const Font *font, const std::string &text, const unsigned int alignment) { - unsigned int align_horizontal = (align & 0x000F); + unsigned int align_horizontal = (alignment & 0x000F); if (!align_horizontal) align_horizontal = AlignLeft; - unsigned int align_vertical = (align & 0x00F0); + unsigned int align_vertical = (alignment & 0x00F0); if (!align_vertical) align_vertical = AlignTop; @@ -110,7 +120,7 @@ void label(const math::Vector2f &location, const math::Vector2f &size, const Fon float text_width = (float) aux::text_strip(text).size() * font->width(); // calculate drawing position - math::Vector2f v(location); + math::Vector2f v(global_location); switch (align_horizontal) { case AlignLeft: @@ -143,20 +153,7 @@ void label(const math::Vector2f &location, const math::Vector2f &size, const Fon } -// draw unaligned text -void text(const math::Vector2f &location, const math::Vector2f &size, const Font *font, const std::string &text) -{ - render::Text::setfont(font->name().c_str(), font->width(), font->height()); - - // enable OpenGL textures - gl::enable(GL_TEXTURE_2D); - - render::Text::draw(location.x(), location.y(), text); - - // disable OpenGL textures - gl::disable(GL_TEXTURE_2D); -} - +/* // draw unaligned text void text(const math::Vector2f &location, const math::Vector2f &size, const Font *font, std::stringstream & textstream) { @@ -171,7 +168,6 @@ void text(const math::Vector2f &location, const math::Vector2f &size, const Font // disable OpenGL textures gl::disable(GL_TEXTURE_2D); } +*/ -} - -} +} //namespace ui diff --git a/src/ui/paint.h b/src/ui/paint.h index 1d28574..2c48a35 100644 --- a/src/ui/paint.h +++ b/src/ui/paint.h @@ -9,46 +9,46 @@ #include "ui/widget.h" -namespace ui -{ - -/// low-level widget paint functions -namespace paint -{ +namespace ui { -/// assign system colors -void assign_color(const char c, const math::Color &color); +/** + * @brief low-level widget paint functions + * This class contains the interface between the user interface and the render library + */ -/// set paint color -void color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f); - -/// set paint color -void color(math::Color const & color); +class Paint +{ +public: + /// set paint color to RGB value + static void set_color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f); -/// set paint color -void color_code(const char c); + /// set paint color to RGB value + static void set_color(math::Color const & color); -/// draw a border -void border(const math::Vector2f &location, const math::Vector2f &size); + /// set paint color to system color code + static void set_system_color(const char c); -/// draw a rectangle -void rectangle(const math::Vector2f &location, const math::Vector2f &size); + /// assign system color code + static void assign_system_color(const char c, const math::Color &color); -/// draw a rectangular bitmap -void bitmap(const math::Vector2f &location, const math::Vector2f &size, std::string const &texture); + /// draw a border + static void draw_border(const math::Vector2f &global_location, const math::Vector2f &size); -/// draw aligned text -void label(const math::Vector2f &location, const math::Vector2f &size, const Font *font, const std::string &text, unsigned int align = AlignCenter); + /// draw a rectangle + static void draw_rectangle(const math::Vector2f &global_location, const math::Vector2f &size); -/// draw unaligned text -void text(const math::Vector2f &location, const math::Vector2f &size, const Font *font, const std::string &text); + /// draw a rectangular bitmap + static void draw_bitmap(const math::Vector2f &global_location, const math::Vector2f &size, const std::string &texture); -/// draw unaligned text -void text(const math::Vector2f &location, const math::Vector2f &size, const Font *font, std::stringstream & textstream); + /// draw unaligned text + static void draw_text(const math::Vector2f &global_location, const Font *font, const std::string &text); + + /// draw aligned text + static void draw_label(const math::Vector2f &global_location, const math::Vector2f &size, const Font *font, const std::string &text, const unsigned int alignment = AlignCenter); -} +}; -} +} // namespace ui #endif // __INCLUDED_UI_PAINT_H__ diff --git a/src/ui/plaintext.cc b/src/ui/plaintext.cc new file mode 100644 index 0000000..33e10fc --- /dev/null +++ b/src/ui/plaintext.cc @@ -0,0 +1,58 @@ +/* + ui/text.cc + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#include "ui/paint.h" +#include "ui/plaintext.h" + +namespace ui +{ + +PlainText::PlainText(Widget *parent, const char *text) : Widget(parent) +{ + set_label("text"); + set_text(text); +} + +PlainText::~PlainText() +{ +} + +void PlainText::print(const size_t indent) const +{ + std::string marker(""); + con_print << aux::pad_left(marker, indent*2) << label() << " \"" << text() << "\"" << std::endl; +} + +void PlainText::clear() +{ + widget_text.clear(); +} + +void PlainText::set_text(const char *text) +{ + if (text) + widget_text.assign(text); + else + widget_text.clear(); +} + +void PlainText::set_text(const std::string &text) +{ + widget_text.assign(text); +} + +void PlainText::draw() +{ + if (!text().size()) + return; + + Paint::set_color(palette()->foreground()); + Paint::draw_text(global_location(), font(), text()); +} + +} + + diff --git a/src/ui/plaintext.h b/src/ui/plaintext.h new file mode 100644 index 0000000..b2fd7fb --- /dev/null +++ b/src/ui/plaintext.h @@ -0,0 +1,63 @@ +/* + ui/text.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_UI_PLAINTEXT_H__ +#define __INCLUDED_UI_PLAINTEXT_H__ + +#include <string> +#include "ui/widget.h" + +namespace ui +{ + +/** + * @brief a widget displaying unaligned text without wrapping + */ +class PlainText : public Widget +{ +public: + PlainText(Widget *parent, const char *text = 0); + ~PlainText(); + + /** + * @brief the text the widget is currently displaying + */ + inline const std::string & text() const { + return widget_text; + } + + /** + * @brief set the text to be displayed + * @param text text, can contain end-of-line characters + */ + void set_text(const std::string & text); + + /** + * @brief set the text to be displayed + * @param text text, can contain end-of-line characters + */ + void set_text(const char *text); + + /** + * @brief clear the text + */ + void clear(); + + /// print widget description + virtual void print(const size_t indent) const; + +protected: + /// draw the widget + virtual void draw(); + +private: + std::string widget_text; +}; + +} + +#endif // __INCLUDED_UI_PLAINTEXT_H__ + diff --git a/src/ui/ui.cc b/src/ui/ui.cc index a6d54ab..5faf9fd 100644 --- a/src/ui/ui.cc +++ b/src/ui/ui.cc @@ -360,12 +360,12 @@ void UI::apply_render_options() { //con_debug << " initializing text colors" << std::endl; // apply palette colors - paint::assign_color('N', palette()->text()); - paint::assign_color('D', palette()->debug()); - paint::assign_color('B', palette()->bold()); - paint::assign_color('F', palette()->fancy()); - paint::assign_color('W', palette()->warning()); - paint::assign_color('E', palette()->error()); + Paint::assign_system_color('N', palette()->text()); + Paint::assign_system_color('D', palette()->debug()); + Paint::assign_system_color('B', palette()->bold()); + Paint::assign_system_color('F', palette()->fancy()); + Paint::assign_system_color('W', palette()->warning()); + Paint::assign_system_color('E', palette()->error()); } @@ -567,11 +567,12 @@ void UI::draw_pointer() } else { c.a = 0.5f; } - paint::color(c); + Paint::set_color(c); + math::Vector2f pos(mouse_cursor.x() - pointer_size * 0.5f, mouse_cursor.y() - pointer_size * 0.5f); math::Vector2f s(pointer_size, pointer_size); - std::string texture("pointers/"); + std::string texture("bitmaps/pointers/"); texture.append(mouse_pointer_bitmap); if (mouse_pointer_animated) { @@ -584,7 +585,7 @@ void UI::draw_pointer() gl::translate(-mouse_cursor.x(), -mouse_cursor.y(), 0); } - paint::bitmap(pos, s, texture); + Paint::draw_bitmap(pos, s, texture); if (mouse_pointer_animated) { gl::pop(); diff --git a/src/ui/widget.cc b/src/ui/widget.cc index 79281a1..b3aa27c 100644 --- a/src/ui/widget.cc +++ b/src/ui/widget.cc @@ -432,20 +432,20 @@ bool Widget::on_emit(Widget *sender, const Event event, void *data) void Widget::draw_debug_border() { - paint::color(1.0f, 0.0f, 1.0f, 0.5f); - paint::border(global_location(), size()); + Paint::set_color(1.0f, 0.0f, 1.0f, 0.5f); + Paint::draw_border(global_location(), size()); } void Widget::draw_background() { - paint::color(palette()->background()); - paint::rectangle(global_location(), size()); + Paint::set_color(palette()->background()); + Paint::draw_rectangle(global_location(), size()); } void Widget::draw_border() { - paint::color(palette()->border()); - paint::border(global_location(), size()); + Paint::set_color(palette()->border()); + Paint::draw_border(global_location(), size()); } void Widget::draw() diff --git a/src/ui/window.cc b/src/ui/window.cc index 0e545be..8571eec 100644 --- a/src/ui/window.cc +++ b/src/ui/window.cc @@ -47,8 +47,8 @@ void Window::clear_previous() void Window::draw_border() { - paint::color(palette()->border()); - paint::border(global_location(), size()); + Paint::set_color(palette()->border()); + Paint::draw_border(global_location(), size()); } } |