From 4331f5c17901f46693dcb5c2df96276f6851be25 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 8 Oct 2008 18:28:21 +0000 Subject: libui updates, paint namespace, font and palette fixes, button sound --- src/ui/button.cc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/ui/button.cc') diff --git a/src/ui/button.cc b/src/ui/button.cc index e06e883..d6384c9 100644 --- a/src/ui/button.cc +++ b/src/ui/button.cc @@ -4,8 +4,9 @@ the terms of the GNU General Public License version 2 */ +#include "audio/audio.h" #include "auxiliary/functions.h" -#include "render/primitives.h" +#include "ui/paint.h" #include "sys/sys.h" #include "ui/button.h" #include "core/commandbuffer.h" @@ -46,13 +47,11 @@ void Button::draw_border() if (!border()) return; - if (palette()) { - if (has_focus()) - render::gl::color(palette()->foreground()); - else - render::gl::color(palette()->border()); - } - render::primitives::border(global_location(), size()); + if (has_focus()) + paint::color(palette()->foreground()); + else + paint::color(palette()->border()); + paint::border(global_location(), size()); } void Button::draw_text() @@ -60,14 +59,12 @@ void Button::draw_text() if (!text().size()) return; - if (palette()) { - if (has_focus()) - render::gl::color(palette()->highlight()); - else - render::gl::color(palette()->foreground()); - } + if (has_focus()) + paint::color(palette()->highlight()); + else + paint::color(palette()->foreground()); - render::primitives::text_centered(global_location(), size(), text()); + paint::text_centered(global_location(), size(), text(), font()); } void Button::keypress(unsigned int key, unsigned int modifier) @@ -79,6 +76,7 @@ void Button::keyrelease(unsigned int key, unsigned int modifier) { if (key == 512 + SDL_BUTTON_LEFT) { core::cmd() << button_command << std::endl; + audio::play("ui/button"); } } -- cgit v1.2.3