lots of cool scripting stuff
[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 Player_release_hook(SQUserPointer ptr, int )
434 {
435   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
436   delete _this;
437   return 0;
438 }
439
440 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
441 {
442   Scripting::Player* _this;
443   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
444   
445   _this->make_invincible();
446   
447   return 0;
448 }
449
450 static int Player_deactivate_wrapper(HSQUIRRELVM v)
451 {
452   Scripting::Player* _this;
453   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
454   
455   _this->deactivate();
456   
457   return 0;
458 }
459
460 static int Player_activate_wrapper(HSQUIRRELVM v)
461 {
462   Scripting::Player* _this;
463   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
464   
465   _this->activate();
466   
467   return 0;
468 }
469
470 static int Player_walk_wrapper(HSQUIRRELVM v)
471 {
472   Scripting::Player* _this;
473   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
474   float arg0;
475   sq_getfloat(v, 2, &arg0);
476   
477   _this->walk(arg0);
478   
479   return 0;
480 }
481
482 static int display_text_file_wrapper(HSQUIRRELVM v)
483 {
484   const char* arg0;
485   sq_getstring(v, 2, &arg0);
486   
487   Scripting::display_text_file(arg0);
488   
489   return 0;
490 }
491
492 static int wait_wrapper(HSQUIRRELVM v)
493 {
494   float arg0;
495   sq_getfloat(v, 2, &arg0);
496   
497   Scripting::wait(arg0);
498   
499   return sq_suspendvm(v);
500 }
501
502 static int translate_wrapper(HSQUIRRELVM v)
503 {
504   const char* arg0;
505   sq_getstring(v, 2, &arg0);
506   
507   std::string return_value = Scripting::translate(arg0);
508   
509   sq_pushstring(v, return_value.c_str(), return_value.size());
510   return 1;
511 }
512
513 static int import_wrapper(HSQUIRRELVM v)
514 {
515   HSQUIRRELVM arg0 = v;
516   const char* arg1;
517   sq_getstring(v, 2, &arg1);
518   
519   Scripting::import(arg0, arg1);
520   
521   return 0;
522 }
523
524 static int add_key_wrapper(HSQUIRRELVM v)
525 {
526   int arg0;
527   sq_getinteger(v, 2, &arg0);
528   
529   Scripting::add_key(arg0);
530   
531   return 0;
532 }
533
534 } // end of namespace Wrapper
535
536 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
537 {
538   using namespace Wrapper;
539
540   sq_pushroottable(v);
541   sq_pushstring(v, "DisplayEffect", -1);
542   if(SQ_FAILED(sq_get(v, -2))) {
543     std::ostringstream msg;
544     msg << "Couldn't resolved squirrel type 'DisplayEffect'";
545     throw SquirrelError(v, msg.str());
546   }
547
548   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
549     std::ostringstream msg;
550     msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
551     throw SquirrelError(v, msg.str());
552   }
553   sq_remove(v, -2); // remove object name
554
555   if(setup_releasehook) {
556     sq_setreleasehook(v, -1, DisplayEffect_release_hook);
557   }
558
559   sq_remove(v, -2); // remove root table
560 }
561
562 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
563 {
564   using namespace Wrapper;
565
566   sq_pushroottable(v);
567   sq_pushstring(v, "Camera", -1);
568   if(SQ_FAILED(sq_get(v, -2))) {
569     std::ostringstream msg;
570     msg << "Couldn't resolved squirrel type 'Camera'";
571     throw SquirrelError(v, msg.str());
572   }
573
574   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
575     std::ostringstream msg;
576     msg << "Couldn't setup squirrel instance for object of type 'Camera'";
577     throw SquirrelError(v, msg.str());
578   }
579   sq_remove(v, -2); // remove object name
580
581   if(setup_releasehook) {
582     sq_setreleasehook(v, -1, Camera_release_hook);
583   }
584
585   sq_remove(v, -2); // remove root table
586 }
587
588 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
589 {
590   using namespace Wrapper;
591
592   sq_pushroottable(v);
593   sq_pushstring(v, "Level", -1);
594   if(SQ_FAILED(sq_get(v, -2))) {
595     std::ostringstream msg;
596     msg << "Couldn't resolved squirrel type 'Level'";
597     throw SquirrelError(v, msg.str());
598   }
599
600   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
601     std::ostringstream msg;
602     msg << "Couldn't setup squirrel instance for object of type 'Level'";
603     throw SquirrelError(v, msg.str());
604   }
605   sq_remove(v, -2); // remove object name
606
607   if(setup_releasehook) {
608     sq_setreleasehook(v, -1, Level_release_hook);
609   }
610
611   sq_remove(v, -2); // remove root table
612 }
613
614 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
615 {
616   using namespace Wrapper;
617
618   sq_pushroottable(v);
619   sq_pushstring(v, "ScriptedObject", -1);
620   if(SQ_FAILED(sq_get(v, -2))) {
621     std::ostringstream msg;
622     msg << "Couldn't resolved squirrel type 'ScriptedObject'";
623     throw SquirrelError(v, msg.str());
624   }
625
626   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
627     std::ostringstream msg;
628     msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
629     throw SquirrelError(v, msg.str());
630   }
631   sq_remove(v, -2); // remove object name
632
633   if(setup_releasehook) {
634     sq_setreleasehook(v, -1, ScriptedObject_release_hook);
635   }
636
637   sq_remove(v, -2); // remove root table
638 }
639
640 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
641 {
642   using namespace Wrapper;
643
644   sq_pushroottable(v);
645   sq_pushstring(v, "Sound", -1);
646   if(SQ_FAILED(sq_get(v, -2))) {
647     std::ostringstream msg;
648     msg << "Couldn't resolved squirrel type 'Sound'";
649     throw SquirrelError(v, msg.str());
650   }
651
652   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
653     std::ostringstream msg;
654     msg << "Couldn't setup squirrel instance for object of type 'Sound'";
655     throw SquirrelError(v, msg.str());
656   }
657   sq_remove(v, -2); // remove object name
658
659   if(setup_releasehook) {
660     sq_setreleasehook(v, -1, Sound_release_hook);
661   }
662
663   sq_remove(v, -2); // remove root table
664 }
665
666 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
667 {
668   using namespace Wrapper;
669
670   sq_pushroottable(v);
671   sq_pushstring(v, "Text", -1);
672   if(SQ_FAILED(sq_get(v, -2))) {
673     std::ostringstream msg;
674     msg << "Couldn't resolved squirrel type 'Text'";
675     throw SquirrelError(v, msg.str());
676   }
677
678   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
679     std::ostringstream msg;
680     msg << "Couldn't setup squirrel instance for object of type 'Text'";
681     throw SquirrelError(v, msg.str());
682   }
683   sq_remove(v, -2); // remove object name
684
685   if(setup_releasehook) {
686     sq_setreleasehook(v, -1, Text_release_hook);
687   }
688
689   sq_remove(v, -2); // remove root table
690 }
691
692 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
693 {
694   using namespace Wrapper;
695
696   sq_pushroottable(v);
697   sq_pushstring(v, "Player", -1);
698   if(SQ_FAILED(sq_get(v, -2))) {
699     std::ostringstream msg;
700     msg << "Couldn't resolved squirrel type 'Player'";
701     throw SquirrelError(v, msg.str());
702   }
703
704   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
705     std::ostringstream msg;
706     msg << "Couldn't setup squirrel instance for object of type 'Player'";
707     throw SquirrelError(v, msg.str());
708   }
709   sq_remove(v, -2); // remove object name
710
711   if(setup_releasehook) {
712     sq_setreleasehook(v, -1, Player_release_hook);
713   }
714
715   sq_remove(v, -2); // remove root table
716 }
717
718 void register_supertux_wrapper(HSQUIRRELVM v)
719 {
720   using namespace Wrapper;
721
722   sq_pushroottable(v);
723   sq_pushstring(v, "KEY_BRASS", -1);
724   sq_pushinteger(v, 1);
725   if(SQ_FAILED(sq_createslot(v, -3))) {
726     std::ostringstream msg;
727     msg << "Couldn't register constant'KEY_BRASS'";
728     throw SquirrelError(v, msg.str());
729   }
730
731   sq_pushstring(v, "KEY_IRON", -1);
732   sq_pushinteger(v, 2);
733   if(SQ_FAILED(sq_createslot(v, -3))) {
734     std::ostringstream msg;
735     msg << "Couldn't register constant'KEY_IRON'";
736     throw SquirrelError(v, msg.str());
737   }
738
739   sq_pushstring(v, "KEY_BRONZE", -1);
740   sq_pushinteger(v, 4);
741   if(SQ_FAILED(sq_createslot(v, -3))) {
742     std::ostringstream msg;
743     msg << "Couldn't register constant'KEY_BRONZE'";
744     throw SquirrelError(v, msg.str());
745   }
746
747   sq_pushstring(v, "KEY_SILVER", -1);
748   sq_pushinteger(v, 8);
749   if(SQ_FAILED(sq_createslot(v, -3))) {
750     std::ostringstream msg;
751     msg << "Couldn't register constant'KEY_SILVER'";
752     throw SquirrelError(v, msg.str());
753   }
754
755   sq_pushstring(v, "KEY_GOLD", -1);
756   sq_pushinteger(v, 16);
757   if(SQ_FAILED(sq_createslot(v, -3))) {
758     std::ostringstream msg;
759     msg << "Couldn't register constant'KEY_GOLD'";
760     throw SquirrelError(v, msg.str());
761   }
762
763   sq_pushstring(v, "display_text_file", -1);
764   sq_newclosure(v, &display_text_file_wrapper, 0);
765   if(SQ_FAILED(sq_createslot(v, -3))) {
766     std::ostringstream msg;
767     msg << "Couldn't register function'display_text_file'";
768     throw SquirrelError(v, msg.str());
769   }
770
771   sq_pushstring(v, "wait", -1);
772   sq_newclosure(v, &wait_wrapper, 0);
773   if(SQ_FAILED(sq_createslot(v, -3))) {
774     std::ostringstream msg;
775     msg << "Couldn't register function'wait'";
776     throw SquirrelError(v, msg.str());
777   }
778
779   sq_pushstring(v, "translate", -1);
780   sq_newclosure(v, &translate_wrapper, 0);
781   if(SQ_FAILED(sq_createslot(v, -3))) {
782     std::ostringstream msg;
783     msg << "Couldn't register function'translate'";
784     throw SquirrelError(v, msg.str());
785   }
786
787   sq_pushstring(v, "import", -1);
788   sq_newclosure(v, &import_wrapper, 0);
789   if(SQ_FAILED(sq_createslot(v, -3))) {
790     std::ostringstream msg;
791     msg << "Couldn't register function'import'";
792     throw SquirrelError(v, msg.str());
793   }
794
795   sq_pushstring(v, "add_key", -1);
796   sq_newclosure(v, &add_key_wrapper, 0);
797   if(SQ_FAILED(sq_createslot(v, -3))) {
798     std::ostringstream msg;
799     msg << "Couldn't register function'add_key'";
800     throw SquirrelError(v, msg.str());
801   }
802
803   // Register class DisplayEffect
804   sq_pushstring(v, "DisplayEffect", -1);
805   if(sq_newclass(v, SQFalse) < 0) {
806     std::ostringstream msg;
807     msg << "Couldn't create new class 'DisplayEffect'";
808     throw SquirrelError(v, msg.str());
809   }
810   sq_pushstring(v, "fade_out", -1);
811   sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
812   if(SQ_FAILED(sq_createslot(v, -3))) {
813     std::ostringstream msg;
814     msg << "Couldn't register function'fade_out'";
815     throw SquirrelError(v, msg.str());
816   }
817
818   sq_pushstring(v, "fade_in", -1);
819   sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
820   if(SQ_FAILED(sq_createslot(v, -3))) {
821     std::ostringstream msg;
822     msg << "Couldn't register function'fade_in'";
823     throw SquirrelError(v, msg.str());
824   }
825
826   sq_pushstring(v, "set_black", -1);
827   sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
828   if(SQ_FAILED(sq_createslot(v, -3))) {
829     std::ostringstream msg;
830     msg << "Couldn't register function'set_black'";
831     throw SquirrelError(v, msg.str());
832   }
833
834   sq_pushstring(v, "is_black", -1);
835   sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
836   if(SQ_FAILED(sq_createslot(v, -3))) {
837     std::ostringstream msg;
838     msg << "Couldn't register function'is_black'";
839     throw SquirrelError(v, msg.str());
840   }
841
842   sq_pushstring(v, "sixteen_to_nine", -1);
843   sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
844   if(SQ_FAILED(sq_createslot(v, -3))) {
845     std::ostringstream msg;
846     msg << "Couldn't register function'sixteen_to_nine'";
847     throw SquirrelError(v, msg.str());
848   }
849
850   sq_pushstring(v, "four_to_three", -1);
851   sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
852   if(SQ_FAILED(sq_createslot(v, -3))) {
853     std::ostringstream msg;
854     msg << "Couldn't register function'four_to_three'";
855     throw SquirrelError(v, msg.str());
856   }
857
858   if(SQ_FAILED(sq_createslot(v, -3))) {
859     std::ostringstream msg;
860     msg << "Couldn't register class'DisplayEffect'";
861     throw SquirrelError(v, msg.str());
862   }
863
864   // Register class Camera
865   sq_pushstring(v, "Camera", -1);
866   if(sq_newclass(v, SQFalse) < 0) {
867     std::ostringstream msg;
868     msg << "Couldn't create new class 'Camera'";
869     throw SquirrelError(v, msg.str());
870   }
871   sq_pushstring(v, "shake", -1);
872   sq_newclosure(v, &Camera_shake_wrapper, 0);
873   if(SQ_FAILED(sq_createslot(v, -3))) {
874     std::ostringstream msg;
875     msg << "Couldn't register function'shake'";
876     throw SquirrelError(v, msg.str());
877   }
878
879   sq_pushstring(v, "set_pos", -1);
880   sq_newclosure(v, &Camera_set_pos_wrapper, 0);
881   if(SQ_FAILED(sq_createslot(v, -3))) {
882     std::ostringstream msg;
883     msg << "Couldn't register function'set_pos'";
884     throw SquirrelError(v, msg.str());
885   }
886
887   sq_pushstring(v, "set_mode", -1);
888   sq_newclosure(v, &Camera_set_mode_wrapper, 0);
889   if(SQ_FAILED(sq_createslot(v, -3))) {
890     std::ostringstream msg;
891     msg << "Couldn't register function'set_mode'";
892     throw SquirrelError(v, msg.str());
893   }
894
895   if(SQ_FAILED(sq_createslot(v, -3))) {
896     std::ostringstream msg;
897     msg << "Couldn't register class'Camera'";
898     throw SquirrelError(v, msg.str());
899   }
900
901   // Register class Level
902   sq_pushstring(v, "Level", -1);
903   if(sq_newclass(v, SQFalse) < 0) {
904     std::ostringstream msg;
905     msg << "Couldn't create new class 'Level'";
906     throw SquirrelError(v, msg.str());
907   }
908   sq_pushstring(v, "finish", -1);
909   sq_newclosure(v, &Level_finish_wrapper, 0);
910   if(SQ_FAILED(sq_createslot(v, -3))) {
911     std::ostringstream msg;
912     msg << "Couldn't register function'finish'";
913     throw SquirrelError(v, msg.str());
914   }
915
916   sq_pushstring(v, "spawn", -1);
917   sq_newclosure(v, &Level_spawn_wrapper, 0);
918   if(SQ_FAILED(sq_createslot(v, -3))) {
919     std::ostringstream msg;
920     msg << "Couldn't register function'spawn'";
921     throw SquirrelError(v, msg.str());
922   }
923
924   sq_pushstring(v, "flip_vertically", -1);
925   sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
926   if(SQ_FAILED(sq_createslot(v, -3))) {
927     std::ostringstream msg;
928     msg << "Couldn't register function'flip_vertically'";
929     throw SquirrelError(v, msg.str());
930   }
931
932   if(SQ_FAILED(sq_createslot(v, -3))) {
933     std::ostringstream msg;
934     msg << "Couldn't register class'Level'";
935     throw SquirrelError(v, msg.str());
936   }
937
938   // Register class ScriptedObject
939   sq_pushstring(v, "ScriptedObject", -1);
940   if(sq_newclass(v, SQFalse) < 0) {
941     std::ostringstream msg;
942     msg << "Couldn't create new class 'ScriptedObject'";
943     throw SquirrelError(v, msg.str());
944   }
945   sq_pushstring(v, "set_animation", -1);
946   sq_newclosure(v, &ScriptedObject_set_animation_wrapper, 0);
947   if(SQ_FAILED(sq_createslot(v, -3))) {
948     std::ostringstream msg;
949     msg << "Couldn't register function'set_animation'";
950     throw SquirrelError(v, msg.str());
951   }
952
953   sq_pushstring(v, "get_animation", -1);
954   sq_newclosure(v, &ScriptedObject_get_animation_wrapper, 0);
955   if(SQ_FAILED(sq_createslot(v, -3))) {
956     std::ostringstream msg;
957     msg << "Couldn't register function'get_animation'";
958     throw SquirrelError(v, msg.str());
959   }
960
961   sq_pushstring(v, "move", -1);
962   sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
963   if(SQ_FAILED(sq_createslot(v, -3))) {
964     std::ostringstream msg;
965     msg << "Couldn't register function'move'";
966     throw SquirrelError(v, msg.str());
967   }
968
969   sq_pushstring(v, "set_pos", -1);
970   sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
971   if(SQ_FAILED(sq_createslot(v, -3))) {
972     std::ostringstream msg;
973     msg << "Couldn't register function'set_pos'";
974     throw SquirrelError(v, msg.str());
975   }
976
977   sq_pushstring(v, "get_pos_x", -1);
978   sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
979   if(SQ_FAILED(sq_createslot(v, -3))) {
980     std::ostringstream msg;
981     msg << "Couldn't register function'get_pos_x'";
982     throw SquirrelError(v, msg.str());
983   }
984
985   sq_pushstring(v, "get_pos_y", -1);
986   sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
987   if(SQ_FAILED(sq_createslot(v, -3))) {
988     std::ostringstream msg;
989     msg << "Couldn't register function'get_pos_y'";
990     throw SquirrelError(v, msg.str());
991   }
992
993   sq_pushstring(v, "set_velocity", -1);
994   sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
995   if(SQ_FAILED(sq_createslot(v, -3))) {
996     std::ostringstream msg;
997     msg << "Couldn't register function'set_velocity'";
998     throw SquirrelError(v, msg.str());
999   }
1000
1001   sq_pushstring(v, "get_velocity_x", -1);
1002   sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
1003   if(SQ_FAILED(sq_createslot(v, -3))) {
1004     std::ostringstream msg;
1005     msg << "Couldn't register function'get_velocity_x'";
1006     throw SquirrelError(v, msg.str());
1007   }
1008
1009   sq_pushstring(v, "get_velocity_y", -1);
1010   sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
1011   if(SQ_FAILED(sq_createslot(v, -3))) {
1012     std::ostringstream msg;
1013     msg << "Couldn't register function'get_velocity_y'";
1014     throw SquirrelError(v, msg.str());
1015   }
1016
1017   sq_pushstring(v, "set_visible", -1);
1018   sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
1019   if(SQ_FAILED(sq_createslot(v, -3))) {
1020     std::ostringstream msg;
1021     msg << "Couldn't register function'set_visible'";
1022     throw SquirrelError(v, msg.str());
1023   }
1024
1025   sq_pushstring(v, "is_visible", -1);
1026   sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
1027   if(SQ_FAILED(sq_createslot(v, -3))) {
1028     std::ostringstream msg;
1029     msg << "Couldn't register function'is_visible'";
1030     throw SquirrelError(v, msg.str());
1031   }
1032
1033   sq_pushstring(v, "get_name", -1);
1034   sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
1035   if(SQ_FAILED(sq_createslot(v, -3))) {
1036     std::ostringstream msg;
1037     msg << "Couldn't register function'get_name'";
1038     throw SquirrelError(v, msg.str());
1039   }
1040
1041   if(SQ_FAILED(sq_createslot(v, -3))) {
1042     std::ostringstream msg;
1043     msg << "Couldn't register class'ScriptedObject'";
1044     throw SquirrelError(v, msg.str());
1045   }
1046
1047   // Register class Sound
1048   sq_pushstring(v, "Sound", -1);
1049   if(sq_newclass(v, SQFalse) < 0) {
1050     std::ostringstream msg;
1051     msg << "Couldn't create new class 'Sound'";
1052     throw SquirrelError(v, msg.str());
1053   }
1054   sq_pushstring(v, "play_music", -1);
1055   sq_newclosure(v, &Sound_play_music_wrapper, 0);
1056   if(SQ_FAILED(sq_createslot(v, -3))) {
1057     std::ostringstream msg;
1058     msg << "Couldn't register function'play_music'";
1059     throw SquirrelError(v, msg.str());
1060   }
1061
1062   sq_pushstring(v, "play", -1);
1063   sq_newclosure(v, &Sound_play_wrapper, 0);
1064   if(SQ_FAILED(sq_createslot(v, -3))) {
1065     std::ostringstream msg;
1066     msg << "Couldn't register function'play'";
1067     throw SquirrelError(v, msg.str());
1068   }
1069
1070   if(SQ_FAILED(sq_createslot(v, -3))) {
1071     std::ostringstream msg;
1072     msg << "Couldn't register class'Sound'";
1073     throw SquirrelError(v, msg.str());
1074   }
1075
1076   // Register class Text
1077   sq_pushstring(v, "Text", -1);
1078   if(sq_newclass(v, SQFalse) < 0) {
1079     std::ostringstream msg;
1080     msg << "Couldn't create new class 'Text'";
1081     throw SquirrelError(v, msg.str());
1082   }
1083   sq_pushstring(v, "set_text", -1);
1084   sq_newclosure(v, &Text_set_text_wrapper, 0);
1085   if(SQ_FAILED(sq_createslot(v, -3))) {
1086     std::ostringstream msg;
1087     msg << "Couldn't register function'set_text'";
1088     throw SquirrelError(v, msg.str());
1089   }
1090
1091   sq_pushstring(v, "set_font", -1);
1092   sq_newclosure(v, &Text_set_font_wrapper, 0);
1093   if(SQ_FAILED(sq_createslot(v, -3))) {
1094     std::ostringstream msg;
1095     msg << "Couldn't register function'set_font'";
1096     throw SquirrelError(v, msg.str());
1097   }
1098
1099   sq_pushstring(v, "fade_in", -1);
1100   sq_newclosure(v, &Text_fade_in_wrapper, 0);
1101   if(SQ_FAILED(sq_createslot(v, -3))) {
1102     std::ostringstream msg;
1103     msg << "Couldn't register function'fade_in'";
1104     throw SquirrelError(v, msg.str());
1105   }
1106
1107   sq_pushstring(v, "fade_out", -1);
1108   sq_newclosure(v, &Text_fade_out_wrapper, 0);
1109   if(SQ_FAILED(sq_createslot(v, -3))) {
1110     std::ostringstream msg;
1111     msg << "Couldn't register function'fade_out'";
1112     throw SquirrelError(v, msg.str());
1113   }
1114
1115   sq_pushstring(v, "set_visible", -1);
1116   sq_newclosure(v, &Text_set_visible_wrapper, 0);
1117   if(SQ_FAILED(sq_createslot(v, -3))) {
1118     std::ostringstream msg;
1119     msg << "Couldn't register function'set_visible'";
1120     throw SquirrelError(v, msg.str());
1121   }
1122
1123   if(SQ_FAILED(sq_createslot(v, -3))) {
1124     std::ostringstream msg;
1125     msg << "Couldn't register class'Text'";
1126     throw SquirrelError(v, msg.str());
1127   }
1128
1129   // Register class Player
1130   sq_pushstring(v, "Player", -1);
1131   if(sq_newclass(v, SQFalse) < 0) {
1132     std::ostringstream msg;
1133     msg << "Couldn't create new class 'Player'";
1134     throw SquirrelError(v, msg.str());
1135   }
1136   sq_pushstring(v, "make_invincible", -1);
1137   sq_newclosure(v, &Player_make_invincible_wrapper, 0);
1138   if(SQ_FAILED(sq_createslot(v, -3))) {
1139     std::ostringstream msg;
1140     msg << "Couldn't register function'make_invincible'";
1141     throw SquirrelError(v, msg.str());
1142   }
1143
1144   sq_pushstring(v, "deactivate", -1);
1145   sq_newclosure(v, &Player_deactivate_wrapper, 0);
1146   if(SQ_FAILED(sq_createslot(v, -3))) {
1147     std::ostringstream msg;
1148     msg << "Couldn't register function'deactivate'";
1149     throw SquirrelError(v, msg.str());
1150   }
1151
1152   sq_pushstring(v, "activate", -1);
1153   sq_newclosure(v, &Player_activate_wrapper, 0);
1154   if(SQ_FAILED(sq_createslot(v, -3))) {
1155     std::ostringstream msg;
1156     msg << "Couldn't register function'activate'";
1157     throw SquirrelError(v, msg.str());
1158   }
1159
1160   sq_pushstring(v, "walk", -1);
1161   sq_newclosure(v, &Player_walk_wrapper, 0);
1162   if(SQ_FAILED(sq_createslot(v, -3))) {
1163     std::ostringstream msg;
1164     msg << "Couldn't register function'walk'";
1165     throw SquirrelError(v, msg.str());
1166   }
1167
1168   if(SQ_FAILED(sq_createslot(v, -3))) {
1169     std::ostringstream msg;
1170     msg << "Couldn't register class'Player'";
1171     throw SquirrelError(v, msg.str());
1172   }
1173
1174   sq_pop(v, 1);
1175 }
1176
1177 } // end of namespace Scripting
1178