ScummVM API documentation
shape.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 BLADERUNNER_SHAPE_H
23 #define BLADERUNNER_SHAPE_H
24 
25 #include "common/array.h"
26 #include "common/str.h"
27 
28 
29 namespace Common {
30 class SeekableReadStream;
31 }
32 
33 namespace Graphics {
34 struct Surface;
35 }
36 
37 namespace BladeRunner {
38 
39 class BladeRunnerEngine;
40 
41 class Shape {
42  friend class Shapes;
43 
44  int _width;
45  int _height;
46  byte *_data;
47 
48  bool load(Common::SeekableReadStream *stream);
49 
50  void drawFilledTriangleAux(Graphics::Surface &surface, const int &dst_x, const int &dst_y, int x1, int y1, int x2, int y2, int x3, int y3, uint32 colorRGB) const;
51 
52 public:
53  ~Shape();
54 
55  void draw(Graphics::Surface &surface, int x, int y, uint16 drawModeBitFlags = 0) const;
56 
57  int getWidth() const { return _width; }
58  int getHeight() const { return _height; }
59 };
60 
61 class Shapes {
62  BladeRunnerEngine *_vm;
63 
64  Common::Array<Shape> _shapes;
65 
66 public:
68  ~Shapes();
69 
70  bool load(const Common::String &container);
71  void unload();
72 
73  const Shape *get(uint32 index) const {
74  assert(index < _shapes.size());
75  return &_shapes[index];
76  }
77 };
78 
79 } // End of namespace BladeRunner
80 
81 #endif
Definition: str.h:59
Definition: surface.h:66
Definition: array.h:52
Definition: actor.h:31
Definition: stream.h:745
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: shape.h:41
size_type size() const
Definition: array.h:275
Definition: bladerunner.h:113
Definition: shape.h:61