From 02fcd22d8cde355aa898a8c6bb4773d9434b8e9a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 10 Oct 2008 16:41:38 +0000 Subject: adds KeyPress, DevInfo and Stats widgets --- src/client/view.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) (limited to 'src/client/view.h') diff --git a/src/client/view.h b/src/client/view.h index 1f81597..e5e42bc 100644 --- a/src/client/view.h +++ b/src/client/view.h @@ -7,12 +7,79 @@ #define __INCLUDED_CLIENT_VIEW_H__ #include "core/zone.h" +#include "ui/widget.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); + +protected: + virtual void draw(); + virtual void resize(); + +private: + DevInfo *view_devinfo; + Stats *view_stats; + KeyPress *view_keypress; +}; + /// functions to draw the client view -namespace view +namespace view { /// intialize the view void init(); -- cgit v1.2.3