2 * WARNING: This file is automatically generated from:
3 * 'src/scripting/wrapper.interface.hpp'
12 #include "wrapper_util.hpp"
13 #include "wrapper.interface.hpp"
15 namespace SquirrelWrapper
18 static int DisplayEffect_release_hook(SQUserPointer ptr, int )
20 Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (ptr);
25 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
27 sq_pushstring(v, "DisplayEffect", -1);
28 if(sq_get(v, -2) < 0) {
29 std::ostringstream msg;
30 msg << "Couldn't resolved squirrel type 'DisplayEffect'";
31 throw SquirrelError(v, msg.str());
34 if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object) < 0) {
35 std::ostringstream msg;
36 msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
37 throw SquirrelError(v, msg.str());
41 if(setup_releasehook) {
42 sq_setreleasehook(v, -1, DisplayEffect_release_hook);
45 static int DisplayEffect_fade_out_wrapper(HSQUIRRELVM v)
47 Scripting::DisplayEffect* _this;
48 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
50 sq_getfloat(v, 2, &arg0);
52 _this->fade_out(arg0);
57 static int DisplayEffect_fade_in_wrapper(HSQUIRRELVM v)
59 Scripting::DisplayEffect* _this;
60 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
62 sq_getfloat(v, 2, &arg0);
69 static int DisplayEffect_set_black_wrapper(HSQUIRRELVM v)
71 Scripting::DisplayEffect* _this;
72 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
74 sq_getbool(v, 2, &arg0);
76 _this->set_black(arg0);
81 static int DisplayEffect_is_black_wrapper(HSQUIRRELVM v)
83 Scripting::DisplayEffect* _this;
84 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
86 bool return_value = _this->is_black();
88 sq_pushbool(v, return_value);
92 static int Camera_release_hook(SQUserPointer ptr, int )
94 Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
99 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
101 sq_pushstring(v, "Camera", -1);
102 if(sq_get(v, -2) < 0) {
103 std::ostringstream msg;
104 msg << "Couldn't resolved squirrel type 'Camera'";
105 throw SquirrelError(v, msg.str());
108 if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object) < 0) {
109 std::ostringstream msg;
110 msg << "Couldn't setup squirrel instance for object of type 'Camera'";
111 throw SquirrelError(v, msg.str());
115 if(setup_releasehook) {
116 sq_setreleasehook(v, -1, Camera_release_hook);
119 static int Camera_shake_wrapper(HSQUIRRELVM v)
121 Scripting::Camera* _this;
122 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
124 sq_getfloat(v, 2, &arg0);
126 sq_getfloat(v, 3, &arg1);
128 sq_getfloat(v, 4, &arg2);
130 _this->shake(arg0, arg1, arg2);
135 static int Camera_set_pos_wrapper(HSQUIRRELVM v)
137 Scripting::Camera* _this;
138 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
140 sq_getfloat(v, 2, &arg0);
142 sq_getfloat(v, 3, &arg1);
144 _this->set_pos(arg0, arg1);
149 static int Camera_set_mode_wrapper(HSQUIRRELVM v)
151 Scripting::Camera* _this;
152 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
154 sq_getstring(v, 2, &arg0);
156 _this->set_mode(arg0);
161 static int Level_release_hook(SQUserPointer ptr, int )
163 Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
168 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
170 sq_pushstring(v, "Level", -1);
171 if(sq_get(v, -2) < 0) {
172 std::ostringstream msg;
173 msg << "Couldn't resolved squirrel type 'Level'";
174 throw SquirrelError(v, msg.str());
177 if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object) < 0) {
178 std::ostringstream msg;
179 msg << "Couldn't setup squirrel instance for object of type 'Level'";
180 throw SquirrelError(v, msg.str());
184 if(setup_releasehook) {
185 sq_setreleasehook(v, -1, Level_release_hook);
188 static int Level_finish_wrapper(HSQUIRRELVM v)
190 Scripting::Level* _this;
191 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
198 static int Level_spawn_wrapper(HSQUIRRELVM v)
200 Scripting::Level* _this;
201 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
203 sq_getstring(v, 2, &arg0);
205 sq_getstring(v, 3, &arg1);
207 _this->spawn(arg0, arg1);
212 static int Level_flip_vertically_wrapper(HSQUIRRELVM v)
214 Scripting::Level* _this;
215 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
217 _this->flip_vertically();
222 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
224 Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
229 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
231 sq_pushstring(v, "ScriptedObject", -1);
232 if(sq_get(v, -2) < 0) {
233 std::ostringstream msg;
234 msg << "Couldn't resolved squirrel type 'ScriptedObject'";
235 throw SquirrelError(v, msg.str());
238 if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object) < 0) {
239 std::ostringstream msg;
240 msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
241 throw SquirrelError(v, msg.str());
245 if(setup_releasehook) {
246 sq_setreleasehook(v, -1, ScriptedObject_release_hook);
249 static int ScriptedObject_set_animation_wrapper(HSQUIRRELVM v)
251 Scripting::ScriptedObject* _this;
252 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
254 sq_getstring(v, 2, &arg0);
256 _this->set_animation(arg0);
261 static int ScriptedObject_get_animation_wrapper(HSQUIRRELVM v)
263 Scripting::ScriptedObject* _this;
264 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
266 std::string return_value = _this->get_animation();
268 sq_pushstring(v, return_value.c_str(), return_value.size());
272 static int ScriptedObject_move_wrapper(HSQUIRRELVM v)
274 Scripting::ScriptedObject* _this;
275 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
277 sq_getfloat(v, 2, &arg0);
279 sq_getfloat(v, 3, &arg1);
281 _this->move(arg0, arg1);
286 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM v)
288 Scripting::ScriptedObject* _this;
289 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
291 sq_getfloat(v, 2, &arg0);
293 sq_getfloat(v, 3, &arg1);
295 _this->set_pos(arg0, arg1);
300 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM v)
302 Scripting::ScriptedObject* _this;
303 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
305 float return_value = _this->get_pos_x();
307 sq_pushfloat(v, return_value);
311 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM v)
313 Scripting::ScriptedObject* _this;
314 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
316 float return_value = _this->get_pos_y();
318 sq_pushfloat(v, return_value);
322 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM v)
324 Scripting::ScriptedObject* _this;
325 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
327 sq_getfloat(v, 2, &arg0);
329 sq_getfloat(v, 3, &arg1);
331 _this->set_velocity(arg0, arg1);
336 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM v)
338 Scripting::ScriptedObject* _this;
339 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
341 float return_value = _this->get_velocity_x();
343 sq_pushfloat(v, return_value);
347 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM v)
349 Scripting::ScriptedObject* _this;
350 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
352 float return_value = _this->get_velocity_y();
354 sq_pushfloat(v, return_value);
358 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM v)
360 Scripting::ScriptedObject* _this;
361 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
363 sq_getbool(v, 2, &arg0);
365 _this->set_visible(arg0);
370 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM v)
372 Scripting::ScriptedObject* _this;
373 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
375 bool return_value = _this->is_visible();
377 sq_pushbool(v, return_value);
381 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM v)
383 Scripting::ScriptedObject* _this;
384 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
386 std::string return_value = _this->get_name();
388 sq_pushstring(v, return_value.c_str(), return_value.size());
392 static int Sound_release_hook(SQUserPointer ptr, int )
394 Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
399 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
401 sq_pushstring(v, "Sound", -1);
402 if(sq_get(v, -2) < 0) {
403 std::ostringstream msg;
404 msg << "Couldn't resolved squirrel type 'Sound'";
405 throw SquirrelError(v, msg.str());
408 if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object) < 0) {
409 std::ostringstream msg;
410 msg << "Couldn't setup squirrel instance for object of type 'Sound'";
411 throw SquirrelError(v, msg.str());
415 if(setup_releasehook) {
416 sq_setreleasehook(v, -1, Sound_release_hook);
419 static int Sound_play_music_wrapper(HSQUIRRELVM v)
421 Scripting::Sound* _this;
422 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
424 sq_getstring(v, 2, &arg0);
426 _this->play_music(arg0);
431 static int Sound_play_wrapper(HSQUIRRELVM v)
433 Scripting::Sound* _this;
434 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
436 sq_getstring(v, 2, &arg0);
443 static int Text_release_hook(SQUserPointer ptr, int )
445 Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
450 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
452 sq_pushstring(v, "Text", -1);
453 if(sq_get(v, -2) < 0) {
454 std::ostringstream msg;
455 msg << "Couldn't resolved squirrel type 'Text'";
456 throw SquirrelError(v, msg.str());
459 if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object) < 0) {
460 std::ostringstream msg;
461 msg << "Couldn't setup squirrel instance for object of type 'Text'";
462 throw SquirrelError(v, msg.str());
466 if(setup_releasehook) {
467 sq_setreleasehook(v, -1, Text_release_hook);
470 static int Text_set_text_wrapper(HSQUIRRELVM v)
472 Scripting::Text* _this;
473 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
475 sq_getstring(v, 2, &arg0);
477 _this->set_text(arg0);
482 static int Text_set_font_wrapper(HSQUIRRELVM v)
484 Scripting::Text* _this;
485 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
487 sq_getstring(v, 2, &arg0);
489 _this->set_font(arg0);
494 static int Text_fade_in_wrapper(HSQUIRRELVM v)
496 Scripting::Text* _this;
497 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
499 sq_getfloat(v, 2, &arg0);
501 _this->fade_in(arg0);
506 static int Text_fade_out_wrapper(HSQUIRRELVM v)
508 Scripting::Text* _this;
509 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
511 sq_getfloat(v, 2, &arg0);
513 _this->fade_out(arg0);
518 static int Text_set_visible_wrapper(HSQUIRRELVM v)
520 Scripting::Text* _this;
521 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
523 sq_getbool(v, 2, &arg0);
525 _this->set_visible(arg0);
530 static int Player_release_hook(SQUserPointer ptr, int )
532 Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
537 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
539 sq_pushstring(v, "Player", -1);
540 if(sq_get(v, -2) < 0) {
541 std::ostringstream msg;
542 msg << "Couldn't resolved squirrel type 'Player'";
543 throw SquirrelError(v, msg.str());
546 if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object) < 0) {
547 std::ostringstream msg;
548 msg << "Couldn't setup squirrel instance for object of type 'Player'";
549 throw SquirrelError(v, msg.str());
553 if(setup_releasehook) {
554 sq_setreleasehook(v, -1, Player_release_hook);
557 static int Player_set_bonus_wrapper(HSQUIRRELVM v)
559 Scripting::Player* _this;
560 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
562 sq_getstring(v, 2, &arg0);
564 _this->set_bonus(arg0);
569 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
571 Scripting::Player* _this;
572 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
574 _this->make_invincible();
579 static int Player_add_life_wrapper(HSQUIRRELVM v)
581 Scripting::Player* _this;
582 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
589 static int Player_add_coins_wrapper(HSQUIRRELVM v)
591 Scripting::Player* _this;
592 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
594 sq_getinteger(v, 2, &arg0);
596 _this->add_coins(arg0);
601 static int display_text_file_wrapper(HSQUIRRELVM v)
604 sq_getstring(v, 2, &arg0);
606 Scripting::display_text_file(arg0);
611 static int wait_wrapper(HSQUIRRELVM v)
614 sq_getfloat(v, 2, &arg0);
616 Scripting::wait(arg0);
618 return sq_suspendvm(v);
621 static int translate_wrapper(HSQUIRRELVM v)
624 sq_getstring(v, 2, &arg0);
626 std::string return_value = Scripting::translate(arg0);
628 sq_pushstring(v, return_value.c_str(), return_value.size());
632 static int import_wrapper(HSQUIRRELVM v)
634 HSQUIRRELVM arg0 = v;
636 sq_getstring(v, 2, &arg1);
638 Scripting::import(arg0, arg1);
643 void register_supertux_wrapper(HSQUIRRELVM v)
646 sq_pushstring(v, "display_text_file", -1);
647 sq_newclosure(v, &display_text_file_wrapper, 0);
648 if(sq_createslot(v, -3) < 0) {
649 std::ostringstream msg;
650 msg << "Couldn't register function'display_text_file'";
651 throw SquirrelError(v, msg.str());
654 sq_pushstring(v, "wait", -1);
655 sq_newclosure(v, &wait_wrapper, 0);
656 if(sq_createslot(v, -3) < 0) {
657 std::ostringstream msg;
658 msg << "Couldn't register function'wait'";
659 throw SquirrelError(v, msg.str());
662 sq_pushstring(v, "translate", -1);
663 sq_newclosure(v, &translate_wrapper, 0);
664 if(sq_createslot(v, -3) < 0) {
665 std::ostringstream msg;
666 msg << "Couldn't register function'translate'";
667 throw SquirrelError(v, msg.str());
670 sq_pushstring(v, "import", -1);
671 sq_newclosure(v, &import_wrapper, 0);
672 if(sq_createslot(v, -3) < 0) {
673 std::ostringstream msg;
674 msg << "Couldn't register function'import'";
675 throw SquirrelError(v, msg.str());
678 // Register class DisplayEffect
679 sq_pushstring(v, "DisplayEffect", -1);
680 if(sq_newclass(v, SQFalse) < 0) {
681 std::ostringstream msg;
682 msg << "Couldn't create new class 'DisplayEffect'";
683 throw SquirrelError(v, msg.str());
685 sq_pushstring(v, "fade_out", -1);
686 sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
687 if(sq_createslot(v, -3) < 0) {
688 std::ostringstream msg;
689 msg << "Couldn't register function'fade_out'";
690 throw SquirrelError(v, msg.str());
693 sq_pushstring(v, "fade_in", -1);
694 sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
695 if(sq_createslot(v, -3) < 0) {
696 std::ostringstream msg;
697 msg << "Couldn't register function'fade_in'";
698 throw SquirrelError(v, msg.str());
701 sq_pushstring(v, "set_black", -1);
702 sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
703 if(sq_createslot(v, -3) < 0) {
704 std::ostringstream msg;
705 msg << "Couldn't register function'set_black'";
706 throw SquirrelError(v, msg.str());
709 sq_pushstring(v, "is_black", -1);
710 sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
711 if(sq_createslot(v, -3) < 0) {
712 std::ostringstream msg;
713 msg << "Couldn't register function'is_black'";
714 throw SquirrelError(v, msg.str());
717 if(sq_createslot(v, -3) < 0) {
718 std::ostringstream msg;
719 msg << "Couldn't register class'DisplayEffect'";
720 throw SquirrelError(v, msg.str());
723 // Register class Camera
724 sq_pushstring(v, "Camera", -1);
725 if(sq_newclass(v, SQFalse) < 0) {
726 std::ostringstream msg;
727 msg << "Couldn't create new class 'Camera'";
728 throw SquirrelError(v, msg.str());
730 sq_pushstring(v, "shake", -1);
731 sq_newclosure(v, &Camera_shake_wrapper, 0);
732 if(sq_createslot(v, -3) < 0) {
733 std::ostringstream msg;
734 msg << "Couldn't register function'shake'";
735 throw SquirrelError(v, msg.str());
738 sq_pushstring(v, "set_pos", -1);
739 sq_newclosure(v, &Camera_set_pos_wrapper, 0);
740 if(sq_createslot(v, -3) < 0) {
741 std::ostringstream msg;
742 msg << "Couldn't register function'set_pos'";
743 throw SquirrelError(v, msg.str());
746 sq_pushstring(v, "set_mode", -1);
747 sq_newclosure(v, &Camera_set_mode_wrapper, 0);
748 if(sq_createslot(v, -3) < 0) {
749 std::ostringstream msg;
750 msg << "Couldn't register function'set_mode'";
751 throw SquirrelError(v, msg.str());
754 if(sq_createslot(v, -3) < 0) {
755 std::ostringstream msg;
756 msg << "Couldn't register class'Camera'";
757 throw SquirrelError(v, msg.str());
760 // Register class Level
761 sq_pushstring(v, "Level", -1);
762 if(sq_newclass(v, SQFalse) < 0) {
763 std::ostringstream msg;
764 msg << "Couldn't create new class 'Level'";
765 throw SquirrelError(v, msg.str());
767 sq_pushstring(v, "finish", -1);
768 sq_newclosure(v, &Level_finish_wrapper, 0);
769 if(sq_createslot(v, -3) < 0) {
770 std::ostringstream msg;
771 msg << "Couldn't register function'finish'";
772 throw SquirrelError(v, msg.str());
775 sq_pushstring(v, "spawn", -1);
776 sq_newclosure(v, &Level_spawn_wrapper, 0);
777 if(sq_createslot(v, -3) < 0) {
778 std::ostringstream msg;
779 msg << "Couldn't register function'spawn'";
780 throw SquirrelError(v, msg.str());
783 sq_pushstring(v, "flip_vertically", -1);
784 sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
785 if(sq_createslot(v, -3) < 0) {
786 std::ostringstream msg;
787 msg << "Couldn't register function'flip_vertically'";
788 throw SquirrelError(v, msg.str());
791 if(sq_createslot(v, -3) < 0) {
792 std::ostringstream msg;
793 msg << "Couldn't register class'Level'";
794 throw SquirrelError(v, msg.str());
797 // Register class ScriptedObject
798 sq_pushstring(v, "ScriptedObject", -1);
799 if(sq_newclass(v, SQFalse) < 0) {
800 std::ostringstream msg;
801 msg << "Couldn't create new class 'ScriptedObject'";
802 throw SquirrelError(v, msg.str());
804 sq_pushstring(v, "set_animation", -1);
805 sq_newclosure(v, &ScriptedObject_set_animation_wrapper, 0);
806 if(sq_createslot(v, -3) < 0) {
807 std::ostringstream msg;
808 msg << "Couldn't register function'set_animation'";
809 throw SquirrelError(v, msg.str());
812 sq_pushstring(v, "get_animation", -1);
813 sq_newclosure(v, &ScriptedObject_get_animation_wrapper, 0);
814 if(sq_createslot(v, -3) < 0) {
815 std::ostringstream msg;
816 msg << "Couldn't register function'get_animation'";
817 throw SquirrelError(v, msg.str());
820 sq_pushstring(v, "move", -1);
821 sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
822 if(sq_createslot(v, -3) < 0) {
823 std::ostringstream msg;
824 msg << "Couldn't register function'move'";
825 throw SquirrelError(v, msg.str());
828 sq_pushstring(v, "set_pos", -1);
829 sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
830 if(sq_createslot(v, -3) < 0) {
831 std::ostringstream msg;
832 msg << "Couldn't register function'set_pos'";
833 throw SquirrelError(v, msg.str());
836 sq_pushstring(v, "get_pos_x", -1);
837 sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
838 if(sq_createslot(v, -3) < 0) {
839 std::ostringstream msg;
840 msg << "Couldn't register function'get_pos_x'";
841 throw SquirrelError(v, msg.str());
844 sq_pushstring(v, "get_pos_y", -1);
845 sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
846 if(sq_createslot(v, -3) < 0) {
847 std::ostringstream msg;
848 msg << "Couldn't register function'get_pos_y'";
849 throw SquirrelError(v, msg.str());
852 sq_pushstring(v, "set_velocity", -1);
853 sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
854 if(sq_createslot(v, -3) < 0) {
855 std::ostringstream msg;
856 msg << "Couldn't register function'set_velocity'";
857 throw SquirrelError(v, msg.str());
860 sq_pushstring(v, "get_velocity_x", -1);
861 sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
862 if(sq_createslot(v, -3) < 0) {
863 std::ostringstream msg;
864 msg << "Couldn't register function'get_velocity_x'";
865 throw SquirrelError(v, msg.str());
868 sq_pushstring(v, "get_velocity_y", -1);
869 sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
870 if(sq_createslot(v, -3) < 0) {
871 std::ostringstream msg;
872 msg << "Couldn't register function'get_velocity_y'";
873 throw SquirrelError(v, msg.str());
876 sq_pushstring(v, "set_visible", -1);
877 sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
878 if(sq_createslot(v, -3) < 0) {
879 std::ostringstream msg;
880 msg << "Couldn't register function'set_visible'";
881 throw SquirrelError(v, msg.str());
884 sq_pushstring(v, "is_visible", -1);
885 sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
886 if(sq_createslot(v, -3) < 0) {
887 std::ostringstream msg;
888 msg << "Couldn't register function'is_visible'";
889 throw SquirrelError(v, msg.str());
892 sq_pushstring(v, "get_name", -1);
893 sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
894 if(sq_createslot(v, -3) < 0) {
895 std::ostringstream msg;
896 msg << "Couldn't register function'get_name'";
897 throw SquirrelError(v, msg.str());
900 if(sq_createslot(v, -3) < 0) {
901 std::ostringstream msg;
902 msg << "Couldn't register class'ScriptedObject'";
903 throw SquirrelError(v, msg.str());
906 // Register class Sound
907 sq_pushstring(v, "Sound", -1);
908 if(sq_newclass(v, SQFalse) < 0) {
909 std::ostringstream msg;
910 msg << "Couldn't create new class 'Sound'";
911 throw SquirrelError(v, msg.str());
913 sq_pushstring(v, "play_music", -1);
914 sq_newclosure(v, &Sound_play_music_wrapper, 0);
915 if(sq_createslot(v, -3) < 0) {
916 std::ostringstream msg;
917 msg << "Couldn't register function'play_music'";
918 throw SquirrelError(v, msg.str());
921 sq_pushstring(v, "play", -1);
922 sq_newclosure(v, &Sound_play_wrapper, 0);
923 if(sq_createslot(v, -3) < 0) {
924 std::ostringstream msg;
925 msg << "Couldn't register function'play'";
926 throw SquirrelError(v, msg.str());
929 if(sq_createslot(v, -3) < 0) {
930 std::ostringstream msg;
931 msg << "Couldn't register class'Sound'";
932 throw SquirrelError(v, msg.str());
935 // Register class Text
936 sq_pushstring(v, "Text", -1);
937 if(sq_newclass(v, SQFalse) < 0) {
938 std::ostringstream msg;
939 msg << "Couldn't create new class 'Text'";
940 throw SquirrelError(v, msg.str());
942 sq_pushstring(v, "set_text", -1);
943 sq_newclosure(v, &Text_set_text_wrapper, 0);
944 if(sq_createslot(v, -3) < 0) {
945 std::ostringstream msg;
946 msg << "Couldn't register function'set_text'";
947 throw SquirrelError(v, msg.str());
950 sq_pushstring(v, "set_font", -1);
951 sq_newclosure(v, &Text_set_font_wrapper, 0);
952 if(sq_createslot(v, -3) < 0) {
953 std::ostringstream msg;
954 msg << "Couldn't register function'set_font'";
955 throw SquirrelError(v, msg.str());
958 sq_pushstring(v, "fade_in", -1);
959 sq_newclosure(v, &Text_fade_in_wrapper, 0);
960 if(sq_createslot(v, -3) < 0) {
961 std::ostringstream msg;
962 msg << "Couldn't register function'fade_in'";
963 throw SquirrelError(v, msg.str());
966 sq_pushstring(v, "fade_out", -1);
967 sq_newclosure(v, &Text_fade_out_wrapper, 0);
968 if(sq_createslot(v, -3) < 0) {
969 std::ostringstream msg;
970 msg << "Couldn't register function'fade_out'";
971 throw SquirrelError(v, msg.str());
974 sq_pushstring(v, "set_visible", -1);
975 sq_newclosure(v, &Text_set_visible_wrapper, 0);
976 if(sq_createslot(v, -3) < 0) {
977 std::ostringstream msg;
978 msg << "Couldn't register function'set_visible'";
979 throw SquirrelError(v, msg.str());
982 if(sq_createslot(v, -3) < 0) {
983 std::ostringstream msg;
984 msg << "Couldn't register class'Text'";
985 throw SquirrelError(v, msg.str());
988 // Register class Player
989 sq_pushstring(v, "Player", -1);
990 if(sq_newclass(v, SQFalse) < 0) {
991 std::ostringstream msg;
992 msg << "Couldn't create new class 'Player'";
993 throw SquirrelError(v, msg.str());
995 sq_pushstring(v, "set_bonus", -1);
996 sq_newclosure(v, &Player_set_bonus_wrapper, 0);
997 if(sq_createslot(v, -3) < 0) {
998 std::ostringstream msg;
999 msg << "Couldn't register function'set_bonus'";
1000 throw SquirrelError(v, msg.str());
1003 sq_pushstring(v, "make_invincible", -1);
1004 sq_newclosure(v, &Player_make_invincible_wrapper, 0);
1005 if(sq_createslot(v, -3) < 0) {
1006 std::ostringstream msg;
1007 msg << "Couldn't register function'make_invincible'";
1008 throw SquirrelError(v, msg.str());
1011 sq_pushstring(v, "add_life", -1);
1012 sq_newclosure(v, &Player_add_life_wrapper, 0);
1013 if(sq_createslot(v, -3) < 0) {
1014 std::ostringstream msg;
1015 msg << "Couldn't register function'add_life'";
1016 throw SquirrelError(v, msg.str());
1019 sq_pushstring(v, "add_coins", -1);
1020 sq_newclosure(v, &Player_add_coins_wrapper, 0);
1021 if(sq_createslot(v, -3) < 0) {
1022 std::ostringstream msg;
1023 msg << "Couldn't register function'add_coins'";
1024 throw SquirrelError(v, msg.str());
1027 if(sq_createslot(v, -3) < 0) {
1028 std::ostringstream msg;
1029 msg << "Couldn't register class'Player'";
1030 throw SquirrelError(v, msg.str());