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