Debian Codegraph @

engine/core/model/structures/trigger.i

raw
1 /***************************************************************************
2 * Copyright (C) 2005-2019 by the FIFE team *
3 * http://www.fifengine.net *
4 * This file is part of FIFE. *
5 * *
6 * FIFE is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Lesser General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2.1 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21
22 %module fife
23 %{
24 #include "model/structures/trigger.h"
25 #include "model/structures/triggercontroller.h"
26 %}
27
28 namespace FIFE {
29 class Map;
30 class Layer;
31 class Instance;
32
33 enum TriggerCondition {
34 CELL_TRIGGER_ENTER = 0,
35 CELL_TRIGGER_EXIT,
36 CELL_TRIGGER_BLOCKING_CHANGE,
37 INSTANCE_TRIGGER_LOCATION,
38 INSTANCE_TRIGGER_ROTATION,
39 INSTANCE_TRIGGER_SPEED,
40 INSTANCE_TRIGGER_ACTION,
41 INSTANCE_TRIGGER_TIME_MULTIPLIER,
42 INSTANCE_TRIGGER_SAYTEXT,
43 INSTANCE_TRIGGER_BLOCK,
44 INSTANCE_TRIGGER_CELL,
45 INSTANCE_TRIGGER_TRANSPARENCY,
46 INSTANCE_TRIGGER_VISIBLE,
47 INSTANCE_TRIGGER_STACKPOS,
48 INSTANCE_TRIGGER_VISUAL,
49 INSTANCE_TRIGGER_DELETE
50 };
51
52 %feature("director") ITriggerListener;
53 class ITriggerListener {
54 public:
55 virtual ~ITriggerListener() {};
56
57 virtual void onTriggered() = 0;
58 };
59
60 class Trigger : public FifeClass {
61 public:
62 virtual ~Trigger();
63
64 void addTriggerListener(ITriggerListener* listener);
65 void removeTriggerListener(ITriggerListener* listener);
66 void reset();
67 const std::string& getName() const;
68 bool isTriggered();
69 void setTriggered();
70 void addTriggerCondition(TriggerCondition type);
71 const std::vector<TriggerCondition>& getTriggerConditions();
72 void removeTriggerCondition(TriggerCondition type);
73 void enableForInstance(Instance* instance);
74 const std::vector<Instance*>& getEnabledInstances();
75 void disableForInstance(Instance* instance);
76 void enableForAllInstances();
77 bool isEnabledForAllInstances();
78 void disableForAllInstances();
79 void assign(Layer* layer, const ModelCoordinate& pt);
80 void remove(Layer* layer, const ModelCoordinate& pt);
81 void assign(Cell* cell);
82 void remove(Cell* cell);
83 void attach(Instance* instance);
84 void detach();
85 Instance* getAttached();
86 void moveTo(const ModelCoordinate& newPos, const ModelCoordinate& oldPos);
87 const std::vector<Cell*>& getAssignedCells();
88 private:
89 Trigger();
90 Trigger(const std::string& name);
91 };
92
93 class TriggerController : public FifeClass {
94 public:
95 virtual ~TriggerController();
96
97 Trigger* createTrigger(const std::string& triggerName);
98 Trigger* createTriggerOnCoordinate(const std::string& triggerName, Layer* layer, const ModelCoordinate& pt);
99 Trigger* createTriggerOnCoordinates(const std::string& triggerName, Layer* layer, const std::vector<ModelCoordinate>& coords);
100 Trigger* createTriggerOnRect(const std::string& triggerName, Layer* layer, const Rect& rec);
101 Trigger* createTriggerOnLocation(const std::string& triggerName, const Location& loc);
102 Trigger* createTriggerOnLocations(const std::string& triggerName, const std::vector<Location>& locs);
103 Trigger* createTriggerOnCell(const std::string& triggerName, Cell* cell);
104 Trigger* createTriggerOnCells(const std::string& triggerName, const std::vector<Cell*>& cells);
105 Trigger* createTriggerOnInstance(const std::string& triggerName, Instance* instance);
106 Trigger* getTrigger(const std::string& triggerName);
107 void deleteTrigger(const std::string& triggerName);
108 void removeTriggerFromCoordinate(const std::string& triggerName, Layer* layer, const ModelCoordinate& pt);
109 void removeTriggerFromCoordinates(const std::string& triggerName, Layer* layer, const std::vector<ModelCoordinate>& coords);
110 void removeTriggerFromRect(const std::string& triggerName, Layer* layer, const Rect& rec);
111 void removeTriggerFromLocation(const std::string& triggerName, const Location& loc);
112 void removeTriggerFromLocations(const std::string& triggerName, const std::vector<Location>& locs);
113 void removeTriggerFromCell(const std::string& triggerName, Cell* cell);
114 void removeTriggerFromCells(const std::string& triggerName, const std::vector<Cell*>& cells);
115 void removeTriggerFromInstance(const std::string& triggerName, Instance* instance);
116 std::vector<Trigger*> getAllTriggers();
117 std::vector<std::string> getAllTriggerNames();
118 private:
119 TriggerController(Map* map);
120 };
121 } //FIFE
122
123 namespace std {
124 %template(TriggerConditionVector) vector<FIFE::TriggerCondition>;
125 %template(TriggerVector) vector<FIFE::Trigger*>;
126 }