HoverRace  2.0
TrackCompiler.h
Go to the documentation of this file.
1 // TrackCompiler.h
2 //
3 // Copyright (c) 2013, 2015 Michael Imamura.
4 //
5 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
6 // you may not use this file except in compliance with the License.
7 //
8 // A copy of the license should have been attached to the package from which
9 // you have taken this file. If you can not find the license you can not use
10 // this file.
11 //
12 //
13 // The author makes no representations about the suitability of
14 // this software for any purpose. It is provided "as is" "AS IS",
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16 // implied.
17 //
18 // See the License for the specific language governing permissions
19 // and limitations under the License.
20 //
21 
22 #pragma once
23 
24 #include "../Util/MR_Types.h"
25 #include "../Util/OS.h"
26 #include "TrackCompilationLog.h"
27 
28 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
29 # ifdef MR_ENGINE
30 # define MR_DllDeclare __declspec( dllexport )
31 # else
32 # define MR_DllDeclare __declspec( dllimport )
33 # endif
34 #else
35 # define MR_DllDeclare
36 #endif
37 
38 namespace HoverRace {
39  namespace Parcel {
40  class ObjStream;
41  }
42 }
43 
44 namespace HoverRace {
45 namespace MazeCompiler {
46 
52 {
53 public:
55  const Util::OS::path_t &outputFilename);
57 
58 public:
59  void Compile(const Util::OS::path_t &inputFilename) const;
60  void Compile(std::istream &in) const;
61 
62 private:
63  void CreateHeader(std::istream &in, Parcel::ObjStream &pDestination) const;
64  static void AddBackgroundImage(std::istream &in,
65  Parcel::ObjStream &pDestination);
66 
67  static std::string FormatStr(const char *pSrc);
68 
69  static MR_UInt8 *PCXRead(FILE *pFile, int &pXRes, int &pYRes);
70  static MR_UInt8 *LoadBitmap(FILE *pFile);
71  static MR_UInt8 *LoadPalette(FILE *pFile);
72 
73 private:
76 };
77 
78 } // namespace MazeCompiler
79 } // namespace HoverRace
80 
81 #undef MR_DllDeclare
Compiles the standard textual track format (usually generated by HoverCAD).
Definition: TrackCompiler.h:51
boost::filesystem::path path_t
Definition: OS.h:57
Util::OS::path_t outputFilename
Definition: TrackCompiler.h:74
std::shared_ptr< TrackCompilationLog > TrackCompilationLogPtr
Definition: TrackCompilationLog.h:46
#define MR_DllDeclare
Definition: TrackCompiler.h:35
Base class for parcel serializers.
Definition: ObjStream.h:58
~TrackCompiler()
Definition: TrackCompiler.h:56
Definition: Announcement.h:24
uint8_t MR_UInt8
Definition: MR_Types.h:40
TrackCompilationLogPtr log
Definition: TrackCompiler.h:75
Definition: Symbol.h:253