comparison engine/core/model/structures/instance.i @ 0:4a0efb7baf70

* Datasets becomes the new trunk and retires after that :-)
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 29 Jun 2008 18:44:17 +0000
parents
children 90005975cdbb
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
1 %module fife
2 %{
3 #include "model/structures/instance.h"
4 %}
5
6 %include "model/metamodel/modelcoords.i"
7 %include "model/metamodel/abstractvisual.i"
8 %include "util/structures/utilstructures.i"
9 %include "location.i"
10
11 namespace FIFE {
12
13 class Layer;
14 class Action;
15 class Object;
16 class Instance;
17
18 %feature("director") InstanceActionListener;
19 class InstanceActionListener {
20 public:
21 virtual ~InstanceActionListener() {};
22 virtual void onInstanceActionFinished(Instance* instance, Action* action) = 0;
23 };
24
25 enum InstanceChangeType {
26 ICHANGE_NO_CHANGES = 0x0000,
27 ICHANGE_LOC = 0x0001,
28 ICHANGE_FACING_LOC = 0x0002,
29 ICHANGE_SPEED = 0x0004,
30 ICHANGE_ACTION = 0x0008,
31 ICHANGE_TIME_MULTIPLIER = 0x0010,
32 ICHANGE_SAYTEXT = 0x0020,
33 ICHANGE_ROTATION = 0x0040,
34 };
35 typedef unsigned int InstanceChangeInfo;
36
37 %feature("director") InstanceChangeListener;
38 class InstanceChangeListener {
39 public:
40 virtual ~InstanceChangeListener() {};
41 virtual void onInstanceChanged(Instance* instance, InstanceChangeInfo info) = 0;
42 };
43
44 class Instance : public ResourceClass {
45 public:
46 Instance(Object* object, const Location& location, const std::string& identifier="");
47 virtual ~Instance();
48 const std::string& getId();
49 Object* getObject();
50 void setLocation(const Location& loc);
51 Location getLocation() const;
52 Location& getLocationRef();
53 Location getTargetLocation() const;
54 void setRotation(int);
55 int getRotation() const;
56 void addActionListener(InstanceActionListener* listener);
57 void removeActionListener(InstanceActionListener* listener);
58 void addChangeListener(InstanceChangeListener* listener);
59 void removeChangeListener(InstanceChangeListener* listener);
60 Action* getCurrentAction() const;
61 double getMovementSpeed() const;
62 void setFacingLocation(const Location& loc);
63 Location getFacingLocation();
64 Location& getFacingLocationRef();
65 int getActionRuntime() const;
66 void move(const std::string& action_name, const Location& target, const double speed);
67 void act(const std::string& action_name, const Location& direction, bool repeating=false);
68 void follow(const std::string& action_name, Instance* leader, const double speed);
69 void say(const std::string& text, unsigned int duration=0);
70 void setTimeMultiplier(float multip);
71 float getTimeMultiplier();
72 void refresh();
73 InstanceChangeInfo getChangeInfo();
74
75 void setVisual(AbstractVisual* visual);
76 template<typename T> T* getVisual() const;
77 };
78 }
79
80 namespace std {
81 %template(InstanceVector) vector<FIFE::Instance*>;
82 %template(InstanceList) list<FIFE::Instance*>;
83 }
84