Major rewrite of scripting support:
[supertux.git] / src / object / scripted_object.hpp
1 #ifndef __SCRIPTED_OBJECT_H__
2 #define __SCRIPTED_OBJECT_H__
3
4 #include <string>
5 #include "physic.hpp"
6 #include "sprite/sprite.hpp"
7 #include "lisp/lisp.hpp"
8 #include "moving_object.hpp"
9 #include "script_interface.hpp"
10 #include "scripting/scripted_object.hpp"
11
12 class ScriptedObject : public MovingObject, public Scripting::ScriptedObject,
13                        public ScriptInterface
14 {
15 public:
16   ScriptedObject(const lisp::Lisp& lisp);
17   virtual ~ScriptedObject();
18
19   virtual void expose(HSQUIRRELVM vm, int table_idx);
20   virtual void unexpose(HSQUIRRELVM vm, int table_idx);
21
22   void update(float elapsed_time);
23   void draw(DrawingContext& context);
24   HitResponse collision(GameObject& other, const CollisionHit& hit);
25
26   // --- Scripting Interface stuff ---
27
28   void set_action(const std::string& animation);
29   std::string get_action();
30
31   void move(float x, float y);
32   void set_pos(float x, float y);
33   float get_pos_x();
34   float get_pos_y();
35   void set_velocity(float x, float y);
36   float get_velocity_x();
37   float get_velocity_y();
38   void set_visible(bool visible);
39   bool is_visible();
40
41   std::string get_name();
42
43 private:
44   std::string name;
45   bool solid;
46   bool physic_enabled;
47   bool visible;
48   bool new_vel_set;
49   int layer;
50   Vector new_vel;
51   Physic physic;
52   Sprite* sprite;
53 };
54
55 #endif
56