Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/proxy switched to sigslot library, and it seems to work, but i am not entirely sure…

File size: 2.2 KB
Line 
1/*
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.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
17
18#include "network_stats_widget.h"
19
20#include "multi_type.h"
21
22namespace OrxGui
23{
24  /**
25   * @brief standard constructor
26   */
27  NetworkStatsWidget::NetworkStatsWidget ()
28  {
29    //   this->setClassID(CL_PROTO_ID, "NetworkStatsWidget");
30
31    this->_bar.setSize2D(100, 30);
32    this->pack(&this->_valueText);
33    this->_bar.setParent2D(&this->_valueText);
34
35    this->_valueText.setChangedTextColor(Color::white);
36
37    //this->setBackgroundTexture("maps/gui_element_background_2.png");
38    this->setBackgroundColor(Color(.5,.5,.5,1));
39
40    //this->_name.setBackgroundTexture(Texture());
41    //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");
42    this->_bar.setBackgroundTexture(Texture());
43    this->_bar.setBackgroundColor(Color(0,0,0,0));
44    this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
45    this->_bar.setForegroundColor(Color(.5, .5, .5, 1));
46    this->_bar.setChangedValueColor(Color::black);
47  }
48
49
50  /**
51   * @brief standard deconstructor
52   */
53  NetworkStatsWidget::~NetworkStatsWidget ()
54  {
55  }
56
57
58  void NetworkStatsWidget::setMaximum(float max)
59  {
60    this->_bar.setMaximum(max);
61  }
62
63  void NetworkStatsWidget::setValue(float value)
64  {
65    MultiType val(value);
66    val.setType(MT_INT);
67
68
69    this->_bar.setValue(value);
70    this->_bar.setForegroundColor(Color::slerpHSVColor(Color::red, Color::green, value/this->_bar.maximum()));
71    this->_bar.setFrontColor(Color(1,1,1,1), true);
72    this->_valueText.setText(val.getString());
73  }
74
75  void NetworkStatsWidget::resize()
76  {
77    GLGuiBox::resize();
78  }
79
80
81  void NetworkStatsWidget::showing()
82  {
83    this->_valueText.show();
84    this->_bar.show();
85  }
86
87  void NetworkStatsWidget::hiding()
88  {
89    this->_valueText.hide();
90    this->_bar.hide();
91  }
92}
Note: See TracBrowser for help on using the repository browser.