ScummVM API documentation
qd_game_object_mouse.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 #ifndef QDENGINE_QDCORE_QD_GAME_OBJECT_MOUSE_H
23 #define QDENGINE_QDCORE_QD_GAME_OBJECT_MOUSE_H
24 
25 #include "qdengine/qdcore/qd_game_object_animated.h"
26 
27 namespace Common {
28 class WriteStream;
29 }
30 
31 namespace QDEngine {
32 
35 public:
39 
40  qdGameObjectMouse &operator = (const qdGameObjectMouse &obj);
41 
42  int named_object_type() const {
43  return QD_NAMED_OBJECT_MOUSE_OBJ;
44  }
45 
46  bool load_script(const xml::tag *p);
47  bool save_script(Common::WriteStream &fh, int indent = 0) const;
48 
49  bool load_data(Common::SeekableReadStream &fh, int save_version);
50  bool save_data(Common::WriteStream &fh) const;
51 
52  void take_object(qdGameObjectAnimated *p);
53  qdGameObjectAnimated *object() {
54  return _object;
55  }
56 
58  enum cursor_ID_t {
71 
72  MAX_CURSOR_ID
73  };
74 
76 
79  void set_default_cursor(cursor_ID_t id, int state_index) {
80  _default_cursors[id] = state_index;
81  }
83  int default_cursor(cursor_ID_t id) const {
84  return _default_cursors[id];
85  }
86 
87  void set_cursor(cursor_ID_t id);
88  void set_cursor_state(int state_idx) {
89  if (cur_state() != state_idx) set_state(state_idx);
90  }
91 
92  void pre_redraw();
93  void redraw(int offs_x = 0, int offs_y = 0) const;
94  void post_redraw();
95 
96  void quant(float dt);
97 
98  bool update_screen_pos();
99 
100  const Vect2f &screen_pos_offset() const {
101  return _screen_pos_offset;
102  }
103 
104 protected:
105 
106  bool load_script_body(const xml::tag *p);
107  bool save_script_body(Common::WriteStream &fh, int indent = 0) const;
108 
109 private:
110 
112  qdGameObjectAnimated *_object;
113 
115  int _default_cursors[MAX_CURSOR_ID];
116 
117  grScreenRegion _object_screen_region;
118 
119  Vect2f _screen_pos_offset;
120  Vect2f _screen_pos_offset_delta;
121 
122  void update_object_position() const;
123 };
124 
125 } // namespace QDEngine
126 
127 #endif // QDENGINE_QDCORE_QD_GAME_OBJECT_MOUSE_H
курсор для зон на сетке
Definition: qd_game_object_mouse.h:64
Definition: stream.h:77
Mouse.
Definition: qd_game_object_mouse.h:34
курсор для анимированных объектов
Definition: qd_game_object_mouse.h:62
Definition: xmath.h:117
общий курсор по-умолчанию
Definition: qd_game_object_mouse.h:60
курсор для main menu.
Definition: qd_game_object_mouse.h:66
Definition: stream.h:745
Dynamic object.
Definition: qd_game_object_animated.h:37
курсор для внутриигрового интерфейса
Definition: qd_game_object_mouse.h:68
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28
void set_default_cursor(cursor_ID_t id, int state_index)
Установка курсора по-умолчанию.
Definition: qd_game_object_mouse.h:79
cursor_ID_t
Идентификаторы для курсоров по-умолчанию.
Definition: qd_game_object_mouse.h:58
Definition: algorithm.h:29
int default_cursor(cursor_ID_t id) const
Возвращает курсор по-умолчанию.
Definition: qd_game_object_mouse.h:83
курсор для объектов в инвентори
Definition: qd_game_object_mouse.h:70
Прямоугольная область на экране.
Definition: gr_screen_region.h:31
int named_object_type() const
Возвращает тип объекта.
Definition: qd_game_object_mouse.h:42