1 /*
2  * Copyright (C) 2006-2019 Christopho, Solarus - http://www.solarus-games.org
3  *
4  * Solarus is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Solarus is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef SOLARUS_COLLISION_MODE_H
18 #define SOLARUS_COLLISION_MODE_H
19 
20 #include "solarus/core/EnumInfo.h"
21 
22 namespace Solarus {
23 
24 /**
25  * \brief Collisions modes an entity can detect.
26  */
27 enum CollisionMode {
28   COLLISION_NONE              = 0x0000, /**< No collision will be detected
29                                          * (the detector doesn't detect any entity). */
30   COLLISION_OVERLAPPING       = 0x0001, /**< Collision if the entity's rectangle
31                                          * overlaps the detector's rectangle. */
32   COLLISION_CONTAINING        = 0x0002, /**< Collision if the entity's rectangle
33                                          * is inside the detector's rectangle. */
34   COLLISION_ORIGIN            = 0x0004, /**< Collision if the entity's origin point
35                                          * is inside the detector's rectangle. */
36   COLLISION_FACING            = 0x0008, /**< Collision if the entity's facing point corresponding to
37                                          * its current direction is inside the detector's rectangle. */
38   COLLISION_TOUCHING          = 0x0010, /**< Collision if any entity's facing point (i.e. in any of
39                                          * the four main directions) is inside the detector's rectangle. */
40   COLLISION_CENTER            = 0x0020, /**< Collision if the entity's center point
41                                          * is inside the detector's rectangle. */
42   COLLISION_SPRITE            = 0x0040, /**< Collision if an entity's sprite has pixels
43                                          * overlapping pixels of the detector's sprite. */
44   COLLISION_CUSTOM            = 0x0080  /**< Custom collision function, defined by a subclass of Entity. */
45 };
46 
47 template <>
48 struct SOLARUS_API EnumInfoTraits<CollisionMode> {
49   static const std::string pretty_name;
50 
51   static const EnumInfo<CollisionMode>::names_type names;
52   static const EnumInfo<CollisionMode>::names_type names_no_none_no_custom;
53 };
54 
55 }
56 
57 #endif
58