ScummVM API documentation
puzzle.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 ASYLUM_PUZZLES_PUZZLE_H
23 #define ASYLUM_PUZZLES_PUZZLE_H
24 
25 #include "common/rect.h"
26 #include "common/serializer.h"
27 
28 #include "asylum/eventhandler.h"
29 #include "asylum/shared.h"
30 
31 namespace Asylum {
32 
33 class AsylumEngine;
34 class Screen;
35 class Sound;
36 class VideoPlayer;
37 class Cursor;
38 class GraphicResource;
39 struct GraphicQueueItem;
40 
41 class Puzzle : public EventHandler, public Common::Serializable {
42 public:
43  Puzzle(AsylumEngine *engine);
44  virtual ~Puzzle() {};
45 
46  bool handleEvent(const AsylumEvent &evt);
47 
48  // Serializable
49  virtual void saveLoadWithSerializer(Common::Serializer &s);
50 
51 protected:
52  AsylumEngine *_vm;
53 
55  // Event Handling
57  virtual bool init(const AsylumEvent &evt) = 0;
58  virtual bool update(const AsylumEvent &evt);
59  virtual void updateScreen() {};
60  virtual void updateCursor() {};
61  virtual bool activate(const AsylumEvent &evt) { return true; }
62  virtual bool mouseLeftUp(const AsylumEvent &evt) { return true; }
63  virtual bool mouseLeftDown(const AsylumEvent &evt) { return true; }
64 
65  virtual bool exitPuzzle() = 0;
66 
68  // Hit test functions
70  bool hitTest(const int16 (*polygonPoint)[2], const Common::Point &point, uint32 index) const;
71  bool hitTest(const int16 (*polygonPoint)[2], const Common::Point &point) const;
72 };
73 
74 } // End of namespace Asylum
75 
76 #endif // ASYLUM_PUZZLES_PUZZLE_H
Definition: asylum.h:53
Definition: atari-screen.h:60
Definition: serializer.h:79
Definition: eventhandler.h:43
Definition: atari-cursor.h:38
Definition: eventhandler.h:61
Definition: rect.h:45
Definition: asylum.h:73
Definition: puzzle.h:41
Definition: serializer.h:308