support for centered text in scripts
[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   
80   _this->sixteen_to_nine();
81   
82   return 0;
83 }
84
85 static int DisplayEffect_four_to_three_wrapper(HSQUIRRELVM v)
86 {
87   Scripting::DisplayEffect* _this;
88   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
89   
90   _this->four_to_three();
91   
92   return 0;
93 }
94
95 static int Camera_release_hook(SQUserPointer ptr, int )
96 {
97   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
98   delete _this;
99   return 0;
100 }
101
102 static int Camera_shake_wrapper(HSQUIRRELVM v)
103 {
104   Scripting::Camera* _this;
105   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
106   float arg0;
107   sq_getfloat(v, 2, &arg0);
108   float arg1;
109   sq_getfloat(v, 3, &arg1);
110   float arg2;
111   sq_getfloat(v, 4, &arg2);
112   
113   _this->shake(arg0, arg1, arg2);
114   
115   return 0;
116 }
117
118 static int Camera_set_pos_wrapper(HSQUIRRELVM v)
119 {
120   Scripting::Camera* _this;
121   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
122   float arg0;
123   sq_getfloat(v, 2, &arg0);
124   float arg1;
125   sq_getfloat(v, 3, &arg1);
126   
127   _this->set_pos(arg0, arg1);
128   
129   return 0;
130 }
131
132 static int Camera_set_mode_wrapper(HSQUIRRELVM v)
133 {
134   Scripting::Camera* _this;
135   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
136   const char* arg0;
137   sq_getstring(v, 2, &arg0);
138   
139   _this->set_mode(arg0);
140   
141   return 0;
142 }
143
144 static int Level_release_hook(SQUserPointer ptr, int )
145 {
146   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
147   delete _this;
148   return 0;
149 }
150
151 static int Level_finish_wrapper(HSQUIRRELVM v)
152 {
153   Scripting::Level* _this;
154   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
155   
156   _this->finish();
157   
158   return 0;
159 }
160
161 static int Level_spawn_wrapper(HSQUIRRELVM v)
162 {
163   Scripting::Level* _this;
164   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
165   const char* arg0;
166   sq_getstring(v, 2, &arg0);
167   const char* arg1;
168   sq_getstring(v, 3, &arg1);
169   
170   _this->spawn(arg0, arg1);
171   
172   return 0;
173 }
174
175 static int Level_flip_vertically_wrapper(HSQUIRRELVM v)
176 {
177   Scripting::Level* _this;
178   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
179   
180   _this->flip_vertically();
181   
182   return 0;
183 }
184
185 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
186 {
187   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
188   delete _this;
189   return 0;
190 }
191
192 static int ScriptedObject_set_animation_wrapper(HSQUIRRELVM v)
193 {
194   Scripting::ScriptedObject* _this;
195   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
196   const char* arg0;
197   sq_getstring(v, 2, &arg0);
198   
199   _this->set_animation(arg0);
200   
201   return 0;
202 }
203
204 static int ScriptedObject_get_animation_wrapper(HSQUIRRELVM v)
205 {
206   Scripting::ScriptedObject* _this;
207   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
208   
209   std::string return_value = _this->get_animation();
210   
211   sq_pushstring(v, return_value.c_str(), return_value.size());
212   return 1;
213 }
214
215 static int ScriptedObject_move_wrapper(HSQUIRRELVM v)
216 {
217   Scripting::ScriptedObject* _this;
218   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
219   float arg0;
220   sq_getfloat(v, 2, &arg0);
221   float arg1;
222   sq_getfloat(v, 3, &arg1);
223   
224   _this->move(arg0, arg1);
225   
226   return 0;
227 }
228
229 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM v)
230 {
231   Scripting::ScriptedObject* _this;
232   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
233   float arg0;
234   sq_getfloat(v, 2, &arg0);
235   float arg1;
236   sq_getfloat(v, 3, &arg1);
237   
238   _this->set_pos(arg0, arg1);
239   
240   return 0;
241 }
242
243 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM v)
244 {
245   Scripting::ScriptedObject* _this;
246   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
247   
248   float return_value = _this->get_pos_x();
249   
250   sq_pushfloat(v, return_value);
251   return 1;
252 }
253
254 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM v)
255 {
256   Scripting::ScriptedObject* _this;
257   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
258   
259   float return_value = _this->get_pos_y();
260   
261   sq_pushfloat(v, return_value);
262   return 1;
263 }
264
265 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM v)
266 {
267   Scripting::ScriptedObject* _this;
268   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
269   float arg0;
270   sq_getfloat(v, 2, &arg0);
271   float arg1;
272   sq_getfloat(v, 3, &arg1);
273   
274   _this->set_velocity(arg0, arg1);
275   
276   return 0;
277 }
278
279 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM v)
280 {
281   Scripting::ScriptedObject* _this;
282   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
283   
284   float return_value = _this->get_velocity_x();
285   
286   sq_pushfloat(v, return_value);
287   return 1;
288 }
289
290 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM v)
291 {
292   Scripting::ScriptedObject* _this;
293   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
294   
295   float return_value = _this->get_velocity_y();
296   
297   sq_pushfloat(v, return_value);
298   return 1;
299 }
300
301 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM v)
302 {
303   Scripting::ScriptedObject* _this;
304   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
305   SQBool arg0;
306   sq_getbool(v, 2, &arg0);
307   
308   _this->set_visible(arg0);
309   
310   return 0;
311 }
312
313 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM v)
314 {
315   Scripting::ScriptedObject* _this;
316   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
317   
318   bool return_value = _this->is_visible();
319   
320   sq_pushbool(v, return_value);
321   return 1;
322 }
323
324 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM v)
325 {
326   Scripting::ScriptedObject* _this;
327   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
328   
329   std::string return_value = _this->get_name();
330   
331   sq_pushstring(v, return_value.c_str(), return_value.size());
332   return 1;
333 }
334
335 static int Sound_release_hook(SQUserPointer ptr, int )
336 {
337   Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
338   delete _this;
339   return 0;
340 }
341
342 static int Sound_play_music_wrapper(HSQUIRRELVM v)
343 {
344   Scripting::Sound* _this;
345   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
346   const char* arg0;
347   sq_getstring(v, 2, &arg0);
348   
349   _this->play_music(arg0);
350   
351   return 0;
352 }
353
354 static int Sound_play_wrapper(HSQUIRRELVM v)
355 {
356   Scripting::Sound* _this;
357   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
358   const char* arg0;
359   sq_getstring(v, 2, &arg0);
360   
361   _this->play(arg0);
362   
363   return 0;
364 }
365
366 static int Text_release_hook(SQUserPointer ptr, int )
367 {
368   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
369   delete _this;
370   return 0;
371 }
372
373 static int Text_set_text_wrapper(HSQUIRRELVM v)
374 {
375   Scripting::Text* _this;
376   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
377   const char* arg0;
378   sq_getstring(v, 2, &arg0);
379   
380   _this->set_text(arg0);
381   
382   return 0;
383 }
384
385 static int Text_set_font_wrapper(HSQUIRRELVM v)
386 {
387   Scripting::Text* _this;
388   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
389   const char* arg0;
390   sq_getstring(v, 2, &arg0);
391   
392   _this->set_font(arg0);
393   
394   return 0;
395 }
396
397 static int Text_fade_in_wrapper(HSQUIRRELVM v)
398 {
399   Scripting::Text* _this;
400   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
401   float arg0;
402   sq_getfloat(v, 2, &arg0);
403   
404   _this->fade_in(arg0);
405   
406   return 0;
407 }
408
409 static int Text_fade_out_wrapper(HSQUIRRELVM v)
410 {
411   Scripting::Text* _this;
412   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
413   float arg0;
414   sq_getfloat(v, 2, &arg0);
415   
416   _this->fade_out(arg0);
417   
418   return 0;
419 }
420
421 static int Text_set_visible_wrapper(HSQUIRRELVM v)
422 {
423   Scripting::Text* _this;
424   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
425   SQBool arg0;
426   sq_getbool(v, 2, &arg0);
427   
428   _this->set_visible(arg0);
429   
430   return 0;
431 }
432
433 static int Text_set_centered_wrapper(HSQUIRRELVM v)
434 {
435   Scripting::Text* _this;
436   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
437   SQBool arg0;
438   sq_getbool(v, 2, &arg0);
439   
440   _this->set_centered(arg0);
441   
442   return 0;
443 }
444
445 static int Player_release_hook(SQUserPointer ptr, int )
446 {
447   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
448   delete _this;
449   return 0;
450 }
451
452 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
453 {
454   Scripting::Player* _this;
455   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
456   
457   _this->make_invincible();
458   
459   return 0;
460 }
461
462 static int Player_deactivate_wrapper(HSQUIRRELVM v)
463 {
464   Scripting::Player* _this;
465   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
466   
467   _this->deactivate();
468   
469   return 0;
470 }
471
472 static int Player_activate_wrapper(HSQUIRRELVM v)
473 {
474   Scripting::Player* _this;
475   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
476   
477   _this->activate();
478   
479   return 0;
480 }
481
482 static int Player_walk_wrapper(HSQUIRRELVM v)
483 {
484   Scripting::Player* _this;
485   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
486   float arg0;
487   sq_getfloat(v, 2, &arg0);
488   
489   _this->walk(arg0);
490   
491   return 0;
492 }
493
494 static int display_text_file_wrapper(HSQUIRRELVM v)
495 {
496   const char* arg0;
497   sq_getstring(v, 2, &arg0);
498   
499   Scripting::display_text_file(arg0);
500   
501   return 0;
502 }
503
504 static int wait_wrapper(HSQUIRRELVM v)
505 {
506   float arg0;
507   sq_getfloat(v, 2, &arg0);
508   
509   Scripting::wait(arg0);
510   
511   return sq_suspendvm(v);
512 }
513
514 static int translate_wrapper(HSQUIRRELVM v)
515 {
516   const char* arg0;
517   sq_getstring(v, 2, &arg0);
518   
519   std::string return_value = Scripting::translate(arg0);
520   
521   sq_pushstring(v, return_value.c_str(), return_value.size());
522   return 1;
523 }
524
525 static int import_wrapper(HSQUIRRELVM v)
526 {
527   HSQUIRRELVM arg0 = v;
528   const char* arg1;
529   sq_getstring(v, 2, &arg1);
530   
531   Scripting::import(arg0, arg1);
532   
533   return 0;
534 }
535
536 static int add_key_wrapper(HSQUIRRELVM v)
537 {
538   int arg0;
539   sq_getinteger(v, 2, &arg0);
540   
541   Scripting::add_key(arg0);
542   
543   return 0;
544 }
545
546 } // end of namespace Wrapper
547
548 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
549 {
550   using namespace Wrapper;
551
552   sq_pushroottable(v);
553   sq_pushstring(v, "DisplayEffect", -1);
554   if(SQ_FAILED(sq_get(v, -2))) {
555     std::ostringstream msg;
556     msg << "Couldn't resolved squirrel type 'DisplayEffect'";
557     throw SquirrelError(v, msg.str());
558   }
559
560   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
561     std::ostringstream msg;
562     msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
563     throw SquirrelError(v, msg.str());
564   }
565   sq_remove(v, -2); // remove object name
566
567   if(setup_releasehook) {
568     sq_setreleasehook(v, -1, DisplayEffect_release_hook);
569   }
570
571   sq_remove(v, -2); // remove root table
572 }
573
574 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
575 {
576   using namespace Wrapper;
577
578   sq_pushroottable(v);
579   sq_pushstring(v, "Camera", -1);
580   if(SQ_FAILED(sq_get(v, -2))) {
581     std::ostringstream msg;
582     msg << "Couldn't resolved squirrel type 'Camera'";
583     throw SquirrelError(v, msg.str());
584   }
585
586   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
587     std::ostringstream msg;
588     msg << "Couldn't setup squirrel instance for object of type 'Camera'";
589     throw SquirrelError(v, msg.str());
590   }
591   sq_remove(v, -2); // remove object name
592
593   if(setup_releasehook) {
594     sq_setreleasehook(v, -1, Camera_release_hook);
595   }
596
597   sq_remove(v, -2); // remove root table
598 }
599
600 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
601 {
602   using namespace Wrapper;
603
604   sq_pushroottable(v);
605   sq_pushstring(v, "Level", -1);
606   if(SQ_FAILED(sq_get(v, -2))) {
607     std::ostringstream msg;
608     msg << "Couldn't resolved squirrel type 'Level'";
609     throw SquirrelError(v, msg.str());
610   }
611
612   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
613     std::ostringstream msg;
614     msg << "Couldn't setup squirrel instance for object of type 'Level'";
615     throw SquirrelError(v, msg.str());
616   }
617   sq_remove(v, -2); // remove object name
618
619   if(setup_releasehook) {
620     sq_setreleasehook(v, -1, Level_release_hook);
621   }
622
623   sq_remove(v, -2); // remove root table
624 }
625
626 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
627 {
628   using namespace Wrapper;
629
630   sq_pushroottable(v);
631   sq_pushstring(v, "ScriptedObject", -1);
632   if(SQ_FAILED(sq_get(v, -2))) {
633     std::ostringstream msg;
634     msg << "Couldn't resolved squirrel type 'ScriptedObject'";
635     throw SquirrelError(v, msg.str());
636   }
637
638   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
639     std::ostringstream msg;
640     msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
641     throw SquirrelError(v, msg.str());
642   }
643   sq_remove(v, -2); // remove object name
644
645   if(setup_releasehook) {
646     sq_setreleasehook(v, -1, ScriptedObject_release_hook);
647   }
648
649   sq_remove(v, -2); // remove root table
650 }
651
652 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
653 {
654   using namespace Wrapper;
655
656   sq_pushroottable(v);
657   sq_pushstring(v, "Sound", -1);
658   if(SQ_FAILED(sq_get(v, -2))) {
659     std::ostringstream msg;
660     msg << "Couldn't resolved squirrel type 'Sound'";
661     throw SquirrelError(v, msg.str());
662   }
663
664   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
665     std::ostringstream msg;
666     msg << "Couldn't setup squirrel instance for object of type 'Sound'";
667     throw SquirrelError(v, msg.str());
668   }
669   sq_remove(v, -2); // remove object name
670
671   if(setup_releasehook) {
672     sq_setreleasehook(v, -1, Sound_release_hook);
673   }
674
675   sq_remove(v, -2); // remove root table
676 }
677
678 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
679 {
680   using namespace Wrapper;
681
682   sq_pushroottable(v);
683   sq_pushstring(v, "Text", -1);
684   if(SQ_FAILED(sq_get(v, -2))) {
685     std::ostringstream msg;
686     msg << "Couldn't resolved squirrel type 'Text'";
687     throw SquirrelError(v, msg.str());
688   }
689
690   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
691     std::ostringstream msg;
692     msg << "Couldn't setup squirrel instance for object of type 'Text'";
693     throw SquirrelError(v, msg.str());
694   }
695   sq_remove(v, -2); // remove object name
696
697   if(setup_releasehook) {
698     sq_setreleasehook(v, -1, Text_release_hook);
699   }
700
701   sq_remove(v, -2); // remove root table
702 }
703
704 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
705 {
706   using namespace Wrapper;
707
708   sq_pushroottable(v);
709   sq_pushstring(v, "Player", -1);
710   if(SQ_FAILED(sq_get(v, -2))) {
711     std::ostringstream msg;
712     msg << "Couldn't resolved squirrel type 'Player'";
713     throw SquirrelError(v, msg.str());
714   }
715
716   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
717     std::ostringstream msg;
718     msg << "Couldn't setup squirrel instance for object of type 'Player'";
719     throw SquirrelError(v, msg.str());
720   }
721   sq_remove(v, -2); // remove object name
722
723   if(setup_releasehook) {
724     sq_setreleasehook(v, -1, Player_release_hook);
725   }
726
727   sq_remove(v, -2); // remove root table
728 }
729
730 void register_supertux_wrapper(HSQUIRRELVM v)
731 {
732   using namespace Wrapper;
733
734   sq_pushroottable(v);
735   sq_pushstring(v, "KEY_BRASS", -1);
736   sq_pushinteger(v, 1);
737   if(SQ_FAILED(sq_createslot(v, -3))) {
738     std::ostringstream msg;
739     msg << "Couldn't register constant'KEY_BRASS'";
740     throw SquirrelError(v, msg.str());
741   }
742
743   sq_pushstring(v, "KEY_IRON", -1);
744   sq_pushinteger(v, 2);
745   if(SQ_FAILED(sq_createslot(v, -3))) {
746     std::ostringstream msg;
747     msg << "Couldn't register constant'KEY_IRON'";
748     throw SquirrelError(v, msg.str());
749   }
750
751   sq_pushstring(v, "KEY_BRONZE", -1);
752   sq_pushinteger(v, 4);
753   if(SQ_FAILED(sq_createslot(v, -3))) {
754     std::ostringstream msg;
755     msg << "Couldn't register constant'KEY_BRONZE'";
756     throw SquirrelError(v, msg.str());
757   }
758
759   sq_pushstring(v, "KEY_SILVER", -1);
760   sq_pushinteger(v, 8);
761   if(SQ_FAILED(sq_createslot(v, -3))) {
762     std::ostringstream msg;
763     msg << "Couldn't register constant'KEY_SILVER'";
764     throw SquirrelError(v, msg.str());
765   }
766
767   sq_pushstring(v, "KEY_GOLD", -1);
768   sq_pushinteger(v, 16);
769   if(SQ_FAILED(sq_createslot(v, -3))) {
770     std::ostringstream msg;
771     msg << "Couldn't register constant'KEY_GOLD'";
772     throw SquirrelError(v, msg.str());
773   }
774
775   sq_pushstring(v, "display_text_file", -1);
776   sq_newclosure(v, &display_text_file_wrapper, 0);
777   if(SQ_FAILED(sq_createslot(v, -3))) {
778     std::ostringstream msg;
779     msg << "Couldn't register function'display_text_file'";
780     throw SquirrelError(v, msg.str());
781   }
782
783   sq_pushstring(v, "wait", -1);
784   sq_newclosure(v, &wait_wrapper, 0);
785   if(SQ_FAILED(sq_createslot(v, -3))) {
786     std::ostringstream msg;
787     msg << "Couldn't register function'wait'";
788     throw SquirrelError(v, msg.str());
789   }
790
791   sq_pushstring(v, "translate", -1);
792   sq_newclosure(v, &translate_wrapper, 0);
793   if(SQ_FAILED(sq_createslot(v, -3))) {
794     std::ostringstream msg;
795     msg << "Couldn't register function'translate'";
796     throw SquirrelError(v, msg.str());
797   }
798
799   sq_pushstring(v, "import", -1);
800   sq_newclosure(v, &import_wrapper, 0);
801   if(SQ_FAILED(sq_createslot(v, -3))) {
802     std::ostringstream msg;
803     msg << "Couldn't register function'import'";
804     throw SquirrelError(v, msg.str());
805   }
806
807   sq_pushstring(v, "add_key", -1);
808   sq_newclosure(v, &add_key_wrapper, 0);
809   if(SQ_FAILED(sq_createslot(v, -3))) {
810     std::ostringstream msg;
811     msg << "Couldn't register function'add_key'";
812     throw SquirrelError(v, msg.str());
813   }
814
815   // Register class DisplayEffect
816   sq_pushstring(v, "DisplayEffect", -1);
817   if(sq_newclass(v, SQFalse) < 0) {
818     std::ostringstream msg;
819     msg << "Couldn't create new class 'DisplayEffect'";
820     throw SquirrelError(v, msg.str());
821   }
822   sq_pushstring(v, "fade_out", -1);
823   sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
824   if(SQ_FAILED(sq_createslot(v, -3))) {
825     std::ostringstream msg;
826     msg << "Couldn't register function'fade_out'";
827     throw SquirrelError(v, msg.str());
828   }
829
830   sq_pushstring(v, "fade_in", -1);
831   sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
832   if(SQ_FAILED(sq_createslot(v, -3))) {
833     std::ostringstream msg;
834     msg << "Couldn't register function'fade_in'";
835     throw SquirrelError(v, msg.str());
836   }
837
838   sq_pushstring(v, "set_black", -1);
839   sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
840   if(SQ_FAILED(sq_createslot(v, -3))) {
841     std::ostringstream msg;
842     msg << "Couldn't register function'set_black'";
843     throw SquirrelError(v, msg.str());
844   }
845
846   sq_pushstring(v, "is_black", -1);
847   sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
848   if(SQ_FAILED(sq_createslot(v, -3))) {
849     std::ostringstream msg;
850     msg << "Couldn't register function'is_black'";
851     throw SquirrelError(v, msg.str());
852   }
853
854   sq_pushstring(v, "sixteen_to_nine", -1);
855   sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
856   if(SQ_FAILED(sq_createslot(v, -3))) {
857     std::ostringstream msg;
858     msg << "Couldn't register function'sixteen_to_nine'";
859     throw SquirrelError(v, msg.str());
860   }
861
862   sq_pushstring(v, "four_to_three", -1);
863   sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
864   if(SQ_FAILED(sq_createslot(v, -3))) {
865     std::ostringstream msg;
866     msg << "Couldn't register function'four_to_three'";
867     throw SquirrelError(v, msg.str());
868   }
869
870   if(SQ_FAILED(sq_createslot(v, -3))) {
871     std::ostringstream msg;
872     msg << "Couldn't register class'DisplayEffect'";
873     throw SquirrelError(v, msg.str());
874   }
875
876   // Register class Camera
877   sq_pushstring(v, "Camera", -1);
878   if(sq_newclass(v, SQFalse) < 0) {
879     std::ostringstream msg;
880     msg << "Couldn't create new class 'Camera'";
881     throw SquirrelError(v, msg.str());
882   }
883   sq_pushstring(v, "shake", -1);
884   sq_newclosure(v, &Camera_shake_wrapper, 0);
885   if(SQ_FAILED(sq_createslot(v, -3))) {
886     std::ostringstream msg;
887     msg << "Couldn't register function'shake'";
888     throw SquirrelError(v, msg.str());
889   }
890
891   sq_pushstring(v, "set_pos", -1);
892   sq_newclosure(v, &Camera_set_pos_wrapper, 0);
893   if(SQ_FAILED(sq_createslot(v, -3))) {
894     std::ostringstream msg;
895     msg << "Couldn't register function'set_pos'";
896     throw SquirrelError(v, msg.str());
897   }
898
899   sq_pushstring(v, "set_mode", -1);
900   sq_newclosure(v, &Camera_set_mode_wrapper, 0);
901   if(SQ_FAILED(sq_createslot(v, -3))) {
902     std::ostringstream msg;
903     msg << "Couldn't register function'set_mode'";
904     throw SquirrelError(v, msg.str());
905   }
906
907   if(SQ_FAILED(sq_createslot(v, -3))) {
908     std::ostringstream msg;
909     msg << "Couldn't register class'Camera'";
910     throw SquirrelError(v, msg.str());
911   }
912
913   // Register class Level
914   sq_pushstring(v, "Level", -1);
915   if(sq_newclass(v, SQFalse) < 0) {
916     std::ostringstream msg;
917     msg << "Couldn't create new class 'Level'";
918     throw SquirrelError(v, msg.str());
919   }
920   sq_pushstring(v, "finish", -1);
921   sq_newclosure(v, &Level_finish_wrapper, 0);
922   if(SQ_FAILED(sq_createslot(v, -3))) {
923     std::ostringstream msg;
924     msg << "Couldn't register function'finish'";
925     throw SquirrelError(v, msg.str());
926   }
927
928   sq_pushstring(v, "spawn", -1);
929   sq_newclosure(v, &Level_spawn_wrapper, 0);
930   if(SQ_FAILED(sq_createslot(v, -3))) {
931     std::ostringstream msg;
932     msg << "Couldn't register function'spawn'";
933     throw SquirrelError(v, msg.str());
934   }
935
936   sq_pushstring(v, "flip_vertically", -1);
937   sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
938   if(SQ_FAILED(sq_createslot(v, -3))) {
939     std::ostringstream msg;
940     msg << "Couldn't register function'flip_vertically'";
941     throw SquirrelError(v, msg.str());
942   }
943
944   if(SQ_FAILED(sq_createslot(v, -3))) {
945     std::ostringstream msg;
946     msg << "Couldn't register class'Level'";
947     throw SquirrelError(v, msg.str());
948   }
949
950   // Register class ScriptedObject
951   sq_pushstring(v, "ScriptedObject", -1);
952   if(sq_newclass(v, SQFalse) < 0) {
953     std::ostringstream msg;
954     msg << "Couldn't create new class 'ScriptedObject'";
955     throw SquirrelError(v, msg.str());
956   }
957   sq_pushstring(v, "set_animation", -1);
958   sq_newclosure(v, &ScriptedObject_set_animation_wrapper, 0);
959   if(SQ_FAILED(sq_createslot(v, -3))) {
960     std::ostringstream msg;
961     msg << "Couldn't register function'set_animation'";
962     throw SquirrelError(v, msg.str());
963   }
964
965   sq_pushstring(v, "get_animation", -1);
966   sq_newclosure(v, &ScriptedObject_get_animation_wrapper, 0);
967   if(SQ_FAILED(sq_createslot(v, -3))) {
968     std::ostringstream msg;
969     msg << "Couldn't register function'get_animation'";
970     throw SquirrelError(v, msg.str());
971   }
972
973   sq_pushstring(v, "move", -1);
974   sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
975   if(SQ_FAILED(sq_createslot(v, -3))) {
976     std::ostringstream msg;
977     msg << "Couldn't register function'move'";
978     throw SquirrelError(v, msg.str());
979   }
980
981   sq_pushstring(v, "set_pos", -1);
982   sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
983   if(SQ_FAILED(sq_createslot(v, -3))) {
984     std::ostringstream msg;
985     msg << "Couldn't register function'set_pos'";
986     throw SquirrelError(v, msg.str());
987   }
988
989   sq_pushstring(v, "get_pos_x", -1);
990   sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
991   if(SQ_FAILED(sq_createslot(v, -3))) {
992     std::ostringstream msg;
993     msg << "Couldn't register function'get_pos_x'";
994     throw SquirrelError(v, msg.str());
995   }
996
997   sq_pushstring(v, "get_pos_y", -1);
998   sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
999   if(SQ_FAILED(sq_createslot(v, -3))) {
1000     std::ostringstream msg;
1001     msg << "Couldn't register function'get_pos_y'";
1002     throw SquirrelError(v, msg.str());
1003   }
1004
1005   sq_pushstring(v, "set_velocity", -1);
1006   sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
1007   if(SQ_FAILED(sq_createslot(v, -3))) {
1008     std::ostringstream msg;
1009     msg << "Couldn't register function'set_velocity'";
1010     throw SquirrelError(v, msg.str());
1011   }
1012
1013   sq_pushstring(v, "get_velocity_x", -1);
1014   sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
1015   if(SQ_FAILED(sq_createslot(v, -3))) {
1016     std::ostringstream msg;
1017     msg << "Couldn't register function'get_velocity_x'";
1018     throw SquirrelError(v, msg.str());
1019   }
1020
1021   sq_pushstring(v, "get_velocity_y", -1);
1022   sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
1023   if(SQ_FAILED(sq_createslot(v, -3))) {
1024     std::ostringstream msg;
1025     msg << "Couldn't register function'get_velocity_y'";
1026     throw SquirrelError(v, msg.str());
1027   }
1028
1029   sq_pushstring(v, "set_visible", -1);
1030   sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
1031   if(SQ_FAILED(sq_createslot(v, -3))) {
1032     std::ostringstream msg;
1033     msg << "Couldn't register function'set_visible'";
1034     throw SquirrelError(v, msg.str());
1035   }
1036
1037   sq_pushstring(v, "is_visible", -1);
1038   sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
1039   if(SQ_FAILED(sq_createslot(v, -3))) {
1040     std::ostringstream msg;
1041     msg << "Couldn't register function'is_visible'";
1042     throw SquirrelError(v, msg.str());
1043   }
1044
1045   sq_pushstring(v, "get_name", -1);
1046   sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
1047   if(SQ_FAILED(sq_createslot(v, -3))) {
1048     std::ostringstream msg;
1049     msg << "Couldn't register function'get_name'";
1050     throw SquirrelError(v, msg.str());
1051   }
1052
1053   if(SQ_FAILED(sq_createslot(v, -3))) {
1054     std::ostringstream msg;
1055     msg << "Couldn't register class'ScriptedObject'";
1056     throw SquirrelError(v, msg.str());
1057   }
1058
1059   // Register class Sound
1060   sq_pushstring(v, "Sound", -1);
1061   if(sq_newclass(v, SQFalse) < 0) {
1062     std::ostringstream msg;
1063     msg << "Couldn't create new class 'Sound'";
1064     throw SquirrelError(v, msg.str());
1065   }
1066   sq_pushstring(v, "play_music", -1);
1067   sq_newclosure(v, &Sound_play_music_wrapper, 0);
1068   if(SQ_FAILED(sq_createslot(v, -3))) {
1069     std::ostringstream msg;
1070     msg << "Couldn't register function'play_music'";
1071     throw SquirrelError(v, msg.str());
1072   }
1073
1074   sq_pushstring(v, "play", -1);
1075   sq_newclosure(v, &Sound_play_wrapper, 0);
1076   if(SQ_FAILED(sq_createslot(v, -3))) {
1077     std::ostringstream msg;
1078     msg << "Couldn't register function'play'";
1079     throw SquirrelError(v, msg.str());
1080   }
1081
1082   if(SQ_FAILED(sq_createslot(v, -3))) {
1083     std::ostringstream msg;
1084     msg << "Couldn't register class'Sound'";
1085     throw SquirrelError(v, msg.str());
1086   }
1087
1088   // Register class Text
1089   sq_pushstring(v, "Text", -1);
1090   if(sq_newclass(v, SQFalse) < 0) {
1091     std::ostringstream msg;
1092     msg << "Couldn't create new class 'Text'";
1093     throw SquirrelError(v, msg.str());
1094   }
1095   sq_pushstring(v, "set_text", -1);
1096   sq_newclosure(v, &Text_set_text_wrapper, 0);
1097   if(SQ_FAILED(sq_createslot(v, -3))) {
1098     std::ostringstream msg;
1099     msg << "Couldn't register function'set_text'";
1100     throw SquirrelError(v, msg.str());
1101   }
1102
1103   sq_pushstring(v, "set_font", -1);
1104   sq_newclosure(v, &Text_set_font_wrapper, 0);
1105   if(SQ_FAILED(sq_createslot(v, -3))) {
1106     std::ostringstream msg;
1107     msg << "Couldn't register function'set_font'";
1108     throw SquirrelError(v, msg.str());
1109   }
1110
1111   sq_pushstring(v, "fade_in", -1);
1112   sq_newclosure(v, &Text_fade_in_wrapper, 0);
1113   if(SQ_FAILED(sq_createslot(v, -3))) {
1114     std::ostringstream msg;
1115     msg << "Couldn't register function'fade_in'";
1116     throw SquirrelError(v, msg.str());
1117   }
1118
1119   sq_pushstring(v, "fade_out", -1);
1120   sq_newclosure(v, &Text_fade_out_wrapper, 0);
1121   if(SQ_FAILED(sq_createslot(v, -3))) {
1122     std::ostringstream msg;
1123     msg << "Couldn't register function'fade_out'";
1124     throw SquirrelError(v, msg.str());
1125   }
1126
1127   sq_pushstring(v, "set_visible", -1);
1128   sq_newclosure(v, &Text_set_visible_wrapper, 0);
1129   if(SQ_FAILED(sq_createslot(v, -3))) {
1130     std::ostringstream msg;
1131     msg << "Couldn't register function'set_visible'";
1132     throw SquirrelError(v, msg.str());
1133   }
1134
1135   sq_pushstring(v, "set_centered", -1);
1136   sq_newclosure(v, &Text_set_centered_wrapper, 0);
1137   if(SQ_FAILED(sq_createslot(v, -3))) {
1138     std::ostringstream msg;
1139     msg << "Couldn't register function'set_centered'";
1140     throw SquirrelError(v, msg.str());
1141   }
1142
1143   if(SQ_FAILED(sq_createslot(v, -3))) {
1144     std::ostringstream msg;
1145     msg << "Couldn't register class'Text'";
1146     throw SquirrelError(v, msg.str());
1147   }
1148
1149   // Register class Player
1150   sq_pushstring(v, "Player", -1);
1151   if(sq_newclass(v, SQFalse) < 0) {
1152     std::ostringstream msg;
1153     msg << "Couldn't create new class 'Player'";
1154     throw SquirrelError(v, msg.str());
1155   }
1156   sq_pushstring(v, "make_invincible", -1);
1157   sq_newclosure(v, &Player_make_invincible_wrapper, 0);
1158   if(SQ_FAILED(sq_createslot(v, -3))) {
1159     std::ostringstream msg;
1160     msg << "Couldn't register function'make_invincible'";
1161     throw SquirrelError(v, msg.str());
1162   }
1163
1164   sq_pushstring(v, "deactivate", -1);
1165   sq_newclosure(v, &Player_deactivate_wrapper, 0);
1166   if(SQ_FAILED(sq_createslot(v, -3))) {
1167     std::ostringstream msg;
1168     msg << "Couldn't register function'deactivate'";
1169     throw SquirrelError(v, msg.str());
1170   }
1171
1172   sq_pushstring(v, "activate", -1);
1173   sq_newclosure(v, &Player_activate_wrapper, 0);
1174   if(SQ_FAILED(sq_createslot(v, -3))) {
1175     std::ostringstream msg;
1176     msg << "Couldn't register function'activate'";
1177     throw SquirrelError(v, msg.str());
1178   }
1179
1180   sq_pushstring(v, "walk", -1);
1181   sq_newclosure(v, &Player_walk_wrapper, 0);
1182   if(SQ_FAILED(sq_createslot(v, -3))) {
1183     std::ostringstream msg;
1184     msg << "Couldn't register function'walk'";
1185     throw SquirrelError(v, msg.str());
1186   }
1187
1188   if(SQ_FAILED(sq_createslot(v, -3))) {
1189     std::ostringstream msg;
1190     msg << "Couldn't register class'Player'";
1191     throw SquirrelError(v, msg.str());
1192   }
1193
1194   sq_pop(v, 1);
1195 }
1196
1197 } // end of namespace Scripting
1198