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 DisplayEffect_sixteen_to_nine_wrapper(HSQUIRRELVM v)
77 Scripting::DisplayEffect* _this;
78 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
80 _this->sixteen_to_nine();
85 static int DisplayEffect_four_to_three_wrapper(HSQUIRRELVM v)
87 Scripting::DisplayEffect* _this;
88 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
90 _this->four_to_three();
95 static int Camera_release_hook(SQUserPointer ptr, int )
97 Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
102 static int Camera_shake_wrapper(HSQUIRRELVM v)
104 Scripting::Camera* _this;
105 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
107 sq_getfloat(v, 2, &arg0);
109 sq_getfloat(v, 3, &arg1);
111 sq_getfloat(v, 4, &arg2);
113 _this->shake(arg0, arg1, arg2);
118 static int Camera_set_pos_wrapper(HSQUIRRELVM v)
120 Scripting::Camera* _this;
121 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
123 sq_getfloat(v, 2, &arg0);
125 sq_getfloat(v, 3, &arg1);
127 _this->set_pos(arg0, arg1);
132 static int Camera_set_mode_wrapper(HSQUIRRELVM v)
134 Scripting::Camera* _this;
135 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
137 sq_getstring(v, 2, &arg0);
139 _this->set_mode(arg0);
144 static int Level_release_hook(SQUserPointer ptr, int )
146 Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
151 static int Level_finish_wrapper(HSQUIRRELVM v)
153 Scripting::Level* _this;
154 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
161 static int Level_spawn_wrapper(HSQUIRRELVM v)
163 Scripting::Level* _this;
164 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
166 sq_getstring(v, 2, &arg0);
168 sq_getstring(v, 3, &arg1);
170 _this->spawn(arg0, arg1);
175 static int Level_flip_vertically_wrapper(HSQUIRRELVM v)
177 Scripting::Level* _this;
178 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
180 _this->flip_vertically();
185 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
187 Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
192 static int ScriptedObject_set_animation_wrapper(HSQUIRRELVM v)
194 Scripting::ScriptedObject* _this;
195 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
197 sq_getstring(v, 2, &arg0);
199 _this->set_animation(arg0);
204 static int ScriptedObject_get_animation_wrapper(HSQUIRRELVM v)
206 Scripting::ScriptedObject* _this;
207 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
209 std::string return_value = _this->get_animation();
211 sq_pushstring(v, return_value.c_str(), return_value.size());
215 static int ScriptedObject_move_wrapper(HSQUIRRELVM v)
217 Scripting::ScriptedObject* _this;
218 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
220 sq_getfloat(v, 2, &arg0);
222 sq_getfloat(v, 3, &arg1);
224 _this->move(arg0, arg1);
229 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM v)
231 Scripting::ScriptedObject* _this;
232 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
234 sq_getfloat(v, 2, &arg0);
236 sq_getfloat(v, 3, &arg1);
238 _this->set_pos(arg0, arg1);
243 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM v)
245 Scripting::ScriptedObject* _this;
246 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
248 float return_value = _this->get_pos_x();
250 sq_pushfloat(v, return_value);
254 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM v)
256 Scripting::ScriptedObject* _this;
257 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
259 float return_value = _this->get_pos_y();
261 sq_pushfloat(v, return_value);
265 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM v)
267 Scripting::ScriptedObject* _this;
268 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
270 sq_getfloat(v, 2, &arg0);
272 sq_getfloat(v, 3, &arg1);
274 _this->set_velocity(arg0, arg1);
279 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM v)
281 Scripting::ScriptedObject* _this;
282 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
284 float return_value = _this->get_velocity_x();
286 sq_pushfloat(v, return_value);
290 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM v)
292 Scripting::ScriptedObject* _this;
293 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
295 float return_value = _this->get_velocity_y();
297 sq_pushfloat(v, return_value);
301 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM v)
303 Scripting::ScriptedObject* _this;
304 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
306 sq_getbool(v, 2, &arg0);
308 _this->set_visible(arg0);
313 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM v)
315 Scripting::ScriptedObject* _this;
316 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
318 bool return_value = _this->is_visible();
320 sq_pushbool(v, return_value);
324 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM v)
326 Scripting::ScriptedObject* _this;
327 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
329 std::string return_value = _this->get_name();
331 sq_pushstring(v, return_value.c_str(), return_value.size());
335 static int Sound_release_hook(SQUserPointer ptr, int )
337 Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
342 static int Sound_play_music_wrapper(HSQUIRRELVM v)
344 Scripting::Sound* _this;
345 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
347 sq_getstring(v, 2, &arg0);
349 _this->play_music(arg0);
354 static int Sound_play_wrapper(HSQUIRRELVM v)
356 Scripting::Sound* _this;
357 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
359 sq_getstring(v, 2, &arg0);
366 static int Text_release_hook(SQUserPointer ptr, int )
368 Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
373 static int Text_set_text_wrapper(HSQUIRRELVM v)
375 Scripting::Text* _this;
376 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
378 sq_getstring(v, 2, &arg0);
380 _this->set_text(arg0);
385 static int Text_set_font_wrapper(HSQUIRRELVM v)
387 Scripting::Text* _this;
388 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
390 sq_getstring(v, 2, &arg0);
392 _this->set_font(arg0);
397 static int Text_fade_in_wrapper(HSQUIRRELVM v)
399 Scripting::Text* _this;
400 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
402 sq_getfloat(v, 2, &arg0);
404 _this->fade_in(arg0);
409 static int Text_fade_out_wrapper(HSQUIRRELVM v)
411 Scripting::Text* _this;
412 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
414 sq_getfloat(v, 2, &arg0);
416 _this->fade_out(arg0);
421 static int Text_set_visible_wrapper(HSQUIRRELVM v)
423 Scripting::Text* _this;
424 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
426 sq_getbool(v, 2, &arg0);
428 _this->set_visible(arg0);
433 static int Player_release_hook(SQUserPointer ptr, int )
435 Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
440 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
442 Scripting::Player* _this;
443 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
445 _this->make_invincible();
450 static int Player_deactivate_wrapper(HSQUIRRELVM v)
452 Scripting::Player* _this;
453 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
460 static int Player_activate_wrapper(HSQUIRRELVM v)
462 Scripting::Player* _this;
463 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
470 static int Player_walk_wrapper(HSQUIRRELVM v)
472 Scripting::Player* _this;
473 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
475 sq_getfloat(v, 2, &arg0);
482 static int display_text_file_wrapper(HSQUIRRELVM v)
485 sq_getstring(v, 2, &arg0);
487 Scripting::display_text_file(arg0);
492 static int wait_wrapper(HSQUIRRELVM v)
495 sq_getfloat(v, 2, &arg0);
497 Scripting::wait(arg0);
499 return sq_suspendvm(v);
502 static int translate_wrapper(HSQUIRRELVM v)
505 sq_getstring(v, 2, &arg0);
507 std::string return_value = Scripting::translate(arg0);
509 sq_pushstring(v, return_value.c_str(), return_value.size());
513 static int import_wrapper(HSQUIRRELVM v)
515 HSQUIRRELVM arg0 = v;
517 sq_getstring(v, 2, &arg1);
519 Scripting::import(arg0, arg1);
524 static int add_key_wrapper(HSQUIRRELVM v)
527 sq_getinteger(v, 2, &arg0);
529 Scripting::add_key(arg0);
534 } // end of namespace Wrapper
536 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
538 using namespace Wrapper;
541 sq_pushstring(v, "DisplayEffect", -1);
542 if(SQ_FAILED(sq_get(v, -2))) {
543 std::ostringstream msg;
544 msg << "Couldn't resolved squirrel type 'DisplayEffect'";
545 throw SquirrelError(v, msg.str());
548 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
549 std::ostringstream msg;
550 msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
551 throw SquirrelError(v, msg.str());
553 sq_remove(v, -2); // remove object name
555 if(setup_releasehook) {
556 sq_setreleasehook(v, -1, DisplayEffect_release_hook);
559 sq_remove(v, -2); // remove root table
562 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
564 using namespace Wrapper;
567 sq_pushstring(v, "Camera", -1);
568 if(SQ_FAILED(sq_get(v, -2))) {
569 std::ostringstream msg;
570 msg << "Couldn't resolved squirrel type 'Camera'";
571 throw SquirrelError(v, msg.str());
574 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
575 std::ostringstream msg;
576 msg << "Couldn't setup squirrel instance for object of type 'Camera'";
577 throw SquirrelError(v, msg.str());
579 sq_remove(v, -2); // remove object name
581 if(setup_releasehook) {
582 sq_setreleasehook(v, -1, Camera_release_hook);
585 sq_remove(v, -2); // remove root table
588 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
590 using namespace Wrapper;
593 sq_pushstring(v, "Level", -1);
594 if(SQ_FAILED(sq_get(v, -2))) {
595 std::ostringstream msg;
596 msg << "Couldn't resolved squirrel type 'Level'";
597 throw SquirrelError(v, msg.str());
600 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
601 std::ostringstream msg;
602 msg << "Couldn't setup squirrel instance for object of type 'Level'";
603 throw SquirrelError(v, msg.str());
605 sq_remove(v, -2); // remove object name
607 if(setup_releasehook) {
608 sq_setreleasehook(v, -1, Level_release_hook);
611 sq_remove(v, -2); // remove root table
614 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
616 using namespace Wrapper;
619 sq_pushstring(v, "ScriptedObject", -1);
620 if(SQ_FAILED(sq_get(v, -2))) {
621 std::ostringstream msg;
622 msg << "Couldn't resolved squirrel type 'ScriptedObject'";
623 throw SquirrelError(v, msg.str());
626 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
627 std::ostringstream msg;
628 msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
629 throw SquirrelError(v, msg.str());
631 sq_remove(v, -2); // remove object name
633 if(setup_releasehook) {
634 sq_setreleasehook(v, -1, ScriptedObject_release_hook);
637 sq_remove(v, -2); // remove root table
640 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
642 using namespace Wrapper;
645 sq_pushstring(v, "Sound", -1);
646 if(SQ_FAILED(sq_get(v, -2))) {
647 std::ostringstream msg;
648 msg << "Couldn't resolved squirrel type 'Sound'";
649 throw SquirrelError(v, msg.str());
652 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
653 std::ostringstream msg;
654 msg << "Couldn't setup squirrel instance for object of type 'Sound'";
655 throw SquirrelError(v, msg.str());
657 sq_remove(v, -2); // remove object name
659 if(setup_releasehook) {
660 sq_setreleasehook(v, -1, Sound_release_hook);
663 sq_remove(v, -2); // remove root table
666 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
668 using namespace Wrapper;
671 sq_pushstring(v, "Text", -1);
672 if(SQ_FAILED(sq_get(v, -2))) {
673 std::ostringstream msg;
674 msg << "Couldn't resolved squirrel type 'Text'";
675 throw SquirrelError(v, msg.str());
678 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
679 std::ostringstream msg;
680 msg << "Couldn't setup squirrel instance for object of type 'Text'";
681 throw SquirrelError(v, msg.str());
683 sq_remove(v, -2); // remove object name
685 if(setup_releasehook) {
686 sq_setreleasehook(v, -1, Text_release_hook);
689 sq_remove(v, -2); // remove root table
692 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
694 using namespace Wrapper;
697 sq_pushstring(v, "Player", -1);
698 if(SQ_FAILED(sq_get(v, -2))) {
699 std::ostringstream msg;
700 msg << "Couldn't resolved squirrel type 'Player'";
701 throw SquirrelError(v, msg.str());
704 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
705 std::ostringstream msg;
706 msg << "Couldn't setup squirrel instance for object of type 'Player'";
707 throw SquirrelError(v, msg.str());
709 sq_remove(v, -2); // remove object name
711 if(setup_releasehook) {
712 sq_setreleasehook(v, -1, Player_release_hook);
715 sq_remove(v, -2); // remove root table
718 void register_supertux_wrapper(HSQUIRRELVM v)
720 using namespace Wrapper;
723 sq_pushstring(v, "KEY_BRASS", -1);
724 sq_pushinteger(v, 1);
725 if(SQ_FAILED(sq_createslot(v, -3))) {
726 std::ostringstream msg;
727 msg << "Couldn't register constant'KEY_BRASS'";
728 throw SquirrelError(v, msg.str());
731 sq_pushstring(v, "KEY_IRON", -1);
732 sq_pushinteger(v, 2);
733 if(SQ_FAILED(sq_createslot(v, -3))) {
734 std::ostringstream msg;
735 msg << "Couldn't register constant'KEY_IRON'";
736 throw SquirrelError(v, msg.str());
739 sq_pushstring(v, "KEY_BRONZE", -1);
740 sq_pushinteger(v, 4);
741 if(SQ_FAILED(sq_createslot(v, -3))) {
742 std::ostringstream msg;
743 msg << "Couldn't register constant'KEY_BRONZE'";
744 throw SquirrelError(v, msg.str());
747 sq_pushstring(v, "KEY_SILVER", -1);
748 sq_pushinteger(v, 8);
749 if(SQ_FAILED(sq_createslot(v, -3))) {
750 std::ostringstream msg;
751 msg << "Couldn't register constant'KEY_SILVER'";
752 throw SquirrelError(v, msg.str());
755 sq_pushstring(v, "KEY_GOLD", -1);
756 sq_pushinteger(v, 16);
757 if(SQ_FAILED(sq_createslot(v, -3))) {
758 std::ostringstream msg;
759 msg << "Couldn't register constant'KEY_GOLD'";
760 throw SquirrelError(v, msg.str());
763 sq_pushstring(v, "display_text_file", -1);
764 sq_newclosure(v, &display_text_file_wrapper, 0);
765 if(SQ_FAILED(sq_createslot(v, -3))) {
766 std::ostringstream msg;
767 msg << "Couldn't register function'display_text_file'";
768 throw SquirrelError(v, msg.str());
771 sq_pushstring(v, "wait", -1);
772 sq_newclosure(v, &wait_wrapper, 0);
773 if(SQ_FAILED(sq_createslot(v, -3))) {
774 std::ostringstream msg;
775 msg << "Couldn't register function'wait'";
776 throw SquirrelError(v, msg.str());
779 sq_pushstring(v, "translate", -1);
780 sq_newclosure(v, &translate_wrapper, 0);
781 if(SQ_FAILED(sq_createslot(v, -3))) {
782 std::ostringstream msg;
783 msg << "Couldn't register function'translate'";
784 throw SquirrelError(v, msg.str());
787 sq_pushstring(v, "import", -1);
788 sq_newclosure(v, &import_wrapper, 0);
789 if(SQ_FAILED(sq_createslot(v, -3))) {
790 std::ostringstream msg;
791 msg << "Couldn't register function'import'";
792 throw SquirrelError(v, msg.str());
795 sq_pushstring(v, "add_key", -1);
796 sq_newclosure(v, &add_key_wrapper, 0);
797 if(SQ_FAILED(sq_createslot(v, -3))) {
798 std::ostringstream msg;
799 msg << "Couldn't register function'add_key'";
800 throw SquirrelError(v, msg.str());
803 // Register class DisplayEffect
804 sq_pushstring(v, "DisplayEffect", -1);
805 if(sq_newclass(v, SQFalse) < 0) {
806 std::ostringstream msg;
807 msg << "Couldn't create new class 'DisplayEffect'";
808 throw SquirrelError(v, msg.str());
810 sq_pushstring(v, "fade_out", -1);
811 sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
812 if(SQ_FAILED(sq_createslot(v, -3))) {
813 std::ostringstream msg;
814 msg << "Couldn't register function'fade_out'";
815 throw SquirrelError(v, msg.str());
818 sq_pushstring(v, "fade_in", -1);
819 sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
820 if(SQ_FAILED(sq_createslot(v, -3))) {
821 std::ostringstream msg;
822 msg << "Couldn't register function'fade_in'";
823 throw SquirrelError(v, msg.str());
826 sq_pushstring(v, "set_black", -1);
827 sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
828 if(SQ_FAILED(sq_createslot(v, -3))) {
829 std::ostringstream msg;
830 msg << "Couldn't register function'set_black'";
831 throw SquirrelError(v, msg.str());
834 sq_pushstring(v, "is_black", -1);
835 sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
836 if(SQ_FAILED(sq_createslot(v, -3))) {
837 std::ostringstream msg;
838 msg << "Couldn't register function'is_black'";
839 throw SquirrelError(v, msg.str());
842 sq_pushstring(v, "sixteen_to_nine", -1);
843 sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
844 if(SQ_FAILED(sq_createslot(v, -3))) {
845 std::ostringstream msg;
846 msg << "Couldn't register function'sixteen_to_nine'";
847 throw SquirrelError(v, msg.str());
850 sq_pushstring(v, "four_to_three", -1);
851 sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
852 if(SQ_FAILED(sq_createslot(v, -3))) {
853 std::ostringstream msg;
854 msg << "Couldn't register function'four_to_three'";
855 throw SquirrelError(v, msg.str());
858 if(SQ_FAILED(sq_createslot(v, -3))) {
859 std::ostringstream msg;
860 msg << "Couldn't register class'DisplayEffect'";
861 throw SquirrelError(v, msg.str());
864 // Register class Camera
865 sq_pushstring(v, "Camera", -1);
866 if(sq_newclass(v, SQFalse) < 0) {
867 std::ostringstream msg;
868 msg << "Couldn't create new class 'Camera'";
869 throw SquirrelError(v, msg.str());
871 sq_pushstring(v, "shake", -1);
872 sq_newclosure(v, &Camera_shake_wrapper, 0);
873 if(SQ_FAILED(sq_createslot(v, -3))) {
874 std::ostringstream msg;
875 msg << "Couldn't register function'shake'";
876 throw SquirrelError(v, msg.str());
879 sq_pushstring(v, "set_pos", -1);
880 sq_newclosure(v, &Camera_set_pos_wrapper, 0);
881 if(SQ_FAILED(sq_createslot(v, -3))) {
882 std::ostringstream msg;
883 msg << "Couldn't register function'set_pos'";
884 throw SquirrelError(v, msg.str());
887 sq_pushstring(v, "set_mode", -1);
888 sq_newclosure(v, &Camera_set_mode_wrapper, 0);
889 if(SQ_FAILED(sq_createslot(v, -3))) {
890 std::ostringstream msg;
891 msg << "Couldn't register function'set_mode'";
892 throw SquirrelError(v, msg.str());
895 if(SQ_FAILED(sq_createslot(v, -3))) {
896 std::ostringstream msg;
897 msg << "Couldn't register class'Camera'";
898 throw SquirrelError(v, msg.str());
901 // Register class Level
902 sq_pushstring(v, "Level", -1);
903 if(sq_newclass(v, SQFalse) < 0) {
904 std::ostringstream msg;
905 msg << "Couldn't create new class 'Level'";
906 throw SquirrelError(v, msg.str());
908 sq_pushstring(v, "finish", -1);
909 sq_newclosure(v, &Level_finish_wrapper, 0);
910 if(SQ_FAILED(sq_createslot(v, -3))) {
911 std::ostringstream msg;
912 msg << "Couldn't register function'finish'";
913 throw SquirrelError(v, msg.str());
916 sq_pushstring(v, "spawn", -1);
917 sq_newclosure(v, &Level_spawn_wrapper, 0);
918 if(SQ_FAILED(sq_createslot(v, -3))) {
919 std::ostringstream msg;
920 msg << "Couldn't register function'spawn'";
921 throw SquirrelError(v, msg.str());
924 sq_pushstring(v, "flip_vertically", -1);
925 sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
926 if(SQ_FAILED(sq_createslot(v, -3))) {
927 std::ostringstream msg;
928 msg << "Couldn't register function'flip_vertically'";
929 throw SquirrelError(v, msg.str());
932 if(SQ_FAILED(sq_createslot(v, -3))) {
933 std::ostringstream msg;
934 msg << "Couldn't register class'Level'";
935 throw SquirrelError(v, msg.str());
938 // Register class ScriptedObject
939 sq_pushstring(v, "ScriptedObject", -1);
940 if(sq_newclass(v, SQFalse) < 0) {
941 std::ostringstream msg;
942 msg << "Couldn't create new class 'ScriptedObject'";
943 throw SquirrelError(v, msg.str());
945 sq_pushstring(v, "set_animation", -1);
946 sq_newclosure(v, &ScriptedObject_set_animation_wrapper, 0);
947 if(SQ_FAILED(sq_createslot(v, -3))) {
948 std::ostringstream msg;
949 msg << "Couldn't register function'set_animation'";
950 throw SquirrelError(v, msg.str());
953 sq_pushstring(v, "get_animation", -1);
954 sq_newclosure(v, &ScriptedObject_get_animation_wrapper, 0);
955 if(SQ_FAILED(sq_createslot(v, -3))) {
956 std::ostringstream msg;
957 msg << "Couldn't register function'get_animation'";
958 throw SquirrelError(v, msg.str());
961 sq_pushstring(v, "move", -1);
962 sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
963 if(SQ_FAILED(sq_createslot(v, -3))) {
964 std::ostringstream msg;
965 msg << "Couldn't register function'move'";
966 throw SquirrelError(v, msg.str());
969 sq_pushstring(v, "set_pos", -1);
970 sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
971 if(SQ_FAILED(sq_createslot(v, -3))) {
972 std::ostringstream msg;
973 msg << "Couldn't register function'set_pos'";
974 throw SquirrelError(v, msg.str());
977 sq_pushstring(v, "get_pos_x", -1);
978 sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
979 if(SQ_FAILED(sq_createslot(v, -3))) {
980 std::ostringstream msg;
981 msg << "Couldn't register function'get_pos_x'";
982 throw SquirrelError(v, msg.str());
985 sq_pushstring(v, "get_pos_y", -1);
986 sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
987 if(SQ_FAILED(sq_createslot(v, -3))) {
988 std::ostringstream msg;
989 msg << "Couldn't register function'get_pos_y'";
990 throw SquirrelError(v, msg.str());
993 sq_pushstring(v, "set_velocity", -1);
994 sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
995 if(SQ_FAILED(sq_createslot(v, -3))) {
996 std::ostringstream msg;
997 msg << "Couldn't register function'set_velocity'";
998 throw SquirrelError(v, msg.str());
1001 sq_pushstring(v, "get_velocity_x", -1);
1002 sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
1003 if(SQ_FAILED(sq_createslot(v, -3))) {
1004 std::ostringstream msg;
1005 msg << "Couldn't register function'get_velocity_x'";
1006 throw SquirrelError(v, msg.str());
1009 sq_pushstring(v, "get_velocity_y", -1);
1010 sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
1011 if(SQ_FAILED(sq_createslot(v, -3))) {
1012 std::ostringstream msg;
1013 msg << "Couldn't register function'get_velocity_y'";
1014 throw SquirrelError(v, msg.str());
1017 sq_pushstring(v, "set_visible", -1);
1018 sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
1019 if(SQ_FAILED(sq_createslot(v, -3))) {
1020 std::ostringstream msg;
1021 msg << "Couldn't register function'set_visible'";
1022 throw SquirrelError(v, msg.str());
1025 sq_pushstring(v, "is_visible", -1);
1026 sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
1027 if(SQ_FAILED(sq_createslot(v, -3))) {
1028 std::ostringstream msg;
1029 msg << "Couldn't register function'is_visible'";
1030 throw SquirrelError(v, msg.str());
1033 sq_pushstring(v, "get_name", -1);
1034 sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
1035 if(SQ_FAILED(sq_createslot(v, -3))) {
1036 std::ostringstream msg;
1037 msg << "Couldn't register function'get_name'";
1038 throw SquirrelError(v, msg.str());
1041 if(SQ_FAILED(sq_createslot(v, -3))) {
1042 std::ostringstream msg;
1043 msg << "Couldn't register class'ScriptedObject'";
1044 throw SquirrelError(v, msg.str());
1047 // Register class Sound
1048 sq_pushstring(v, "Sound", -1);
1049 if(sq_newclass(v, SQFalse) < 0) {
1050 std::ostringstream msg;
1051 msg << "Couldn't create new class 'Sound'";
1052 throw SquirrelError(v, msg.str());
1054 sq_pushstring(v, "play_music", -1);
1055 sq_newclosure(v, &Sound_play_music_wrapper, 0);
1056 if(SQ_FAILED(sq_createslot(v, -3))) {
1057 std::ostringstream msg;
1058 msg << "Couldn't register function'play_music'";
1059 throw SquirrelError(v, msg.str());
1062 sq_pushstring(v, "play", -1);
1063 sq_newclosure(v, &Sound_play_wrapper, 0);
1064 if(SQ_FAILED(sq_createslot(v, -3))) {
1065 std::ostringstream msg;
1066 msg << "Couldn't register function'play'";
1067 throw SquirrelError(v, msg.str());
1070 if(SQ_FAILED(sq_createslot(v, -3))) {
1071 std::ostringstream msg;
1072 msg << "Couldn't register class'Sound'";
1073 throw SquirrelError(v, msg.str());
1076 // Register class Text
1077 sq_pushstring(v, "Text", -1);
1078 if(sq_newclass(v, SQFalse) < 0) {
1079 std::ostringstream msg;
1080 msg << "Couldn't create new class 'Text'";
1081 throw SquirrelError(v, msg.str());
1083 sq_pushstring(v, "set_text", -1);
1084 sq_newclosure(v, &Text_set_text_wrapper, 0);
1085 if(SQ_FAILED(sq_createslot(v, -3))) {
1086 std::ostringstream msg;
1087 msg << "Couldn't register function'set_text'";
1088 throw SquirrelError(v, msg.str());
1091 sq_pushstring(v, "set_font", -1);
1092 sq_newclosure(v, &Text_set_font_wrapper, 0);
1093 if(SQ_FAILED(sq_createslot(v, -3))) {
1094 std::ostringstream msg;
1095 msg << "Couldn't register function'set_font'";
1096 throw SquirrelError(v, msg.str());
1099 sq_pushstring(v, "fade_in", -1);
1100 sq_newclosure(v, &Text_fade_in_wrapper, 0);
1101 if(SQ_FAILED(sq_createslot(v, -3))) {
1102 std::ostringstream msg;
1103 msg << "Couldn't register function'fade_in'";
1104 throw SquirrelError(v, msg.str());
1107 sq_pushstring(v, "fade_out", -1);
1108 sq_newclosure(v, &Text_fade_out_wrapper, 0);
1109 if(SQ_FAILED(sq_createslot(v, -3))) {
1110 std::ostringstream msg;
1111 msg << "Couldn't register function'fade_out'";
1112 throw SquirrelError(v, msg.str());
1115 sq_pushstring(v, "set_visible", -1);
1116 sq_newclosure(v, &Text_set_visible_wrapper, 0);
1117 if(SQ_FAILED(sq_createslot(v, -3))) {
1118 std::ostringstream msg;
1119 msg << "Couldn't register function'set_visible'";
1120 throw SquirrelError(v, msg.str());
1123 if(SQ_FAILED(sq_createslot(v, -3))) {
1124 std::ostringstream msg;
1125 msg << "Couldn't register class'Text'";
1126 throw SquirrelError(v, msg.str());
1129 // Register class Player
1130 sq_pushstring(v, "Player", -1);
1131 if(sq_newclass(v, SQFalse) < 0) {
1132 std::ostringstream msg;
1133 msg << "Couldn't create new class 'Player'";
1134 throw SquirrelError(v, msg.str());
1136 sq_pushstring(v, "make_invincible", -1);
1137 sq_newclosure(v, &Player_make_invincible_wrapper, 0);
1138 if(SQ_FAILED(sq_createslot(v, -3))) {
1139 std::ostringstream msg;
1140 msg << "Couldn't register function'make_invincible'";
1141 throw SquirrelError(v, msg.str());
1144 sq_pushstring(v, "deactivate", -1);
1145 sq_newclosure(v, &Player_deactivate_wrapper, 0);
1146 if(SQ_FAILED(sq_createslot(v, -3))) {
1147 std::ostringstream msg;
1148 msg << "Couldn't register function'deactivate'";
1149 throw SquirrelError(v, msg.str());
1152 sq_pushstring(v, "activate", -1);
1153 sq_newclosure(v, &Player_activate_wrapper, 0);
1154 if(SQ_FAILED(sq_createslot(v, -3))) {
1155 std::ostringstream msg;
1156 msg << "Couldn't register function'activate'";
1157 throw SquirrelError(v, msg.str());
1160 sq_pushstring(v, "walk", -1);
1161 sq_newclosure(v, &Player_walk_wrapper, 0);
1162 if(SQ_FAILED(sq_createslot(v, -3))) {
1163 std::ostringstream msg;
1164 msg << "Couldn't register function'walk'";
1165 throw SquirrelError(v, msg.str());
1168 if(SQ_FAILED(sq_createslot(v, -3))) {
1169 std::ostringstream msg;
1170 msg << "Couldn't register class'Player'";
1171 throw SquirrelError(v, msg.str());
1177 } // end of namespace Scripting