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