ab1a764e52be4b659dc95425aec5804f0967a39a
[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 DisplayEffect_sixteen_to_nine_wrapper(HSQUIRRELVM v)
76 {
77   Scripting::DisplayEffect* _this;
78   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
79   float arg0;
80   sq_getfloat(v, 2, &arg0);
81   
82   _this->sixteen_to_nine(arg0);
83   
84   return 0;
85 }
86
87 static int DisplayEffect_four_to_three_wrapper(HSQUIRRELVM v)
88 {
89   Scripting::DisplayEffect* _this;
90   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
91   float arg0;
92   sq_getfloat(v, 2, &arg0);
93   
94   _this->four_to_three(arg0);
95   
96   return 0;
97 }
98
99 static int Camera_release_hook(SQUserPointer ptr, int )
100 {
101   Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
102   delete _this;
103   return 0;
104 }
105
106 static int Camera_shake_wrapper(HSQUIRRELVM v)
107 {
108   Scripting::Camera* _this;
109   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
110   float arg0;
111   sq_getfloat(v, 2, &arg0);
112   float arg1;
113   sq_getfloat(v, 3, &arg1);
114   float arg2;
115   sq_getfloat(v, 4, &arg2);
116   
117   _this->shake(arg0, arg1, arg2);
118   
119   return 0;
120 }
121
122 static int Camera_set_pos_wrapper(HSQUIRRELVM v)
123 {
124   Scripting::Camera* _this;
125   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
126   float arg0;
127   sq_getfloat(v, 2, &arg0);
128   float arg1;
129   sq_getfloat(v, 3, &arg1);
130   
131   _this->set_pos(arg0, arg1);
132   
133   return 0;
134 }
135
136 static int Camera_set_mode_wrapper(HSQUIRRELVM v)
137 {
138   Scripting::Camera* _this;
139   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
140   const char* arg0;
141   sq_getstring(v, 2, &arg0);
142   
143   _this->set_mode(arg0);
144   
145   return 0;
146 }
147
148 static int Level_release_hook(SQUserPointer ptr, int )
149 {
150   Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
151   delete _this;
152   return 0;
153 }
154
155 static int Level_finish_wrapper(HSQUIRRELVM v)
156 {
157   Scripting::Level* _this;
158   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
159   
160   _this->finish();
161   
162   return 0;
163 }
164
165 static int Level_spawn_wrapper(HSQUIRRELVM v)
166 {
167   Scripting::Level* _this;
168   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
169   const char* arg0;
170   sq_getstring(v, 2, &arg0);
171   const char* arg1;
172   sq_getstring(v, 3, &arg1);
173   
174   _this->spawn(arg0, arg1);
175   
176   return 0;
177 }
178
179 static int Level_flip_vertically_wrapper(HSQUIRRELVM v)
180 {
181   Scripting::Level* _this;
182   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
183   
184   _this->flip_vertically();
185   
186   return 0;
187 }
188
189 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
190 {
191   Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
192   delete _this;
193   return 0;
194 }
195
196 static int ScriptedObject_set_action_wrapper(HSQUIRRELVM v)
197 {
198   Scripting::ScriptedObject* _this;
199   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
200   const char* arg0;
201   sq_getstring(v, 2, &arg0);
202   
203   _this->set_action(arg0);
204   
205   return 0;
206 }
207
208 static int ScriptedObject_get_action_wrapper(HSQUIRRELVM v)
209 {
210   Scripting::ScriptedObject* _this;
211   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
212   
213   std::string return_value = _this->get_action();
214   
215   sq_pushstring(v, return_value.c_str(), return_value.size());
216   return 1;
217 }
218
219 static int ScriptedObject_move_wrapper(HSQUIRRELVM v)
220 {
221   Scripting::ScriptedObject* _this;
222   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
223   float arg0;
224   sq_getfloat(v, 2, &arg0);
225   float arg1;
226   sq_getfloat(v, 3, &arg1);
227   
228   _this->move(arg0, arg1);
229   
230   return 0;
231 }
232
233 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM v)
234 {
235   Scripting::ScriptedObject* _this;
236   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
237   float arg0;
238   sq_getfloat(v, 2, &arg0);
239   float arg1;
240   sq_getfloat(v, 3, &arg1);
241   
242   _this->set_pos(arg0, arg1);
243   
244   return 0;
245 }
246
247 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM v)
248 {
249   Scripting::ScriptedObject* _this;
250   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
251   
252   float return_value = _this->get_pos_x();
253   
254   sq_pushfloat(v, return_value);
255   return 1;
256 }
257
258 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM v)
259 {
260   Scripting::ScriptedObject* _this;
261   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
262   
263   float return_value = _this->get_pos_y();
264   
265   sq_pushfloat(v, return_value);
266   return 1;
267 }
268
269 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM v)
270 {
271   Scripting::ScriptedObject* _this;
272   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
273   float arg0;
274   sq_getfloat(v, 2, &arg0);
275   float arg1;
276   sq_getfloat(v, 3, &arg1);
277   
278   _this->set_velocity(arg0, arg1);
279   
280   return 0;
281 }
282
283 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM v)
284 {
285   Scripting::ScriptedObject* _this;
286   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
287   
288   float return_value = _this->get_velocity_x();
289   
290   sq_pushfloat(v, return_value);
291   return 1;
292 }
293
294 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM v)
295 {
296   Scripting::ScriptedObject* _this;
297   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
298   
299   float return_value = _this->get_velocity_y();
300   
301   sq_pushfloat(v, return_value);
302   return 1;
303 }
304
305 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM v)
306 {
307   Scripting::ScriptedObject* _this;
308   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
309   SQBool arg0;
310   sq_getbool(v, 2, &arg0);
311   
312   _this->set_visible(arg0);
313   
314   return 0;
315 }
316
317 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM v)
318 {
319   Scripting::ScriptedObject* _this;
320   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
321   
322   bool return_value = _this->is_visible();
323   
324   sq_pushbool(v, return_value);
325   return 1;
326 }
327
328 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM v)
329 {
330   Scripting::ScriptedObject* _this;
331   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
332   
333   std::string return_value = _this->get_name();
334   
335   sq_pushstring(v, return_value.c_str(), return_value.size());
336   return 1;
337 }
338
339 static int Sound_release_hook(SQUserPointer ptr, int )
340 {
341   Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
342   delete _this;
343   return 0;
344 }
345
346 static int Sound_play_music_wrapper(HSQUIRRELVM v)
347 {
348   Scripting::Sound* _this;
349   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
350   const char* arg0;
351   sq_getstring(v, 2, &arg0);
352   
353   _this->play_music(arg0);
354   
355   return 0;
356 }
357
358 static int Sound_play_wrapper(HSQUIRRELVM v)
359 {
360   Scripting::Sound* _this;
361   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
362   const char* arg0;
363   sq_getstring(v, 2, &arg0);
364   
365   _this->play(arg0);
366   
367   return 0;
368 }
369
370 static int Text_release_hook(SQUserPointer ptr, int )
371 {
372   Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
373   delete _this;
374   return 0;
375 }
376
377 static int Text_set_text_wrapper(HSQUIRRELVM v)
378 {
379   Scripting::Text* _this;
380   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
381   const char* arg0;
382   sq_getstring(v, 2, &arg0);
383   
384   _this->set_text(arg0);
385   
386   return 0;
387 }
388
389 static int Text_set_font_wrapper(HSQUIRRELVM v)
390 {
391   Scripting::Text* _this;
392   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
393   const char* arg0;
394   sq_getstring(v, 2, &arg0);
395   
396   _this->set_font(arg0);
397   
398   return 0;
399 }
400
401 static int Text_fade_in_wrapper(HSQUIRRELVM v)
402 {
403   Scripting::Text* _this;
404   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
405   float arg0;
406   sq_getfloat(v, 2, &arg0);
407   
408   _this->fade_in(arg0);
409   
410   return 0;
411 }
412
413 static int Text_fade_out_wrapper(HSQUIRRELVM v)
414 {
415   Scripting::Text* _this;
416   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
417   float arg0;
418   sq_getfloat(v, 2, &arg0);
419   
420   _this->fade_out(arg0);
421   
422   return 0;
423 }
424
425 static int Text_set_visible_wrapper(HSQUIRRELVM v)
426 {
427   Scripting::Text* _this;
428   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
429   SQBool arg0;
430   sq_getbool(v, 2, &arg0);
431   
432   _this->set_visible(arg0);
433   
434   return 0;
435 }
436
437 static int Text_set_centered_wrapper(HSQUIRRELVM v)
438 {
439   Scripting::Text* _this;
440   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
441   SQBool arg0;
442   sq_getbool(v, 2, &arg0);
443   
444   _this->set_centered(arg0);
445   
446   return 0;
447 }
448
449 static int Player_release_hook(SQUserPointer ptr, int )
450 {
451   Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
452   delete _this;
453   return 0;
454 }
455
456 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
457 {
458   Scripting::Player* _this;
459   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
460   
461   _this->make_invincible();
462   
463   return 0;
464 }
465
466 static int Player_deactivate_wrapper(HSQUIRRELVM v)
467 {
468   Scripting::Player* _this;
469   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
470   
471   _this->deactivate();
472   
473   return 0;
474 }
475
476 static int Player_activate_wrapper(HSQUIRRELVM v)
477 {
478   Scripting::Player* _this;
479   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
480   
481   _this->activate();
482   
483   return 0;
484 }
485
486 static int Player_walk_wrapper(HSQUIRRELVM v)
487 {
488   Scripting::Player* _this;
489   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
490   float arg0;
491   sq_getfloat(v, 2, &arg0);
492   
493   _this->walk(arg0);
494   
495   return 0;
496 }
497
498 static int Player_set_visible_wrapper(HSQUIRRELVM v)
499 {
500   Scripting::Player* _this;
501   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
502   SQBool arg0;
503   sq_getbool(v, 2, &arg0);
504   
505   _this->set_visible(arg0);
506   
507   return 0;
508 }
509
510 static int Player_get_visible_wrapper(HSQUIRRELVM v)
511 {
512   Scripting::Player* _this;
513   sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
514   
515   bool return_value = _this->get_visible();
516   
517   sq_pushbool(v, return_value);
518   return 1;
519 }
520
521 static int display_text_file_wrapper(HSQUIRRELVM v)
522 {
523   const char* arg0;
524   sq_getstring(v, 2, &arg0);
525   
526   Scripting::display_text_file(arg0);
527   
528   return 0;
529 }
530
531 static int wait_wrapper(HSQUIRRELVM v)
532 {
533   float arg0;
534   sq_getfloat(v, 2, &arg0);
535   
536   Scripting::wait(arg0);
537   
538   return sq_suspendvm(v);
539 }
540
541 static int translate_wrapper(HSQUIRRELVM v)
542 {
543   const char* arg0;
544   sq_getstring(v, 2, &arg0);
545   
546   std::string return_value = Scripting::translate(arg0);
547   
548   sq_pushstring(v, return_value.c_str(), return_value.size());
549   return 1;
550 }
551
552 static int import_wrapper(HSQUIRRELVM v)
553 {
554   HSQUIRRELVM arg0 = v;
555   const char* arg1;
556   sq_getstring(v, 2, &arg1);
557   
558   Scripting::import(arg0, arg1);
559   
560   return 0;
561 }
562
563 static int add_key_wrapper(HSQUIRRELVM v)
564 {
565   int arg0;
566   sq_getinteger(v, 2, &arg0);
567   
568   Scripting::add_key(arg0);
569   
570   return 0;
571 }
572
573 } // end of namespace Wrapper
574
575 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
576 {
577   using namespace Wrapper;
578
579   sq_pushroottable(v);
580   sq_pushstring(v, "DisplayEffect", -1);
581   if(SQ_FAILED(sq_get(v, -2))) {
582     std::ostringstream msg;
583     msg << "Couldn't resolved squirrel type 'DisplayEffect'";
584     throw SquirrelError(v, msg.str());
585   }
586
587   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
588     std::ostringstream msg;
589     msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
590     throw SquirrelError(v, msg.str());
591   }
592   sq_remove(v, -2); // remove object name
593
594   if(setup_releasehook) {
595     sq_setreleasehook(v, -1, DisplayEffect_release_hook);
596   }
597
598   sq_remove(v, -2); // remove root table
599 }
600
601 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
602 {
603   using namespace Wrapper;
604
605   sq_pushroottable(v);
606   sq_pushstring(v, "Camera", -1);
607   if(SQ_FAILED(sq_get(v, -2))) {
608     std::ostringstream msg;
609     msg << "Couldn't resolved squirrel type 'Camera'";
610     throw SquirrelError(v, msg.str());
611   }
612
613   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
614     std::ostringstream msg;
615     msg << "Couldn't setup squirrel instance for object of type 'Camera'";
616     throw SquirrelError(v, msg.str());
617   }
618   sq_remove(v, -2); // remove object name
619
620   if(setup_releasehook) {
621     sq_setreleasehook(v, -1, Camera_release_hook);
622   }
623
624   sq_remove(v, -2); // remove root table
625 }
626
627 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
628 {
629   using namespace Wrapper;
630
631   sq_pushroottable(v);
632   sq_pushstring(v, "Level", -1);
633   if(SQ_FAILED(sq_get(v, -2))) {
634     std::ostringstream msg;
635     msg << "Couldn't resolved squirrel type 'Level'";
636     throw SquirrelError(v, msg.str());
637   }
638
639   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
640     std::ostringstream msg;
641     msg << "Couldn't setup squirrel instance for object of type 'Level'";
642     throw SquirrelError(v, msg.str());
643   }
644   sq_remove(v, -2); // remove object name
645
646   if(setup_releasehook) {
647     sq_setreleasehook(v, -1, Level_release_hook);
648   }
649
650   sq_remove(v, -2); // remove root table
651 }
652
653 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
654 {
655   using namespace Wrapper;
656
657   sq_pushroottable(v);
658   sq_pushstring(v, "ScriptedObject", -1);
659   if(SQ_FAILED(sq_get(v, -2))) {
660     std::ostringstream msg;
661     msg << "Couldn't resolved squirrel type 'ScriptedObject'";
662     throw SquirrelError(v, msg.str());
663   }
664
665   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
666     std::ostringstream msg;
667     msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
668     throw SquirrelError(v, msg.str());
669   }
670   sq_remove(v, -2); // remove object name
671
672   if(setup_releasehook) {
673     sq_setreleasehook(v, -1, ScriptedObject_release_hook);
674   }
675
676   sq_remove(v, -2); // remove root table
677 }
678
679 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
680 {
681   using namespace Wrapper;
682
683   sq_pushroottable(v);
684   sq_pushstring(v, "Sound", -1);
685   if(SQ_FAILED(sq_get(v, -2))) {
686     std::ostringstream msg;
687     msg << "Couldn't resolved squirrel type 'Sound'";
688     throw SquirrelError(v, msg.str());
689   }
690
691   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
692     std::ostringstream msg;
693     msg << "Couldn't setup squirrel instance for object of type 'Sound'";
694     throw SquirrelError(v, msg.str());
695   }
696   sq_remove(v, -2); // remove object name
697
698   if(setup_releasehook) {
699     sq_setreleasehook(v, -1, Sound_release_hook);
700   }
701
702   sq_remove(v, -2); // remove root table
703 }
704
705 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
706 {
707   using namespace Wrapper;
708
709   sq_pushroottable(v);
710   sq_pushstring(v, "Text", -1);
711   if(SQ_FAILED(sq_get(v, -2))) {
712     std::ostringstream msg;
713     msg << "Couldn't resolved squirrel type 'Text'";
714     throw SquirrelError(v, msg.str());
715   }
716
717   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
718     std::ostringstream msg;
719     msg << "Couldn't setup squirrel instance for object of type 'Text'";
720     throw SquirrelError(v, msg.str());
721   }
722   sq_remove(v, -2); // remove object name
723
724   if(setup_releasehook) {
725     sq_setreleasehook(v, -1, Text_release_hook);
726   }
727
728   sq_remove(v, -2); // remove root table
729 }
730
731 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
732 {
733   using namespace Wrapper;
734
735   sq_pushroottable(v);
736   sq_pushstring(v, "Player", -1);
737   if(SQ_FAILED(sq_get(v, -2))) {
738     std::ostringstream msg;
739     msg << "Couldn't resolved squirrel type 'Player'";
740     throw SquirrelError(v, msg.str());
741   }
742
743   if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
744     std::ostringstream msg;
745     msg << "Couldn't setup squirrel instance for object of type 'Player'";
746     throw SquirrelError(v, msg.str());
747   }
748   sq_remove(v, -2); // remove object name
749
750   if(setup_releasehook) {
751     sq_setreleasehook(v, -1, Player_release_hook);
752   }
753
754   sq_remove(v, -2); // remove root table
755 }
756
757 void register_supertux_wrapper(HSQUIRRELVM v)
758 {
759   using namespace Wrapper;
760
761   sq_pushroottable(v);
762   sq_pushstring(v, "KEY_BRASS", -1);
763   sq_pushinteger(v, 1);
764   if(SQ_FAILED(sq_createslot(v, -3))) {
765     std::ostringstream msg;
766     msg << "Couldn't register constant'KEY_BRASS'";
767     throw SquirrelError(v, msg.str());
768   }
769
770   sq_pushstring(v, "KEY_IRON", -1);
771   sq_pushinteger(v, 2);
772   if(SQ_FAILED(sq_createslot(v, -3))) {
773     std::ostringstream msg;
774     msg << "Couldn't register constant'KEY_IRON'";
775     throw SquirrelError(v, msg.str());
776   }
777
778   sq_pushstring(v, "KEY_BRONZE", -1);
779   sq_pushinteger(v, 4);
780   if(SQ_FAILED(sq_createslot(v, -3))) {
781     std::ostringstream msg;
782     msg << "Couldn't register constant'KEY_BRONZE'";
783     throw SquirrelError(v, msg.str());
784   }
785
786   sq_pushstring(v, "KEY_SILVER", -1);
787   sq_pushinteger(v, 8);
788   if(SQ_FAILED(sq_createslot(v, -3))) {
789     std::ostringstream msg;
790     msg << "Couldn't register constant'KEY_SILVER'";
791     throw SquirrelError(v, msg.str());
792   }
793
794   sq_pushstring(v, "KEY_GOLD", -1);
795   sq_pushinteger(v, 16);
796   if(SQ_FAILED(sq_createslot(v, -3))) {
797     std::ostringstream msg;
798     msg << "Couldn't register constant'KEY_GOLD'";
799     throw SquirrelError(v, msg.str());
800   }
801
802   sq_pushstring(v, "display_text_file", -1);
803   sq_newclosure(v, &display_text_file_wrapper, 0);
804   if(SQ_FAILED(sq_createslot(v, -3))) {
805     std::ostringstream msg;
806     msg << "Couldn't register function'display_text_file'";
807     throw SquirrelError(v, msg.str());
808   }
809
810   sq_pushstring(v, "wait", -1);
811   sq_newclosure(v, &wait_wrapper, 0);
812   if(SQ_FAILED(sq_createslot(v, -3))) {
813     std::ostringstream msg;
814     msg << "Couldn't register function'wait'";
815     throw SquirrelError(v, msg.str());
816   }
817
818   sq_pushstring(v, "translate", -1);
819   sq_newclosure(v, &translate_wrapper, 0);
820   if(SQ_FAILED(sq_createslot(v, -3))) {
821     std::ostringstream msg;
822     msg << "Couldn't register function'translate'";
823     throw SquirrelError(v, msg.str());
824   }
825
826   sq_pushstring(v, "import", -1);
827   sq_newclosure(v, &import_wrapper, 0);
828   if(SQ_FAILED(sq_createslot(v, -3))) {
829     std::ostringstream msg;
830     msg << "Couldn't register function'import'";
831     throw SquirrelError(v, msg.str());
832   }
833
834   sq_pushstring(v, "add_key", -1);
835   sq_newclosure(v, &add_key_wrapper, 0);
836   if(SQ_FAILED(sq_createslot(v, -3))) {
837     std::ostringstream msg;
838     msg << "Couldn't register function'add_key'";
839     throw SquirrelError(v, msg.str());
840   }
841
842   // Register class DisplayEffect
843   sq_pushstring(v, "DisplayEffect", -1);
844   if(sq_newclass(v, SQFalse) < 0) {
845     std::ostringstream msg;
846     msg << "Couldn't create new class 'DisplayEffect'";
847     throw SquirrelError(v, msg.str());
848   }
849   sq_pushstring(v, "fade_out", -1);
850   sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
851   if(SQ_FAILED(sq_createslot(v, -3))) {
852     std::ostringstream msg;
853     msg << "Couldn't register function'fade_out'";
854     throw SquirrelError(v, msg.str());
855   }
856
857   sq_pushstring(v, "fade_in", -1);
858   sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
859   if(SQ_FAILED(sq_createslot(v, -3))) {
860     std::ostringstream msg;
861     msg << "Couldn't register function'fade_in'";
862     throw SquirrelError(v, msg.str());
863   }
864
865   sq_pushstring(v, "set_black", -1);
866   sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
867   if(SQ_FAILED(sq_createslot(v, -3))) {
868     std::ostringstream msg;
869     msg << "Couldn't register function'set_black'";
870     throw SquirrelError(v, msg.str());
871   }
872
873   sq_pushstring(v, "is_black", -1);
874   sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
875   if(SQ_FAILED(sq_createslot(v, -3))) {
876     std::ostringstream msg;
877     msg << "Couldn't register function'is_black'";
878     throw SquirrelError(v, msg.str());
879   }
880
881   sq_pushstring(v, "sixteen_to_nine", -1);
882   sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
883   if(SQ_FAILED(sq_createslot(v, -3))) {
884     std::ostringstream msg;
885     msg << "Couldn't register function'sixteen_to_nine'";
886     throw SquirrelError(v, msg.str());
887   }
888
889   sq_pushstring(v, "four_to_three", -1);
890   sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
891   if(SQ_FAILED(sq_createslot(v, -3))) {
892     std::ostringstream msg;
893     msg << "Couldn't register function'four_to_three'";
894     throw SquirrelError(v, msg.str());
895   }
896
897   if(SQ_FAILED(sq_createslot(v, -3))) {
898     std::ostringstream msg;
899     msg << "Couldn't register class'DisplayEffect'";
900     throw SquirrelError(v, msg.str());
901   }
902
903   // Register class Camera
904   sq_pushstring(v, "Camera", -1);
905   if(sq_newclass(v, SQFalse) < 0) {
906     std::ostringstream msg;
907     msg << "Couldn't create new class 'Camera'";
908     throw SquirrelError(v, msg.str());
909   }
910   sq_pushstring(v, "shake", -1);
911   sq_newclosure(v, &Camera_shake_wrapper, 0);
912   if(SQ_FAILED(sq_createslot(v, -3))) {
913     std::ostringstream msg;
914     msg << "Couldn't register function'shake'";
915     throw SquirrelError(v, msg.str());
916   }
917
918   sq_pushstring(v, "set_pos", -1);
919   sq_newclosure(v, &Camera_set_pos_wrapper, 0);
920   if(SQ_FAILED(sq_createslot(v, -3))) {
921     std::ostringstream msg;
922     msg << "Couldn't register function'set_pos'";
923     throw SquirrelError(v, msg.str());
924   }
925
926   sq_pushstring(v, "set_mode", -1);
927   sq_newclosure(v, &Camera_set_mode_wrapper, 0);
928   if(SQ_FAILED(sq_createslot(v, -3))) {
929     std::ostringstream msg;
930     msg << "Couldn't register function'set_mode'";
931     throw SquirrelError(v, msg.str());
932   }
933
934   if(SQ_FAILED(sq_createslot(v, -3))) {
935     std::ostringstream msg;
936     msg << "Couldn't register class'Camera'";
937     throw SquirrelError(v, msg.str());
938   }
939
940   // Register class Level
941   sq_pushstring(v, "Level", -1);
942   if(sq_newclass(v, SQFalse) < 0) {
943     std::ostringstream msg;
944     msg << "Couldn't create new class 'Level'";
945     throw SquirrelError(v, msg.str());
946   }
947   sq_pushstring(v, "finish", -1);
948   sq_newclosure(v, &Level_finish_wrapper, 0);
949   if(SQ_FAILED(sq_createslot(v, -3))) {
950     std::ostringstream msg;
951     msg << "Couldn't register function'finish'";
952     throw SquirrelError(v, msg.str());
953   }
954
955   sq_pushstring(v, "spawn", -1);
956   sq_newclosure(v, &Level_spawn_wrapper, 0);
957   if(SQ_FAILED(sq_createslot(v, -3))) {
958     std::ostringstream msg;
959     msg << "Couldn't register function'spawn'";
960     throw SquirrelError(v, msg.str());
961   }
962
963   sq_pushstring(v, "flip_vertically", -1);
964   sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
965   if(SQ_FAILED(sq_createslot(v, -3))) {
966     std::ostringstream msg;
967     msg << "Couldn't register function'flip_vertically'";
968     throw SquirrelError(v, msg.str());
969   }
970
971   if(SQ_FAILED(sq_createslot(v, -3))) {
972     std::ostringstream msg;
973     msg << "Couldn't register class'Level'";
974     throw SquirrelError(v, msg.str());
975   }
976
977   // Register class ScriptedObject
978   sq_pushstring(v, "ScriptedObject", -1);
979   if(sq_newclass(v, SQFalse) < 0) {
980     std::ostringstream msg;
981     msg << "Couldn't create new class 'ScriptedObject'";
982     throw SquirrelError(v, msg.str());
983   }
984   sq_pushstring(v, "set_action", -1);
985   sq_newclosure(v, &ScriptedObject_set_action_wrapper, 0);
986   if(SQ_FAILED(sq_createslot(v, -3))) {
987     std::ostringstream msg;
988     msg << "Couldn't register function'set_action'";
989     throw SquirrelError(v, msg.str());
990   }
991
992   sq_pushstring(v, "get_action", -1);
993   sq_newclosure(v, &ScriptedObject_get_action_wrapper, 0);
994   if(SQ_FAILED(sq_createslot(v, -3))) {
995     std::ostringstream msg;
996     msg << "Couldn't register function'get_action'";
997     throw SquirrelError(v, msg.str());
998   }
999
1000   sq_pushstring(v, "move", -1);
1001   sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
1002   if(SQ_FAILED(sq_createslot(v, -3))) {
1003     std::ostringstream msg;
1004     msg << "Couldn't register function'move'";
1005     throw SquirrelError(v, msg.str());
1006   }
1007
1008   sq_pushstring(v, "set_pos", -1);
1009   sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
1010   if(SQ_FAILED(sq_createslot(v, -3))) {
1011     std::ostringstream msg;
1012     msg << "Couldn't register function'set_pos'";
1013     throw SquirrelError(v, msg.str());
1014   }
1015
1016   sq_pushstring(v, "get_pos_x", -1);
1017   sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
1018   if(SQ_FAILED(sq_createslot(v, -3))) {
1019     std::ostringstream msg;
1020     msg << "Couldn't register function'get_pos_x'";
1021     throw SquirrelError(v, msg.str());
1022   }
1023
1024   sq_pushstring(v, "get_pos_y", -1);
1025   sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
1026   if(SQ_FAILED(sq_createslot(v, -3))) {
1027     std::ostringstream msg;
1028     msg << "Couldn't register function'get_pos_y'";
1029     throw SquirrelError(v, msg.str());
1030   }
1031
1032   sq_pushstring(v, "set_velocity", -1);
1033   sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
1034   if(SQ_FAILED(sq_createslot(v, -3))) {
1035     std::ostringstream msg;
1036     msg << "Couldn't register function'set_velocity'";
1037     throw SquirrelError(v, msg.str());
1038   }
1039
1040   sq_pushstring(v, "get_velocity_x", -1);
1041   sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
1042   if(SQ_FAILED(sq_createslot(v, -3))) {
1043     std::ostringstream msg;
1044     msg << "Couldn't register function'get_velocity_x'";
1045     throw SquirrelError(v, msg.str());
1046   }
1047
1048   sq_pushstring(v, "get_velocity_y", -1);
1049   sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
1050   if(SQ_FAILED(sq_createslot(v, -3))) {
1051     std::ostringstream msg;
1052     msg << "Couldn't register function'get_velocity_y'";
1053     throw SquirrelError(v, msg.str());
1054   }
1055
1056   sq_pushstring(v, "set_visible", -1);
1057   sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
1058   if(SQ_FAILED(sq_createslot(v, -3))) {
1059     std::ostringstream msg;
1060     msg << "Couldn't register function'set_visible'";
1061     throw SquirrelError(v, msg.str());
1062   }
1063
1064   sq_pushstring(v, "is_visible", -1);
1065   sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
1066   if(SQ_FAILED(sq_createslot(v, -3))) {
1067     std::ostringstream msg;
1068     msg << "Couldn't register function'is_visible'";
1069     throw SquirrelError(v, msg.str());
1070   }
1071
1072   sq_pushstring(v, "get_name", -1);
1073   sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
1074   if(SQ_FAILED(sq_createslot(v, -3))) {
1075     std::ostringstream msg;
1076     msg << "Couldn't register function'get_name'";
1077     throw SquirrelError(v, msg.str());
1078   }
1079
1080   if(SQ_FAILED(sq_createslot(v, -3))) {
1081     std::ostringstream msg;
1082     msg << "Couldn't register class'ScriptedObject'";
1083     throw SquirrelError(v, msg.str());
1084   }
1085
1086   // Register class Sound
1087   sq_pushstring(v, "Sound", -1);
1088   if(sq_newclass(v, SQFalse) < 0) {
1089     std::ostringstream msg;
1090     msg << "Couldn't create new class 'Sound'";
1091     throw SquirrelError(v, msg.str());
1092   }
1093   sq_pushstring(v, "play_music", -1);
1094   sq_newclosure(v, &Sound_play_music_wrapper, 0);
1095   if(SQ_FAILED(sq_createslot(v, -3))) {
1096     std::ostringstream msg;
1097     msg << "Couldn't register function'play_music'";
1098     throw SquirrelError(v, msg.str());
1099   }
1100
1101   sq_pushstring(v, "play", -1);
1102   sq_newclosure(v, &Sound_play_wrapper, 0);
1103   if(SQ_FAILED(sq_createslot(v, -3))) {
1104     std::ostringstream msg;
1105     msg << "Couldn't register function'play'";
1106     throw SquirrelError(v, msg.str());
1107   }
1108
1109   if(SQ_FAILED(sq_createslot(v, -3))) {
1110     std::ostringstream msg;
1111     msg << "Couldn't register class'Sound'";
1112     throw SquirrelError(v, msg.str());
1113   }
1114
1115   // Register class Text
1116   sq_pushstring(v, "Text", -1);
1117   if(sq_newclass(v, SQFalse) < 0) {
1118     std::ostringstream msg;
1119     msg << "Couldn't create new class 'Text'";
1120     throw SquirrelError(v, msg.str());
1121   }
1122   sq_pushstring(v, "set_text", -1);
1123   sq_newclosure(v, &Text_set_text_wrapper, 0);
1124   if(SQ_FAILED(sq_createslot(v, -3))) {
1125     std::ostringstream msg;
1126     msg << "Couldn't register function'set_text'";
1127     throw SquirrelError(v, msg.str());
1128   }
1129
1130   sq_pushstring(v, "set_font", -1);
1131   sq_newclosure(v, &Text_set_font_wrapper, 0);
1132   if(SQ_FAILED(sq_createslot(v, -3))) {
1133     std::ostringstream msg;
1134     msg << "Couldn't register function'set_font'";
1135     throw SquirrelError(v, msg.str());
1136   }
1137
1138   sq_pushstring(v, "fade_in", -1);
1139   sq_newclosure(v, &Text_fade_in_wrapper, 0);
1140   if(SQ_FAILED(sq_createslot(v, -3))) {
1141     std::ostringstream msg;
1142     msg << "Couldn't register function'fade_in'";
1143     throw SquirrelError(v, msg.str());
1144   }
1145
1146   sq_pushstring(v, "fade_out", -1);
1147   sq_newclosure(v, &Text_fade_out_wrapper, 0);
1148   if(SQ_FAILED(sq_createslot(v, -3))) {
1149     std::ostringstream msg;
1150     msg << "Couldn't register function'fade_out'";
1151     throw SquirrelError(v, msg.str());
1152   }
1153
1154   sq_pushstring(v, "set_visible", -1);
1155   sq_newclosure(v, &Text_set_visible_wrapper, 0);
1156   if(SQ_FAILED(sq_createslot(v, -3))) {
1157     std::ostringstream msg;
1158     msg << "Couldn't register function'set_visible'";
1159     throw SquirrelError(v, msg.str());
1160   }
1161
1162   sq_pushstring(v, "set_centered", -1);
1163   sq_newclosure(v, &Text_set_centered_wrapper, 0);
1164   if(SQ_FAILED(sq_createslot(v, -3))) {
1165     std::ostringstream msg;
1166     msg << "Couldn't register function'set_centered'";
1167     throw SquirrelError(v, msg.str());
1168   }
1169
1170   if(SQ_FAILED(sq_createslot(v, -3))) {
1171     std::ostringstream msg;
1172     msg << "Couldn't register class'Text'";
1173     throw SquirrelError(v, msg.str());
1174   }
1175
1176   // Register class Player
1177   sq_pushstring(v, "Player", -1);
1178   if(sq_newclass(v, SQFalse) < 0) {
1179     std::ostringstream msg;
1180     msg << "Couldn't create new class 'Player'";
1181     throw SquirrelError(v, msg.str());
1182   }
1183   sq_pushstring(v, "make_invincible", -1);
1184   sq_newclosure(v, &Player_make_invincible_wrapper, 0);
1185   if(SQ_FAILED(sq_createslot(v, -3))) {
1186     std::ostringstream msg;
1187     msg << "Couldn't register function'make_invincible'";
1188     throw SquirrelError(v, msg.str());
1189   }
1190
1191   sq_pushstring(v, "deactivate", -1);
1192   sq_newclosure(v, &Player_deactivate_wrapper, 0);
1193   if(SQ_FAILED(sq_createslot(v, -3))) {
1194     std::ostringstream msg;
1195     msg << "Couldn't register function'deactivate'";
1196     throw SquirrelError(v, msg.str());
1197   }
1198
1199   sq_pushstring(v, "activate", -1);
1200   sq_newclosure(v, &Player_activate_wrapper, 0);
1201   if(SQ_FAILED(sq_createslot(v, -3))) {
1202     std::ostringstream msg;
1203     msg << "Couldn't register function'activate'";
1204     throw SquirrelError(v, msg.str());
1205   }
1206
1207   sq_pushstring(v, "walk", -1);
1208   sq_newclosure(v, &Player_walk_wrapper, 0);
1209   if(SQ_FAILED(sq_createslot(v, -3))) {
1210     std::ostringstream msg;
1211     msg << "Couldn't register function'walk'";
1212     throw SquirrelError(v, msg.str());
1213   }
1214
1215   sq_pushstring(v, "set_visible", -1);
1216   sq_newclosure(v, &Player_set_visible_wrapper, 0);
1217   if(SQ_FAILED(sq_createslot(v, -3))) {
1218     std::ostringstream msg;
1219     msg << "Couldn't register function'set_visible'";
1220     throw SquirrelError(v, msg.str());
1221   }
1222
1223   sq_pushstring(v, "get_visible", -1);
1224   sq_newclosure(v, &Player_get_visible_wrapper, 0);
1225   if(SQ_FAILED(sq_createslot(v, -3))) {
1226     std::ostringstream msg;
1227     msg << "Couldn't register function'get_visible'";
1228     throw SquirrelError(v, msg.str());
1229   }
1230
1231   if(SQ_FAILED(sq_createslot(v, -3))) {
1232     std::ostringstream msg;
1233     msg << "Couldn't register class'Player'";
1234     throw SquirrelError(v, msg.str());
1235   }
1236
1237   sq_pop(v, 1);
1238 }
1239
1240 } // end of namespace Scripting
1241