2 * WARNING: This file is automatically generated from:
3 * 'src/scripting/wrapper.interface.hpp'
13 #include "squirrel_error.hpp"
14 #include "wrapper.interface.hpp"
21 static int DisplayEffect_release_hook(SQUserPointer ptr, int )
23 Scripting::DisplayEffect* _this = reinterpret_cast<Scripting::DisplayEffect*> (ptr);
28 static int DisplayEffect_fade_out_wrapper(HSQUIRRELVM v)
30 Scripting::DisplayEffect* _this;
31 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
33 sq_getfloat(v, 2, &arg0);
35 _this->fade_out(arg0);
40 static int DisplayEffect_fade_in_wrapper(HSQUIRRELVM v)
42 Scripting::DisplayEffect* _this;
43 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
45 sq_getfloat(v, 2, &arg0);
52 static int DisplayEffect_set_black_wrapper(HSQUIRRELVM v)
54 Scripting::DisplayEffect* _this;
55 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
57 sq_getbool(v, 2, &arg0);
59 _this->set_black(arg0);
64 static int DisplayEffect_is_black_wrapper(HSQUIRRELVM v)
66 Scripting::DisplayEffect* _this;
67 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
69 bool return_value = _this->is_black();
71 sq_pushbool(v, return_value);
75 static int Camera_release_hook(SQUserPointer ptr, int )
77 Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
82 static int Camera_shake_wrapper(HSQUIRRELVM v)
84 Scripting::Camera* _this;
85 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
87 sq_getfloat(v, 2, &arg0);
89 sq_getfloat(v, 3, &arg1);
91 sq_getfloat(v, 4, &arg2);
93 _this->shake(arg0, arg1, arg2);
98 static int Camera_set_pos_wrapper(HSQUIRRELVM v)
100 Scripting::Camera* _this;
101 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
103 sq_getfloat(v, 2, &arg0);
105 sq_getfloat(v, 3, &arg1);
107 _this->set_pos(arg0, arg1);
112 static int Camera_set_mode_wrapper(HSQUIRRELVM v)
114 Scripting::Camera* _this;
115 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
117 sq_getstring(v, 2, &arg0);
119 _this->set_mode(arg0);
124 static int Level_release_hook(SQUserPointer ptr, int )
126 Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
131 static int Level_finish_wrapper(HSQUIRRELVM v)
133 Scripting::Level* _this;
134 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
141 static int Level_spawn_wrapper(HSQUIRRELVM v)
143 Scripting::Level* _this;
144 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
146 sq_getstring(v, 2, &arg0);
148 sq_getstring(v, 3, &arg1);
150 _this->spawn(arg0, arg1);
155 static int Level_flip_vertically_wrapper(HSQUIRRELVM v)
157 Scripting::Level* _this;
158 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
160 _this->flip_vertically();
165 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
167 Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
172 static int ScriptedObject_set_animation_wrapper(HSQUIRRELVM v)
174 Scripting::ScriptedObject* _this;
175 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
177 sq_getstring(v, 2, &arg0);
179 _this->set_animation(arg0);
184 static int ScriptedObject_get_animation_wrapper(HSQUIRRELVM v)
186 Scripting::ScriptedObject* _this;
187 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
189 std::string return_value = _this->get_animation();
191 sq_pushstring(v, return_value.c_str(), return_value.size());
195 static int ScriptedObject_move_wrapper(HSQUIRRELVM v)
197 Scripting::ScriptedObject* _this;
198 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
200 sq_getfloat(v, 2, &arg0);
202 sq_getfloat(v, 3, &arg1);
204 _this->move(arg0, arg1);
209 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM v)
211 Scripting::ScriptedObject* _this;
212 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
214 sq_getfloat(v, 2, &arg0);
216 sq_getfloat(v, 3, &arg1);
218 _this->set_pos(arg0, arg1);
223 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM v)
225 Scripting::ScriptedObject* _this;
226 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
228 float return_value = _this->get_pos_x();
230 sq_pushfloat(v, return_value);
234 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM v)
236 Scripting::ScriptedObject* _this;
237 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
239 float return_value = _this->get_pos_y();
241 sq_pushfloat(v, return_value);
245 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM v)
247 Scripting::ScriptedObject* _this;
248 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
250 sq_getfloat(v, 2, &arg0);
252 sq_getfloat(v, 3, &arg1);
254 _this->set_velocity(arg0, arg1);
259 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM v)
261 Scripting::ScriptedObject* _this;
262 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
264 float return_value = _this->get_velocity_x();
266 sq_pushfloat(v, return_value);
270 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM v)
272 Scripting::ScriptedObject* _this;
273 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
275 float return_value = _this->get_velocity_y();
277 sq_pushfloat(v, return_value);
281 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM v)
283 Scripting::ScriptedObject* _this;
284 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
286 sq_getbool(v, 2, &arg0);
288 _this->set_visible(arg0);
293 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM v)
295 Scripting::ScriptedObject* _this;
296 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
298 bool return_value = _this->is_visible();
300 sq_pushbool(v, return_value);
304 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM v)
306 Scripting::ScriptedObject* _this;
307 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
309 std::string return_value = _this->get_name();
311 sq_pushstring(v, return_value.c_str(), return_value.size());
315 static int Sound_release_hook(SQUserPointer ptr, int )
317 Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
322 static int Sound_play_music_wrapper(HSQUIRRELVM v)
324 Scripting::Sound* _this;
325 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
327 sq_getstring(v, 2, &arg0);
329 _this->play_music(arg0);
334 static int Sound_play_wrapper(HSQUIRRELVM v)
336 Scripting::Sound* _this;
337 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
339 sq_getstring(v, 2, &arg0);
346 static int Text_release_hook(SQUserPointer ptr, int )
348 Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
353 static int Text_set_text_wrapper(HSQUIRRELVM v)
355 Scripting::Text* _this;
356 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
358 sq_getstring(v, 2, &arg0);
360 _this->set_text(arg0);
365 static int Text_set_font_wrapper(HSQUIRRELVM v)
367 Scripting::Text* _this;
368 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
370 sq_getstring(v, 2, &arg0);
372 _this->set_font(arg0);
377 static int Text_fade_in_wrapper(HSQUIRRELVM v)
379 Scripting::Text* _this;
380 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
382 sq_getfloat(v, 2, &arg0);
384 _this->fade_in(arg0);
389 static int Text_fade_out_wrapper(HSQUIRRELVM v)
391 Scripting::Text* _this;
392 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
394 sq_getfloat(v, 2, &arg0);
396 _this->fade_out(arg0);
401 static int Text_set_visible_wrapper(HSQUIRRELVM v)
403 Scripting::Text* _this;
404 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
406 sq_getbool(v, 2, &arg0);
408 _this->set_visible(arg0);
413 static int Player_release_hook(SQUserPointer ptr, int )
415 Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
420 static int Player_set_bonus_wrapper(HSQUIRRELVM v)
422 Scripting::Player* _this;
423 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
425 sq_getstring(v, 2, &arg0);
427 _this->set_bonus(arg0);
432 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
434 Scripting::Player* _this;
435 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
437 _this->make_invincible();
442 static int Player_add_life_wrapper(HSQUIRRELVM v)
444 Scripting::Player* _this;
445 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
452 static int Player_add_coins_wrapper(HSQUIRRELVM v)
454 Scripting::Player* _this;
455 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
457 sq_getinteger(v, 2, &arg0);
459 _this->add_coins(arg0);
464 static int display_text_file_wrapper(HSQUIRRELVM v)
467 sq_getstring(v, 2, &arg0);
469 Scripting::display_text_file(arg0);
474 static int wait_wrapper(HSQUIRRELVM v)
477 sq_getfloat(v, 2, &arg0);
479 Scripting::wait(arg0);
481 return sq_suspendvm(v);
484 static int translate_wrapper(HSQUIRRELVM v)
487 sq_getstring(v, 2, &arg0);
489 std::string return_value = Scripting::translate(arg0);
491 sq_pushstring(v, return_value.c_str(), return_value.size());
495 static int import_wrapper(HSQUIRRELVM v)
497 HSQUIRRELVM arg0 = v;
499 sq_getstring(v, 2, &arg1);
501 Scripting::import(arg0, arg1);
506 } // end of namespace Wrapper
508 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
510 using namespace Wrapper;
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());
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());
525 sq_remove(v, -2); // remove object name
527 if(setup_releasehook) {
528 sq_setreleasehook(v, -1, DisplayEffect_release_hook);
531 sq_remove(v, -2); // remove root table
534 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
536 using namespace Wrapper;
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());
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());
551 sq_remove(v, -2); // remove object name
553 if(setup_releasehook) {
554 sq_setreleasehook(v, -1, Camera_release_hook);
557 sq_remove(v, -2); // remove root table
560 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
562 using namespace Wrapper;
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());
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());
577 sq_remove(v, -2); // remove object name
579 if(setup_releasehook) {
580 sq_setreleasehook(v, -1, Level_release_hook);
583 sq_remove(v, -2); // remove root table
586 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
588 using namespace Wrapper;
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());
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());
603 sq_remove(v, -2); // remove object name
605 if(setup_releasehook) {
606 sq_setreleasehook(v, -1, ScriptedObject_release_hook);
609 sq_remove(v, -2); // remove root table
612 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
614 using namespace Wrapper;
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());
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());
629 sq_remove(v, -2); // remove object name
631 if(setup_releasehook) {
632 sq_setreleasehook(v, -1, Sound_release_hook);
635 sq_remove(v, -2); // remove root table
638 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
640 using namespace Wrapper;
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());
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());
655 sq_remove(v, -2); // remove object name
657 if(setup_releasehook) {
658 sq_setreleasehook(v, -1, Text_release_hook);
661 sq_remove(v, -2); // remove root table
664 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
666 using namespace Wrapper;
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());
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());
681 sq_remove(v, -2); // remove object name
683 if(setup_releasehook) {
684 sq_setreleasehook(v, -1, Player_release_hook);
687 sq_remove(v, -2); // remove root table
690 void register_supertux_wrapper(HSQUIRRELVM v)
692 using namespace Wrapper;
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
1085 } // end of namespace Scripting