b31ccceffb49aa4c141ca2d4fa98588aa1a7f38f
[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 vm)
29 {
30   Scripting::DisplayEffect* _this;
31   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
32     sq_throwerror(vm, _SC("'fade_out' called without instance"));
33     return SQ_ERROR;
34   }
35   float arg0;
36   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
37     sq_throwerror(vm, _SC("Argument 1 not a float"));
38     return SQ_ERROR;
39   }
40   
41   try {
42     _this->fade_out(arg0);
43   
44     return 0;
45   
46   } catch(std::exception& e) {
47     sq_throwerror(vm, e.what());
48     return SQ_ERROR;
49   } catch(...) {
50     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
51     return SQ_ERROR;
52   }
53   
54 }
55
56 static int DisplayEffect_fade_in_wrapper(HSQUIRRELVM vm)
57 {
58   Scripting::DisplayEffect* _this;
59   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
60     sq_throwerror(vm, _SC("'fade_in' called without instance"));
61     return SQ_ERROR;
62   }
63   float arg0;
64   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
65     sq_throwerror(vm, _SC("Argument 1 not a float"));
66     return SQ_ERROR;
67   }
68   
69   try {
70     _this->fade_in(arg0);
71   
72     return 0;
73   
74   } catch(std::exception& e) {
75     sq_throwerror(vm, e.what());
76     return SQ_ERROR;
77   } catch(...) {
78     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
79     return SQ_ERROR;
80   }
81   
82 }
83
84 static int DisplayEffect_set_black_wrapper(HSQUIRRELVM vm)
85 {
86   Scripting::DisplayEffect* _this;
87   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
88     sq_throwerror(vm, _SC("'set_black' called without instance"));
89     return SQ_ERROR;
90   }
91   SQBool arg0;
92   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
93     sq_throwerror(vm, _SC("Argument 1 not a bool"));
94     return SQ_ERROR;
95   }
96   
97   try {
98     _this->set_black(arg0);
99   
100     return 0;
101   
102   } catch(std::exception& e) {
103     sq_throwerror(vm, e.what());
104     return SQ_ERROR;
105   } catch(...) {
106     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_black'"));
107     return SQ_ERROR;
108   }
109   
110 }
111
112 static int DisplayEffect_is_black_wrapper(HSQUIRRELVM vm)
113 {
114   Scripting::DisplayEffect* _this;
115   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
116     sq_throwerror(vm, _SC("'is_black' called without instance"));
117     return SQ_ERROR;
118   }
119   
120   try {
121     bool return_value = _this->is_black();
122   
123     sq_pushbool(vm, return_value);
124     return 1;
125   
126   } catch(std::exception& e) {
127     sq_throwerror(vm, e.what());
128     return SQ_ERROR;
129   } catch(...) {
130     sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_black'"));
131     return SQ_ERROR;
132   }
133   
134 }
135
136 static int DisplayEffect_sixteen_to_nine_wrapper(HSQUIRRELVM vm)
137 {
138   Scripting::DisplayEffect* _this;
139   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
140     sq_throwerror(vm, _SC("'sixteen_to_nine' called without instance"));
141     return SQ_ERROR;
142   }
143   float arg0;
144   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
145     sq_throwerror(vm, _SC("Argument 1 not a float"));
146     return SQ_ERROR;
147   }
148   
149   try {
150     _this->sixteen_to_nine(arg0);
151   
152     return 0;
153   
154   } catch(std::exception& e) {
155     sq_throwerror(vm, e.what());
156     return SQ_ERROR;
157   } catch(...) {
158     sq_throwerror(vm, _SC("Unexpected exception while executing function 'sixteen_to_nine'"));
159     return SQ_ERROR;
160   }
161   
162 }
163
164 static int DisplayEffect_four_to_three_wrapper(HSQUIRRELVM vm)
165 {
166   Scripting::DisplayEffect* _this;
167   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
168     sq_throwerror(vm, _SC("'four_to_three' called without instance"));
169     return SQ_ERROR;
170   }
171   float arg0;
172   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
173     sq_throwerror(vm, _SC("Argument 1 not a float"));
174     return SQ_ERROR;
175   }
176   
177   try {
178     _this->four_to_three(arg0);
179   
180     return 0;
181   
182   } catch(std::exception& e) {
183     sq_throwerror(vm, e.what());
184     return SQ_ERROR;
185   } catch(...) {
186     sq_throwerror(vm, _SC("Unexpected exception while executing function 'four_to_three'"));
187     return SQ_ERROR;
188   }
189   
190 }
191
192 static int Camera_release_hook(SQUserPointer ptr, int )
193 {
194   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
195   delete _this;
196   return 0;
197 }
198
199 static int Camera_shake_wrapper(HSQUIRRELVM vm)
200 {
201   Scripting::Camera* _this;
202   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
203     sq_throwerror(vm, _SC("'shake' called without instance"));
204     return SQ_ERROR;
205   }
206   float arg0;
207   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
208     sq_throwerror(vm, _SC("Argument 1 not a float"));
209     return SQ_ERROR;
210   }
211   float arg1;
212   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
213     sq_throwerror(vm, _SC("Argument 2 not a float"));
214     return SQ_ERROR;
215   }
216   float arg2;
217   if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
218     sq_throwerror(vm, _SC("Argument 3 not a float"));
219     return SQ_ERROR;
220   }
221   
222   try {
223     _this->shake(arg0, arg1, arg2);
224   
225     return 0;
226   
227   } catch(std::exception& e) {
228     sq_throwerror(vm, e.what());
229     return SQ_ERROR;
230   } catch(...) {
231     sq_throwerror(vm, _SC("Unexpected exception while executing function 'shake'"));
232     return SQ_ERROR;
233   }
234   
235 }
236
237 static int Camera_set_pos_wrapper(HSQUIRRELVM vm)
238 {
239   Scripting::Camera* _this;
240   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
241     sq_throwerror(vm, _SC("'set_pos' called without instance"));
242     return SQ_ERROR;
243   }
244   float arg0;
245   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
246     sq_throwerror(vm, _SC("Argument 1 not a float"));
247     return SQ_ERROR;
248   }
249   float arg1;
250   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
251     sq_throwerror(vm, _SC("Argument 2 not a float"));
252     return SQ_ERROR;
253   }
254   
255   try {
256     _this->set_pos(arg0, arg1);
257   
258     return 0;
259   
260   } catch(std::exception& e) {
261     sq_throwerror(vm, e.what());
262     return SQ_ERROR;
263   } catch(...) {
264     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
265     return SQ_ERROR;
266   }
267   
268 }
269
270 static int Camera_set_mode_wrapper(HSQUIRRELVM vm)
271 {
272   Scripting::Camera* _this;
273   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
274     sq_throwerror(vm, _SC("'set_mode' called without instance"));
275     return SQ_ERROR;
276   }
277   const char* arg0;
278   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
279     sq_throwerror(vm, _SC("Argument 1 not a string"));
280     return SQ_ERROR;
281   }
282   
283   try {
284     _this->set_mode(arg0);
285   
286     return 0;
287   
288   } catch(std::exception& e) {
289     sq_throwerror(vm, e.what());
290     return SQ_ERROR;
291   } catch(...) {
292     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_mode'"));
293     return SQ_ERROR;
294   }
295   
296 }
297
298 static int Camera_scroll_to_wrapper(HSQUIRRELVM vm)
299 {
300   Scripting::Camera* _this;
301   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
302     sq_throwerror(vm, _SC("'scroll_to' called without instance"));
303     return SQ_ERROR;
304   }
305   float arg0;
306   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
307     sq_throwerror(vm, _SC("Argument 1 not a float"));
308     return SQ_ERROR;
309   }
310   float arg1;
311   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
312     sq_throwerror(vm, _SC("Argument 2 not a float"));
313     return SQ_ERROR;
314   }
315   float arg2;
316   if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
317     sq_throwerror(vm, _SC("Argument 3 not a float"));
318     return SQ_ERROR;
319   }
320   
321   try {
322     _this->scroll_to(arg0, arg1, arg2);
323   
324     return 0;
325   
326   } catch(std::exception& e) {
327     sq_throwerror(vm, e.what());
328     return SQ_ERROR;
329   } catch(...) {
330     sq_throwerror(vm, _SC("Unexpected exception while executing function 'scroll_to'"));
331     return SQ_ERROR;
332   }
333   
334 }
335
336 static int Level_release_hook(SQUserPointer ptr, int )
337 {
338   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
339   delete _this;
340   return 0;
341 }
342
343 static int Level_finish_wrapper(HSQUIRRELVM vm)
344 {
345   Scripting::Level* _this;
346   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
347     sq_throwerror(vm, _SC("'finish' called without instance"));
348     return SQ_ERROR;
349   }
350   SQBool arg0;
351   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
352     sq_throwerror(vm, _SC("Argument 1 not a bool"));
353     return SQ_ERROR;
354   }
355   
356   try {
357     _this->finish(arg0);
358   
359     return 0;
360   
361   } catch(std::exception& e) {
362     sq_throwerror(vm, e.what());
363     return SQ_ERROR;
364   } catch(...) {
365     sq_throwerror(vm, _SC("Unexpected exception while executing function 'finish'"));
366     return SQ_ERROR;
367   }
368   
369 }
370
371 static int Level_spawn_wrapper(HSQUIRRELVM vm)
372 {
373   Scripting::Level* _this;
374   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
375     sq_throwerror(vm, _SC("'spawn' called without instance"));
376     return SQ_ERROR;
377   }
378   const char* arg0;
379   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
380     sq_throwerror(vm, _SC("Argument 1 not a string"));
381     return SQ_ERROR;
382   }
383   const char* arg1;
384   if(SQ_FAILED(sq_getstring(vm, 3, &arg1))) {
385     sq_throwerror(vm, _SC("Argument 2 not a string"));
386     return SQ_ERROR;
387   }
388   
389   try {
390     _this->spawn(arg0, arg1);
391   
392     return 0;
393   
394   } catch(std::exception& e) {
395     sq_throwerror(vm, e.what());
396     return SQ_ERROR;
397   } catch(...) {
398     sq_throwerror(vm, _SC("Unexpected exception while executing function 'spawn'"));
399     return SQ_ERROR;
400   }
401   
402 }
403
404 static int Level_flip_vertically_wrapper(HSQUIRRELVM vm)
405 {
406   Scripting::Level* _this;
407   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
408     sq_throwerror(vm, _SC("'flip_vertically' called without instance"));
409     return SQ_ERROR;
410   }
411   
412   try {
413     _this->flip_vertically();
414   
415     return 0;
416   
417   } catch(std::exception& e) {
418     sq_throwerror(vm, e.what());
419     return SQ_ERROR;
420   } catch(...) {
421     sq_throwerror(vm, _SC("Unexpected exception while executing function 'flip_vertically'"));
422     return SQ_ERROR;
423   }
424   
425 }
426
427 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
428 {
429   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
430   delete _this;
431   return 0;
432 }
433
434 static int ScriptedObject_set_action_wrapper(HSQUIRRELVM vm)
435 {
436   Scripting::ScriptedObject* _this;
437   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
438     sq_throwerror(vm, _SC("'set_action' called without instance"));
439     return SQ_ERROR;
440   }
441   const char* arg0;
442   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
443     sq_throwerror(vm, _SC("Argument 1 not a string"));
444     return SQ_ERROR;
445   }
446   
447   try {
448     _this->set_action(arg0);
449   
450     return 0;
451   
452   } catch(std::exception& e) {
453     sq_throwerror(vm, e.what());
454     return SQ_ERROR;
455   } catch(...) {
456     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_action'"));
457     return SQ_ERROR;
458   }
459   
460 }
461
462 static int ScriptedObject_get_action_wrapper(HSQUIRRELVM vm)
463 {
464   Scripting::ScriptedObject* _this;
465   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
466     sq_throwerror(vm, _SC("'get_action' called without instance"));
467     return SQ_ERROR;
468   }
469   
470   try {
471     std::string return_value = _this->get_action();
472   
473     sq_pushstring(vm, return_value.c_str(), return_value.size());
474     return 1;
475   
476   } catch(std::exception& e) {
477     sq_throwerror(vm, e.what());
478     return SQ_ERROR;
479   } catch(...) {
480     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_action'"));
481     return SQ_ERROR;
482   }
483   
484 }
485
486 static int ScriptedObject_move_wrapper(HSQUIRRELVM vm)
487 {
488   Scripting::ScriptedObject* _this;
489   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
490     sq_throwerror(vm, _SC("'move' called without instance"));
491     return SQ_ERROR;
492   }
493   float arg0;
494   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
495     sq_throwerror(vm, _SC("Argument 1 not a float"));
496     return SQ_ERROR;
497   }
498   float arg1;
499   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
500     sq_throwerror(vm, _SC("Argument 2 not a float"));
501     return SQ_ERROR;
502   }
503   
504   try {
505     _this->move(arg0, arg1);
506   
507     return 0;
508   
509   } catch(std::exception& e) {
510     sq_throwerror(vm, e.what());
511     return SQ_ERROR;
512   } catch(...) {
513     sq_throwerror(vm, _SC("Unexpected exception while executing function 'move'"));
514     return SQ_ERROR;
515   }
516   
517 }
518
519 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM vm)
520 {
521   Scripting::ScriptedObject* _this;
522   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
523     sq_throwerror(vm, _SC("'set_pos' called without instance"));
524     return SQ_ERROR;
525   }
526   float arg0;
527   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
528     sq_throwerror(vm, _SC("Argument 1 not a float"));
529     return SQ_ERROR;
530   }
531   float arg1;
532   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
533     sq_throwerror(vm, _SC("Argument 2 not a float"));
534     return SQ_ERROR;
535   }
536   
537   try {
538     _this->set_pos(arg0, arg1);
539   
540     return 0;
541   
542   } catch(std::exception& e) {
543     sq_throwerror(vm, e.what());
544     return SQ_ERROR;
545   } catch(...) {
546     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
547     return SQ_ERROR;
548   }
549   
550 }
551
552 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM vm)
553 {
554   Scripting::ScriptedObject* _this;
555   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
556     sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
557     return SQ_ERROR;
558   }
559   
560   try {
561     float return_value = _this->get_pos_x();
562   
563     sq_pushfloat(vm, return_value);
564     return 1;
565   
566   } catch(std::exception& e) {
567     sq_throwerror(vm, e.what());
568     return SQ_ERROR;
569   } catch(...) {
570     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
571     return SQ_ERROR;
572   }
573   
574 }
575
576 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM vm)
577 {
578   Scripting::ScriptedObject* _this;
579   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
580     sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
581     return SQ_ERROR;
582   }
583   
584   try {
585     float return_value = _this->get_pos_y();
586   
587     sq_pushfloat(vm, return_value);
588     return 1;
589   
590   } catch(std::exception& e) {
591     sq_throwerror(vm, e.what());
592     return SQ_ERROR;
593   } catch(...) {
594     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
595     return SQ_ERROR;
596   }
597   
598 }
599
600 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM vm)
601 {
602   Scripting::ScriptedObject* _this;
603   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
604     sq_throwerror(vm, _SC("'set_velocity' called without instance"));
605     return SQ_ERROR;
606   }
607   float arg0;
608   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
609     sq_throwerror(vm, _SC("Argument 1 not a float"));
610     return SQ_ERROR;
611   }
612   float arg1;
613   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
614     sq_throwerror(vm, _SC("Argument 2 not a float"));
615     return SQ_ERROR;
616   }
617   
618   try {
619     _this->set_velocity(arg0, arg1);
620   
621     return 0;
622   
623   } catch(std::exception& e) {
624     sq_throwerror(vm, e.what());
625     return SQ_ERROR;
626   } catch(...) {
627     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_velocity'"));
628     return SQ_ERROR;
629   }
630   
631 }
632
633 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM vm)
634 {
635   Scripting::ScriptedObject* _this;
636   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
637     sq_throwerror(vm, _SC("'get_velocity_x' called without instance"));
638     return SQ_ERROR;
639   }
640   
641   try {
642     float return_value = _this->get_velocity_x();
643   
644     sq_pushfloat(vm, return_value);
645     return 1;
646   
647   } catch(std::exception& e) {
648     sq_throwerror(vm, e.what());
649     return SQ_ERROR;
650   } catch(...) {
651     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_velocity_x'"));
652     return SQ_ERROR;
653   }
654   
655 }
656
657 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM vm)
658 {
659   Scripting::ScriptedObject* _this;
660   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
661     sq_throwerror(vm, _SC("'get_velocity_y' called without instance"));
662     return SQ_ERROR;
663   }
664   
665   try {
666     float return_value = _this->get_velocity_y();
667   
668     sq_pushfloat(vm, return_value);
669     return 1;
670   
671   } catch(std::exception& e) {
672     sq_throwerror(vm, e.what());
673     return SQ_ERROR;
674   } catch(...) {
675     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_velocity_y'"));
676     return SQ_ERROR;
677   }
678   
679 }
680
681 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM vm)
682 {
683   Scripting::ScriptedObject* _this;
684   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
685     sq_throwerror(vm, _SC("'set_visible' called without instance"));
686     return SQ_ERROR;
687   }
688   SQBool arg0;
689   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
690     sq_throwerror(vm, _SC("Argument 1 not a bool"));
691     return SQ_ERROR;
692   }
693   
694   try {
695     _this->set_visible(arg0);
696   
697     return 0;
698   
699   } catch(std::exception& e) {
700     sq_throwerror(vm, e.what());
701     return SQ_ERROR;
702   } catch(...) {
703     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
704     return SQ_ERROR;
705   }
706   
707 }
708
709 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM vm)
710 {
711   Scripting::ScriptedObject* _this;
712   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
713     sq_throwerror(vm, _SC("'is_visible' called without instance"));
714     return SQ_ERROR;
715   }
716   
717   try {
718     bool return_value = _this->is_visible();
719   
720     sq_pushbool(vm, return_value);
721     return 1;
722   
723   } catch(std::exception& e) {
724     sq_throwerror(vm, e.what());
725     return SQ_ERROR;
726   } catch(...) {
727     sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_visible'"));
728     return SQ_ERROR;
729   }
730   
731 }
732
733 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM vm)
734 {
735   Scripting::ScriptedObject* _this;
736   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
737     sq_throwerror(vm, _SC("'get_name' called without instance"));
738     return SQ_ERROR;
739   }
740   
741   try {
742     std::string return_value = _this->get_name();
743   
744     sq_pushstring(vm, return_value.c_str(), return_value.size());
745     return 1;
746   
747   } catch(std::exception& e) {
748     sq_throwerror(vm, e.what());
749     return SQ_ERROR;
750   } catch(...) {
751     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_name'"));
752     return SQ_ERROR;
753   }
754   
755 }
756
757 static int Sound_release_hook(SQUserPointer ptr, int )
758 {
759   Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
760   delete _this;
761   return 0;
762 }
763
764 static int Sound_play_music_wrapper(HSQUIRRELVM vm)
765 {
766   Scripting::Sound* _this;
767   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
768     sq_throwerror(vm, _SC("'play_music' called without instance"));
769     return SQ_ERROR;
770   }
771   const char* arg0;
772   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
773     sq_throwerror(vm, _SC("Argument 1 not a string"));
774     return SQ_ERROR;
775   }
776   
777   try {
778     _this->play_music(arg0);
779   
780     return 0;
781   
782   } catch(std::exception& e) {
783     sq_throwerror(vm, e.what());
784     return SQ_ERROR;
785   } catch(...) {
786     sq_throwerror(vm, _SC("Unexpected exception while executing function 'play_music'"));
787     return SQ_ERROR;
788   }
789   
790 }
791
792 static int Sound_play_wrapper(HSQUIRRELVM vm)
793 {
794   Scripting::Sound* _this;
795   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
796     sq_throwerror(vm, _SC("'play' called without instance"));
797     return SQ_ERROR;
798   }
799   const char* arg0;
800   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
801     sq_throwerror(vm, _SC("Argument 1 not a string"));
802     return SQ_ERROR;
803   }
804   
805   try {
806     _this->play(arg0);
807   
808     return 0;
809   
810   } catch(std::exception& e) {
811     sq_throwerror(vm, e.what());
812     return SQ_ERROR;
813   } catch(...) {
814     sq_throwerror(vm, _SC("Unexpected exception while executing function 'play'"));
815     return SQ_ERROR;
816   }
817   
818 }
819
820 static int Text_release_hook(SQUserPointer ptr, int )
821 {
822   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
823   delete _this;
824   return 0;
825 }
826
827 static int Text_set_text_wrapper(HSQUIRRELVM vm)
828 {
829   Scripting::Text* _this;
830   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
831     sq_throwerror(vm, _SC("'set_text' called without instance"));
832     return SQ_ERROR;
833   }
834   const char* arg0;
835   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
836     sq_throwerror(vm, _SC("Argument 1 not a string"));
837     return SQ_ERROR;
838   }
839   
840   try {
841     _this->set_text(arg0);
842   
843     return 0;
844   
845   } catch(std::exception& e) {
846     sq_throwerror(vm, e.what());
847     return SQ_ERROR;
848   } catch(...) {
849     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_text'"));
850     return SQ_ERROR;
851   }
852   
853 }
854
855 static int Text_set_font_wrapper(HSQUIRRELVM vm)
856 {
857   Scripting::Text* _this;
858   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
859     sq_throwerror(vm, _SC("'set_font' called without instance"));
860     return SQ_ERROR;
861   }
862   const char* arg0;
863   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
864     sq_throwerror(vm, _SC("Argument 1 not a string"));
865     return SQ_ERROR;
866   }
867   
868   try {
869     _this->set_font(arg0);
870   
871     return 0;
872   
873   } catch(std::exception& e) {
874     sq_throwerror(vm, e.what());
875     return SQ_ERROR;
876   } catch(...) {
877     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_font'"));
878     return SQ_ERROR;
879   }
880   
881 }
882
883 static int Text_fade_in_wrapper(HSQUIRRELVM vm)
884 {
885   Scripting::Text* _this;
886   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
887     sq_throwerror(vm, _SC("'fade_in' called without instance"));
888     return SQ_ERROR;
889   }
890   float arg0;
891   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
892     sq_throwerror(vm, _SC("Argument 1 not a float"));
893     return SQ_ERROR;
894   }
895   
896   try {
897     _this->fade_in(arg0);
898   
899     return 0;
900   
901   } catch(std::exception& e) {
902     sq_throwerror(vm, e.what());
903     return SQ_ERROR;
904   } catch(...) {
905     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
906     return SQ_ERROR;
907   }
908   
909 }
910
911 static int Text_fade_out_wrapper(HSQUIRRELVM vm)
912 {
913   Scripting::Text* _this;
914   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
915     sq_throwerror(vm, _SC("'fade_out' called without instance"));
916     return SQ_ERROR;
917   }
918   float arg0;
919   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
920     sq_throwerror(vm, _SC("Argument 1 not a float"));
921     return SQ_ERROR;
922   }
923   
924   try {
925     _this->fade_out(arg0);
926   
927     return 0;
928   
929   } catch(std::exception& e) {
930     sq_throwerror(vm, e.what());
931     return SQ_ERROR;
932   } catch(...) {
933     sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
934     return SQ_ERROR;
935   }
936   
937 }
938
939 static int Text_set_visible_wrapper(HSQUIRRELVM vm)
940 {
941   Scripting::Text* _this;
942   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
943     sq_throwerror(vm, _SC("'set_visible' called without instance"));
944     return SQ_ERROR;
945   }
946   SQBool arg0;
947   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
948     sq_throwerror(vm, _SC("Argument 1 not a bool"));
949     return SQ_ERROR;
950   }
951   
952   try {
953     _this->set_visible(arg0);
954   
955     return 0;
956   
957   } catch(std::exception& e) {
958     sq_throwerror(vm, e.what());
959     return SQ_ERROR;
960   } catch(...) {
961     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
962     return SQ_ERROR;
963   }
964   
965 }
966
967 static int Text_set_centered_wrapper(HSQUIRRELVM vm)
968 {
969   Scripting::Text* _this;
970   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
971     sq_throwerror(vm, _SC("'set_centered' called without instance"));
972     return SQ_ERROR;
973   }
974   SQBool arg0;
975   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
976     sq_throwerror(vm, _SC("Argument 1 not a bool"));
977     return SQ_ERROR;
978   }
979   
980   try {
981     _this->set_centered(arg0);
982   
983     return 0;
984   
985   } catch(std::exception& e) {
986     sq_throwerror(vm, e.what());
987     return SQ_ERROR;
988   } catch(...) {
989     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_centered'"));
990     return SQ_ERROR;
991   }
992   
993 }
994
995 static int Player_release_hook(SQUserPointer ptr, int )
996 {
997   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
998   delete _this;
999   return 0;
1000 }
1001
1002 static int Player_make_invincible_wrapper(HSQUIRRELVM vm)
1003 {
1004   Scripting::Player* _this;
1005   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1006     sq_throwerror(vm, _SC("'make_invincible' called without instance"));
1007     return SQ_ERROR;
1008   }
1009   
1010   try {
1011     _this->make_invincible();
1012   
1013     return 0;
1014   
1015   } catch(std::exception& e) {
1016     sq_throwerror(vm, e.what());
1017     return SQ_ERROR;
1018   } catch(...) {
1019     sq_throwerror(vm, _SC("Unexpected exception while executing function 'make_invincible'"));
1020     return SQ_ERROR;
1021   }
1022   
1023 }
1024
1025 static int Player_deactivate_wrapper(HSQUIRRELVM vm)
1026 {
1027   Scripting::Player* _this;
1028   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1029     sq_throwerror(vm, _SC("'deactivate' called without instance"));
1030     return SQ_ERROR;
1031   }
1032   
1033   try {
1034     _this->deactivate();
1035   
1036     return 0;
1037   
1038   } catch(std::exception& e) {
1039     sq_throwerror(vm, e.what());
1040     return SQ_ERROR;
1041   } catch(...) {
1042     sq_throwerror(vm, _SC("Unexpected exception while executing function 'deactivate'"));
1043     return SQ_ERROR;
1044   }
1045   
1046 }
1047
1048 static int Player_activate_wrapper(HSQUIRRELVM vm)
1049 {
1050   Scripting::Player* _this;
1051   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1052     sq_throwerror(vm, _SC("'activate' called without instance"));
1053     return SQ_ERROR;
1054   }
1055   
1056   try {
1057     _this->activate();
1058   
1059     return 0;
1060   
1061   } catch(std::exception& e) {
1062     sq_throwerror(vm, e.what());
1063     return SQ_ERROR;
1064   } catch(...) {
1065     sq_throwerror(vm, _SC("Unexpected exception while executing function 'activate'"));
1066     return SQ_ERROR;
1067   }
1068   
1069 }
1070
1071 static int Player_walk_wrapper(HSQUIRRELVM vm)
1072 {
1073   Scripting::Player* _this;
1074   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1075     sq_throwerror(vm, _SC("'walk' called without instance"));
1076     return SQ_ERROR;
1077   }
1078   float arg0;
1079   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1080     sq_throwerror(vm, _SC("Argument 1 not a float"));
1081     return SQ_ERROR;
1082   }
1083   
1084   try {
1085     _this->walk(arg0);
1086   
1087     return 0;
1088   
1089   } catch(std::exception& e) {
1090     sq_throwerror(vm, e.what());
1091     return SQ_ERROR;
1092   } catch(...) {
1093     sq_throwerror(vm, _SC("Unexpected exception while executing function 'walk'"));
1094     return SQ_ERROR;
1095   }
1096   
1097 }
1098
1099 static int Player_set_visible_wrapper(HSQUIRRELVM vm)
1100 {
1101   Scripting::Player* _this;
1102   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1103     sq_throwerror(vm, _SC("'set_visible' called without instance"));
1104     return SQ_ERROR;
1105   }
1106   SQBool arg0;
1107   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1108     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1109     return SQ_ERROR;
1110   }
1111   
1112   try {
1113     _this->set_visible(arg0);
1114   
1115     return 0;
1116   
1117   } catch(std::exception& e) {
1118     sq_throwerror(vm, e.what());
1119     return SQ_ERROR;
1120   } catch(...) {
1121     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1122     return SQ_ERROR;
1123   }
1124   
1125 }
1126
1127 static int Player_get_visible_wrapper(HSQUIRRELVM vm)
1128 {
1129   Scripting::Player* _this;
1130   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1131     sq_throwerror(vm, _SC("'get_visible' called without instance"));
1132     return SQ_ERROR;
1133   }
1134   
1135   try {
1136     bool return_value = _this->get_visible();
1137   
1138     sq_pushbool(vm, return_value);
1139     return 1;
1140   
1141   } catch(std::exception& e) {
1142     sq_throwerror(vm, e.what());
1143     return SQ_ERROR;
1144   } catch(...) {
1145     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_visible'"));
1146     return SQ_ERROR;
1147   }
1148   
1149 }
1150
1151 static int FloatingImage_release_hook(SQUserPointer ptr, int )
1152 {
1153   Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (ptr);
1154   delete _this;
1155   return 0;
1156 }
1157
1158 static int FloatingImage_constructor_wrapper(HSQUIRRELVM vm)
1159 {
1160   const char* arg0;
1161   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1162     sq_throwerror(vm, _SC("Argument 1 not a string"));
1163     return SQ_ERROR;
1164   }
1165   
1166   try {
1167     Scripting::FloatingImage* _this = new Scripting::FloatingImage(arg0);
1168   if(SQ_FAILED(sq_setinstanceup(vm, 1, _this))) {
1169     sq_throwerror(vm, _SC("Couldn't setup instance of 'FloatingImage' class"));
1170     return SQ_ERROR;
1171   }
1172   sq_setreleasehook(vm, 1, FloatingImage_release_hook);
1173   
1174     return 0;
1175   
1176   } catch(std::exception& e) {
1177     sq_throwerror(vm, e.what());
1178     return SQ_ERROR;
1179   } catch(...) {
1180     sq_throwerror(vm, _SC("Unexpected exception while executing function 'constructor'"));
1181     return SQ_ERROR;
1182   }
1183   
1184 }
1185
1186 static int FloatingImage_set_layer_wrapper(HSQUIRRELVM vm)
1187 {
1188   Scripting::FloatingImage* _this;
1189   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1190     sq_throwerror(vm, _SC("'set_layer' called without instance"));
1191     return SQ_ERROR;
1192   }
1193   int arg0;
1194   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1195     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1196     return SQ_ERROR;
1197   }
1198   
1199   try {
1200     _this->set_layer(arg0);
1201   
1202     return 0;
1203   
1204   } catch(std::exception& e) {
1205     sq_throwerror(vm, e.what());
1206     return SQ_ERROR;
1207   } catch(...) {
1208     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_layer'"));
1209     return SQ_ERROR;
1210   }
1211   
1212 }
1213
1214 static int FloatingImage_get_layer_wrapper(HSQUIRRELVM vm)
1215 {
1216   Scripting::FloatingImage* _this;
1217   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1218     sq_throwerror(vm, _SC("'get_layer' called without instance"));
1219     return SQ_ERROR;
1220   }
1221   
1222   try {
1223     int return_value = _this->get_layer();
1224   
1225     sq_pushinteger(vm, return_value);
1226     return 1;
1227   
1228   } catch(std::exception& e) {
1229     sq_throwerror(vm, e.what());
1230     return SQ_ERROR;
1231   } catch(...) {
1232     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_layer'"));
1233     return SQ_ERROR;
1234   }
1235   
1236 }
1237
1238 static int FloatingImage_set_pos_wrapper(HSQUIRRELVM vm)
1239 {
1240   Scripting::FloatingImage* _this;
1241   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1242     sq_throwerror(vm, _SC("'set_pos' called without instance"));
1243     return SQ_ERROR;
1244   }
1245   float arg0;
1246   if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1247     sq_throwerror(vm, _SC("Argument 1 not a float"));
1248     return SQ_ERROR;
1249   }
1250   float arg1;
1251   if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
1252     sq_throwerror(vm, _SC("Argument 2 not a float"));
1253     return SQ_ERROR;
1254   }
1255   
1256   try {
1257     _this->set_pos(arg0, arg1);
1258   
1259     return 0;
1260   
1261   } catch(std::exception& e) {
1262     sq_throwerror(vm, e.what());
1263     return SQ_ERROR;
1264   } catch(...) {
1265     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
1266     return SQ_ERROR;
1267   }
1268   
1269 }
1270
1271 static int FloatingImage_get_pos_x_wrapper(HSQUIRRELVM vm)
1272 {
1273   Scripting::FloatingImage* _this;
1274   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1275     sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
1276     return SQ_ERROR;
1277   }
1278   
1279   try {
1280     float return_value = _this->get_pos_x();
1281   
1282     sq_pushfloat(vm, return_value);
1283     return 1;
1284   
1285   } catch(std::exception& e) {
1286     sq_throwerror(vm, e.what());
1287     return SQ_ERROR;
1288   } catch(...) {
1289     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
1290     return SQ_ERROR;
1291   }
1292   
1293 }
1294
1295 static int FloatingImage_get_pos_y_wrapper(HSQUIRRELVM vm)
1296 {
1297   Scripting::FloatingImage* _this;
1298   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1299     sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
1300     return SQ_ERROR;
1301   }
1302   
1303   try {
1304     float return_value = _this->get_pos_y();
1305   
1306     sq_pushfloat(vm, return_value);
1307     return 1;
1308   
1309   } catch(std::exception& e) {
1310     sq_throwerror(vm, e.what());
1311     return SQ_ERROR;
1312   } catch(...) {
1313     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
1314     return SQ_ERROR;
1315   }
1316   
1317 }
1318
1319 static int FloatingImage_set_anchor_point_wrapper(HSQUIRRELVM vm)
1320 {
1321   Scripting::FloatingImage* _this;
1322   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1323     sq_throwerror(vm, _SC("'set_anchor_point' called without instance"));
1324     return SQ_ERROR;
1325   }
1326   int arg0;
1327   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1328     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1329     return SQ_ERROR;
1330   }
1331   
1332   try {
1333     _this->set_anchor_point(arg0);
1334   
1335     return 0;
1336   
1337   } catch(std::exception& e) {
1338     sq_throwerror(vm, e.what());
1339     return SQ_ERROR;
1340   } catch(...) {
1341     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_anchor_point'"));
1342     return SQ_ERROR;
1343   }
1344   
1345 }
1346
1347 static int FloatingImage_get_anchor_point_wrapper(HSQUIRRELVM vm)
1348 {
1349   Scripting::FloatingImage* _this;
1350   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1351     sq_throwerror(vm, _SC("'get_anchor_point' called without instance"));
1352     return SQ_ERROR;
1353   }
1354   
1355   try {
1356     int return_value = _this->get_anchor_point();
1357   
1358     sq_pushinteger(vm, return_value);
1359     return 1;
1360   
1361   } catch(std::exception& e) {
1362     sq_throwerror(vm, e.what());
1363     return SQ_ERROR;
1364   } catch(...) {
1365     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_anchor_point'"));
1366     return SQ_ERROR;
1367   }
1368   
1369 }
1370
1371 static int FloatingImage_set_visible_wrapper(HSQUIRRELVM vm)
1372 {
1373   Scripting::FloatingImage* _this;
1374   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1375     sq_throwerror(vm, _SC("'set_visible' called without instance"));
1376     return SQ_ERROR;
1377   }
1378   SQBool arg0;
1379   if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1380     sq_throwerror(vm, _SC("Argument 1 not a bool"));
1381     return SQ_ERROR;
1382   }
1383   
1384   try {
1385     _this->set_visible(arg0);
1386   
1387     return 0;
1388   
1389   } catch(std::exception& e) {
1390     sq_throwerror(vm, e.what());
1391     return SQ_ERROR;
1392   } catch(...) {
1393     sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1394     return SQ_ERROR;
1395   }
1396   
1397 }
1398
1399 static int FloatingImage_get_visible_wrapper(HSQUIRRELVM vm)
1400 {
1401   Scripting::FloatingImage* _this;
1402   if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1403     sq_throwerror(vm, _SC("'get_visible' called without instance"));
1404     return SQ_ERROR;
1405   }
1406   
1407   try {
1408     bool return_value = _this->get_visible();
1409   
1410     sq_pushbool(vm, return_value);
1411     return 1;
1412   
1413   } catch(std::exception& e) {
1414     sq_throwerror(vm, e.what());
1415     return SQ_ERROR;
1416   } catch(...) {
1417     sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_visible'"));
1418     return SQ_ERROR;
1419   }
1420   
1421 }
1422
1423 static int display_wrapper(HSQUIRRELVM vm)
1424 {
1425   return Scripting::display(vm);
1426 }
1427
1428 static int display_text_file_wrapper(HSQUIRRELVM vm)
1429 {
1430   const char* arg0;
1431   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1432     sq_throwerror(vm, _SC("Argument 1 not a string"));
1433     return SQ_ERROR;
1434   }
1435   
1436   try {
1437     Scripting::display_text_file(arg0);
1438   
1439     return 0;
1440   
1441   } catch(std::exception& e) {
1442     sq_throwerror(vm, e.what());
1443     return SQ_ERROR;
1444   } catch(...) {
1445     sq_throwerror(vm, _SC("Unexpected exception while executing function 'display_text_file'"));
1446     return SQ_ERROR;
1447   }
1448   
1449 }
1450
1451 static int load_worldmap_wrapper(HSQUIRRELVM vm)
1452 {
1453   const char* arg0;
1454   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1455     sq_throwerror(vm, _SC("Argument 1 not a string"));
1456     return SQ_ERROR;
1457   }
1458   
1459   try {
1460     Scripting::load_worldmap(arg0);
1461   
1462     return 0;
1463   
1464   } catch(std::exception& e) {
1465     sq_throwerror(vm, e.what());
1466     return SQ_ERROR;
1467   } catch(...) {
1468     sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_worldmap'"));
1469     return SQ_ERROR;
1470   }
1471   
1472 }
1473
1474 static int load_level_wrapper(HSQUIRRELVM vm)
1475 {
1476   const char* arg0;
1477   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1478     sq_throwerror(vm, _SC("Argument 1 not a string"));
1479     return SQ_ERROR;
1480   }
1481   
1482   try {
1483     Scripting::load_level(arg0);
1484   
1485     return 0;
1486   
1487   } catch(std::exception& e) {
1488     sq_throwerror(vm, e.what());
1489     return SQ_ERROR;
1490   } catch(...) {
1491     sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_level'"));
1492     return SQ_ERROR;
1493   }
1494   
1495 }
1496
1497 static int wait_wrapper(HSQUIRRELVM vm)
1498 {
1499   HSQUIRRELVM arg0 = vm;
1500   float arg1;
1501   if(SQ_FAILED(sq_getfloat(vm, 2, &arg1))) {
1502     sq_throwerror(vm, _SC("Argument 1 not a float"));
1503     return SQ_ERROR;
1504   }
1505   
1506   try {
1507     Scripting::wait(arg0, arg1);
1508   
1509     return sq_suspendvm(vm);
1510   
1511   } catch(std::exception& e) {
1512     sq_throwerror(vm, e.what());
1513     return SQ_ERROR;
1514   } catch(...) {
1515     sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait'"));
1516     return SQ_ERROR;
1517   }
1518   
1519 }
1520
1521 static int wait_for_screenswitch_wrapper(HSQUIRRELVM vm)
1522 {
1523   HSQUIRRELVM arg0 = vm;
1524   
1525   try {
1526     Scripting::wait_for_screenswitch(arg0);
1527   
1528     return sq_suspendvm(vm);
1529   
1530   } catch(std::exception& e) {
1531     sq_throwerror(vm, e.what());
1532     return SQ_ERROR;
1533   } catch(...) {
1534     sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait_for_screenswitch'"));
1535     return SQ_ERROR;
1536   }
1537   
1538 }
1539
1540 static int translate_wrapper(HSQUIRRELVM vm)
1541 {
1542   const char* arg0;
1543   if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1544     sq_throwerror(vm, _SC("Argument 1 not a string"));
1545     return SQ_ERROR;
1546   }
1547   
1548   try {
1549     std::string return_value = Scripting::translate(arg0);
1550   
1551     sq_pushstring(vm, return_value.c_str(), return_value.size());
1552     return 1;
1553   
1554   } catch(std::exception& e) {
1555     sq_throwerror(vm, e.what());
1556     return SQ_ERROR;
1557   } catch(...) {
1558     sq_throwerror(vm, _SC("Unexpected exception while executing function 'translate'"));
1559     return SQ_ERROR;
1560   }
1561   
1562 }
1563
1564 static int import_wrapper(HSQUIRRELVM vm)
1565 {
1566   HSQUIRRELVM arg0 = vm;
1567   const char* arg1;
1568   if(SQ_FAILED(sq_getstring(vm, 2, &arg1))) {
1569     sq_throwerror(vm, _SC("Argument 1 not a string"));
1570     return SQ_ERROR;
1571   }
1572   
1573   try {
1574     Scripting::import(arg0, arg1);
1575   
1576     return 0;
1577   
1578   } catch(std::exception& e) {
1579     sq_throwerror(vm, e.what());
1580     return SQ_ERROR;
1581   } catch(...) {
1582     sq_throwerror(vm, _SC("Unexpected exception while executing function 'import'"));
1583     return SQ_ERROR;
1584   }
1585   
1586 }
1587
1588 static int add_key_wrapper(HSQUIRRELVM vm)
1589 {
1590   int arg0;
1591   if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1592     sq_throwerror(vm, _SC("Argument 1 not an integer"));
1593     return SQ_ERROR;
1594   }
1595   
1596   try {
1597     Scripting::add_key(arg0);
1598   
1599     return 0;
1600   
1601   } catch(std::exception& e) {
1602     sq_throwerror(vm, e.what());
1603     return SQ_ERROR;
1604   } catch(...) {
1605     sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_key'"));
1606     return SQ_ERROR;
1607   }
1608   
1609 }
1610
1611 } // end of namespace Wrapper
1612
1613 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
1614 {
1615   using namespace Wrapper;
1616
1617   sq_pushroottable(v);
1618   sq_pushstring(v, "DisplayEffect", -1);
1619   if(SQ_FAILED(sq_get(v, -2))) {
1620     std::ostringstream msg;
1621     msg << "Couldn't resolved squirrel type 'DisplayEffect'";
1622     throw SquirrelError(v, msg.str());
1623   }
1624
1625   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1626     std::ostringstream msg;
1627     msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
1628     throw SquirrelError(v, msg.str());
1629   }
1630   sq_remove(v, -2); // remove object name
1631
1632   if(setup_releasehook) {
1633     sq_setreleasehook(v, -1, DisplayEffect_release_hook);
1634   }
1635
1636   sq_remove(v, -2); // remove root table
1637 }
1638
1639 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
1640 {
1641   using namespace Wrapper;
1642
1643   sq_pushroottable(v);
1644   sq_pushstring(v, "Camera", -1);
1645   if(SQ_FAILED(sq_get(v, -2))) {
1646     std::ostringstream msg;
1647     msg << "Couldn't resolved squirrel type 'Camera'";
1648     throw SquirrelError(v, msg.str());
1649   }
1650
1651   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1652     std::ostringstream msg;
1653     msg << "Couldn't setup squirrel instance for object of type 'Camera'";
1654     throw SquirrelError(v, msg.str());
1655   }
1656   sq_remove(v, -2); // remove object name
1657
1658   if(setup_releasehook) {
1659     sq_setreleasehook(v, -1, Camera_release_hook);
1660   }
1661
1662   sq_remove(v, -2); // remove root table
1663 }
1664
1665 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
1666 {
1667   using namespace Wrapper;
1668
1669   sq_pushroottable(v);
1670   sq_pushstring(v, "Level", -1);
1671   if(SQ_FAILED(sq_get(v, -2))) {
1672     std::ostringstream msg;
1673     msg << "Couldn't resolved squirrel type 'Level'";
1674     throw SquirrelError(v, msg.str());
1675   }
1676
1677   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1678     std::ostringstream msg;
1679     msg << "Couldn't setup squirrel instance for object of type 'Level'";
1680     throw SquirrelError(v, msg.str());
1681   }
1682   sq_remove(v, -2); // remove object name
1683
1684   if(setup_releasehook) {
1685     sq_setreleasehook(v, -1, Level_release_hook);
1686   }
1687
1688   sq_remove(v, -2); // remove root table
1689 }
1690
1691 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
1692 {
1693   using namespace Wrapper;
1694
1695   sq_pushroottable(v);
1696   sq_pushstring(v, "ScriptedObject", -1);
1697   if(SQ_FAILED(sq_get(v, -2))) {
1698     std::ostringstream msg;
1699     msg << "Couldn't resolved squirrel type 'ScriptedObject'";
1700     throw SquirrelError(v, msg.str());
1701   }
1702
1703   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1704     std::ostringstream msg;
1705     msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
1706     throw SquirrelError(v, msg.str());
1707   }
1708   sq_remove(v, -2); // remove object name
1709
1710   if(setup_releasehook) {
1711     sq_setreleasehook(v, -1, ScriptedObject_release_hook);
1712   }
1713
1714   sq_remove(v, -2); // remove root table
1715 }
1716
1717 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
1718 {
1719   using namespace Wrapper;
1720
1721   sq_pushroottable(v);
1722   sq_pushstring(v, "Sound", -1);
1723   if(SQ_FAILED(sq_get(v, -2))) {
1724     std::ostringstream msg;
1725     msg << "Couldn't resolved squirrel type 'Sound'";
1726     throw SquirrelError(v, msg.str());
1727   }
1728
1729   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1730     std::ostringstream msg;
1731     msg << "Couldn't setup squirrel instance for object of type 'Sound'";
1732     throw SquirrelError(v, msg.str());
1733   }
1734   sq_remove(v, -2); // remove object name
1735
1736   if(setup_releasehook) {
1737     sq_setreleasehook(v, -1, Sound_release_hook);
1738   }
1739
1740   sq_remove(v, -2); // remove root table
1741 }
1742
1743 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
1744 {
1745   using namespace Wrapper;
1746
1747   sq_pushroottable(v);
1748   sq_pushstring(v, "Text", -1);
1749   if(SQ_FAILED(sq_get(v, -2))) {
1750     std::ostringstream msg;
1751     msg << "Couldn't resolved squirrel type 'Text'";
1752     throw SquirrelError(v, msg.str());
1753   }
1754
1755   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1756     std::ostringstream msg;
1757     msg << "Couldn't setup squirrel instance for object of type 'Text'";
1758     throw SquirrelError(v, msg.str());
1759   }
1760   sq_remove(v, -2); // remove object name
1761
1762   if(setup_releasehook) {
1763     sq_setreleasehook(v, -1, Text_release_hook);
1764   }
1765
1766   sq_remove(v, -2); // remove root table
1767 }
1768
1769 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
1770 {
1771   using namespace Wrapper;
1772
1773   sq_pushroottable(v);
1774   sq_pushstring(v, "Player", -1);
1775   if(SQ_FAILED(sq_get(v, -2))) {
1776     std::ostringstream msg;
1777     msg << "Couldn't resolved squirrel type 'Player'";
1778     throw SquirrelError(v, msg.str());
1779   }
1780
1781   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1782     std::ostringstream msg;
1783     msg << "Couldn't setup squirrel instance for object of type 'Player'";
1784     throw SquirrelError(v, msg.str());
1785   }
1786   sq_remove(v, -2); // remove object name
1787
1788   if(setup_releasehook) {
1789     sq_setreleasehook(v, -1, Player_release_hook);
1790   }
1791
1792   sq_remove(v, -2); // remove root table
1793 }
1794
1795 void create_squirrel_instance(HSQUIRRELVM v, Scripting::FloatingImage* object, bool setup_releasehook)
1796 {
1797   using namespace Wrapper;
1798
1799   sq_pushroottable(v);
1800   sq_pushstring(v, "FloatingImage", -1);
1801   if(SQ_FAILED(sq_get(v, -2))) {
1802     std::ostringstream msg;
1803     msg << "Couldn't resolved squirrel type 'FloatingImage'";
1804     throw SquirrelError(v, msg.str());
1805   }
1806
1807   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
1808     std::ostringstream msg;
1809     msg << "Couldn't setup squirrel instance for object of type 'FloatingImage'";
1810     throw SquirrelError(v, msg.str());
1811   }
1812   sq_remove(v, -2); // remove object name
1813
1814   if(setup_releasehook) {
1815     sq_setreleasehook(v, -1, FloatingImage_release_hook);
1816   }
1817
1818   sq_remove(v, -2); // remove root table
1819 }
1820
1821 void register_supertux_wrapper(HSQUIRRELVM v)
1822 {
1823   using namespace Wrapper;
1824
1825   sq_pushroottable(v);
1826   sq_pushstring(v, "KEY_BRASS", -1);
1827   sq_pushinteger(v, 1);
1828   if(SQ_FAILED(sq_createslot(v, -3))) {
1829     throw SquirrelError(v, "Couldn't register constant 'KEY_BRASS'");
1830   }
1831
1832   sq_pushstring(v, "KEY_IRON", -1);
1833   sq_pushinteger(v, 2);
1834   if(SQ_FAILED(sq_createslot(v, -3))) {
1835     throw SquirrelError(v, "Couldn't register constant 'KEY_IRON'");
1836   }
1837
1838   sq_pushstring(v, "KEY_BRONZE", -1);
1839   sq_pushinteger(v, 4);
1840   if(SQ_FAILED(sq_createslot(v, -3))) {
1841     throw SquirrelError(v, "Couldn't register constant 'KEY_BRONZE'");
1842   }
1843
1844   sq_pushstring(v, "KEY_SILVER", -1);
1845   sq_pushinteger(v, 8);
1846   if(SQ_FAILED(sq_createslot(v, -3))) {
1847     throw SquirrelError(v, "Couldn't register constant 'KEY_SILVER'");
1848   }
1849
1850   sq_pushstring(v, "KEY_GOLD", -1);
1851   sq_pushinteger(v, 16);
1852   if(SQ_FAILED(sq_createslot(v, -3))) {
1853     throw SquirrelError(v, "Couldn't register constant 'KEY_GOLD'");
1854   }
1855
1856   sq_pushstring(v, "ANCHOR_TOP", -1);
1857   sq_pushinteger(v, 16);
1858   if(SQ_FAILED(sq_createslot(v, -3))) {
1859     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP'");
1860   }
1861
1862   sq_pushstring(v, "ANCHOR_BOTTOM", -1);
1863   sq_pushinteger(v, 32);
1864   if(SQ_FAILED(sq_createslot(v, -3))) {
1865     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM'");
1866   }
1867
1868   sq_pushstring(v, "ANCHOR_LEFT", -1);
1869   sq_pushinteger(v, 1);
1870   if(SQ_FAILED(sq_createslot(v, -3))) {
1871     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_LEFT'");
1872   }
1873
1874   sq_pushstring(v, "ANCHOR_RIGHT", -1);
1875   sq_pushinteger(v, 2);
1876   if(SQ_FAILED(sq_createslot(v, -3))) {
1877     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_RIGHT'");
1878   }
1879
1880   sq_pushstring(v, "ANCHOR_MIDDLE", -1);
1881   sq_pushinteger(v, 0);
1882   if(SQ_FAILED(sq_createslot(v, -3))) {
1883     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_MIDDLE'");
1884   }
1885
1886   sq_pushstring(v, "ANCHOR_TOP_LEFT", -1);
1887   sq_pushinteger(v, 17);
1888   if(SQ_FAILED(sq_createslot(v, -3))) {
1889     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_LEFT'");
1890   }
1891
1892   sq_pushstring(v, "ANCHOR_TOP_RIGHT", -1);
1893   sq_pushinteger(v, 18);
1894   if(SQ_FAILED(sq_createslot(v, -3))) {
1895     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_RIGHT'");
1896   }
1897
1898   sq_pushstring(v, "ANCHOR_BOTTOM_LEFT", -1);
1899   sq_pushinteger(v, 33);
1900   if(SQ_FAILED(sq_createslot(v, -3))) {
1901     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_LEFT'");
1902   }
1903
1904   sq_pushstring(v, "ANCHOR_BOTTOM_RIGHT", -1);
1905   sq_pushinteger(v, 34);
1906   if(SQ_FAILED(sq_createslot(v, -3))) {
1907     throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_RIGHT'");
1908   }
1909
1910   sq_pushstring(v, "display", -1);
1911   sq_newclosure(v, &display_wrapper, 0);
1912   if(SQ_FAILED(sq_createslot(v, -3))) {
1913     throw SquirrelError(v, "Couldn't register function 'display'");
1914   }
1915
1916   sq_pushstring(v, "display_text_file", -1);
1917   sq_newclosure(v, &display_text_file_wrapper, 0);
1918   if(SQ_FAILED(sq_createslot(v, -3))) {
1919     throw SquirrelError(v, "Couldn't register function 'display_text_file'");
1920   }
1921
1922   sq_pushstring(v, "load_worldmap", -1);
1923   sq_newclosure(v, &load_worldmap_wrapper, 0);
1924   if(SQ_FAILED(sq_createslot(v, -3))) {
1925     throw SquirrelError(v, "Couldn't register function 'load_worldmap'");
1926   }
1927
1928   sq_pushstring(v, "load_level", -1);
1929   sq_newclosure(v, &load_level_wrapper, 0);
1930   if(SQ_FAILED(sq_createslot(v, -3))) {
1931     throw SquirrelError(v, "Couldn't register function 'load_level'");
1932   }
1933
1934   sq_pushstring(v, "wait", -1);
1935   sq_newclosure(v, &wait_wrapper, 0);
1936   if(SQ_FAILED(sq_createslot(v, -3))) {
1937     throw SquirrelError(v, "Couldn't register function 'wait'");
1938   }
1939
1940   sq_pushstring(v, "wait_for_screenswitch", -1);
1941   sq_newclosure(v, &wait_for_screenswitch_wrapper, 0);
1942   if(SQ_FAILED(sq_createslot(v, -3))) {
1943     throw SquirrelError(v, "Couldn't register function 'wait_for_screenswitch'");
1944   }
1945
1946   sq_pushstring(v, "translate", -1);
1947   sq_newclosure(v, &translate_wrapper, 0);
1948   if(SQ_FAILED(sq_createslot(v, -3))) {
1949     throw SquirrelError(v, "Couldn't register function 'translate'");
1950   }
1951
1952   sq_pushstring(v, "import", -1);
1953   sq_newclosure(v, &import_wrapper, 0);
1954   if(SQ_FAILED(sq_createslot(v, -3))) {
1955     throw SquirrelError(v, "Couldn't register function 'import'");
1956   }
1957
1958   sq_pushstring(v, "add_key", -1);
1959   sq_newclosure(v, &add_key_wrapper, 0);
1960   if(SQ_FAILED(sq_createslot(v, -3))) {
1961     throw SquirrelError(v, "Couldn't register function 'add_key'");
1962   }
1963
1964   // Register class DisplayEffect
1965   sq_pushstring(v, "DisplayEffect", -1);
1966   if(sq_newclass(v, SQFalse) < 0) {
1967     std::ostringstream msg;
1968     msg << "Couldn't create new class 'DisplayEffect'";
1969     throw SquirrelError(v, msg.str());
1970   }
1971   sq_pushstring(v, "fade_out", -1);
1972   sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
1973   if(SQ_FAILED(sq_createslot(v, -3))) {
1974     throw SquirrelError(v, "Couldn't register function 'fade_out'");
1975   }
1976
1977   sq_pushstring(v, "fade_in", -1);
1978   sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
1979   if(SQ_FAILED(sq_createslot(v, -3))) {
1980     throw SquirrelError(v, "Couldn't register function 'fade_in'");
1981   }
1982
1983   sq_pushstring(v, "set_black", -1);
1984   sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
1985   if(SQ_FAILED(sq_createslot(v, -3))) {
1986     throw SquirrelError(v, "Couldn't register function 'set_black'");
1987   }
1988
1989   sq_pushstring(v, "is_black", -1);
1990   sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
1991   if(SQ_FAILED(sq_createslot(v, -3))) {
1992     throw SquirrelError(v, "Couldn't register function 'is_black'");
1993   }
1994
1995   sq_pushstring(v, "sixteen_to_nine", -1);
1996   sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
1997   if(SQ_FAILED(sq_createslot(v, -3))) {
1998     throw SquirrelError(v, "Couldn't register function 'sixteen_to_nine'");
1999   }
2000
2001   sq_pushstring(v, "four_to_three", -1);
2002   sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
2003   if(SQ_FAILED(sq_createslot(v, -3))) {
2004     throw SquirrelError(v, "Couldn't register function 'four_to_three'");
2005   }
2006
2007   if(SQ_FAILED(sq_createslot(v, -3))) {
2008     throw SquirrelError(v, "Couldn't register class 'DisplayEffect'");
2009   }
2010
2011   // Register class Camera
2012   sq_pushstring(v, "Camera", -1);
2013   if(sq_newclass(v, SQFalse) < 0) {
2014     std::ostringstream msg;
2015     msg << "Couldn't create new class 'Camera'";
2016     throw SquirrelError(v, msg.str());
2017   }
2018   sq_pushstring(v, "shake", -1);
2019   sq_newclosure(v, &Camera_shake_wrapper, 0);
2020   if(SQ_FAILED(sq_createslot(v, -3))) {
2021     throw SquirrelError(v, "Couldn't register function 'shake'");
2022   }
2023
2024   sq_pushstring(v, "set_pos", -1);
2025   sq_newclosure(v, &Camera_set_pos_wrapper, 0);
2026   if(SQ_FAILED(sq_createslot(v, -3))) {
2027     throw SquirrelError(v, "Couldn't register function 'set_pos'");
2028   }
2029
2030   sq_pushstring(v, "set_mode", -1);
2031   sq_newclosure(v, &Camera_set_mode_wrapper, 0);
2032   if(SQ_FAILED(sq_createslot(v, -3))) {
2033     throw SquirrelError(v, "Couldn't register function 'set_mode'");
2034   }
2035
2036   sq_pushstring(v, "scroll_to", -1);
2037   sq_newclosure(v, &Camera_scroll_to_wrapper, 0);
2038   if(SQ_FAILED(sq_createslot(v, -3))) {
2039     throw SquirrelError(v, "Couldn't register function 'scroll_to'");
2040   }
2041
2042   if(SQ_FAILED(sq_createslot(v, -3))) {
2043     throw SquirrelError(v, "Couldn't register class 'Camera'");
2044   }
2045
2046   // Register class Level
2047   sq_pushstring(v, "Level", -1);
2048   if(sq_newclass(v, SQFalse) < 0) {
2049     std::ostringstream msg;
2050     msg << "Couldn't create new class 'Level'";
2051     throw SquirrelError(v, msg.str());
2052   }
2053   sq_pushstring(v, "finish", -1);
2054   sq_newclosure(v, &Level_finish_wrapper, 0);
2055   if(SQ_FAILED(sq_createslot(v, -3))) {
2056     throw SquirrelError(v, "Couldn't register function 'finish'");
2057   }
2058
2059   sq_pushstring(v, "spawn", -1);
2060   sq_newclosure(v, &Level_spawn_wrapper, 0);
2061   if(SQ_FAILED(sq_createslot(v, -3))) {
2062     throw SquirrelError(v, "Couldn't register function 'spawn'");
2063   }
2064
2065   sq_pushstring(v, "flip_vertically", -1);
2066   sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
2067   if(SQ_FAILED(sq_createslot(v, -3))) {
2068     throw SquirrelError(v, "Couldn't register function 'flip_vertically'");
2069   }
2070
2071   if(SQ_FAILED(sq_createslot(v, -3))) {
2072     throw SquirrelError(v, "Couldn't register class 'Level'");
2073   }
2074
2075   // Register class ScriptedObject
2076   sq_pushstring(v, "ScriptedObject", -1);
2077   if(sq_newclass(v, SQFalse) < 0) {
2078     std::ostringstream msg;
2079     msg << "Couldn't create new class 'ScriptedObject'";
2080     throw SquirrelError(v, msg.str());
2081   }
2082   sq_pushstring(v, "set_action", -1);
2083   sq_newclosure(v, &ScriptedObject_set_action_wrapper, 0);
2084   if(SQ_FAILED(sq_createslot(v, -3))) {
2085     throw SquirrelError(v, "Couldn't register function 'set_action'");
2086   }
2087
2088   sq_pushstring(v, "get_action", -1);
2089   sq_newclosure(v, &ScriptedObject_get_action_wrapper, 0);
2090   if(SQ_FAILED(sq_createslot(v, -3))) {
2091     throw SquirrelError(v, "Couldn't register function 'get_action'");
2092   }
2093
2094   sq_pushstring(v, "move", -1);
2095   sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
2096   if(SQ_FAILED(sq_createslot(v, -3))) {
2097     throw SquirrelError(v, "Couldn't register function 'move'");
2098   }
2099
2100   sq_pushstring(v, "set_pos", -1);
2101   sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
2102   if(SQ_FAILED(sq_createslot(v, -3))) {
2103     throw SquirrelError(v, "Couldn't register function 'set_pos'");
2104   }
2105
2106   sq_pushstring(v, "get_pos_x", -1);
2107   sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
2108   if(SQ_FAILED(sq_createslot(v, -3))) {
2109     throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
2110   }
2111
2112   sq_pushstring(v, "get_pos_y", -1);
2113   sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
2114   if(SQ_FAILED(sq_createslot(v, -3))) {
2115     throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
2116   }
2117
2118   sq_pushstring(v, "set_velocity", -1);
2119   sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
2120   if(SQ_FAILED(sq_createslot(v, -3))) {
2121     throw SquirrelError(v, "Couldn't register function 'set_velocity'");
2122   }
2123
2124   sq_pushstring(v, "get_velocity_x", -1);
2125   sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
2126   if(SQ_FAILED(sq_createslot(v, -3))) {
2127     throw SquirrelError(v, "Couldn't register function 'get_velocity_x'");
2128   }
2129
2130   sq_pushstring(v, "get_velocity_y", -1);
2131   sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
2132   if(SQ_FAILED(sq_createslot(v, -3))) {
2133     throw SquirrelError(v, "Couldn't register function 'get_velocity_y'");
2134   }
2135
2136   sq_pushstring(v, "set_visible", -1);
2137   sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
2138   if(SQ_FAILED(sq_createslot(v, -3))) {
2139     throw SquirrelError(v, "Couldn't register function 'set_visible'");
2140   }
2141
2142   sq_pushstring(v, "is_visible", -1);
2143   sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
2144   if(SQ_FAILED(sq_createslot(v, -3))) {
2145     throw SquirrelError(v, "Couldn't register function 'is_visible'");
2146   }
2147
2148   sq_pushstring(v, "get_name", -1);
2149   sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
2150   if(SQ_FAILED(sq_createslot(v, -3))) {
2151     throw SquirrelError(v, "Couldn't register function 'get_name'");
2152   }
2153
2154   if(SQ_FAILED(sq_createslot(v, -3))) {
2155     throw SquirrelError(v, "Couldn't register class 'ScriptedObject'");
2156   }
2157
2158   // Register class Sound
2159   sq_pushstring(v, "Sound", -1);
2160   if(sq_newclass(v, SQFalse) < 0) {
2161     std::ostringstream msg;
2162     msg << "Couldn't create new class 'Sound'";
2163     throw SquirrelError(v, msg.str());
2164   }
2165   sq_pushstring(v, "play_music", -1);
2166   sq_newclosure(v, &Sound_play_music_wrapper, 0);
2167   if(SQ_FAILED(sq_createslot(v, -3))) {
2168     throw SquirrelError(v, "Couldn't register function 'play_music'");
2169   }
2170
2171   sq_pushstring(v, "play", -1);
2172   sq_newclosure(v, &Sound_play_wrapper, 0);
2173   if(SQ_FAILED(sq_createslot(v, -3))) {
2174     throw SquirrelError(v, "Couldn't register function 'play'");
2175   }
2176
2177   if(SQ_FAILED(sq_createslot(v, -3))) {
2178     throw SquirrelError(v, "Couldn't register class 'Sound'");
2179   }
2180
2181   // Register class Text
2182   sq_pushstring(v, "Text", -1);
2183   if(sq_newclass(v, SQFalse) < 0) {
2184     std::ostringstream msg;
2185     msg << "Couldn't create new class 'Text'";
2186     throw SquirrelError(v, msg.str());
2187   }
2188   sq_pushstring(v, "set_text", -1);
2189   sq_newclosure(v, &Text_set_text_wrapper, 0);
2190   if(SQ_FAILED(sq_createslot(v, -3))) {
2191     throw SquirrelError(v, "Couldn't register function 'set_text'");
2192   }
2193
2194   sq_pushstring(v, "set_font", -1);
2195   sq_newclosure(v, &Text_set_font_wrapper, 0);
2196   if(SQ_FAILED(sq_createslot(v, -3))) {
2197     throw SquirrelError(v, "Couldn't register function 'set_font'");
2198   }
2199
2200   sq_pushstring(v, "fade_in", -1);
2201   sq_newclosure(v, &Text_fade_in_wrapper, 0);
2202   if(SQ_FAILED(sq_createslot(v, -3))) {
2203     throw SquirrelError(v, "Couldn't register function 'fade_in'");
2204   }
2205
2206   sq_pushstring(v, "fade_out", -1);
2207   sq_newclosure(v, &Text_fade_out_wrapper, 0);
2208   if(SQ_FAILED(sq_createslot(v, -3))) {
2209     throw SquirrelError(v, "Couldn't register function 'fade_out'");
2210   }
2211
2212   sq_pushstring(v, "set_visible", -1);
2213   sq_newclosure(v, &Text_set_visible_wrapper, 0);
2214   if(SQ_FAILED(sq_createslot(v, -3))) {
2215     throw SquirrelError(v, "Couldn't register function 'set_visible'");
2216   }
2217
2218   sq_pushstring(v, "set_centered", -1);
2219   sq_newclosure(v, &Text_set_centered_wrapper, 0);
2220   if(SQ_FAILED(sq_createslot(v, -3))) {
2221     throw SquirrelError(v, "Couldn't register function 'set_centered'");
2222   }
2223
2224   if(SQ_FAILED(sq_createslot(v, -3))) {
2225     throw SquirrelError(v, "Couldn't register class 'Text'");
2226   }
2227
2228   // Register class Player
2229   sq_pushstring(v, "Player", -1);
2230   if(sq_newclass(v, SQFalse) < 0) {
2231     std::ostringstream msg;
2232     msg << "Couldn't create new class 'Player'";
2233     throw SquirrelError(v, msg.str());
2234   }
2235   sq_pushstring(v, "make_invincible", -1);
2236   sq_newclosure(v, &Player_make_invincible_wrapper, 0);
2237   if(SQ_FAILED(sq_createslot(v, -3))) {
2238     throw SquirrelError(v, "Couldn't register function 'make_invincible'");
2239   }
2240
2241   sq_pushstring(v, "deactivate", -1);
2242   sq_newclosure(v, &Player_deactivate_wrapper, 0);
2243   if(SQ_FAILED(sq_createslot(v, -3))) {
2244     throw SquirrelError(v, "Couldn't register function 'deactivate'");
2245   }
2246
2247   sq_pushstring(v, "activate", -1);
2248   sq_newclosure(v, &Player_activate_wrapper, 0);
2249   if(SQ_FAILED(sq_createslot(v, -3))) {
2250     throw SquirrelError(v, "Couldn't register function 'activate'");
2251   }
2252
2253   sq_pushstring(v, "walk", -1);
2254   sq_newclosure(v, &Player_walk_wrapper, 0);
2255   if(SQ_FAILED(sq_createslot(v, -3))) {
2256     throw SquirrelError(v, "Couldn't register function 'walk'");
2257   }
2258
2259   sq_pushstring(v, "set_visible", -1);
2260   sq_newclosure(v, &Player_set_visible_wrapper, 0);
2261   if(SQ_FAILED(sq_createslot(v, -3))) {
2262     throw SquirrelError(v, "Couldn't register function 'set_visible'");
2263   }
2264
2265   sq_pushstring(v, "get_visible", -1);
2266   sq_newclosure(v, &Player_get_visible_wrapper, 0);
2267   if(SQ_FAILED(sq_createslot(v, -3))) {
2268     throw SquirrelError(v, "Couldn't register function 'get_visible'");
2269   }
2270
2271   if(SQ_FAILED(sq_createslot(v, -3))) {
2272     throw SquirrelError(v, "Couldn't register class 'Player'");
2273   }
2274
2275   // Register class FloatingImage
2276   sq_pushstring(v, "FloatingImage", -1);
2277   if(sq_newclass(v, SQFalse) < 0) {
2278     std::ostringstream msg;
2279     msg << "Couldn't create new class 'FloatingImage'";
2280     throw SquirrelError(v, msg.str());
2281   }
2282   sq_pushstring(v, "constructor", -1);
2283   sq_newclosure(v, &FloatingImage_constructor_wrapper, 0);
2284   if(SQ_FAILED(sq_createslot(v, -3))) {
2285     throw SquirrelError(v, "Couldn't register function 'constructor'");
2286   }
2287
2288   sq_pushstring(v, "set_layer", -1);
2289   sq_newclosure(v, &FloatingImage_set_layer_wrapper, 0);
2290   if(SQ_FAILED(sq_createslot(v, -3))) {
2291     throw SquirrelError(v, "Couldn't register function 'set_layer'");
2292   }
2293
2294   sq_pushstring(v, "get_layer", -1);
2295   sq_newclosure(v, &FloatingImage_get_layer_wrapper, 0);
2296   if(SQ_FAILED(sq_createslot(v, -3))) {
2297     throw SquirrelError(v, "Couldn't register function 'get_layer'");
2298   }
2299
2300   sq_pushstring(v, "set_pos", -1);
2301   sq_newclosure(v, &FloatingImage_set_pos_wrapper, 0);
2302   if(SQ_FAILED(sq_createslot(v, -3))) {
2303     throw SquirrelError(v, "Couldn't register function 'set_pos'");
2304   }
2305
2306   sq_pushstring(v, "get_pos_x", -1);
2307   sq_newclosure(v, &FloatingImage_get_pos_x_wrapper, 0);
2308   if(SQ_FAILED(sq_createslot(v, -3))) {
2309     throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
2310   }
2311
2312   sq_pushstring(v, "get_pos_y", -1);
2313   sq_newclosure(v, &FloatingImage_get_pos_y_wrapper, 0);
2314   if(SQ_FAILED(sq_createslot(v, -3))) {
2315     throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
2316   }
2317
2318   sq_pushstring(v, "set_anchor_point", -1);
2319   sq_newclosure(v, &FloatingImage_set_anchor_point_wrapper, 0);
2320   if(SQ_FAILED(sq_createslot(v, -3))) {
2321     throw SquirrelError(v, "Couldn't register function 'set_anchor_point'");
2322   }
2323
2324   sq_pushstring(v, "get_anchor_point", -1);
2325   sq_newclosure(v, &FloatingImage_get_anchor_point_wrapper, 0);
2326   if(SQ_FAILED(sq_createslot(v, -3))) {
2327     throw SquirrelError(v, "Couldn't register function 'get_anchor_point'");
2328   }
2329
2330   sq_pushstring(v, "set_visible", -1);
2331   sq_newclosure(v, &FloatingImage_set_visible_wrapper, 0);
2332   if(SQ_FAILED(sq_createslot(v, -3))) {
2333     throw SquirrelError(v, "Couldn't register function 'set_visible'");
2334   }
2335
2336   sq_pushstring(v, "get_visible", -1);
2337   sq_newclosure(v, &FloatingImage_get_visible_wrapper, 0);
2338   if(SQ_FAILED(sq_createslot(v, -3))) {
2339     throw SquirrelError(v, "Couldn't register function 'get_visible'");
2340   }
2341
2342   if(SQ_FAILED(sq_createslot(v, -3))) {
2343     throw SquirrelError(v, "Couldn't register class 'FloatingImage'");
2344   }
2345
2346   sq_pop(v, 1);
2347 }
2348
2349 } // end of namespace Scripting
2350