ScummVM API documentation
mac_resources.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 MADS_NEBULAR_MAC_RESOURCES_H
23#define MADS_NEBULAR_MAC_RESOURCES_H
24
25#include "common/scummsys.h"
26#include "common/str.h"
27#include "graphics/managed_surface.h"
28#include "mads/core/env.h"
29
30namespace Common {
31class MacResManager;
32class SeekableReadStream;
33}
34
35namespace Graphics {
36class Font;
37class MacFontManager;
38}
39
40namespace MADS {
41namespace RexNebular {
42
44public:
45 enum Container {
46 kInvalidContainer,
47 kApplicationContainer,
48 kGlobalContainer,
49 kSoundContainer,
50 kSection1Container,
51 kSection9Container = kSection1Container + 8
52 };
53
54 struct ResourceID {
55 Container container;
56 uint32 type;
57 uint16 id;
58
59 ResourceID(Container container_ = kInvalidContainer, uint32 type_ = 0, uint16 id_ = 0) :
60 container(container_), type(type_), id(id_) {}
61
62 bool isValid() const { return container != kInvalidContainer; }
63 };
64
66 ~MacResourceProvider() override;
67
68 bool load();
69 Common::SeekableReadStream *openResource(Container container, uint32 type,
70 uint16 id) const;
71 Common::String getApplicationVersion() const;
72 Common::SeekableReadStream *open(const char *filename) override;
73 bool exists(const char *filename) override;
74 bool allowsFallback(const char *filename) const override;
75 Common::SeekableReadStream *openText(int32 id, uint16 &unpackedSize) override;
76 Common::SeekableReadStream *openSound(int section, int commandId);
77 int getCursorCount() const override { return 6; }
78 bool setCursor(int id) override;
79 void updateCursor() override;
80 const Graphics::Surface *getNativeInterface() const {
81 return _nativeInterface.empty() ? nullptr : &_nativeInterface.rawSurface();
82 }
83 const Graphics::Surface *getLogicalInterface() const {
84 return _logicalInterface.empty() ? nullptr : &_logicalInterface.rawSurface();
85 }
86 const Graphics::Font *getDialogFont();
87 const Graphics::Font *getInterfaceFont();
88 const Graphics::Font *getGameFont();
89 const Graphics::Font *getAboutFont(int size, bool bold);
90 const byte *getNativeInterfacePalette() const { return _nativeInterfacePalette; }
91
92 static ResourceID mapResource(const Common::String &filename);
93
94private:
95 Common::MacResManager *_containers[kSection9Container + 1] = {};
96 Graphics::MacFontManager *_fontManager = nullptr;
97 Graphics::ManagedSurface _nativeInterface;
98 Graphics::ManagedSurface _logicalInterface;
99 byte _nativeInterfacePalette[10 * 3] = {};
100 int _cursorID = 0;
101 int _waitCursorFrame = 0;
102 uint32 _nextCursorTime = 0;
103
104 Common::MacResManager *getContainer(Container container) const;
105 Common::SeekableReadStream *createFontResource();
106 Common::SeekableReadStream *createInterfaceResource(int interfaceID);
107 bool installCursorResource(uint16 id);
108};
109
110} // namespace RexNebular
111} // namespace MADS
112
113#endif
Definition: macresman.h:126
Definition: stream.h:745
Definition: str.h:59
Definition: font.h:83
Definition: macfontmanager.h:152
Definition: managed_surface.h:51
const Surface & rawSurface() const
Definition: managed_surface.h:195
bool empty() const
Definition: managed_surface.h:214
Definition: env.h:30
Definition: mac_resources.h:43
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: surface.h:67