ScummVM API documentation
qd_interface_element_state_mode.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22
23#ifndef QDENGINE_QDCORE_QD_INTERFACE_ELEMENT_STATE_MODE_H
24#define QDENGINE_QDCORE_QD_INTERFACE_ELEMENT_STATE_MODE_H
25
26#include "common/path.h"
27#include "qdengine/qdcore/qd_contour.h"
28
29namespace QDEngine {
30
32
37public:
41
43
45
48 void set_sound_file(const Common::Path &name);
50 const Common::Path sound_file() const {
51 return _sound_file;
52 }
54 void set_sound(const qdSound *p) {
55 _sound = p;
56 }
58 const qdSound *sound() const {
59 return _sound;
60 }
62 bool has_sound() const {
63 return !_sound_file.empty();
64 }
65
67
73 return _animation_file;
74 }
76 int animation_flags() const {
77 return _animation_flags;
78 }
79
81 void set_animation_flag(int fl) {
82 _animation_flags |= fl;
83 }
85 void drop_animation_flag(int fl) {
86 _animation_flags &= ~fl;
87 }
89 bool check_animation_flag(int fl) const {
90 if (_animation_flags & fl) return true;
91 return false;
92 }
93
95 void set_animation(const qdAnimation *p) {
96 _animation = p;
97 }
99 const qdAnimation *animation() const {
100 return _animation;
101 }
103 bool has_animation() const {
104 return !_animation_file.empty();
105 }
107 bool has_contour() const {
108 return !_contour.is_contour_empty();
109 }
111 bool hit_test(int x, int y) const {
112 return _contour.is_inside(Vect2s(x, y));
113 }
114
116 bool get_contour(qdContour &cnt) const {
117 cnt = _contour;
118 return true;
119 }
121 bool set_contour(const qdContour &cnt) {
122 _contour = cnt;
123 return true;
124 }
125
126 Common::String stateMode2Str(int fl, bool truncate = false) const;
127
129
132 bool save_script(Common::WriteStream &fh, int type_id = 0, int indent = 0) const;
134 bool load_script(const xml::tag *p);
135
136private:
137
139 Common::Path _sound_file;
140
142 const qdSound *_sound;
143
145 Common::Path _animation_file;
147 int _animation_flags;
148
150 const qdAnimation *_animation;
151
153 qdContour _contour;
154};
155
156} // namespace QDEngine
157
158#endif // QDENGINE_QDCORE_QD_INTERFACE_ELEMENT_STATE_MODE_H
Definition: path.h:52
bool empty() const
Definition: path.h:353
Definition: str.h:59
Definition: stream.h:77
Definition: xmath.h:419
Анимация.
Definition: qd_animation.h:57
Контур.
Definition: qd_contour.h:39
bool is_inside(const Vect2s &pos) const
Возвращает true, если точка с координатами pos лежит внутри контура.
bool is_contour_empty() const
Возвращает true, если контур пустой.
Событие, привязанное к состоянию интерфейсного элемента.
Definition: qd_interface_element_state_mode.h:36
const Common::Path animation_file() const
Возвращает имя файла для анимации.
Definition: qd_interface_element_state_mode.h:72
void set_sound_file(const Common::Path &name)
Устанавливает имя файла звука.
bool has_sound() const
Возвращает true, если к событию привязан звук.
Definition: qd_interface_element_state_mode.h:62
bool hit_test(int x, int y) const
Возвращает true, если точка с экранными координатами (x,у) попадает внутрь контура.
Definition: qd_interface_element_state_mode.h:111
bool has_contour() const
Возвращает true, если у состояния задан контур.
Definition: qd_interface_element_state_mode.h:107
bool get_contour(qdContour &cnt) const
Записывает контур в cnt.
Definition: qd_interface_element_state_mode.h:116
const qdAnimation * animation() const
Возвращает указатель на анимацию события.
Definition: qd_interface_element_state_mode.h:99
void set_animation(const qdAnimation *p)
Устанавливает указатель на анимацию события.
Definition: qd_interface_element_state_mode.h:95
bool save_script(Common::WriteStream &fh, int type_id=0, int indent=0) const
Запись данных в скрипт.
const Common::Path sound_file() const
Возвращает имя файла звука.
Definition: qd_interface_element_state_mode.h:50
void set_animation_flag(int fl)
Устанавливает флаг анимации.
Definition: qd_interface_element_state_mode.h:81
int animation_flags() const
Возвращает флаги анимации.
Definition: qd_interface_element_state_mode.h:76
bool load_script(const xml::tag *p)
Загрузка данных из скрипта.
void drop_animation_flag(int fl)
Скидывает флаг анимации.
Definition: qd_interface_element_state_mode.h:85
const qdSound * sound() const
Возвращает звук события.
Definition: qd_interface_element_state_mode.h:58
bool check_animation_flag(int fl) const
Возвращает true, если для анимации установлен флаг fl.
Definition: qd_interface_element_state_mode.h:89
bool set_contour(const qdContour &cnt)
Устанавливает контур.
Definition: qd_interface_element_state_mode.h:121
bool has_animation() const
Возвращает true, если к состоянию привязана анимация.
Definition: qd_interface_element_state_mode.h:103
void set_sound(const qdSound *p)
Устанавливает звук события.
Definition: qd_interface_element_state_mode.h:54
void set_animation_file(const Common::Path &name)
Устанавливает имя файла для анимации.
Звук.
Definition: qd_sound.h:35
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28