ScummVM API documentation
ags_parallax.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  * of the License, or(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 AGS_PLUGINS_AGS_PARALLAX_AGS_PARALLAX_H
23 #define AGS_PLUGINS_AGS_PARALLAX_AGS_PARALLAX_H
24 
25 #include "ags/plugins/plugin_base.h"
26 #include "ags/plugins/serializer.h"
27 
28 namespace AGS3 {
29 namespace Plugins {
30 namespace AGSParallax {
31 
32 struct Sprite {
33  int32 x = 0;
34  int32 y = 0;
35  int slot = -1;
36  int speed = 0;
37 
38  void syncGame(Serializer &s);
39 };
40 
41 #define MAX_SPEED 1000
42 #define MAX_SPRITES 100
43 
48 class AGSParallax : public PluginBase {
49  SCRIPT_HASH(AGSParallax)
50 private:
51  int32 _screenWidth = 320;
52  int32 _screenHeight = 200;
53  int32 _screenColorDepth = 32;
54 
55  bool _enabled = false;
56  Sprite _sprites[MAX_SPRITES];
57 
58 private:
59  void pxDrawSprite(ScriptMethodParams &params);
60  void pxDeleteSprite(ScriptMethodParams &params);
61 
62  void syncGame(Serializer &s);
63  void Draw(bool foreground);
64  void clear();
65 
66 public:
67  AGSParallax() : PluginBase() {}
68  virtual ~AGSParallax() {}
69 
70  const char *AGS_GetPluginName() override;
71  void AGS_EngineStartup(IAGSEngine *lpEngine) override;
72  int64 AGS_EngineOnEvent(int event, NumberPtr data) override;
73 };
74 
75 } // namespace AGSParallax
76 } // namespace Plugins
77 } // namespace AGS3
78 
79 #endif
Definition: serializer.h:32
Definition: types.h:111
Definition: plugin_base.h:171
Definition: plugin_base.h:131
Definition: ags_parallax.h:32
Definition: ags_parallax.h:48
Definition: ags_plugin.h:328
Definition: ags.h:40