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