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 Text_set_centered_wrapper(HSQUIRRELVM v)
435 Scripting::Text* _this;
436 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
438 sq_getbool(v, 2, &arg0);
440 _this->set_centered(arg0);
445 static int Player_release_hook(SQUserPointer ptr, int )
447 Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
452 static int Player_make_invincible_wrapper(HSQUIRRELVM v)
454 Scripting::Player* _this;
455 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
457 _this->make_invincible();
462 static int Player_deactivate_wrapper(HSQUIRRELVM v)
464 Scripting::Player* _this;
465 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
472 static int Player_activate_wrapper(HSQUIRRELVM v)
474 Scripting::Player* _this;
475 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
482 static int Player_walk_wrapper(HSQUIRRELVM v)
484 Scripting::Player* _this;
485 sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0);
487 sq_getfloat(v, 2, &arg0);
494 static int display_text_file_wrapper(HSQUIRRELVM v)
497 sq_getstring(v, 2, &arg0);
499 Scripting::display_text_file(arg0);
504 static int wait_wrapper(HSQUIRRELVM v)
507 sq_getfloat(v, 2, &arg0);
509 Scripting::wait(arg0);
511 return sq_suspendvm(v);
514 static int translate_wrapper(HSQUIRRELVM v)
517 sq_getstring(v, 2, &arg0);
519 std::string return_value = Scripting::translate(arg0);
521 sq_pushstring(v, return_value.c_str(), return_value.size());
525 static int import_wrapper(HSQUIRRELVM v)
527 HSQUIRRELVM arg0 = v;
529 sq_getstring(v, 2, &arg1);
531 Scripting::import(arg0, arg1);
536 static int add_key_wrapper(HSQUIRRELVM v)
539 sq_getinteger(v, 2, &arg0);
541 Scripting::add_key(arg0);
546 } // end of namespace Wrapper
548 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
550 using namespace Wrapper;
553 sq_pushstring(v, "DisplayEffect", -1);
554 if(SQ_FAILED(sq_get(v, -2))) {
555 std::ostringstream msg;
556 msg << "Couldn't resolved squirrel type 'DisplayEffect'";
557 throw SquirrelError(v, msg.str());
560 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
561 std::ostringstream msg;
562 msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
563 throw SquirrelError(v, msg.str());
565 sq_remove(v, -2); // remove object name
567 if(setup_releasehook) {
568 sq_setreleasehook(v, -1, DisplayEffect_release_hook);
571 sq_remove(v, -2); // remove root table
574 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
576 using namespace Wrapper;
579 sq_pushstring(v, "Camera", -1);
580 if(SQ_FAILED(sq_get(v, -2))) {
581 std::ostringstream msg;
582 msg << "Couldn't resolved squirrel type 'Camera'";
583 throw SquirrelError(v, msg.str());
586 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
587 std::ostringstream msg;
588 msg << "Couldn't setup squirrel instance for object of type 'Camera'";
589 throw SquirrelError(v, msg.str());
591 sq_remove(v, -2); // remove object name
593 if(setup_releasehook) {
594 sq_setreleasehook(v, -1, Camera_release_hook);
597 sq_remove(v, -2); // remove root table
600 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
602 using namespace Wrapper;
605 sq_pushstring(v, "Level", -1);
606 if(SQ_FAILED(sq_get(v, -2))) {
607 std::ostringstream msg;
608 msg << "Couldn't resolved squirrel type 'Level'";
609 throw SquirrelError(v, msg.str());
612 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
613 std::ostringstream msg;
614 msg << "Couldn't setup squirrel instance for object of type 'Level'";
615 throw SquirrelError(v, msg.str());
617 sq_remove(v, -2); // remove object name
619 if(setup_releasehook) {
620 sq_setreleasehook(v, -1, Level_release_hook);
623 sq_remove(v, -2); // remove root table
626 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
628 using namespace Wrapper;
631 sq_pushstring(v, "ScriptedObject", -1);
632 if(SQ_FAILED(sq_get(v, -2))) {
633 std::ostringstream msg;
634 msg << "Couldn't resolved squirrel type 'ScriptedObject'";
635 throw SquirrelError(v, msg.str());
638 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
639 std::ostringstream msg;
640 msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
641 throw SquirrelError(v, msg.str());
643 sq_remove(v, -2); // remove object name
645 if(setup_releasehook) {
646 sq_setreleasehook(v, -1, ScriptedObject_release_hook);
649 sq_remove(v, -2); // remove root table
652 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
654 using namespace Wrapper;
657 sq_pushstring(v, "Sound", -1);
658 if(SQ_FAILED(sq_get(v, -2))) {
659 std::ostringstream msg;
660 msg << "Couldn't resolved squirrel type 'Sound'";
661 throw SquirrelError(v, msg.str());
664 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
665 std::ostringstream msg;
666 msg << "Couldn't setup squirrel instance for object of type 'Sound'";
667 throw SquirrelError(v, msg.str());
669 sq_remove(v, -2); // remove object name
671 if(setup_releasehook) {
672 sq_setreleasehook(v, -1, Sound_release_hook);
675 sq_remove(v, -2); // remove root table
678 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
680 using namespace Wrapper;
683 sq_pushstring(v, "Text", -1);
684 if(SQ_FAILED(sq_get(v, -2))) {
685 std::ostringstream msg;
686 msg << "Couldn't resolved squirrel type 'Text'";
687 throw SquirrelError(v, msg.str());
690 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
691 std::ostringstream msg;
692 msg << "Couldn't setup squirrel instance for object of type 'Text'";
693 throw SquirrelError(v, msg.str());
695 sq_remove(v, -2); // remove object name
697 if(setup_releasehook) {
698 sq_setreleasehook(v, -1, Text_release_hook);
701 sq_remove(v, -2); // remove root table
704 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
706 using namespace Wrapper;
709 sq_pushstring(v, "Player", -1);
710 if(SQ_FAILED(sq_get(v, -2))) {
711 std::ostringstream msg;
712 msg << "Couldn't resolved squirrel type 'Player'";
713 throw SquirrelError(v, msg.str());
716 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
717 std::ostringstream msg;
718 msg << "Couldn't setup squirrel instance for object of type 'Player'";
719 throw SquirrelError(v, msg.str());
721 sq_remove(v, -2); // remove object name
723 if(setup_releasehook) {
724 sq_setreleasehook(v, -1, Player_release_hook);
727 sq_remove(v, -2); // remove root table
730 void register_supertux_wrapper(HSQUIRRELVM v)
732 using namespace Wrapper;
735 sq_pushstring(v, "KEY_BRASS", -1);
736 sq_pushinteger(v, 1);
737 if(SQ_FAILED(sq_createslot(v, -3))) {
738 std::ostringstream msg;
739 msg << "Couldn't register constant'KEY_BRASS'";
740 throw SquirrelError(v, msg.str());
743 sq_pushstring(v, "KEY_IRON", -1);
744 sq_pushinteger(v, 2);
745 if(SQ_FAILED(sq_createslot(v, -3))) {
746 std::ostringstream msg;
747 msg << "Couldn't register constant'KEY_IRON'";
748 throw SquirrelError(v, msg.str());
751 sq_pushstring(v, "KEY_BRONZE", -1);
752 sq_pushinteger(v, 4);
753 if(SQ_FAILED(sq_createslot(v, -3))) {
754 std::ostringstream msg;
755 msg << "Couldn't register constant'KEY_BRONZE'";
756 throw SquirrelError(v, msg.str());
759 sq_pushstring(v, "KEY_SILVER", -1);
760 sq_pushinteger(v, 8);
761 if(SQ_FAILED(sq_createslot(v, -3))) {
762 std::ostringstream msg;
763 msg << "Couldn't register constant'KEY_SILVER'";
764 throw SquirrelError(v, msg.str());
767 sq_pushstring(v, "KEY_GOLD", -1);
768 sq_pushinteger(v, 16);
769 if(SQ_FAILED(sq_createslot(v, -3))) {
770 std::ostringstream msg;
771 msg << "Couldn't register constant'KEY_GOLD'";
772 throw SquirrelError(v, msg.str());
775 sq_pushstring(v, "display_text_file", -1);
776 sq_newclosure(v, &display_text_file_wrapper, 0);
777 if(SQ_FAILED(sq_createslot(v, -3))) {
778 std::ostringstream msg;
779 msg << "Couldn't register function'display_text_file'";
780 throw SquirrelError(v, msg.str());
783 sq_pushstring(v, "wait", -1);
784 sq_newclosure(v, &wait_wrapper, 0);
785 if(SQ_FAILED(sq_createslot(v, -3))) {
786 std::ostringstream msg;
787 msg << "Couldn't register function'wait'";
788 throw SquirrelError(v, msg.str());
791 sq_pushstring(v, "translate", -1);
792 sq_newclosure(v, &translate_wrapper, 0);
793 if(SQ_FAILED(sq_createslot(v, -3))) {
794 std::ostringstream msg;
795 msg << "Couldn't register function'translate'";
796 throw SquirrelError(v, msg.str());
799 sq_pushstring(v, "import", -1);
800 sq_newclosure(v, &import_wrapper, 0);
801 if(SQ_FAILED(sq_createslot(v, -3))) {
802 std::ostringstream msg;
803 msg << "Couldn't register function'import'";
804 throw SquirrelError(v, msg.str());
807 sq_pushstring(v, "add_key", -1);
808 sq_newclosure(v, &add_key_wrapper, 0);
809 if(SQ_FAILED(sq_createslot(v, -3))) {
810 std::ostringstream msg;
811 msg << "Couldn't register function'add_key'";
812 throw SquirrelError(v, msg.str());
815 // Register class DisplayEffect
816 sq_pushstring(v, "DisplayEffect", -1);
817 if(sq_newclass(v, SQFalse) < 0) {
818 std::ostringstream msg;
819 msg << "Couldn't create new class 'DisplayEffect'";
820 throw SquirrelError(v, msg.str());
822 sq_pushstring(v, "fade_out", -1);
823 sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
824 if(SQ_FAILED(sq_createslot(v, -3))) {
825 std::ostringstream msg;
826 msg << "Couldn't register function'fade_out'";
827 throw SquirrelError(v, msg.str());
830 sq_pushstring(v, "fade_in", -1);
831 sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
832 if(SQ_FAILED(sq_createslot(v, -3))) {
833 std::ostringstream msg;
834 msg << "Couldn't register function'fade_in'";
835 throw SquirrelError(v, msg.str());
838 sq_pushstring(v, "set_black", -1);
839 sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
840 if(SQ_FAILED(sq_createslot(v, -3))) {
841 std::ostringstream msg;
842 msg << "Couldn't register function'set_black'";
843 throw SquirrelError(v, msg.str());
846 sq_pushstring(v, "is_black", -1);
847 sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
848 if(SQ_FAILED(sq_createslot(v, -3))) {
849 std::ostringstream msg;
850 msg << "Couldn't register function'is_black'";
851 throw SquirrelError(v, msg.str());
854 sq_pushstring(v, "sixteen_to_nine", -1);
855 sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
856 if(SQ_FAILED(sq_createslot(v, -3))) {
857 std::ostringstream msg;
858 msg << "Couldn't register function'sixteen_to_nine'";
859 throw SquirrelError(v, msg.str());
862 sq_pushstring(v, "four_to_three", -1);
863 sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
864 if(SQ_FAILED(sq_createslot(v, -3))) {
865 std::ostringstream msg;
866 msg << "Couldn't register function'four_to_three'";
867 throw SquirrelError(v, msg.str());
870 if(SQ_FAILED(sq_createslot(v, -3))) {
871 std::ostringstream msg;
872 msg << "Couldn't register class'DisplayEffect'";
873 throw SquirrelError(v, msg.str());
876 // Register class Camera
877 sq_pushstring(v, "Camera", -1);
878 if(sq_newclass(v, SQFalse) < 0) {
879 std::ostringstream msg;
880 msg << "Couldn't create new class 'Camera'";
881 throw SquirrelError(v, msg.str());
883 sq_pushstring(v, "shake", -1);
884 sq_newclosure(v, &Camera_shake_wrapper, 0);
885 if(SQ_FAILED(sq_createslot(v, -3))) {
886 std::ostringstream msg;
887 msg << "Couldn't register function'shake'";
888 throw SquirrelError(v, msg.str());
891 sq_pushstring(v, "set_pos", -1);
892 sq_newclosure(v, &Camera_set_pos_wrapper, 0);
893 if(SQ_FAILED(sq_createslot(v, -3))) {
894 std::ostringstream msg;
895 msg << "Couldn't register function'set_pos'";
896 throw SquirrelError(v, msg.str());
899 sq_pushstring(v, "set_mode", -1);
900 sq_newclosure(v, &Camera_set_mode_wrapper, 0);
901 if(SQ_FAILED(sq_createslot(v, -3))) {
902 std::ostringstream msg;
903 msg << "Couldn't register function'set_mode'";
904 throw SquirrelError(v, msg.str());
907 if(SQ_FAILED(sq_createslot(v, -3))) {
908 std::ostringstream msg;
909 msg << "Couldn't register class'Camera'";
910 throw SquirrelError(v, msg.str());
913 // Register class Level
914 sq_pushstring(v, "Level", -1);
915 if(sq_newclass(v, SQFalse) < 0) {
916 std::ostringstream msg;
917 msg << "Couldn't create new class 'Level'";
918 throw SquirrelError(v, msg.str());
920 sq_pushstring(v, "finish", -1);
921 sq_newclosure(v, &Level_finish_wrapper, 0);
922 if(SQ_FAILED(sq_createslot(v, -3))) {
923 std::ostringstream msg;
924 msg << "Couldn't register function'finish'";
925 throw SquirrelError(v, msg.str());
928 sq_pushstring(v, "spawn", -1);
929 sq_newclosure(v, &Level_spawn_wrapper, 0);
930 if(SQ_FAILED(sq_createslot(v, -3))) {
931 std::ostringstream msg;
932 msg << "Couldn't register function'spawn'";
933 throw SquirrelError(v, msg.str());
936 sq_pushstring(v, "flip_vertically", -1);
937 sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
938 if(SQ_FAILED(sq_createslot(v, -3))) {
939 std::ostringstream msg;
940 msg << "Couldn't register function'flip_vertically'";
941 throw SquirrelError(v, msg.str());
944 if(SQ_FAILED(sq_createslot(v, -3))) {
945 std::ostringstream msg;
946 msg << "Couldn't register class'Level'";
947 throw SquirrelError(v, msg.str());
950 // Register class ScriptedObject
951 sq_pushstring(v, "ScriptedObject", -1);
952 if(sq_newclass(v, SQFalse) < 0) {
953 std::ostringstream msg;
954 msg << "Couldn't create new class 'ScriptedObject'";
955 throw SquirrelError(v, msg.str());
957 sq_pushstring(v, "set_animation", -1);
958 sq_newclosure(v, &ScriptedObject_set_animation_wrapper, 0);
959 if(SQ_FAILED(sq_createslot(v, -3))) {
960 std::ostringstream msg;
961 msg << "Couldn't register function'set_animation'";
962 throw SquirrelError(v, msg.str());
965 sq_pushstring(v, "get_animation", -1);
966 sq_newclosure(v, &ScriptedObject_get_animation_wrapper, 0);
967 if(SQ_FAILED(sq_createslot(v, -3))) {
968 std::ostringstream msg;
969 msg << "Couldn't register function'get_animation'";
970 throw SquirrelError(v, msg.str());
973 sq_pushstring(v, "move", -1);
974 sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
975 if(SQ_FAILED(sq_createslot(v, -3))) {
976 std::ostringstream msg;
977 msg << "Couldn't register function'move'";
978 throw SquirrelError(v, msg.str());
981 sq_pushstring(v, "set_pos", -1);
982 sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
983 if(SQ_FAILED(sq_createslot(v, -3))) {
984 std::ostringstream msg;
985 msg << "Couldn't register function'set_pos'";
986 throw SquirrelError(v, msg.str());
989 sq_pushstring(v, "get_pos_x", -1);
990 sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
991 if(SQ_FAILED(sq_createslot(v, -3))) {
992 std::ostringstream msg;
993 msg << "Couldn't register function'get_pos_x'";
994 throw SquirrelError(v, msg.str());
997 sq_pushstring(v, "get_pos_y", -1);
998 sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
999 if(SQ_FAILED(sq_createslot(v, -3))) {
1000 std::ostringstream msg;
1001 msg << "Couldn't register function'get_pos_y'";
1002 throw SquirrelError(v, msg.str());
1005 sq_pushstring(v, "set_velocity", -1);
1006 sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
1007 if(SQ_FAILED(sq_createslot(v, -3))) {
1008 std::ostringstream msg;
1009 msg << "Couldn't register function'set_velocity'";
1010 throw SquirrelError(v, msg.str());
1013 sq_pushstring(v, "get_velocity_x", -1);
1014 sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
1015 if(SQ_FAILED(sq_createslot(v, -3))) {
1016 std::ostringstream msg;
1017 msg << "Couldn't register function'get_velocity_x'";
1018 throw SquirrelError(v, msg.str());
1021 sq_pushstring(v, "get_velocity_y", -1);
1022 sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
1023 if(SQ_FAILED(sq_createslot(v, -3))) {
1024 std::ostringstream msg;
1025 msg << "Couldn't register function'get_velocity_y'";
1026 throw SquirrelError(v, msg.str());
1029 sq_pushstring(v, "set_visible", -1);
1030 sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
1031 if(SQ_FAILED(sq_createslot(v, -3))) {
1032 std::ostringstream msg;
1033 msg << "Couldn't register function'set_visible'";
1034 throw SquirrelError(v, msg.str());
1037 sq_pushstring(v, "is_visible", -1);
1038 sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
1039 if(SQ_FAILED(sq_createslot(v, -3))) {
1040 std::ostringstream msg;
1041 msg << "Couldn't register function'is_visible'";
1042 throw SquirrelError(v, msg.str());
1045 sq_pushstring(v, "get_name", -1);
1046 sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
1047 if(SQ_FAILED(sq_createslot(v, -3))) {
1048 std::ostringstream msg;
1049 msg << "Couldn't register function'get_name'";
1050 throw SquirrelError(v, msg.str());
1053 if(SQ_FAILED(sq_createslot(v, -3))) {
1054 std::ostringstream msg;
1055 msg << "Couldn't register class'ScriptedObject'";
1056 throw SquirrelError(v, msg.str());
1059 // Register class Sound
1060 sq_pushstring(v, "Sound", -1);
1061 if(sq_newclass(v, SQFalse) < 0) {
1062 std::ostringstream msg;
1063 msg << "Couldn't create new class 'Sound'";
1064 throw SquirrelError(v, msg.str());
1066 sq_pushstring(v, "play_music", -1);
1067 sq_newclosure(v, &Sound_play_music_wrapper, 0);
1068 if(SQ_FAILED(sq_createslot(v, -3))) {
1069 std::ostringstream msg;
1070 msg << "Couldn't register function'play_music'";
1071 throw SquirrelError(v, msg.str());
1074 sq_pushstring(v, "play", -1);
1075 sq_newclosure(v, &Sound_play_wrapper, 0);
1076 if(SQ_FAILED(sq_createslot(v, -3))) {
1077 std::ostringstream msg;
1078 msg << "Couldn't register function'play'";
1079 throw SquirrelError(v, msg.str());
1082 if(SQ_FAILED(sq_createslot(v, -3))) {
1083 std::ostringstream msg;
1084 msg << "Couldn't register class'Sound'";
1085 throw SquirrelError(v, msg.str());
1088 // Register class Text
1089 sq_pushstring(v, "Text", -1);
1090 if(sq_newclass(v, SQFalse) < 0) {
1091 std::ostringstream msg;
1092 msg << "Couldn't create new class 'Text'";
1093 throw SquirrelError(v, msg.str());
1095 sq_pushstring(v, "set_text", -1);
1096 sq_newclosure(v, &Text_set_text_wrapper, 0);
1097 if(SQ_FAILED(sq_createslot(v, -3))) {
1098 std::ostringstream msg;
1099 msg << "Couldn't register function'set_text'";
1100 throw SquirrelError(v, msg.str());
1103 sq_pushstring(v, "set_font", -1);
1104 sq_newclosure(v, &Text_set_font_wrapper, 0);
1105 if(SQ_FAILED(sq_createslot(v, -3))) {
1106 std::ostringstream msg;
1107 msg << "Couldn't register function'set_font'";
1108 throw SquirrelError(v, msg.str());
1111 sq_pushstring(v, "fade_in", -1);
1112 sq_newclosure(v, &Text_fade_in_wrapper, 0);
1113 if(SQ_FAILED(sq_createslot(v, -3))) {
1114 std::ostringstream msg;
1115 msg << "Couldn't register function'fade_in'";
1116 throw SquirrelError(v, msg.str());
1119 sq_pushstring(v, "fade_out", -1);
1120 sq_newclosure(v, &Text_fade_out_wrapper, 0);
1121 if(SQ_FAILED(sq_createslot(v, -3))) {
1122 std::ostringstream msg;
1123 msg << "Couldn't register function'fade_out'";
1124 throw SquirrelError(v, msg.str());
1127 sq_pushstring(v, "set_visible", -1);
1128 sq_newclosure(v, &Text_set_visible_wrapper, 0);
1129 if(SQ_FAILED(sq_createslot(v, -3))) {
1130 std::ostringstream msg;
1131 msg << "Couldn't register function'set_visible'";
1132 throw SquirrelError(v, msg.str());
1135 sq_pushstring(v, "set_centered", -1);
1136 sq_newclosure(v, &Text_set_centered_wrapper, 0);
1137 if(SQ_FAILED(sq_createslot(v, -3))) {
1138 std::ostringstream msg;
1139 msg << "Couldn't register function'set_centered'";
1140 throw SquirrelError(v, msg.str());
1143 if(SQ_FAILED(sq_createslot(v, -3))) {
1144 std::ostringstream msg;
1145 msg << "Couldn't register class'Text'";
1146 throw SquirrelError(v, msg.str());
1149 // Register class Player
1150 sq_pushstring(v, "Player", -1);
1151 if(sq_newclass(v, SQFalse) < 0) {
1152 std::ostringstream msg;
1153 msg << "Couldn't create new class 'Player'";
1154 throw SquirrelError(v, msg.str());
1156 sq_pushstring(v, "make_invincible", -1);
1157 sq_newclosure(v, &Player_make_invincible_wrapper, 0);
1158 if(SQ_FAILED(sq_createslot(v, -3))) {
1159 std::ostringstream msg;
1160 msg << "Couldn't register function'make_invincible'";
1161 throw SquirrelError(v, msg.str());
1164 sq_pushstring(v, "deactivate", -1);
1165 sq_newclosure(v, &Player_deactivate_wrapper, 0);
1166 if(SQ_FAILED(sq_createslot(v, -3))) {
1167 std::ostringstream msg;
1168 msg << "Couldn't register function'deactivate'";
1169 throw SquirrelError(v, msg.str());
1172 sq_pushstring(v, "activate", -1);
1173 sq_newclosure(v, &Player_activate_wrapper, 0);
1174 if(SQ_FAILED(sq_createslot(v, -3))) {
1175 std::ostringstream msg;
1176 msg << "Couldn't register function'activate'";
1177 throw SquirrelError(v, msg.str());
1180 sq_pushstring(v, "walk", -1);
1181 sq_newclosure(v, &Player_walk_wrapper, 0);
1182 if(SQ_FAILED(sq_createslot(v, -3))) {
1183 std::ostringstream msg;
1184 msg << "Couldn't register function'walk'";
1185 throw SquirrelError(v, msg.str());
1188 if(SQ_FAILED(sq_createslot(v, -3))) {
1189 std::ostringstream msg;
1190 msg << "Couldn't register class'Player'";
1191 throw SquirrelError(v, msg.str());
1197 } // end of namespace Scripting