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