ScummVM API documentation
qd_minigame.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_MINIGAME_H
23#define QDENGINE_QDCORE_QD_MINIGAME_H
24
25#include "qdengine/qdcore/qd_named_object.h"
26#include "qdengine/qdcore/qd_minigame_config.h"
27
28
29namespace QDEngine {
30
31class qdMiniGameInterface;
32class qdEmptyMiniGameInterface;
33
35class qdMiniGame : public qdNamedObject {
36public:
37 qdMiniGame();
38 qdMiniGame(const qdMiniGame &mg);
40
41 qdMiniGame &operator = (const qdMiniGame &mg);
42
43 int named_object_type() const {
44 return QD_NAMED_OBJECT_MINIGAME;
45 }
46
48 bool init();
49
50 const Common::Path config_file_name() const {
51 return _config_file_name;
52 }
53 void set_config_file_name(const Common::Path &file_name) {
54 _config_file_name = file_name;
55 }
56 bool has_config_file() const {
57 return !_config_file_name.empty();
58 }
59
61 bool start();
62 bool is_started() const;
64 bool quant(float dt);
66 bool end();
67
69 int save_game(char *buffer, int buffer_size, qdGameScene *scene);
71 int load_game(const char *buffer, int buffer_size, qdGameScene *scene);
72
74 const char *dll_name() const {
75 return _dll_name.c_str();
76 }
78 void set_dll_name(const char *p) {
79 _dll_name = p;
80 }
81 bool has_dll() const {
82 return !_dll_name.empty();
83 }
84
85 const char *game_name() const {
86 return _game_name.c_str();
87 }
88 void set_game_name(const char *p) {
89 _game_name = p;
90 }
91
93 bool load_script(const xml::tag *p);
95 bool save_script(Common::WriteStream &fh, int indent = 0) const;
96
98
99 const config_container_t &config() const {
100 return _config;
101 }
102 void set_config(const config_container_t &cfg) {
103 _config = cfg;
104 }
105 bool load_config();
106
108
111 const char *config_parameter_value(const char *cfg_param_name) const;
112
113private:
114
116 Common::String _dll_name;
118 Common::Path _config_file_name;
120 Common::String _game_name;
122 void *_dll_handle;
124 qdMiniGameInterface *_interface;
125
127 config_container_t _config;
128
129 bool load_interface();
130 bool release_interface();
131};
132
133} // namespace QDEngine
134
135#endif // QDENGINE_QDCORE_QD_MINIGAME_H
Definition: path.h:52
bool empty() const
Definition: path.h:353
Definition: str.h:59
Definition: stream.h:77
Сцена.
Definition: qd_game_scene.h:47
Мини-игра.
Definition: qd_minigame.h:35
int named_object_type() const
Возвращает тип объекта.
Definition: qd_minigame.h:43
const char * config_parameter_value(const char *cfg_param_name) const
Возвращает значение параметра с именем cfg_param_name.
void set_dll_name(const char *p)
Устанавливает имя подгружаемой для игры dll.
Definition: qd_minigame.h:78
bool end()
Окончание игры, вызывается при уходе со сцены, которая управляется игрой.
bool start()
Старт игры, вызывается при заходе на сцену, которой управляет игра.
bool save_script(Common::WriteStream &fh, int indent=0) const
Запись данных в скрипт.
const char * dll_name() const
Возвращает имя подгружаемой для игры dll.
Definition: qd_minigame.h:74
int save_game(char *buffer, int buffer_size, qdGameScene *scene)
Сохранение, вызывается при сохранении сцены scene.
bool load_script(const xml::tag *p)
Загрузка данных из скрипта.
bool quant(float dt)
Логический квант игры, параметр - время, которое должно пройти в игре (в секундах).
int load_game(const char *buffer, int buffer_size, qdGameScene *scene)
Загрузка, вызывается при загрузке сцены scene.
bool init()
Инициализация данных, вызывается при старте и перезапуске основной игры.
Definition: qd_minigame_interface.h:78
Поименованный объект.
Definition: qd_named_object.h:70
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28