From 06212c7d8dc20b11f49d54e42f8299740f90a231 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 9 Nov 2008 17:44:24 +0000 Subject: improved client notifications, minor bugfixes --- src/client/input.cc | 2 +- src/client/notifications.cc | 5 ++++- src/client/targets.cc | 2 +- src/client/view.cc | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/client') diff --git a/src/client/input.cc b/src/client/input.cc index dcddea3..f8c756f 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -111,7 +111,7 @@ void func_screenshot(std::string const & args) void func_ui_control(std::string const &args) { - if (!core::localcontrol()) + if (!core::localcontrol() || core::localplayer()->view()) return; if (input_mousecontrol->value() > 0) { diff --git a/src/client/notifications.cc b/src/client/notifications.cc index 256f110..25cbe0b 100644 --- a/src/client/notifications.cc +++ b/src/client/notifications.cc @@ -6,6 +6,7 @@ #include "client/notifications.h" #include "core/application.h" +#include "ui/ui.h" namespace client { @@ -20,6 +21,7 @@ Notifications::Notifications(ui::Widget *parent) : ui::Widget(parent) notify_scrollpane = new ui::ScrollPane(this, notify_log); notify_scrollpane->set_border(false); + notify_scrollpane->set_alignment(ui::AlignTop); } Notifications::~Notifications() @@ -54,13 +56,14 @@ void Notifications::draw() t = notify_timestamp.begin(); } - const float margin = 8.0f; + const float margin = ui::UI::elementmargin; math::Vector2f s(size()); s.x -= margin*2; s.y -= margin*2; notify_scrollpane->set_location(margin, margin); notify_scrollpane->set_size(s.x, s.y ); + } diff --git a/src/client/targets.cc b/src/client/targets.cc index c7fcf9e..04a4463 100644 --- a/src/client/targets.cc +++ b/src/client/targets.cc @@ -430,7 +430,7 @@ void draw() render_entity_sound(static_cast(entity)); } // find the current target - if (core::localcontrol() && is_legal_target(entity)) { + if (!core::localplayer()->view() && core::localcontrol() && is_legal_target(entity)) { if (entity->id() == current_target_id) { current_target = entity; diff --git a/src/client/view.cc b/src/client/view.cc index 304d2a5..42ace02 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -208,10 +208,6 @@ void View::resize() view_devinfo->set_size(font()->width()*32, font()->height()*5); view_devinfo->set_location(font()->width() * 0.5f, font()->height() * 0.5f); - // reposition notifications widget - view_notify->set_location(font()->width(), view_devinfo->top() + view_devinfo->height() + font()->height()); - view_notify->set_size(width() - font()->width() * 2, height() * 0.5f - view_notify->top()); - // reposition stats widget view_stats->set_size(font()->width()*12, font()->height()*5); view_stats->set_location(width() - view_stats->width() - font()->width() * 0.5, font()->height() * 0.5f); @@ -225,6 +221,10 @@ void View::resize() view_center->set_size(ui::pointer_size, ui::pointer_size); view_center->set_location((size() - view_center->size()) * 0.5f); view_center->set_color(palette()->pointer()); + + // reposition notifications + view_notify->set_location(ui::UI::elementsize.width()*2.0f+ font()->width(), view_devinfo->top() + view_devinfo->height() + font()->height()); + view_notify->set_size(width() - ui::UI::elementsize.width()*2.0f - font()->width() * 2, height() * 0.5f - view_notify->top()); } void View::draw() -- cgit v1.2.3