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