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 sq_getfloat(v, 2, &arg0);
82 _this->sixteen_to_nine(arg0);
87 static int DisplayEffect_four_to_three_wrapper(HSQUIRRELVM v)
89 Scripting::DisplayEffect* _this;
90 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
92 sq_getfloat(v, 2, &arg0);
94 _this->four_to_three(arg0);
99 static int Camera_release_hook(SQUserPointer ptr, int )
101 Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
106 static int Camera_shake_wrapper(HSQUIRRELVM v)
108 Scripting::Camera* _this;
109 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
111 sq_getfloat(v, 2, &arg0);
113 sq_getfloat(v, 3, &arg1);
115 sq_getfloat(v, 4, &arg2);
117 _this->shake(arg0, arg1, arg2);
122 static int Camera_set_pos_wrapper(HSQUIRRELVM v)
124 Scripting::Camera* _this;
125 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
127 sq_getfloat(v, 2, &arg0);
129 sq_getfloat(v, 3, &arg1);
131 _this->set_pos(arg0, arg1);
136 static int Camera_set_mode_wrapper(HSQUIRRELVM v)
138 Scripting::Camera* _this;
139 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
141 sq_getstring(v, 2, &arg0);
143 _this->set_mode(arg0);
148 static int Level_release_hook(SQUserPointer ptr, int )
150 Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
155 static int Level_finish_wrapper(HSQUIRRELVM v)
157 Scripting::Level* _this;
158 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
165 static int Level_spawn_wrapper(HSQUIRRELVM v)
167 Scripting::Level* _this;
168 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
170 sq_getstring(v, 2, &arg0);
172 sq_getstring(v, 3, &arg1);
174 _this->spawn(arg0, arg1);
179 static int Level_flip_vertically_wrapper(HSQUIRRELVM v)
181 Scripting::Level* _this;
182 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
184 _this->flip_vertically();
189 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
191 Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
196 static int ScriptedObject_set_action_wrapper(HSQUIRRELVM v)
198 Scripting::ScriptedObject* _this;
199 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
201 sq_getstring(v, 2, &arg0);
203 _this->set_action(arg0);
208 static int ScriptedObject_get_action_wrapper(HSQUIRRELVM v)
210 Scripting::ScriptedObject* _this;
211 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
213 std::string return_value = _this->get_action();
215 sq_pushstring(v, return_value.c_str(), return_value.size());
219 static int ScriptedObject_move_wrapper(HSQUIRRELVM v)
221 Scripting::ScriptedObject* _this;
222 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
224 sq_getfloat(v, 2, &arg0);
226 sq_getfloat(v, 3, &arg1);
228 _this->move(arg0, arg1);
233 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM v)
235 Scripting::ScriptedObject* _this;
236 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
238 sq_getfloat(v, 2, &arg0);
240 sq_getfloat(v, 3, &arg1);
242 _this->set_pos(arg0, arg1);
247 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM v)
249 Scripting::ScriptedObject* _this;
250 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
252 float return_value = _this->get_pos_x();
254 sq_pushfloat(v, return_value);
258 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM v)
260 Scripting::ScriptedObject* _this;
261 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
263 float return_value = _this->get_pos_y();
265 sq_pushfloat(v, return_value);
269 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM v)
271 Scripting::ScriptedObject* _this;
272 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
274 sq_getfloat(v, 2, &arg0);
276 sq_getfloat(v, 3, &arg1);
278 _this->set_velocity(arg0, arg1);
283 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM v)
285 Scripting::ScriptedObject* _this;
286 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
288 float return_value = _this->get_velocity_x();
290 sq_pushfloat(v, return_value);
294 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM v)
296 Scripting::ScriptedObject* _this;
297 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
299 float return_value = _this->get_velocity_y();
301 sq_pushfloat(v, return_value);
305 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM v)
307 Scripting::ScriptedObject* _this;
308 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
310 sq_getbool(v, 2, &arg0);
312 _this->set_visible(arg0);
317 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM v)
319 Scripting::ScriptedObject* _this;
320 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
322 bool return_value = _this->is_visible();
324 sq_pushbool(v, return_value);
328 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM v)
330 Scripting::ScriptedObject* _this;
331 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
333 std::string return_value = _this->get_name();
335 sq_pushstring(v, return_value.c_str(), return_value.size());
339 static int Sound_release_hook(SQUserPointer ptr, int )
341 Scripting::Sound* _this = reinterpret_cast<Scripting::Sound*> (ptr);
346 static int Sound_play_music_wrapper(HSQUIRRELVM v)
348 Scripting::Sound* _this;
349 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
351 sq_getstring(v, 2, &arg0);
353 _this->play_music(arg0);
358 static int Sound_play_wrapper(HSQUIRRELVM v)
360 Scripting::Sound* _this;
361 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
363 sq_getstring(v, 2, &arg0);
370 static int Text_release_hook(SQUserPointer ptr, int )
372 Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
377 static int Text_set_text_wrapper(HSQUIRRELVM v)
379 Scripting::Text* _this;
380 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
382 sq_getstring(v, 2, &arg0);
384 _this->set_text(arg0);
389 static int Text_set_font_wrapper(HSQUIRRELVM v)
391 Scripting::Text* _this;
392 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
394 sq_getstring(v, 2, &arg0);
396 _this->set_font(arg0);
401 static int Text_fade_in_wrapper(HSQUIRRELVM v)
403 Scripting::Text* _this;
404 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
406 sq_getfloat(v, 2, &arg0);
408 _this->fade_in(arg0);
413 static int Text_fade_out_wrapper(HSQUIRRELVM v)
415 Scripting::Text* _this;
416 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
418 sq_getfloat(v, 2, &arg0);
420 _this->fade_out(arg0);
425 static int Text_set_visible_wrapper(HSQUIRRELVM v)
427 Scripting::Text* _this;
428 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
430 sq_getbool(v, 2, &arg0);
432 _this->set_visible(arg0);
437 static int Text_set_centered_wrapper(HSQUIRRELVM v)
439 Scripting::Text* _this;
440 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
442 sq_getbool(v, 2, &arg0);
444 _this->set_centered(arg0);
449 static int Player_release_hook(SQUserPointer ptr, int )
451 Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
456 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
458 Scripting::Player* _this;
459 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
461 _this->make_invincible();
466 static int Player_deactivate_wrapper(HSQUIRRELVM v)
468 Scripting::Player* _this;
469 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
476 static int Player_activate_wrapper(HSQUIRRELVM v)
478 Scripting::Player* _this;
479 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
486 static int Player_walk_wrapper(HSQUIRRELVM v)
488 Scripting::Player* _this;
489 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
491 sq_getfloat(v, 2, &arg0);
498 static int Player_set_visible_wrapper(HSQUIRRELVM v)
500 Scripting::Player* _this;
501 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
503 sq_getbool(v, 2, &arg0);
505 _this->set_visible(arg0);
510 static int Player_get_visible_wrapper(HSQUIRRELVM v)
512 Scripting::Player* _this;
513 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
515 bool return_value = _this->get_visible();
517 sq_pushbool(v, return_value);
521 static int display_text_file_wrapper(HSQUIRRELVM v)
524 sq_getstring(v, 2, &arg0);
526 Scripting::display_text_file(arg0);
531 static int wait_wrapper(HSQUIRRELVM v)
534 sq_getfloat(v, 2, &arg0);
536 Scripting::wait(arg0);
538 return sq_suspendvm(v);
541 static int translate_wrapper(HSQUIRRELVM v)
544 sq_getstring(v, 2, &arg0);
546 std::string return_value = Scripting::translate(arg0);
548 sq_pushstring(v, return_value.c_str(), return_value.size());
552 static int import_wrapper(HSQUIRRELVM v)
554 HSQUIRRELVM arg0 = v;
556 sq_getstring(v, 2, &arg1);
558 Scripting::import(arg0, arg1);
563 static int add_key_wrapper(HSQUIRRELVM v)
566 sq_getinteger(v, 2, &arg0);
568 Scripting::add_key(arg0);
573 } // end of namespace Wrapper
575 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
577 using namespace Wrapper;
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());
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());
592 sq_remove(v, -2); // remove object name
594 if(setup_releasehook) {
595 sq_setreleasehook(v, -1, DisplayEffect_release_hook);
598 sq_remove(v, -2); // remove root table
601 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
603 using namespace Wrapper;
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());
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());
618 sq_remove(v, -2); // remove object name
620 if(setup_releasehook) {
621 sq_setreleasehook(v, -1, Camera_release_hook);
624 sq_remove(v, -2); // remove root table
627 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
629 using namespace Wrapper;
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());
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());
644 sq_remove(v, -2); // remove object name
646 if(setup_releasehook) {
647 sq_setreleasehook(v, -1, Level_release_hook);
650 sq_remove(v, -2); // remove root table
653 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
655 using namespace Wrapper;
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());
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());
670 sq_remove(v, -2); // remove object name
672 if(setup_releasehook) {
673 sq_setreleasehook(v, -1, ScriptedObject_release_hook);
676 sq_remove(v, -2); // remove root table
679 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
681 using namespace Wrapper;
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());
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());
696 sq_remove(v, -2); // remove object name
698 if(setup_releasehook) {
699 sq_setreleasehook(v, -1, Sound_release_hook);
702 sq_remove(v, -2); // remove root table
705 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
707 using namespace Wrapper;
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());
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());
722 sq_remove(v, -2); // remove object name
724 if(setup_releasehook) {
725 sq_setreleasehook(v, -1, Text_release_hook);
728 sq_remove(v, -2); // remove root table
731 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
733 using namespace Wrapper;
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());
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());
748 sq_remove(v, -2); // remove object name
750 if(setup_releasehook) {
751 sq_setreleasehook(v, -1, Player_release_hook);
754 sq_remove(v, -2); // remove root table
757 void register_supertux_wrapper(HSQUIRRELVM v)
759 using namespace Wrapper;
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
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());
1240 } // end of namespace Scripting