Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/mainwindow.cc')
-rw-r--r--src/client/mainwindow.cc92
1 files changed, 56 insertions, 36 deletions
diff --git a/src/client/mainwindow.cc b/src/client/mainwindow.cc
index 91cb9b4..698c5b3 100644
--- a/src/client/mainwindow.cc
+++ b/src/client/mainwindow.cc
@@ -18,15 +18,25 @@ MainWindow::MainWindow(ui::Widget *parent) : ui::Widget(parent)
set_border(false);
set_background(false);
- // add child widgets
- mainwindow_devinfo = new DevInfoWidget(this);
- mainwindow_statsinfo = new StatsInfoWidget(this);
- mainwindow_keyinfo = new KeyInfoWidget(this);
- mainwindow_clock = new ClockInfoWidget(this);
-
- mainwindow_playerview = new PlayerView(this);
- mainwindow_playerview->raise();
- mainwindow_playerview->hide();
+ // console notifications widget
+ mainwindow_notificationswidget = new Notifications(this);
+
+ // developer info widget
+ mainwindow_devinfowidget = new DevInfoWidget(this);
+
+ // statistics widget
+ mainwindow_statsinfowidget = new StatsInfoWidget(this);
+
+ // key info widget
+ mainwindow_keyinfowidget = new KeyInfoWidget(this);
+
+ // clock widget
+ mainwindow_clockwidget = new ClockInfoWidget(this);
+
+ // game window
+ mainwindow_gamewindow = new GameWindow(this);
+ mainwindow_gamewindow->raise();
+ mainwindow_gamewindow->hide();
}
MainWindow::~MainWindow()
@@ -41,62 +51,72 @@ void MainWindow::resize()
//const float largemargin = ui::UI::elementsize.width() * 0.25
const float smallmargin = ui::UI::elementsize.height();
- // resize player view
- mainwindow_playerview->set_size(size());
-
+ // reposition notifications
+ mainwindow_notificationswidget->set_size(width() - smallmargin * 2, height() - smallmargin * 4);
+ mainwindow_notificationswidget->set_location(smallmargin, smallmargin * 2);
+
// reposition devinfo widget
- mainwindow_devinfo->set_size(font()->width()*32, font()->height()*5);
- mainwindow_devinfo->set_location(smallmargin, smallmargin);
+ mainwindow_devinfowidget->set_size(font()->width()*32, font()->height()*5);
+ mainwindow_devinfowidget->set_location(smallmargin, smallmargin);
// reposition stats widget
- mainwindow_statsinfo->set_size(font()->width()*12, font()->height()*5);
- mainwindow_statsinfo->set_location(width() - mainwindow_statsinfo->width() - smallmargin, smallmargin);
+ mainwindow_statsinfowidget->set_size(font()->width()*12, font()->height()*5);
+ mainwindow_statsinfowidget->set_location(width() - mainwindow_statsinfowidget->width() - smallmargin, smallmargin);
// reposition clock
- mainwindow_clock->set_size(font()->width()*7, font()->height());
- mainwindow_clock->set_location(width() - mainwindow_clock->width() - smallmargin, mainwindow_statsinfo->bottom() + smallmargin);
+ mainwindow_clockwidget->set_size(font()->width()*7, font()->height());
+ mainwindow_clockwidget->set_location(width() - mainwindow_clockwidget->width() - smallmargin, mainwindow_statsinfowidget->bottom() + smallmargin);
// reposition keypress widget
- mainwindow_keyinfo->set_size(font()->width()*12, font()->height()*1);
- mainwindow_keyinfo->set_location(width() - mainwindow_keyinfo->width() - smallmargin,
- height() - mainwindow_keyinfo->height() - smallmargin);
+ mainwindow_keyinfowidget->set_size(font()->width()*12, font()->height()*1);
+ mainwindow_keyinfowidget->set_location(width() - mainwindow_keyinfowidget->width() - smallmargin,
+ height() - mainwindow_keyinfowidget->height() - smallmargin);
+
+ // resize game window
+ mainwindow_gamewindow->set_size(size());
}
void MainWindow::clear()
{
- mainwindow_playerview->clear();
+ // clear console notifications
+ mainwindow_notificationswidget->clear();
+
+ // clear the game window
+ mainwindow_gamewindow->clear();
}
void MainWindow::event_text(const std::string & text)
{
- mainwindow_playerview->event_text(text);
+ mainwindow_notificationswidget->event_text(text);
+ mainwindow_gamewindow->event_text(text);
}
void MainWindow::draw()
{
- // the mianwindow is only drawn when the application is connected
+ // the mainwindow is only drawn if the application is connected
// and the loader screen is not shown
- // FIXME the mainwindow should alway be visible, except in the loader screen
- mainwindow_devinfo->set_visible(draw_devinfo->value() ? true : false);
- mainwindow_statsinfo->set_visible(draw_stats->value() ? true : false);
- mainwindow_keyinfo->set_visible(draw_keypress->value() ? true : false);
+ mainwindow_devinfowidget->set_visible(draw_devinfo->value() > 0 ? true : false);
+
+ mainwindow_statsinfowidget->set_visible(draw_stats->value() > 0 ? true : false);
+
+ mainwindow_keyinfowidget->set_visible(draw_keypress->value() > 0 ? true : false);
+
if (draw_clock->value() <= 0) {
- mainwindow_clock->set_mode(ClockInfoWidget::ClockOff);
+ mainwindow_clockwidget->set_mode(ClockInfoWidget::ClockOff);
} else if (draw_clock->value() >= 2) {
- mainwindow_clock->set_mode(ClockInfoWidget::Clock12Hours);
+ mainwindow_clockwidget->set_mode(ClockInfoWidget::Clock12Hours);
} else {
- mainwindow_clock->set_mode(ClockInfoWidget::Clock24Hours);
+ mainwindow_clockwidget->set_mode(ClockInfoWidget::Clock24Hours);
}
-
// FIXME - either draw one of the menus or draw the playerview
if (ui::root()->active() || !core::game()->interactive() || !core::localcontrol() || (core::localplayer()->view() && !core::localplayer()->view()->menus().size())) {
- mainwindow_playerview->hide();
+ if (mainwindow_gamewindow->visible())
+ mainwindow_gamewindow->hide();
} else {
- mainwindow_playerview->show();
- mainwindow_playerview->set_focus();
-
+ if (!mainwindow_gamewindow->visible())
+ mainwindow_gamewindow->show();
}
}