Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
displaytext.h
1 // * This file is part of the COLOBOT source code
2 // * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3 // * Copyright (C) 2012, Polish Portal of Colobot (PPC)
4 // *
5 // * This program is free software: you can redistribute it and/or modify
6 // * it under the terms of the GNU General Public License as published by
7 // * the Free Software Foundation, either version 3 of the License, or
8 // * (at your option) any later version.
9 // *
10 // * This program is distributed in the hope that it will be useful,
11 // * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // * GNU General Public License for more details.
14 // *
15 // * You should have received a copy of the GNU General Public License
16 // * along with this program. If not, see http://www.gnu.org/licenses/.
17 
18 // displaytext.h
19 
20 #pragma once
21 
22 
23 #include "common/event.h"
24 #include "common/global.h"
25 
26 #include "sound/sound.h"
27 
28 
29 
30 class CObject;
31 class CSound;
32 
33 namespace Gfx {
34 class CEngine;
35 }
36 
37 namespace Ui {
38 
39 class CInterface;
40 
41 enum TextType
42 {
43  TT_ERROR = 1,
44  TT_WARNING = 2,
45  TT_INFO = 3,
46  TT_MESSAGE = 4,
47 };
48 
49 const int MAXDTLINE = 4;
50 
51 
53 {
54 public:
55  CDisplayText();
56  ~CDisplayText();
57 
58  void DeleteObject();
59 
60  bool EventProcess(const Event &event);
61 
62  void DisplayError(Error err, CObject* pObj, float time=10.0f);
63  void DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f);
64  void DisplayText(const char *text, CObject* pObj, float time=10.0f, TextType type=TT_INFO);
65  void DisplayText(const char *text, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f, TextType type=TT_INFO);
66  void HideText(bool bHide);
67  void ClearText();
68  bool ClearLastText();
69  void SetDelay(float factor);
70  void SetEnable(bool bEnable);
71 
72  Math::Vector GetVisitGoal(EventType event);
73  float GetVisitDist(EventType event);
74  float GetVisitHeight(EventType event);
75 
76  float GetIdealDist(CObject* pObj);
77  float GetIdealHeight(CObject* pObj);
78 
79  void ClearVisit();
80  void SetVisit(EventType event);
81  bool IsVisit(EventType event);
82 
83 protected:
84  CObject* SearchToto();
85 
86 protected:
87  Gfx::CEngine* m_engine;
88  Ui::CInterface* m_interface;
89  CSoundInterface* m_sound;
90 
91  bool m_bExist[MAXDTLINE];
92  float m_time[MAXDTLINE];
93  Math::Vector m_visitGoal[MAXDTLINE];
94  float m_visitDist[MAXDTLINE];
95  float m_visitHeight[MAXDTLINE];
96 
97  bool m_bHide;
98  bool m_bEnable;
99  float m_delayFactor;
100 };
101 
102 
103 } // namespace Ui
104 
Sound plugin interface.
Definition: displaytext.h:52
Some common, global definitions.
The graphics engine.
Definition: engine.h:681
Event types, structs and event queue.
Error
Type of error or info message.
Definition: global.h:29
3D (3x1) vector
Definition: vector.h:49
EventType
Type of event message.
Definition: event.h:35
Event sent by system, interface or game.
Definition: event.h:687
Definition: interface.h:56
Definition: object.h:372
Sound plugin interface.
Definition: sound.h:149