Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/util/network_stats_widget.cc @ 9330

Last change on this file since 9330 was 9330, checked in by bensch, 18 years ago

orxonox/proxy added network_stats_widget to display the network statistics on the fly

File size: 2.1 KB
RevLine 
[4744]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
[9014]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[3955]16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
[1853]17
[9330]18#include "network_stats_widget.h"
[1853]19
[8972]20namespace OrxGui
[3365]21{
[8972]22  /**
23   * @brief standard constructor
[8981]24   */
[9330]25  NetworkStatsWidget::NetworkStatsWidget ()
[8972]26  {
[9330]27    //   this->setClassID(CL_PROTO_ID, "NetworkStatsWidget");
[8983]28
29    this->_bar.setSize2D(100, 30);
[8980]30    this->pack(&this->_valueText);
[8988]31    this->_bar.setParent2D(&this->_valueText);
[8973]32
[8991]33    this->_valueText.setChangedTextColor(Color::white);
34
35    //this->setBackgroundTexture("maps/gui_element_background_2.png");
[8980]36    this->setBackgroundColor(Color(.5,.5,.5,1));
37
[8991]38    //this->_name.setBackgroundTexture(Texture());
39    //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");
[8980]40    this->_bar.setBackgroundTexture(Texture());
[8983]41    this->_bar.setBackgroundColor(Color(0,0,0,0));
[8990]42    this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
[8984]43    this->_bar.setForegroundColor(Color(.5, .5, .5, 1));
[8991]44    this->_bar.setChangedValueColor(Color::black);
[8972]45  }
[4320]46
47
[8972]48  /**
49   * @brief standard deconstructor
[4320]50   */
[9330]51  NetworkStatsWidget::~NetworkStatsWidget ()
[8972]52  {
53  }
[8974]54
55
[9330]56  void NetworkStatsWidget::setMaximum(float max)
[8977]57  {
[8980]58    this->_bar.setMaximum(max);
[8974]59  }
60
[9330]61  void NetworkStatsWidget::setValue(float value)
[8974]62  {
[8976]63    MultiType val(value);
64    val.setType(MT_INT);
[8974]65
[8984]66
[8980]67    this->_bar.setValue(value);
[8986]68    this->_bar.setForegroundColor(Color::slerpHSVColor(Color::red, Color::green, value/this->_bar.maximum()));
[8985]69    this->_bar.setFrontColor(Color(1,1,1,1), true);
[8980]70    this->_valueText.setText(val.getString());
[8974]71  }
72
[9330]73  void NetworkStatsWidget::resize()
[8981]74  {
75    GLGuiBox::resize();
76  }
[8974]77
[8981]78
[9330]79  void NetworkStatsWidget::showing()
[8975]80  {
[8980]81    this->_valueText.show();
82    this->_bar.show();
[8975]83  }
[8974]84
[9330]85  void NetworkStatsWidget::hiding()
[8975]86  {
[8980]87    this->_valueText.hide();
88    this->_bar.hide();
[8975]89  }
[3365]90}
Note: See TracBrowser for help on using the repository browser.