File: MessageView.h

package info (click to toggle)
arkrpg 0.1.4b-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,104 kB
  • ctags: 5,445
  • sloc: cpp: 28,145; sh: 9,006; ansic: 3,259; makefile: 344
file content (71 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download | duplicates (3)
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
#ifndef MESSAGE_VIEW_H
#define MESSAGE_VIEW_H

#include <Client/GLClient.h>
#include <Client/TerrainView.h>
#include <Client/UIStyle.h>

namespace Client
{
   struct MessageLabel
   {
	 Ark::String m_Msg;
	 Ark::String m_Reply;
	 Ark::TexturePtr m_Image;
	 Ark::Entity *m_MyEntity;
	 Ark::Entity *m_DestEntity;
	 
	 Box m_Box;

      public:
	 MessageLabel ();
	 MessageLabel (const Box &bbox,
		       Ark::Entity *my,
		       const Ark::String &msg,
		       Ark::Entity *dest = NULL);

	 MessageLabel (const Box &bbox, const Ark::TexturePtr& image);

	 ~MessageLabel();
		       
	 void Render(UIRenderer *ui);

	 bool HandleMButton (bool down, int b, int x, int y);
   };

   class MessageView
   {
      public:
	 MessageView (UIRenderer *ui);
	 ~MessageView ();

	 void UpdateChildren (UIRenderer *ui, Ark::Entity *ent);
	 void Render(UIRenderer *ui, Ark::Entity *ent);

	 bool HandleMButton (bool down, int b, int x, int y);

      private:
	 Ark::Timer m_Timer;
	 bool m_HasTimeout;

	 Ark::Entity *m_PlayerEntity;

	 std::vector <MessageLabel> m_Children;
	 Style m_Style;
	 Box m_Box;

	 int m_MaxX, m_MinX, m_MinY, m_MaxY;
	 int m_PaddingX, m_PaddingY;
	 Ark::String m_FontQuestion, m_FontAnswer;

	 void AppendChild (UIRenderer *ui,
			   const Ark::String &text,
			   Ark::FontPtr font,
			   int startx,
			   Ark::Entity *ent,
			   Ark::Entity *dest = NULL);
   };

}

#endif