blob: c9c91569eadfc83821356864104dee2e2eabfaf2 (
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/*
client/view.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_VIEW_H__
#define __INCLUDED_CLIENT_VIEW_H__
#include "core/zone.h"
#include "client/chat.h"
#include "client/notifications.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 DevInfo : public ui::Widget
{
public:
/// default constructor
DevInfo(ui::Widget *parent = 0);
protected:
/// draw developer info
void draw();
};
/// a widget that shows engine statistics
class Stats : public ui::Widget
{
public:
/// default constructor
Stats(ui::Widget *parent=0);
protected:
/// draw engine statistics
virtual void draw();
private:
float fps_counter_time[fps_counter_size];
size_t fps_counter_index;
float 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 KeyPress : public ui::Widget
{
public:
// default constructor
KeyPress(ui::Widget *parent=0);
protected:
// draw keypress events
virtual void draw();
};
/// the client view widget
/**
* the client view renders the world and contains the main user interface widgets
*/
class View : public ui::Widget
{
public:
View(ui::Widget *parent=0);
inline Chat *chat() { return view_chat; }
inline Notifications *notify() { return view_notify; }
protected:
virtual void draw();
virtual void resize();
private:
Chat *view_chat;
DevInfo *view_devinfo;
Stats *view_stats;
KeyPress *view_keypress;
Notifications *view_notify;
ui::Bitmap *view_center;
};
/// functions to draw the client view
namespace view
{
/// intialize the view
void init();
/// shutdown the view
void shutdown();
/// draw the next frame
void frame(float elapsed);
/// reset OpenGL state
void reset();
/// clear client-side assets of a zone
void clear_zone(core::Zone *zone);
} // namespace view
} // namespace client
#endif // __INCLUDED_CLIENT_VIEW_H__
|