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