blob: d2936e4cb3e8932cc6ec94ae103b49abd9aab38a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/*
client/infowidget.h
This file is part of the Osirion project and is distributed under
the terms and conditions of the GNU General Public License version 2
*/
#ifndef __INCLUDED_CLIENT_INFOWIDGET_H__
#define __INCLUDED_CLIENT_INFOWIDGET_H__
#include "ui/widget.h"
#include "ui/bitmap.h"
namespace client
{
const size_t fps_counter_size = 32; // fps is the average of 32 frames
const size_t net_counter_size = 128; // net is the average of 128 frames
/// a widget to show developer info
class DevInfoWidget : public ui::Widget
{
public:
/// default constructor
DevInfoWidget(ui::Widget *parent = 0);
protected:
/// draw developer info
virtual void draw();
};
/// a widget that shows engine statistics
class StatsInfoWidget : public ui::Widget
{
public:
/// default constructor
StatsInfoWidget(ui::Widget *parent = 0);
protected:
/// draw engine statistics
virtual void draw();
private:
unsigned long fps_counter_time[fps_counter_size];
size_t fps_counter_index;
unsigned long net_counter_time[net_counter_size];
size_t net_counter_traffic[net_counter_size];
size_t net_counter_index;
};
/// a widget to show keypress events
class KeyInfoWidget : public ui::Widget
{
public:
/// default constructor
KeyInfoWidget(ui::Widget *parent = 0);
protected:
/// draw keypress events
virtual void draw();
};
/// a widget to show keypress events
class ClockInfoWidget : public ui::Widget
{
public:
/// clock mode
enum Mode {ClockOff=0, Clock24Hours=1, Clock12Hours=2};
/// default constructor
ClockInfoWidget(ui::Widget *parent = 0);
inline void set_mode(const Mode mode) {
clock_mode = mode;
}
inline const Mode mode() const {
return clock_mode;
}
protected:
/// draw the current time
virtual void draw();
Mode clock_mode;
};
}
#endif // __INCLUDED_CLIENT_INFOWIDGET_H__
|