diff options
author | Stijn Buys <ingar@osirion.org> | 2010-10-05 14:38:14 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-10-05 14:38:14 +0000 |
commit | fed29d9ddc3b8372b9c3fe8bffe221a5a55e5ce9 (patch) | |
tree | 659096f4412e6ad9a0f47e70a620da327195e67a /src/ui | |
parent | 312b9bcb81748032ff21e3d3f1d5fd36405fb713 (diff) |
updated inventory window, listview seletion sounds, modelview zoom factor
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/button.cc | 4 | ||||
-rw-r--r-- | src/ui/iconbutton.cc | 9 | ||||
-rw-r--r-- | src/ui/listitem.cc | 8 | ||||
-rw-r--r-- | src/ui/listitem.h | 2 | ||||
-rwxr-xr-x | src/ui/modelview.cc | 4 |
5 files changed, 20 insertions, 7 deletions
diff --git a/src/ui/button.cc b/src/ui/button.cc index ddcc72d..6cbb51e 100644 --- a/src/ui/button.cc +++ b/src/ui/button.cc @@ -85,7 +85,9 @@ bool Button::on_keypress(const int key, const unsigned int modifier) { if (key == 512 + SDL_BUTTON_LEFT) { if (enabled()) { - core::cmd() << button_command << std::endl; + if (button_command.size()) { + core::cmd() << button_command << std::endl; + } audio::play("ui/button"); emit(EventButtonClicked); diff --git a/src/ui/iconbutton.cc b/src/ui/iconbutton.cc index 204918e..5f16e71 100644 --- a/src/ui/iconbutton.cc +++ b/src/ui/iconbutton.cc @@ -81,7 +81,7 @@ void IconButton::draw() Paint::set_color(palette()->foreground()); } - Paint::draw_bitmap(location(), size(), icon()); + Paint::draw_bitmap(global_location(), size(), icon()); } void IconButton::draw_border() @@ -101,9 +101,12 @@ void IconButton::draw_border() bool IconButton::on_keypress(const int key, const unsigned int modifier) { if (key == 512 + SDL_BUTTON_LEFT) { - if (enabled() && iconbutton_command.size()) { - core::cmd() << iconbutton_command << std::endl; + if (enabled()) { + if (iconbutton_command.size()) { + core::cmd() << iconbutton_command << std::endl; + } audio::play("ui/button"); + emit(EventButtonClicked); } return true; } diff --git a/src/ui/listitem.cc b/src/ui/listitem.cc index ff9ad18..8702757 100644 --- a/src/ui/listitem.cc +++ b/src/ui/listitem.cc @@ -51,10 +51,16 @@ void ListItem::draw() Paint::draw_label(global_location(), size(), font(), text(), alignment()); } +void ListItem::on_mouseover(const math::Vector2f &cursor) +{ + if (enabled()) + audio::play("ui/select"); +} + bool ListItem::on_keypress(const int key, const unsigned int modifier) { if (key == 512 + SDL_BUTTON_LEFT) { - audio::play("ui/select"); + audio::play("ui/button"); emit(EventListItemClicked); diff --git a/src/ui/listitem.h b/src/ui/listitem.h index 6fad3e9..3c9efea 100644 --- a/src/ui/listitem.h +++ b/src/ui/listitem.h @@ -52,6 +52,8 @@ protected: /// draw the button border virtual void draw_border(); + virtual void on_mouseover(const math::Vector2f &cursor); + virtual void draw(); private: diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc index b247213..9542b5f 100755 --- a/src/ui/modelview.cc +++ b/src/ui/modelview.cc @@ -69,12 +69,12 @@ void ModelView::set_zoom(const float zoom) bool ModelView::on_keypress(const int key, const unsigned int modifier) { if (key == 512 + SDL_BUTTON_WHEELUP) { - modelview_zoom -= 0.1f; + modelview_zoom -= 0.5f; if (modelview_zoom < 1.0f) modelview_zoom = 1.0f; return true; } else if (key == 512 + SDL_BUTTON_WHEELDOWN) { - modelview_zoom += 0.1f; + modelview_zoom += 0.5f; if (modelview_zoom > 10.0f) modelview_zoom = 10.0f; return true; |