ScummVM API documentation
meter.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  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, this code is also
23  * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24  * full text of the license.
25  *
26  */
27 
28 #ifndef GOB_MINIGAMES_GEISHA_METER_H
29 #define GOB_MINIGAMES_GEISHA_METER_H
30 
31 #include "gob/aniobject.h"
32 
33 namespace Gob {
34 
35 class Surface;
36 
37 namespace Geisha {
38 
40 class Meter {
41 public:
42  enum Direction {
43  kFillToLeft,
44  kFillToRight
45  };
46 
47  Meter(int16 x, int16 y, int16 width, int16 height,
48  uint8 frontColor, uint8 backColor, int32 maxValue,
49  Direction direction);
50  ~Meter();
51 
53  int32 getMaxValue() const;
55  int32 getValue() const;
56 
58  void setValue(int32 value);
59 
61  void setMaxValue();
62 
64  int32 increase(int32 n = 1);
66  int32 decrease(int32 n = 1);
67 
69  void draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
70 
71 private:
72  int16 _x;
73  int16 _y;
74  int16 _width;
75  int16 _height;
76 
77  uint8 _frontColor;
78  uint8 _backColor;
79 
80  int32 _value;
81  int32 _maxValue;
82 
83  Direction _direction;
84 
85  bool _needUpdate;
86 
87  Surface *_surface;
88 
89  void update();
90 };
91 
92 } // End of namespace Geisha
93 
94 } // End of namespace Gob
95 
96 #endif // GOB_MINIGAMES_GEISHA_METER_H
Definition: meter.h:40
int32 decrease(int32 n=1)
void draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom)
int32 getValue() const
int32 getMaxValue() const
Definition: anifile.h:40
void setValue(int32 value)
Definition: surface.h:100
int32 increase(int32 n=1)