ScummVM API documentation
q_manager.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 PETKA_QMANAGER_H
23 #define PETKA_QMANAGER_H
24 
25 #include "common/hashmap.h"
26 
27 namespace Common {
28  class SeekableReadStream;
29 }
30 
31 namespace Graphics {
32  struct Surface;
33 }
34 
35 namespace Petka {
36 
37 class PetkaEngine;
38 
39 class FlicDecoder;
40 
41 class QManager {
42 public:
43  explicit QManager(PetkaEngine &vm);
44 
45  bool init();
46 
47  Common::String findResourceName(uint32 id) const;
48  Common::String findSoundName(uint32 id) const;
49 
50  Graphics::Surface *getSurface(uint32 id, uint16 w, uint16 h);
51  Graphics::Surface *getSurface(uint32 id);
52  FlicDecoder *getFlic(uint32 id);
53 
54  void removeResource(uint32 id);
55  void clearUnneeded();
56  void clear();
57 
58 private:
59  struct QResource {
60  union {
61  Graphics::Surface *surface;
62  FlicDecoder *flcDecoder;
63  };
64  enum ResType {
65  kSurface,
66  kFlic
67  } type;
68 
69  ~QResource();
70  };
71 
72  Common::SeekableReadStream *loadFileStream(uint32 id) const;
73 
74  static Graphics::Surface *loadBitmapSurface(Common::SeekableReadStream &stream);
75 
76 private:
77  PetkaEngine &_vm;
80  Common::HashMap<uint32, bool> _isAlwaysNeededMap;
81 };
82 
83 } // End of namespace Petka
84 
85 #endif
Definition: str.h:59
Definition: surface.h:67
Definition: flc.h:29
Definition: q_manager.h:41
Definition: stream.h:745
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: petka.h:83
Definition: base.h:27