HoverRace  2.0
ResourceLib.h
Go to the documentation of this file.
1 
2 // ResourceLib.h
3 //
4 // Copyright (c) 2010, 2014, 2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include <map>
25 
26 #include "../Util/OS.h"
27 #include "ResActor.h"
28 #include "ResSprite.h"
29 #include "ResSound.h"
30 
31 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
32 # ifdef MR_ENGINE
33 # define MR_DllDeclare __declspec( dllexport )
34 # else
35 # define MR_DllDeclare __declspec( dllimport )
36 # endif
37 #else
38 # define MR_DllDeclare
39 #endif
40 
41 namespace HoverRace {
42  namespace Parcel {
43  class ObjStream;
44  class RecordFile;
45  }
46 }
47 
48 namespace HoverRace {
49 namespace ObjFacTools {
50 
56 {
57 protected:
58  ResourceLib();
59 public:
60  ResourceLib(const Util::OS::path_t &filename);
61  ~ResourceLib();
62 
63 public:
64  ResBitmap *GetBitmap(int id);
65  const ResActor *GetActor(int id);
66  const ResSprite *GetSprite(int id);
67  const ResShortSound *GetShortSound(int id);
68  const ResContinuousSound *GetContinuousSound(int id);
69 
70 protected:
71  std::unique_ptr<Parcel::RecordFile> recordFile;
72 
73  std::map<int, std::unique_ptr<ResBitmap>> bitmaps;
74  std::map<int, std::unique_ptr<ResActor>> actors;
75  std::map<int, std::unique_ptr<ResSprite>> sprites;
76  std::map<int, std::unique_ptr<ResShortSound>> shortSounds;
77  std::map<int, std::unique_ptr<ResContinuousSound>> continuousSounds;
78 
79 protected:
80  static const MR_UInt32 FILE_MAGIC = 12345;
81 };
82 
83 } // namespace HoverRace
84 } // namespace ObjFacTools
85 
86 #undef MR_DllDeclare
std::map< int, std::unique_ptr< ResShortSound > > shortSounds
Definition: ResourceLib.h:76
boost::filesystem::path path_t
Definition: OS.h:57
Definition: ResSprite.h:40
std::map< int, std::unique_ptr< ResContinuousSound > > continuousSounds
Definition: ResourceLib.h:77
std::map< int, std::unique_ptr< ResActor > > actors
Definition: ResourceLib.h:74
std::map< int, std::unique_ptr< ResBitmap > > bitmaps
Definition: ResourceLib.h:73
Definition: ResActor.h:52
#define MR_DllDeclare
Definition: ResourceLib.h:38
Definition: Announcement.h:24
uint32_t MR_UInt32
Definition: MR_Types.h:44
std::map< int, std::unique_ptr< ResSprite > > sprites
Definition: ResourceLib.h:75
Definition: ResBitmap.h:47
Definition: ResSound.h:47
Legacy resource manager for ObjFac1.dat resources.
Definition: ResourceLib.h:55
std::unique_ptr< Parcel::RecordFile > recordFile
Definition: ResourceLib.h:71