Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-10-01 22:07:45 +0000
committerStijn Buys <ingar@osirion.org>2010-10-01 22:07:45 +0000
commit25af16fac3127523d532d4b4797eec7947ed5a72 (patch)
treee0a1f59452f16c100ceaca3050f0b369d32b6e18 /src/client/playerview.cc
parent8b67219f7de2971114a81c5476dae578ac29e989 (diff)
Initial inventory window
Diffstat (limited to 'src/client/playerview.cc')
-rw-r--r--src/client/playerview.cc64
1 files changed, 53 insertions, 11 deletions
diff --git a/src/client/playerview.cc b/src/client/playerview.cc
index 7791a2a..159371c 100644
--- a/src/client/playerview.cc
+++ b/src/client/playerview.cc
@@ -36,6 +36,7 @@ PlayerView::PlayerView(ui::Widget *parent) : ui::Widget(parent)
view_entitymenu = new EntityMenu(this);
view_buymenu = new BuyMenu(this);
view_trademenu = new TradeMenu(this);
+ view_inventory = new Inventory(this);
//view_hud->set_focus();
//view_hud->raise();
@@ -68,11 +69,17 @@ void PlayerView::toggle_map()
{
if (!map()->visible()) {
- if (chat()->visible() && !chat()->small_view())
+ if (chat()->visible() && !chat()->small_view()) {
chat()->hide();
+ }
- if (view_entitymenu->visible())
+ if (inventory()->visible()) {
+ inventory()->hide();
+ }
+
+ if (view_entitymenu->visible()) {
view_entitymenu->hide();
+ }
}
map()->toggle();
@@ -83,11 +90,40 @@ void PlayerView::toggle_map()
}
}
+void PlayerView::toggle_inventory()
+{
+
+ if (!inventory()->visible()) {
+ if (chat()->visible() && !chat()->small_view()) {
+ chat()->hide();
+ }
+
+ if (map()->visible()) {
+ map()->hide();
+ }
+
+ if (view_entitymenu->visible()) {
+ view_entitymenu->hide();
+ }
+ }
+
+ inventory()->toggle();
+ audio::play("ui/menu");
+
+ if (inventory()->visible() && chat()->visible() && chat()->small_view()) {
+ chat()->raise();
+ }
+}
+
void PlayerView::toggle_chat()
{
if (!chat()->visible()) {
if (map()->visible())
map()->hide();
+
+ if (inventory()->visible()) {
+ inventory()->hide();
+ }
if (view_entitymenu->visible())
view_entitymenu->hide();
@@ -189,7 +225,11 @@ void PlayerView::resize()
// reposition map
view_map->set_size(width() - smallmargin * 2, height() - smallmargin * 4);
view_map->set_location(smallmargin, smallmargin * 2);
-
+
+ // reposition inventory
+ view_inventory->set_size(width() - smallmargin * 2, height() - smallmargin * 4);
+ view_inventory->set_location(smallmargin, smallmargin * 2);
+
// reposition notifications
view_notify->set_geometry(view_map->location(), view_map->size());
@@ -228,7 +268,7 @@ void PlayerView::draw()
audio::play("ui/menu");
} else if (!view_entitymenu->visible() && !view_buymenu->visible() && !view_trademenu->visible() &&
- !map()->visible() && (!chat()->visible() || chat()->small_view())) {
+ !inventory()->visible() && !map()->visible() && (!chat()->visible() || chat()->small_view())) {
// show the menu if there's no other window open
view_entitymenu->show();
@@ -270,7 +310,7 @@ void PlayerView::draw()
label_viewname->hide();
}
- if (!map()->visible() && !chat()->visible()) {
+ if (!map()->visible() && !chat()->visible() && !inventory()->visible()) {
view_hud->set_focus();
}
@@ -278,13 +318,15 @@ void PlayerView::draw()
}
// reposition chat widget
- if (view_chat->small_view()) {
- view_chat->set_size(width() - smallmargin * 2, font()->height() * 2);
- view_chat->set_location(smallmargin, height() - smallmargin *2 - view_chat->height());
- } else {
- view_chat->set_geometry(view_map->location(), view_map->size());
+ if (chat()->visible()) {
+ if (view_chat->small_view()) {
+ view_chat->set_size(width() - smallmargin * 2, font()->height() * 2);
+ view_chat->set_location(smallmargin, height() - smallmargin *2 - view_chat->height());
+ } else {
+ view_chat->set_geometry(view_map->location(), view_map->size());
+ }
+ view_chat->event_resize();
}
- view_chat->event_resize();
}
}