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