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