746110cad30ebca268ebe8f8d06cd963dca0dfd2
[supertux.git] / src / scripting / wrapper.cpp
1 /**
2  * WARNING: This file is automatically generated from:
3  *  'src/scripting/wrapper.interface.hpp'
4  * DO NOT CHANGE
5  */
6 #include <config.h>
7
8 #include <new>
9 #include <assert.h>
10 #include <string>
11 #include <sstream>
12 #include <squirrel.h>
13 #include "squirrel_error.hpp"
14 #include "wrapper.interface.hpp"
15
16 namespace Scripting
17 {
18 namespace Wrapper
19 {
20
21 static int DisplayEffect_release_hook(SQUserPointer ptr, int )
22 {
23   Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (ptr);
24   delete _this;
25   return 0;
26 }
27
28 static int DisplayEffect_fade_out_wrapper(HSQUIRRELVM v)
29 {
30   Scripting::DisplayEffect* _this;
31   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
32   float arg0;
33   sq_getfloat(v, 2, &arg0);
34   
35   _this->fade_out(arg0);
36   
37   return 0;
38 }
39
40 static int DisplayEffect_fade_in_wrapper(HSQUIRRELVM v)
41 {
42   Scripting::DisplayEffect* _this;
43   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
44   float arg0;
45   sq_getfloat(v, 2, &arg0);
46   
47   _this->fade_in(arg0);
48   
49   return 0;
50 }
51
52 static int DisplayEffect_set_black_wrapper(HSQUIRRELVM v)
53 {
54   Scripting::DisplayEffect* _this;
55   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
56   SQBool arg0;
57   sq_getbool(v, 2, &arg0);
58   
59   _this->set_black(arg0);
60   
61   return 0;
62 }
63
64 static int DisplayEffect_is_black_wrapper(HSQUIRRELVM v)
65 {
66   Scripting::DisplayEffect* _this;
67   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
68   
69   bool return_value = _this->is_black();
70   
71   sq_pushbool(v, return_value);
72   return 1;
73 }
74
75 static int DisplayEffect_sixteen_to_nine_wrapper(HSQUIRRELVM v)
76 {
77   Scripting::DisplayEffect* _this;
78   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
79   float arg0;
80   sq_getfloat(v, 2, &arg0);
81   
82   _this->sixteen_to_nine(arg0);
83   
84   return 0;
85 }
86
87 static int DisplayEffect_four_to_three_wrapper(HSQUIRRELVM v)
88 {
89   Scripting::DisplayEffect* _this;
90   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
91   float arg0;
92   sq_getfloat(v, 2, &arg0);
93   
94   _this->four_to_three(arg0);
95   
96   return 0;
97 }
98
99 static int Camera_release_hook(SQUserPointer ptr, int )
100 {
101   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
102   delete _this;
103   return 0;
104 }
105
106 static int Camera_shake_wrapper(HSQUIRRELVM v)
107 {
108   Scripting::Camera* _this;
109   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
110   float arg0;
111   sq_getfloat(v, 2, &arg0);
112   float arg1;
113   sq_getfloat(v, 3, &arg1);
114   float arg2;
115   sq_getfloat(v, 4, &arg2);
116   
117   _this->shake(arg0, arg1, arg2);
118   
119   return 0;
120 }
121
122 static int Camera_set_pos_wrapper(HSQUIRRELVM v)
123 {
124   Scripting::Camera* _this;
125   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
126   float arg0;
127   sq_getfloat(v, 2, &arg0);
128   float arg1;
129   sq_getfloat(v, 3, &arg1);
130   
131   _this->set_pos(arg0, arg1);
132   
133   return 0;
134 }
135
136 static int Camera_set_mode_wrapper(HSQUIRRELVM v)
137 {
138   Scripting::Camera* _this;
139   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
140   const char* arg0;
141   sq_getstring(v, 2, &arg0);
142   
143   _this->set_mode(arg0);
144   
145   return 0;
146 }
147
148 static int Camera_scroll_to_wrapper(HSQUIRRELVM v)
149 {
150   Scripting::Camera* _this;
151   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
152   float arg0;
153   sq_getfloat(v, 2, &arg0);
154   float arg1;
155   sq_getfloat(v, 3, &arg1);
156   float arg2;
157   sq_getfloat(v, 4, &arg2);
158   
159   _this->scroll_to(arg0, arg1, arg2);
160   
161   return 0;
162 }
163
164 static int Level_release_hook(SQUserPointer ptr, int )
165 {
166   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
167   delete _this;
168   return 0;
169 }
170
171 static int Level_finish_wrapper(HSQUIRRELVM v)
172 {
173   Scripting::Level* _this;
174   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
175   
176   _this->finish();
177   
178   return 0;
179 }
180
181 static int Level_spawn_wrapper(HSQUIRRELVM v)
182 {
183   Scripting::Level* _this;
184   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
185   const char* arg0;
186   sq_getstring(v, 2, &arg0);
187   const char* arg1;
188   sq_getstring(v, 3, &arg1);
189   
190   _this->spawn(arg0, arg1);
191   
192   return 0;
193 }
194
195 static int Level_flip_vertically_wrapper(HSQUIRRELVM v)
196 {
197   Scripting::Level* _this;
198   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
199   
200   _this->flip_vertically();
201   
202   return 0;
203 }
204
205 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
206 {
207   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
208   delete _this;
209   return 0;
210 }
211
212 static int ScriptedObject_set_action_wrapper(HSQUIRRELVM v)
213 {
214   Scripting::ScriptedObject* _this;
215   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
216   const char* arg0;
217   sq_getstring(v, 2, &arg0);
218   
219   _this->set_action(arg0);
220   
221   return 0;
222 }
223
224 static int ScriptedObject_get_action_wrapper(HSQUIRRELVM v)
225 {
226   Scripting::ScriptedObject* _this;
227   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
228   
229   std::string return_value = _this->get_action();
230   
231   sq_pushstring(v, return_value.c_str(), return_value.size());
232   return 1;
233 }
234
235 static int ScriptedObject_move_wrapper(HSQUIRRELVM v)
236 {
237   Scripting::ScriptedObject* _this;
238   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
239   float arg0;
240   sq_getfloat(v, 2, &arg0);
241   float arg1;
242   sq_getfloat(v, 3, &arg1);
243   
244   _this->move(arg0, arg1);
245   
246   return 0;
247 }
248
249 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM v)
250 {
251   Scripting::ScriptedObject* _this;
252   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
253   float arg0;
254   sq_getfloat(v, 2, &arg0);
255   float arg1;
256   sq_getfloat(v, 3, &arg1);
257   
258   _this->set_pos(arg0, arg1);
259   
260   return 0;
261 }
262
263 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM v)
264 {
265   Scripting::ScriptedObject* _this;
266   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
267   
268   float return_value = _this->get_pos_x();
269   
270   sq_pushfloat(v, return_value);
271   return 1;
272 }
273
274 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM v)
275 {
276   Scripting::ScriptedObject* _this;
277   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
278   
279   float return_value = _this->get_pos_y();
280   
281   sq_pushfloat(v, return_value);
282   return 1;
283 }
284
285 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM v)
286 {
287   Scripting::ScriptedObject* _this;
288   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
289   float arg0;
290   sq_getfloat(v, 2, &arg0);
291   float arg1;
292   sq_getfloat(v, 3, &arg1);
293   
294   _this->set_velocity(arg0, arg1);
295   
296   return 0;
297 }
298
299 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM v)
300 {
301   Scripting::ScriptedObject* _this;
302   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
303   
304   float return_value = _this->get_velocity_x();
305   
306   sq_pushfloat(v, return_value);
307   return 1;
308 }
309
310 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM v)
311 {
312   Scripting::ScriptedObject* _this;
313   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
314   
315   float return_value = _this->get_velocity_y();
316   
317   sq_pushfloat(v, return_value);
318   return 1;
319 }
320
321 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM v)
322 {
323   Scripting::ScriptedObject* _this;
324   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
325   SQBool arg0;
326   sq_getbool(v, 2, &arg0);
327   
328   _this->set_visible(arg0);
329   
330   return 0;
331 }
332
333 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM v)
334 {
335   Scripting::ScriptedObject* _this;
336   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
337   
338   bool return_value = _this->is_visible();
339   
340   sq_pushbool(v, return_value);
341   return 1;
342 }
343
344 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM v)
345 {
346   Scripting::ScriptedObject* _this;
347   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
348   
349   std::string return_value = _this->get_name();
350   
351   sq_pushstring(v, return_value.c_str(), return_value.size());
352   return 1;
353 }
354
355 static int Sound_release_hook(SQUserPointer ptr, int )
356 {
357   Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
358   delete _this;
359   return 0;
360 }
361
362 static int Sound_play_music_wrapper(HSQUIRRELVM v)
363 {
364   Scripting::Sound* _this;
365   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
366   const char* arg0;
367   sq_getstring(v, 2, &arg0);
368   
369   _this->play_music(arg0);
370   
371   return 0;
372 }
373
374 static int Sound_play_wrapper(HSQUIRRELVM v)
375 {
376   Scripting::Sound* _this;
377   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
378   const char* arg0;
379   sq_getstring(v, 2, &arg0);
380   
381   _this->play(arg0);
382   
383   return 0;
384 }
385
386 static int Text_release_hook(SQUserPointer ptr, int )
387 {
388   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
389   delete _this;
390   return 0;
391 }
392
393 static int Text_set_text_wrapper(HSQUIRRELVM v)
394 {
395   Scripting::Text* _this;
396   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
397   const char* arg0;
398   sq_getstring(v, 2, &arg0);
399   
400   _this->set_text(arg0);
401   
402   return 0;
403 }
404
405 static int Text_set_font_wrapper(HSQUIRRELVM v)
406 {
407   Scripting::Text* _this;
408   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
409   const char* arg0;
410   sq_getstring(v, 2, &arg0);
411   
412   _this->set_font(arg0);
413   
414   return 0;
415 }
416
417 static int Text_fade_in_wrapper(HSQUIRRELVM v)
418 {
419   Scripting::Text* _this;
420   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
421   float arg0;
422   sq_getfloat(v, 2, &arg0);
423   
424   _this->fade_in(arg0);
425   
426   return 0;
427 }
428
429 static int Text_fade_out_wrapper(HSQUIRRELVM v)
430 {
431   Scripting::Text* _this;
432   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
433   float arg0;
434   sq_getfloat(v, 2, &arg0);
435   
436   _this->fade_out(arg0);
437   
438   return 0;
439 }
440
441 static int Text_set_visible_wrapper(HSQUIRRELVM v)
442 {
443   Scripting::Text* _this;
444   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
445   SQBool arg0;
446   sq_getbool(v, 2, &arg0);
447   
448   _this->set_visible(arg0);
449   
450   return 0;
451 }
452
453 static int Text_set_centered_wrapper(HSQUIRRELVM v)
454 {
455   Scripting::Text* _this;
456   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
457   SQBool arg0;
458   sq_getbool(v, 2, &arg0);
459   
460   _this->set_centered(arg0);
461   
462   return 0;
463 }
464
465 static int Player_release_hook(SQUserPointer ptr, int )
466 {
467   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
468   delete _this;
469   return 0;
470 }
471
472 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
473 {
474   Scripting::Player* _this;
475   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
476   
477   _this->make_invincible();
478   
479   return 0;
480 }
481
482 static int Player_deactivate_wrapper(HSQUIRRELVM v)
483 {
484   Scripting::Player* _this;
485   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
486   
487   _this->deactivate();
488   
489   return 0;
490 }
491
492 static int Player_activate_wrapper(HSQUIRRELVM v)
493 {
494   Scripting::Player* _this;
495   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
496   
497   _this->activate();
498   
499   return 0;
500 }
501
502 static int Player_walk_wrapper(HSQUIRRELVM v)
503 {
504   Scripting::Player* _this;
505   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
506   float arg0;
507   sq_getfloat(v, 2, &arg0);
508   
509   _this->walk(arg0);
510   
511   return 0;
512 }
513
514 static int Player_set_visible_wrapper(HSQUIRRELVM v)
515 {
516   Scripting::Player* _this;
517   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
518   SQBool arg0;
519   sq_getbool(v, 2, &arg0);
520   
521   _this->set_visible(arg0);
522   
523   return 0;
524 }
525
526 static int Player_get_visible_wrapper(HSQUIRRELVM v)
527 {
528   Scripting::Player* _this;
529   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
530   
531   bool return_value = _this->get_visible();
532   
533   sq_pushbool(v, return_value);
534   return 1;
535 }
536
537 static int FloatingImage_release_hook(SQUserPointer ptr, int )
538 {
539   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (ptr);
540   delete _this;
541   return 0;
542 }
543
544 static int FloatingImage_constructor_wrapper(HSQUIRRELVM v)
545 {
546   const char* arg0;
547   sq_getstring(v, 2, &arg0);
548   
549   Scripting::FloatingImage* _this = new Scripting::FloatingImage(arg0);
550   sq_setinstanceup(v, 1, _this);
551   sq_setreleasehook(v, 1, FloatingImage_release_hook);
552   
553   return 0;
554 }
555
556 static int FloatingImage_set_layer_wrapper(HSQUIRRELVM v)
557 {
558   Scripting::FloatingImage* _this;
559   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
560   int arg0;
561   sq_getinteger(v, 2, &arg0);
562   
563   _this->set_layer(arg0);
564   
565   return 0;
566 }
567
568 static int FloatingImage_get_layer_wrapper(HSQUIRRELVM v)
569 {
570   Scripting::FloatingImage* _this;
571   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
572   
573   int return_value = _this->get_layer();
574   
575   sq_pushinteger(v, return_value);
576   return 1;
577 }
578
579 static int FloatingImage_set_pos_wrapper(HSQUIRRELVM v)
580 {
581   Scripting::FloatingImage* _this;
582   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
583   float arg0;
584   sq_getfloat(v, 2, &arg0);
585   float arg1;
586   sq_getfloat(v, 3, &arg1);
587   
588   _this->set_pos(arg0, arg1);
589   
590   return 0;
591 }
592
593 static int FloatingImage_get_pos_x_wrapper(HSQUIRRELVM v)
594 {
595   Scripting::FloatingImage* _this;
596   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
597   
598   float return_value = _this->get_pos_x();
599   
600   sq_pushfloat(v, return_value);
601   return 1;
602 }
603
604 static int FloatingImage_get_pos_y_wrapper(HSQUIRRELVM v)
605 {
606   Scripting::FloatingImage* _this;
607   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
608   
609   float return_value = _this->get_pos_y();
610   
611   sq_pushfloat(v, return_value);
612   return 1;
613 }
614
615 static int FloatingImage_set_anchor_point_wrapper(HSQUIRRELVM v)
616 {
617   Scripting::FloatingImage* _this;
618   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
619   int arg0;
620   sq_getinteger(v, 2, &arg0);
621   
622   _this->set_anchor_point(arg0);
623   
624   return 0;
625 }
626
627 static int FloatingImage_get_anchor_point_wrapper(HSQUIRRELVM v)
628 {
629   Scripting::FloatingImage* _this;
630   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
631   
632   int return_value = _this->get_anchor_point();
633   
634   sq_pushinteger(v, return_value);
635   return 1;
636 }
637
638 static int FloatingImage_set_visible_wrapper(HSQUIRRELVM v)
639 {
640   Scripting::FloatingImage* _this;
641   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
642   SQBool arg0;
643   sq_getbool(v, 2, &arg0);
644   
645   _this->set_visible(arg0);
646   
647   return 0;
648 }
649
650 static int FloatingImage_get_visible_wrapper(HSQUIRRELVM v)
651 {
652   Scripting::FloatingImage* _this;
653   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
654   
655   bool return_value = _this->get_visible();
656   
657   sq_pushbool(v, return_value);
658   return 1;
659 }
660
661 static int display_text_file_wrapper(HSQUIRRELVM v)
662 {
663   const char* arg0;
664   sq_getstring(v, 2, &arg0);
665   
666   Scripting::display_text_file(arg0);
667   
668   return 0;
669 }
670
671 static int wait_wrapper(HSQUIRRELVM v)
672 {
673   float arg0;
674   sq_getfloat(v, 2, &arg0);
675   
676   Scripting::wait(arg0);
677   
678   return sq_suspendvm(v);
679 }
680
681 static int translate_wrapper(HSQUIRRELVM v)
682 {
683   const char* arg0;
684   sq_getstring(v, 2, &arg0);
685   
686   std::string return_value = Scripting::translate(arg0);
687   
688   sq_pushstring(v, return_value.c_str(), return_value.size());
689   return 1;
690 }
691
692 static int import_wrapper(HSQUIRRELVM v)
693 {
694   HSQUIRRELVM arg0 = v;
695   const char* arg1;
696   sq_getstring(v, 2, &arg1);
697   
698   Scripting::import(arg0, arg1);
699   
700   return 0;
701 }
702
703 static int add_key_wrapper(HSQUIRRELVM v)
704 {
705   int arg0;
706   sq_getinteger(v, 2, &arg0);
707   
708   Scripting::add_key(arg0);
709   
710   return 0;
711 }
712
713 } // end of namespace Wrapper
714
715 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
716 {
717   using namespace Wrapper;
718
719   sq_pushroottable(v);
720   sq_pushstring(v, "DisplayEffect", -1);
721   if(SQ_FAILED(sq_get(v, -2))) {
722     std::ostringstream msg;
723     msg << "Couldn't resolved squirrel type 'DisplayEffect'";
724     throw SquirrelError(v, msg.str());
725   }
726
727   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
728     std::ostringstream msg;
729     msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
730     throw SquirrelError(v, msg.str());
731   }
732   sq_remove(v, -2); // remove object name
733
734   if(setup_releasehook) {
735     sq_setreleasehook(v, -1, DisplayEffect_release_hook);
736   }
737
738   sq_remove(v, -2); // remove root table
739 }
740
741 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
742 {
743   using namespace Wrapper;
744
745   sq_pushroottable(v);
746   sq_pushstring(v, "Camera", -1);
747   if(SQ_FAILED(sq_get(v, -2))) {
748     std::ostringstream msg;
749     msg << "Couldn't resolved squirrel type 'Camera'";
750     throw SquirrelError(v, msg.str());
751   }
752
753   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
754     std::ostringstream msg;
755     msg << "Couldn't setup squirrel instance for object of type 'Camera'";
756     throw SquirrelError(v, msg.str());
757   }
758   sq_remove(v, -2); // remove object name
759
760   if(setup_releasehook) {
761     sq_setreleasehook(v, -1, Camera_release_hook);
762   }
763
764   sq_remove(v, -2); // remove root table
765 }
766
767 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
768 {
769   using namespace Wrapper;
770
771   sq_pushroottable(v);
772   sq_pushstring(v, "Level", -1);
773   if(SQ_FAILED(sq_get(v, -2))) {
774     std::ostringstream msg;
775     msg << "Couldn't resolved squirrel type 'Level'";
776     throw SquirrelError(v, msg.str());
777   }
778
779   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
780     std::ostringstream msg;
781     msg << "Couldn't setup squirrel instance for object of type 'Level'";
782     throw SquirrelError(v, msg.str());
783   }
784   sq_remove(v, -2); // remove object name
785
786   if(setup_releasehook) {
787     sq_setreleasehook(v, -1, Level_release_hook);
788   }
789
790   sq_remove(v, -2); // remove root table
791 }
792
793 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
794 {
795   using namespace Wrapper;
796
797   sq_pushroottable(v);
798   sq_pushstring(v, "ScriptedObject", -1);
799   if(SQ_FAILED(sq_get(v, -2))) {
800     std::ostringstream msg;
801     msg << "Couldn't resolved squirrel type 'ScriptedObject'";
802     throw SquirrelError(v, msg.str());
803   }
804
805   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
806     std::ostringstream msg;
807     msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
808     throw SquirrelError(v, msg.str());
809   }
810   sq_remove(v, -2); // remove object name
811
812   if(setup_releasehook) {
813     sq_setreleasehook(v, -1, ScriptedObject_release_hook);
814   }
815
816   sq_remove(v, -2); // remove root table
817 }
818
819 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
820 {
821   using namespace Wrapper;
822
823   sq_pushroottable(v);
824   sq_pushstring(v, "Sound", -1);
825   if(SQ_FAILED(sq_get(v, -2))) {
826     std::ostringstream msg;
827     msg << "Couldn't resolved squirrel type 'Sound'";
828     throw SquirrelError(v, msg.str());
829   }
830
831   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
832     std::ostringstream msg;
833     msg << "Couldn't setup squirrel instance for object of type 'Sound'";
834     throw SquirrelError(v, msg.str());
835   }
836   sq_remove(v, -2); // remove object name
837
838   if(setup_releasehook) {
839     sq_setreleasehook(v, -1, Sound_release_hook);
840   }
841
842   sq_remove(v, -2); // remove root table
843 }
844
845 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
846 {
847   using namespace Wrapper;
848
849   sq_pushroottable(v);
850   sq_pushstring(v, "Text", -1);
851   if(SQ_FAILED(sq_get(v, -2))) {
852     std::ostringstream msg;
853     msg << "Couldn't resolved squirrel type 'Text'";
854     throw SquirrelError(v, msg.str());
855   }
856
857   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
858     std::ostringstream msg;
859     msg << "Couldn't setup squirrel instance for object of type 'Text'";
860     throw SquirrelError(v, msg.str());
861   }
862   sq_remove(v, -2); // remove object name
863
864   if(setup_releasehook) {
865     sq_setreleasehook(v, -1, Text_release_hook);
866   }
867
868   sq_remove(v, -2); // remove root table
869 }
870
871 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
872 {
873   using namespace Wrapper;
874
875   sq_pushroottable(v);
876   sq_pushstring(v, "Player", -1);
877   if(SQ_FAILED(sq_get(v, -2))) {
878     std::ostringstream msg;
879     msg << "Couldn't resolved squirrel type 'Player'";
880     throw SquirrelError(v, msg.str());
881   }
882
883   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
884     std::ostringstream msg;
885     msg << "Couldn't setup squirrel instance for object of type 'Player'";
886     throw SquirrelError(v, msg.str());
887   }
888   sq_remove(v, -2); // remove object name
889
890   if(setup_releasehook) {
891     sq_setreleasehook(v, -1, Player_release_hook);
892   }
893
894   sq_remove(v, -2); // remove root table
895 }
896
897 void create_squirrel_instance(HSQUIRRELVM v, Scripting::FloatingImage* object, bool setup_releasehook)
898 {
899   using namespace Wrapper;
900
901   sq_pushroottable(v);
902   sq_pushstring(v, "FloatingImage", -1);
903   if(SQ_FAILED(sq_get(v, -2))) {
904     std::ostringstream msg;
905     msg << "Couldn't resolved squirrel type 'FloatingImage'";
906     throw SquirrelError(v, msg.str());
907   }
908
909   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
910     std::ostringstream msg;
911     msg << "Couldn't setup squirrel instance for object of type 'FloatingImage'";
912     throw SquirrelError(v, msg.str());
913   }
914   sq_remove(v, -2); // remove object name
915
916   if(setup_releasehook) {
917     sq_setreleasehook(v, -1, FloatingImage_release_hook);
918   }
919
920   sq_remove(v, -2); // remove root table
921 }
922
923 void register_supertux_wrapper(HSQUIRRELVM v)
924 {
925   using namespace Wrapper;
926
927   sq_pushroottable(v);
928   sq_pushstring(v, "KEY_BRASS", -1);
929   sq_pushinteger(v, 1);
930   if(SQ_FAILED(sq_createslot(v, -3))) {
931     std::ostringstream msg;
932     msg << "Couldn't register constant'KEY_BRASS'";
933     throw SquirrelError(v, msg.str());
934   }
935
936   sq_pushstring(v, "KEY_IRON", -1);
937   sq_pushinteger(v, 2);
938   if(SQ_FAILED(sq_createslot(v, -3))) {
939     std::ostringstream msg;
940     msg << "Couldn't register constant'KEY_IRON'";
941     throw SquirrelError(v, msg.str());
942   }
943
944   sq_pushstring(v, "KEY_BRONZE", -1);
945   sq_pushinteger(v, 4);
946   if(SQ_FAILED(sq_createslot(v, -3))) {
947     std::ostringstream msg;
948     msg << "Couldn't register constant'KEY_BRONZE'";
949     throw SquirrelError(v, msg.str());
950   }
951
952   sq_pushstring(v, "KEY_SILVER", -1);
953   sq_pushinteger(v, 8);
954   if(SQ_FAILED(sq_createslot(v, -3))) {
955     std::ostringstream msg;
956     msg << "Couldn't register constant'KEY_SILVER'";
957     throw SquirrelError(v, msg.str());
958   }
959
960   sq_pushstring(v, "KEY_GOLD", -1);
961   sq_pushinteger(v, 16);
962   if(SQ_FAILED(sq_createslot(v, -3))) {
963     std::ostringstream msg;
964     msg << "Couldn't register constant'KEY_GOLD'";
965     throw SquirrelError(v, msg.str());
966   }
967
968   sq_pushstring(v, "ANCHOR_TOP", -1);
969   sq_pushinteger(v, 16);
970   if(SQ_FAILED(sq_createslot(v, -3))) {
971     std::ostringstream msg;
972     msg << "Couldn't register constant'ANCHOR_TOP'";
973     throw SquirrelError(v, msg.str());
974   }
975
976   sq_pushstring(v, "ANCHOR_BOTTOM", -1);
977   sq_pushinteger(v, 32);
978   if(SQ_FAILED(sq_createslot(v, -3))) {
979     std::ostringstream msg;
980     msg << "Couldn't register constant'ANCHOR_BOTTOM'";
981     throw SquirrelError(v, msg.str());
982   }
983
984   sq_pushstring(v, "ANCHOR_LEFT", -1);
985   sq_pushinteger(v, 1);
986   if(SQ_FAILED(sq_createslot(v, -3))) {
987     std::ostringstream msg;
988     msg << "Couldn't register constant'ANCHOR_LEFT'";
989     throw SquirrelError(v, msg.str());
990   }
991
992   sq_pushstring(v, "ANCHOR_RIGHT", -1);
993   sq_pushinteger(v, 2);
994   if(SQ_FAILED(sq_createslot(v, -3))) {
995     std::ostringstream msg;
996     msg << "Couldn't register constant'ANCHOR_RIGHT'";
997     throw SquirrelError(v, msg.str());
998   }
999
1000   sq_pushstring(v, "ANCHOR_MIDDLE", -1);
1001   sq_pushinteger(v, 0);
1002   if(SQ_FAILED(sq_createslot(v, -3))) {
1003     std::ostringstream msg;
1004     msg << "Couldn't register constant'ANCHOR_MIDDLE'";
1005     throw SquirrelError(v, msg.str());
1006   }
1007
1008   sq_pushstring(v, "ANCHOR_TOP_LEFT", -1);
1009   sq_pushinteger(v, 17);
1010   if(SQ_FAILED(sq_createslot(v, -3))) {
1011     std::ostringstream msg;
1012     msg << "Couldn't register constant'ANCHOR_TOP_LEFT'";
1013     throw SquirrelError(v, msg.str());
1014   }
1015
1016   sq_pushstring(v, "ANCHOR_TOP_RIGHT", -1);
1017   sq_pushinteger(v, 18);
1018   if(SQ_FAILED(sq_createslot(v, -3))) {
1019     std::ostringstream msg;
1020     msg << "Couldn't register constant'ANCHOR_TOP_RIGHT'";
1021     throw SquirrelError(v, msg.str());
1022   }
1023
1024   sq_pushstring(v, "ANCHOR_BOTTOM_LEFT", -1);
1025   sq_pushinteger(v, 33);
1026   if(SQ_FAILED(sq_createslot(v, -3))) {
1027     std::ostringstream msg;
1028     msg << "Couldn't register constant'ANCHOR_BOTTOM_LEFT'";
1029     throw SquirrelError(v, msg.str());
1030   }
1031
1032   sq_pushstring(v, "ANCHOR_BOTTOM_RIGHT", -1);
1033   sq_pushinteger(v, 34);
1034   if(SQ_FAILED(sq_createslot(v, -3))) {
1035     std::ostringstream msg;
1036     msg << "Couldn't register constant'ANCHOR_BOTTOM_RIGHT'";
1037     throw SquirrelError(v, msg.str());
1038   }
1039
1040   sq_pushstring(v, "display_text_file", -1);
1041   sq_newclosure(v, &display_text_file_wrapper, 0);
1042   if(SQ_FAILED(sq_createslot(v, -3))) {
1043     std::ostringstream msg;
1044     msg << "Couldn't register function'display_text_file'";
1045     throw SquirrelError(v, msg.str());
1046   }
1047
1048   sq_pushstring(v, "wait", -1);
1049   sq_newclosure(v, &wait_wrapper, 0);
1050   if(SQ_FAILED(sq_createslot(v, -3))) {
1051     std::ostringstream msg;
1052     msg << "Couldn't register function'wait'";
1053     throw SquirrelError(v, msg.str());
1054   }
1055
1056   sq_pushstring(v, "translate", -1);
1057   sq_newclosure(v, &translate_wrapper, 0);
1058   if(SQ_FAILED(sq_createslot(v, -3))) {
1059     std::ostringstream msg;
1060     msg << "Couldn't register function'translate'";
1061     throw SquirrelError(v, msg.str());
1062   }
1063
1064   sq_pushstring(v, "import", -1);
1065   sq_newclosure(v, &import_wrapper, 0);
1066   if(SQ_FAILED(sq_createslot(v, -3))) {
1067     std::ostringstream msg;
1068     msg << "Couldn't register function'import'";
1069     throw SquirrelError(v, msg.str());
1070   }
1071
1072   sq_pushstring(v, "add_key", -1);
1073   sq_newclosure(v, &add_key_wrapper, 0);
1074   if(SQ_FAILED(sq_createslot(v, -3))) {
1075     std::ostringstream msg;
1076     msg << "Couldn't register function'add_key'";
1077     throw SquirrelError(v, msg.str());
1078   }
1079
1080   // Register class DisplayEffect
1081   sq_pushstring(v, "DisplayEffect", -1);
1082   if(sq_newclass(v, SQFalse) < 0) {
1083     std::ostringstream msg;
1084     msg << "Couldn't create new class 'DisplayEffect'";
1085     throw SquirrelError(v, msg.str());
1086   }
1087   sq_pushstring(v, "fade_out", -1);
1088   sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
1089   if(SQ_FAILED(sq_createslot(v, -3))) {
1090     std::ostringstream msg;
1091     msg << "Couldn't register function'fade_out'";
1092     throw SquirrelError(v, msg.str());
1093   }
1094
1095   sq_pushstring(v, "fade_in", -1);
1096   sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
1097   if(SQ_FAILED(sq_createslot(v, -3))) {
1098     std::ostringstream msg;
1099     msg << "Couldn't register function'fade_in'";
1100     throw SquirrelError(v, msg.str());
1101   }
1102
1103   sq_pushstring(v, "set_black", -1);
1104   sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
1105   if(SQ_FAILED(sq_createslot(v, -3))) {
1106     std::ostringstream msg;
1107     msg << "Couldn't register function'set_black'";
1108     throw SquirrelError(v, msg.str());
1109   }
1110
1111   sq_pushstring(v, "is_black", -1);
1112   sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
1113   if(SQ_FAILED(sq_createslot(v, -3))) {
1114     std::ostringstream msg;
1115     msg << "Couldn't register function'is_black'";
1116     throw SquirrelError(v, msg.str());
1117   }
1118
1119   sq_pushstring(v, "sixteen_to_nine", -1);
1120   sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
1121   if(SQ_FAILED(sq_createslot(v, -3))) {
1122     std::ostringstream msg;
1123     msg << "Couldn't register function'sixteen_to_nine'";
1124     throw SquirrelError(v, msg.str());
1125   }
1126
1127   sq_pushstring(v, "four_to_three", -1);
1128   sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
1129   if(SQ_FAILED(sq_createslot(v, -3))) {
1130     std::ostringstream msg;
1131     msg << "Couldn't register function'four_to_three'";
1132     throw SquirrelError(v, msg.str());
1133   }
1134
1135   if(SQ_FAILED(sq_createslot(v, -3))) {
1136     std::ostringstream msg;
1137     msg << "Couldn't register class'DisplayEffect'";
1138     throw SquirrelError(v, msg.str());
1139   }
1140
1141   // Register class Camera
1142   sq_pushstring(v, "Camera", -1);
1143   if(sq_newclass(v, SQFalse) < 0) {
1144     std::ostringstream msg;
1145     msg << "Couldn't create new class 'Camera'";
1146     throw SquirrelError(v, msg.str());
1147   }
1148   sq_pushstring(v, "shake", -1);
1149   sq_newclosure(v, &Camera_shake_wrapper, 0);
1150   if(SQ_FAILED(sq_createslot(v, -3))) {
1151     std::ostringstream msg;
1152     msg << "Couldn't register function'shake'";
1153     throw SquirrelError(v, msg.str());
1154   }
1155
1156   sq_pushstring(v, "set_pos", -1);
1157   sq_newclosure(v, &Camera_set_pos_wrapper, 0);
1158   if(SQ_FAILED(sq_createslot(v, -3))) {
1159     std::ostringstream msg;
1160     msg << "Couldn't register function'set_pos'";
1161     throw SquirrelError(v, msg.str());
1162   }
1163
1164   sq_pushstring(v, "set_mode", -1);
1165   sq_newclosure(v, &Camera_set_mode_wrapper, 0);
1166   if(SQ_FAILED(sq_createslot(v, -3))) {
1167     std::ostringstream msg;
1168     msg << "Couldn't register function'set_mode'";
1169     throw SquirrelError(v, msg.str());
1170   }
1171
1172   sq_pushstring(v, "scroll_to", -1);
1173   sq_newclosure(v, &Camera_scroll_to_wrapper, 0);
1174   if(SQ_FAILED(sq_createslot(v, -3))) {
1175     std::ostringstream msg;
1176     msg << "Couldn't register function'scroll_to'";
1177     throw SquirrelError(v, msg.str());
1178   }
1179
1180   if(SQ_FAILED(sq_createslot(v, -3))) {
1181     std::ostringstream msg;
1182     msg << "Couldn't register class'Camera'";
1183     throw SquirrelError(v, msg.str());
1184   }
1185
1186   // Register class Level
1187   sq_pushstring(v, "Level", -1);
1188   if(sq_newclass(v, SQFalse) < 0) {
1189     std::ostringstream msg;
1190     msg << "Couldn't create new class 'Level'";
1191     throw SquirrelError(v, msg.str());
1192   }
1193   sq_pushstring(v, "finish", -1);
1194   sq_newclosure(v, &Level_finish_wrapper, 0);
1195   if(SQ_FAILED(sq_createslot(v, -3))) {
1196     std::ostringstream msg;
1197     msg << "Couldn't register function'finish'";
1198     throw SquirrelError(v, msg.str());
1199   }
1200
1201   sq_pushstring(v, "spawn", -1);
1202   sq_newclosure(v, &Level_spawn_wrapper, 0);
1203   if(SQ_FAILED(sq_createslot(v, -3))) {
1204     std::ostringstream msg;
1205     msg << "Couldn't register function'spawn'";
1206     throw SquirrelError(v, msg.str());
1207   }
1208
1209   sq_pushstring(v, "flip_vertically", -1);
1210   sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
1211   if(SQ_FAILED(sq_createslot(v, -3))) {
1212     std::ostringstream msg;
1213     msg << "Couldn't register function'flip_vertically'";
1214     throw SquirrelError(v, msg.str());
1215   }
1216
1217   if(SQ_FAILED(sq_createslot(v, -3))) {
1218     std::ostringstream msg;
1219     msg << "Couldn't register class'Level'";
1220     throw SquirrelError(v, msg.str());
1221   }
1222
1223   // Register class ScriptedObject
1224   sq_pushstring(v, "ScriptedObject", -1);
1225   if(sq_newclass(v, SQFalse) < 0) {
1226     std::ostringstream msg;
1227     msg << "Couldn't create new class 'ScriptedObject'";
1228     throw SquirrelError(v, msg.str());
1229   }
1230   sq_pushstring(v, "set_action", -1);
1231   sq_newclosure(v, &ScriptedObject_set_action_wrapper, 0);
1232   if(SQ_FAILED(sq_createslot(v, -3))) {
1233     std::ostringstream msg;
1234     msg << "Couldn't register function'set_action'";
1235     throw SquirrelError(v, msg.str());
1236   }
1237
1238   sq_pushstring(v, "get_action", -1);
1239   sq_newclosure(v, &ScriptedObject_get_action_wrapper, 0);
1240   if(SQ_FAILED(sq_createslot(v, -3))) {
1241     std::ostringstream msg;
1242     msg << "Couldn't register function'get_action'";
1243     throw SquirrelError(v, msg.str());
1244   }
1245
1246   sq_pushstring(v, "move", -1);
1247   sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
1248   if(SQ_FAILED(sq_createslot(v, -3))) {
1249     std::ostringstream msg;
1250     msg << "Couldn't register function'move'";
1251     throw SquirrelError(v, msg.str());
1252   }
1253
1254   sq_pushstring(v, "set_pos", -1);
1255   sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
1256   if(SQ_FAILED(sq_createslot(v, -3))) {
1257     std::ostringstream msg;
1258     msg << "Couldn't register function'set_pos'";
1259     throw SquirrelError(v, msg.str());
1260   }
1261
1262   sq_pushstring(v, "get_pos_x", -1);
1263   sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
1264   if(SQ_FAILED(sq_createslot(v, -3))) {
1265     std::ostringstream msg;
1266     msg << "Couldn't register function'get_pos_x'";
1267     throw SquirrelError(v, msg.str());
1268   }
1269
1270   sq_pushstring(v, "get_pos_y", -1);
1271   sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
1272   if(SQ_FAILED(sq_createslot(v, -3))) {
1273     std::ostringstream msg;
1274     msg << "Couldn't register function'get_pos_y'";
1275     throw SquirrelError(v, msg.str());
1276   }
1277
1278   sq_pushstring(v, "set_velocity", -1);
1279   sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
1280   if(SQ_FAILED(sq_createslot(v, -3))) {
1281     std::ostringstream msg;
1282     msg << "Couldn't register function'set_velocity'";
1283     throw SquirrelError(v, msg.str());
1284   }
1285
1286   sq_pushstring(v, "get_velocity_x", -1);
1287   sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
1288   if(SQ_FAILED(sq_createslot(v, -3))) {
1289     std::ostringstream msg;
1290     msg << "Couldn't register function'get_velocity_x'";
1291     throw SquirrelError(v, msg.str());
1292   }
1293
1294   sq_pushstring(v, "get_velocity_y", -1);
1295   sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
1296   if(SQ_FAILED(sq_createslot(v, -3))) {
1297     std::ostringstream msg;
1298     msg << "Couldn't register function'get_velocity_y'";
1299     throw SquirrelError(v, msg.str());
1300   }
1301
1302   sq_pushstring(v, "set_visible", -1);
1303   sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
1304   if(SQ_FAILED(sq_createslot(v, -3))) {
1305     std::ostringstream msg;
1306     msg << "Couldn't register function'set_visible'";
1307     throw SquirrelError(v, msg.str());
1308   }
1309
1310   sq_pushstring(v, "is_visible", -1);
1311   sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
1312   if(SQ_FAILED(sq_createslot(v, -3))) {
1313     std::ostringstream msg;
1314     msg << "Couldn't register function'is_visible'";
1315     throw SquirrelError(v, msg.str());
1316   }
1317
1318   sq_pushstring(v, "get_name", -1);
1319   sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
1320   if(SQ_FAILED(sq_createslot(v, -3))) {
1321     std::ostringstream msg;
1322     msg << "Couldn't register function'get_name'";
1323     throw SquirrelError(v, msg.str());
1324   }
1325
1326   if(SQ_FAILED(sq_createslot(v, -3))) {
1327     std::ostringstream msg;
1328     msg << "Couldn't register class'ScriptedObject'";
1329     throw SquirrelError(v, msg.str());
1330   }
1331
1332   // Register class Sound
1333   sq_pushstring(v, "Sound", -1);
1334   if(sq_newclass(v, SQFalse) < 0) {
1335     std::ostringstream msg;
1336     msg << "Couldn't create new class 'Sound'";
1337     throw SquirrelError(v, msg.str());
1338   }
1339   sq_pushstring(v, "play_music", -1);
1340   sq_newclosure(v, &Sound_play_music_wrapper, 0);
1341   if(SQ_FAILED(sq_createslot(v, -3))) {
1342     std::ostringstream msg;
1343     msg << "Couldn't register function'play_music'";
1344     throw SquirrelError(v, msg.str());
1345   }
1346
1347   sq_pushstring(v, "play", -1);
1348   sq_newclosure(v, &Sound_play_wrapper, 0);
1349   if(SQ_FAILED(sq_createslot(v, -3))) {
1350     std::ostringstream msg;
1351     msg << "Couldn't register function'play'";
1352     throw SquirrelError(v, msg.str());
1353   }
1354
1355   if(SQ_FAILED(sq_createslot(v, -3))) {
1356     std::ostringstream msg;
1357     msg << "Couldn't register class'Sound'";
1358     throw SquirrelError(v, msg.str());
1359   }
1360
1361   // Register class Text
1362   sq_pushstring(v, "Text", -1);
1363   if(sq_newclass(v, SQFalse) < 0) {
1364     std::ostringstream msg;
1365     msg << "Couldn't create new class 'Text'";
1366     throw SquirrelError(v, msg.str());
1367   }
1368   sq_pushstring(v, "set_text", -1);
1369   sq_newclosure(v, &Text_set_text_wrapper, 0);
1370   if(SQ_FAILED(sq_createslot(v, -3))) {
1371     std::ostringstream msg;
1372     msg << "Couldn't register function'set_text'";
1373     throw SquirrelError(v, msg.str());
1374   }
1375
1376   sq_pushstring(v, "set_font", -1);
1377   sq_newclosure(v, &Text_set_font_wrapper, 0);
1378   if(SQ_FAILED(sq_createslot(v, -3))) {
1379     std::ostringstream msg;
1380     msg << "Couldn't register function'set_font'";
1381     throw SquirrelError(v, msg.str());
1382   }
1383
1384   sq_pushstring(v, "fade_in", -1);
1385   sq_newclosure(v, &Text_fade_in_wrapper, 0);
1386   if(SQ_FAILED(sq_createslot(v, -3))) {
1387     std::ostringstream msg;
1388     msg << "Couldn't register function'fade_in'";
1389     throw SquirrelError(v, msg.str());
1390   }
1391
1392   sq_pushstring(v, "fade_out", -1);
1393   sq_newclosure(v, &Text_fade_out_wrapper, 0);
1394   if(SQ_FAILED(sq_createslot(v, -3))) {
1395     std::ostringstream msg;
1396     msg << "Couldn't register function'fade_out'";
1397     throw SquirrelError(v, msg.str());
1398   }
1399
1400   sq_pushstring(v, "set_visible", -1);
1401   sq_newclosure(v, &Text_set_visible_wrapper, 0);
1402   if(SQ_FAILED(sq_createslot(v, -3))) {
1403     std::ostringstream msg;
1404     msg << "Couldn't register function'set_visible'";
1405     throw SquirrelError(v, msg.str());
1406   }
1407
1408   sq_pushstring(v, "set_centered", -1);
1409   sq_newclosure(v, &Text_set_centered_wrapper, 0);
1410   if(SQ_FAILED(sq_createslot(v, -3))) {
1411     std::ostringstream msg;
1412     msg << "Couldn't register function'set_centered'";
1413     throw SquirrelError(v, msg.str());
1414   }
1415
1416   if(SQ_FAILED(sq_createslot(v, -3))) {
1417     std::ostringstream msg;
1418     msg << "Couldn't register class'Text'";
1419     throw SquirrelError(v, msg.str());
1420   }
1421
1422   // Register class Player
1423   sq_pushstring(v, "Player", -1);
1424   if(sq_newclass(v, SQFalse) < 0) {
1425     std::ostringstream msg;
1426     msg << "Couldn't create new class 'Player'";
1427     throw SquirrelError(v, msg.str());
1428   }
1429   sq_pushstring(v, "make_invincible", -1);
1430   sq_newclosure(v, &Player_make_invincible_wrapper, 0);
1431   if(SQ_FAILED(sq_createslot(v, -3))) {
1432     std::ostringstream msg;
1433     msg << "Couldn't register function'make_invincible'";
1434     throw SquirrelError(v, msg.str());
1435   }
1436
1437   sq_pushstring(v, "deactivate", -1);
1438   sq_newclosure(v, &Player_deactivate_wrapper, 0);
1439   if(SQ_FAILED(sq_createslot(v, -3))) {
1440     std::ostringstream msg;
1441     msg << "Couldn't register function'deactivate'";
1442     throw SquirrelError(v, msg.str());
1443   }
1444
1445   sq_pushstring(v, "activate", -1);
1446   sq_newclosure(v, &Player_activate_wrapper, 0);
1447   if(SQ_FAILED(sq_createslot(v, -3))) {
1448     std::ostringstream msg;
1449     msg << "Couldn't register function'activate'";
1450     throw SquirrelError(v, msg.str());
1451   }
1452
1453   sq_pushstring(v, "walk", -1);
1454   sq_newclosure(v, &Player_walk_wrapper, 0);
1455   if(SQ_FAILED(sq_createslot(v, -3))) {
1456     std::ostringstream msg;
1457     msg << "Couldn't register function'walk'";
1458     throw SquirrelError(v, msg.str());
1459   }
1460
1461   sq_pushstring(v, "set_visible", -1);
1462   sq_newclosure(v, &Player_set_visible_wrapper, 0);
1463   if(SQ_FAILED(sq_createslot(v, -3))) {
1464     std::ostringstream msg;
1465     msg << "Couldn't register function'set_visible'";
1466     throw SquirrelError(v, msg.str());
1467   }
1468
1469   sq_pushstring(v, "get_visible", -1);
1470   sq_newclosure(v, &Player_get_visible_wrapper, 0);
1471   if(SQ_FAILED(sq_createslot(v, -3))) {
1472     std::ostringstream msg;
1473     msg << "Couldn't register function'get_visible'";
1474     throw SquirrelError(v, msg.str());
1475   }
1476
1477   if(SQ_FAILED(sq_createslot(v, -3))) {
1478     std::ostringstream msg;
1479     msg << "Couldn't register class'Player'";
1480     throw SquirrelError(v, msg.str());
1481   }
1482
1483   // Register class FloatingImage
1484   sq_pushstring(v, "FloatingImage", -1);
1485   if(sq_newclass(v, SQFalse) < 0) {
1486     std::ostringstream msg;
1487     msg << "Couldn't create new class 'FloatingImage'";
1488     throw SquirrelError(v, msg.str());
1489   }
1490   sq_pushstring(v, "constructor", -1);
1491   sq_newclosure(v, &FloatingImage_constructor_wrapper, 0);
1492   if(SQ_FAILED(sq_createslot(v, -3))) {
1493     std::ostringstream msg;
1494     msg << "Couldn't register function'constructor'";
1495     throw SquirrelError(v, msg.str());
1496   }
1497
1498   sq_pushstring(v, "set_layer", -1);
1499   sq_newclosure(v, &FloatingImage_set_layer_wrapper, 0);
1500   if(SQ_FAILED(sq_createslot(v, -3))) {
1501     std::ostringstream msg;
1502     msg << "Couldn't register function'set_layer'";
1503     throw SquirrelError(v, msg.str());
1504   }
1505
1506   sq_pushstring(v, "get_layer", -1);
1507   sq_newclosure(v, &FloatingImage_get_layer_wrapper, 0);
1508   if(SQ_FAILED(sq_createslot(v, -3))) {
1509     std::ostringstream msg;
1510     msg << "Couldn't register function'get_layer'";
1511     throw SquirrelError(v, msg.str());
1512   }
1513
1514   sq_pushstring(v, "set_pos", -1);
1515   sq_newclosure(v, &FloatingImage_set_pos_wrapper, 0);
1516   if(SQ_FAILED(sq_createslot(v, -3))) {
1517     std::ostringstream msg;
1518     msg << "Couldn't register function'set_pos'";
1519     throw SquirrelError(v, msg.str());
1520   }
1521
1522   sq_pushstring(v, "get_pos_x", -1);
1523   sq_newclosure(v, &FloatingImage_get_pos_x_wrapper, 0);
1524   if(SQ_FAILED(sq_createslot(v, -3))) {
1525     std::ostringstream msg;
1526     msg << "Couldn't register function'get_pos_x'";
1527     throw SquirrelError(v, msg.str());
1528   }
1529
1530   sq_pushstring(v, "get_pos_y", -1);
1531   sq_newclosure(v, &FloatingImage_get_pos_y_wrapper, 0);
1532   if(SQ_FAILED(sq_createslot(v, -3))) {
1533     std::ostringstream msg;
1534     msg << "Couldn't register function'get_pos_y'";
1535     throw SquirrelError(v, msg.str());
1536   }
1537
1538   sq_pushstring(v, "set_anchor_point", -1);
1539   sq_newclosure(v, &FloatingImage_set_anchor_point_wrapper, 0);
1540   if(SQ_FAILED(sq_createslot(v, -3))) {
1541     std::ostringstream msg;
1542     msg << "Couldn't register function'set_anchor_point'";
1543     throw SquirrelError(v, msg.str());
1544   }
1545
1546   sq_pushstring(v, "get_anchor_point", -1);
1547   sq_newclosure(v, &FloatingImage_get_anchor_point_wrapper, 0);
1548   if(SQ_FAILED(sq_createslot(v, -3))) {
1549     std::ostringstream msg;
1550     msg << "Couldn't register function'get_anchor_point'";
1551     throw SquirrelError(v, msg.str());
1552   }
1553
1554   sq_pushstring(v, "set_visible", -1);
1555   sq_newclosure(v, &FloatingImage_set_visible_wrapper, 0);
1556   if(SQ_FAILED(sq_createslot(v, -3))) {
1557     std::ostringstream msg;
1558     msg << "Couldn't register function'set_visible'";
1559     throw SquirrelError(v, msg.str());
1560   }
1561
1562   sq_pushstring(v, "get_visible", -1);
1563   sq_newclosure(v, &FloatingImage_get_visible_wrapper, 0);
1564   if(SQ_FAILED(sq_createslot(v, -3))) {
1565     std::ostringstream msg;
1566     msg << "Couldn't register function'get_visible'";
1567     throw SquirrelError(v, msg.str());
1568   }
1569
1570   if(SQ_FAILED(sq_createslot(v, -3))) {
1571     std::ostringstream msg;
1572     msg << "Couldn't register class'FloatingImage'";
1573     throw SquirrelError(v, msg.str());
1574   }
1575
1576   sq_pop(v, 1);
1577 }
1578
1579 } // end of namespace Scripting
1580