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 display_text_file_wrapper(HSQUIRRELVM v)
423 sq_getstring(v, 2, &arg0);
425 Scripting::display_text_file(arg0);
430 static int wait_wrapper(HSQUIRRELVM v)
433 sq_getfloat(v, 2, &arg0);
435 Scripting::wait(arg0);
437 return sq_suspendvm(v);
440 static int translate_wrapper(HSQUIRRELVM v)
443 sq_getstring(v, 2, &arg0);
445 std::string return_value = Scripting::translate(arg0);
447 sq_pushstring(v, return_value.c_str(), return_value.size());
451 static int import_wrapper(HSQUIRRELVM v)
453 HSQUIRRELVM arg0 = v;
455 sq_getstring(v, 2, &arg1);
457 Scripting::import(arg0, arg1);
462 static int add_key_wrapper(HSQUIRRELVM v)
465 sq_getinteger(v, 2, &arg0);
467 Scripting::add_key(arg0);
472 } // end of namespace Wrapper
474 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
476 using namespace Wrapper;
479 sq_pushstring(v, "DisplayEffect", -1);
480 if(SQ_FAILED(sq_get(v, -2))) {
481 std::ostringstream msg;
482 msg << "Couldn't resolved squirrel type 'DisplayEffect'";
483 throw SquirrelError(v, msg.str());
486 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
487 std::ostringstream msg;
488 msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
489 throw SquirrelError(v, msg.str());
491 sq_remove(v, -2); // remove object name
493 if(setup_releasehook) {
494 sq_setreleasehook(v, -1, DisplayEffect_release_hook);
497 sq_remove(v, -2); // remove root table
500 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
502 using namespace Wrapper;
505 sq_pushstring(v, "Camera", -1);
506 if(SQ_FAILED(sq_get(v, -2))) {
507 std::ostringstream msg;
508 msg << "Couldn't resolved squirrel type 'Camera'";
509 throw SquirrelError(v, msg.str());
512 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
513 std::ostringstream msg;
514 msg << "Couldn't setup squirrel instance for object of type 'Camera'";
515 throw SquirrelError(v, msg.str());
517 sq_remove(v, -2); // remove object name
519 if(setup_releasehook) {
520 sq_setreleasehook(v, -1, Camera_release_hook);
523 sq_remove(v, -2); // remove root table
526 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
528 using namespace Wrapper;
531 sq_pushstring(v, "Level", -1);
532 if(SQ_FAILED(sq_get(v, -2))) {
533 std::ostringstream msg;
534 msg << "Couldn't resolved squirrel type 'Level'";
535 throw SquirrelError(v, msg.str());
538 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
539 std::ostringstream msg;
540 msg << "Couldn't setup squirrel instance for object of type 'Level'";
541 throw SquirrelError(v, msg.str());
543 sq_remove(v, -2); // remove object name
545 if(setup_releasehook) {
546 sq_setreleasehook(v, -1, Level_release_hook);
549 sq_remove(v, -2); // remove root table
552 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
554 using namespace Wrapper;
557 sq_pushstring(v, "ScriptedObject", -1);
558 if(SQ_FAILED(sq_get(v, -2))) {
559 std::ostringstream msg;
560 msg << "Couldn't resolved squirrel type 'ScriptedObject'";
561 throw SquirrelError(v, msg.str());
564 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
565 std::ostringstream msg;
566 msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
567 throw SquirrelError(v, msg.str());
569 sq_remove(v, -2); // remove object name
571 if(setup_releasehook) {
572 sq_setreleasehook(v, -1, ScriptedObject_release_hook);
575 sq_remove(v, -2); // remove root table
578 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Sound* object, bool setup_releasehook)
580 using namespace Wrapper;
583 sq_pushstring(v, "Sound", -1);
584 if(SQ_FAILED(sq_get(v, -2))) {
585 std::ostringstream msg;
586 msg << "Couldn't resolved squirrel type 'Sound'";
587 throw SquirrelError(v, msg.str());
590 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
591 std::ostringstream msg;
592 msg << "Couldn't setup squirrel instance for object of type 'Sound'";
593 throw SquirrelError(v, msg.str());
595 sq_remove(v, -2); // remove object name
597 if(setup_releasehook) {
598 sq_setreleasehook(v, -1, Sound_release_hook);
601 sq_remove(v, -2); // remove root table
604 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
606 using namespace Wrapper;
609 sq_pushstring(v, "Text", -1);
610 if(SQ_FAILED(sq_get(v, -2))) {
611 std::ostringstream msg;
612 msg << "Couldn't resolved squirrel type 'Text'";
613 throw SquirrelError(v, msg.str());
616 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
617 std::ostringstream msg;
618 msg << "Couldn't setup squirrel instance for object of type 'Text'";
619 throw SquirrelError(v, msg.str());
621 sq_remove(v, -2); // remove object name
623 if(setup_releasehook) {
624 sq_setreleasehook(v, -1, Text_release_hook);
627 sq_remove(v, -2); // remove root table
630 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
632 using namespace Wrapper;
635 sq_pushstring(v, "Player", -1);
636 if(SQ_FAILED(sq_get(v, -2))) {
637 std::ostringstream msg;
638 msg << "Couldn't resolved squirrel type 'Player'";
639 throw SquirrelError(v, msg.str());
642 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
643 std::ostringstream msg;
644 msg << "Couldn't setup squirrel instance for object of type 'Player'";
645 throw SquirrelError(v, msg.str());
647 sq_remove(v, -2); // remove object name
649 if(setup_releasehook) {
650 sq_setreleasehook(v, -1, Player_release_hook);
653 sq_remove(v, -2); // remove root table
656 void register_supertux_wrapper(HSQUIRRELVM v)
658 using namespace Wrapper;
661 sq_pushstring(v, "KEY_BRASS", -1);
662 sq_pushinteger(v, 1);
663 if(SQ_FAILED(sq_createslot(v, -3))) {
664 std::ostringstream msg;
665 msg << "Couldn't register constant'KEY_BRASS'";
666 throw SquirrelError(v, msg.str());
669 sq_pushstring(v, "KEY_IRON", -1);
670 sq_pushinteger(v, 2);
671 if(SQ_FAILED(sq_createslot(v, -3))) {
672 std::ostringstream msg;
673 msg << "Couldn't register constant'KEY_IRON'";
674 throw SquirrelError(v, msg.str());
677 sq_pushstring(v, "KEY_BRONZE", -1);
678 sq_pushinteger(v, 4);
679 if(SQ_FAILED(sq_createslot(v, -3))) {
680 std::ostringstream msg;
681 msg << "Couldn't register constant'KEY_BRONZE'";
682 throw SquirrelError(v, msg.str());
685 sq_pushstring(v, "KEY_SILVER", -1);
686 sq_pushinteger(v, 8);
687 if(SQ_FAILED(sq_createslot(v, -3))) {
688 std::ostringstream msg;
689 msg << "Couldn't register constant'KEY_SILVER'";
690 throw SquirrelError(v, msg.str());
693 sq_pushstring(v, "KEY_GOLD", -1);
694 sq_pushinteger(v, 16);
695 if(SQ_FAILED(sq_createslot(v, -3))) {
696 std::ostringstream msg;
697 msg << "Couldn't register constant'KEY_GOLD'";
698 throw SquirrelError(v, msg.str());
701 sq_pushstring(v, "display_text_file", -1);
702 sq_newclosure(v, &display_text_file_wrapper, 0);
703 if(SQ_FAILED(sq_createslot(v, -3))) {
704 std::ostringstream msg;
705 msg << "Couldn't register function'display_text_file'";
706 throw SquirrelError(v, msg.str());
709 sq_pushstring(v, "wait", -1);
710 sq_newclosure(v, &wait_wrapper, 0);
711 if(SQ_FAILED(sq_createslot(v, -3))) {
712 std::ostringstream msg;
713 msg << "Couldn't register function'wait'";
714 throw SquirrelError(v, msg.str());
717 sq_pushstring(v, "translate", -1);
718 sq_newclosure(v, &translate_wrapper, 0);
719 if(SQ_FAILED(sq_createslot(v, -3))) {
720 std::ostringstream msg;
721 msg << "Couldn't register function'translate'";
722 throw SquirrelError(v, msg.str());
725 sq_pushstring(v, "import", -1);
726 sq_newclosure(v, &import_wrapper, 0);
727 if(SQ_FAILED(sq_createslot(v, -3))) {
728 std::ostringstream msg;
729 msg << "Couldn't register function'import'";
730 throw SquirrelError(v, msg.str());
733 sq_pushstring(v, "add_key", -1);
734 sq_newclosure(v, &add_key_wrapper, 0);
735 if(SQ_FAILED(sq_createslot(v, -3))) {
736 std::ostringstream msg;
737 msg << "Couldn't register function'add_key'";
738 throw SquirrelError(v, msg.str());
741 // Register class DisplayEffect
742 sq_pushstring(v, "DisplayEffect", -1);
743 if(sq_newclass(v, SQFalse) < 0) {
744 std::ostringstream msg;
745 msg << "Couldn't create new class 'DisplayEffect'";
746 throw SquirrelError(v, msg.str());
748 sq_pushstring(v, "fade_out", -1);
749 sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
750 if(SQ_FAILED(sq_createslot(v, -3))) {
751 std::ostringstream msg;
752 msg << "Couldn't register function'fade_out'";
753 throw SquirrelError(v, msg.str());
756 sq_pushstring(v, "fade_in", -1);
757 sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
758 if(SQ_FAILED(sq_createslot(v, -3))) {
759 std::ostringstream msg;
760 msg << "Couldn't register function'fade_in'";
761 throw SquirrelError(v, msg.str());
764 sq_pushstring(v, "set_black", -1);
765 sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
766 if(SQ_FAILED(sq_createslot(v, -3))) {
767 std::ostringstream msg;
768 msg << "Couldn't register function'set_black'";
769 throw SquirrelError(v, msg.str());
772 sq_pushstring(v, "is_black", -1);
773 sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
774 if(SQ_FAILED(sq_createslot(v, -3))) {
775 std::ostringstream msg;
776 msg << "Couldn't register function'is_black'";
777 throw SquirrelError(v, msg.str());
780 if(SQ_FAILED(sq_createslot(v, -3))) {
781 std::ostringstream msg;
782 msg << "Couldn't register class'DisplayEffect'";
783 throw SquirrelError(v, msg.str());
786 // Register class Camera
787 sq_pushstring(v, "Camera", -1);
788 if(sq_newclass(v, SQFalse) < 0) {
789 std::ostringstream msg;
790 msg << "Couldn't create new class 'Camera'";
791 throw SquirrelError(v, msg.str());
793 sq_pushstring(v, "shake", -1);
794 sq_newclosure(v, &Camera_shake_wrapper, 0);
795 if(SQ_FAILED(sq_createslot(v, -3))) {
796 std::ostringstream msg;
797 msg << "Couldn't register function'shake'";
798 throw SquirrelError(v, msg.str());
801 sq_pushstring(v, "set_pos", -1);
802 sq_newclosure(v, &Camera_set_pos_wrapper, 0);
803 if(SQ_FAILED(sq_createslot(v, -3))) {
804 std::ostringstream msg;
805 msg << "Couldn't register function'set_pos'";
806 throw SquirrelError(v, msg.str());
809 sq_pushstring(v, "set_mode", -1);
810 sq_newclosure(v, &Camera_set_mode_wrapper, 0);
811 if(SQ_FAILED(sq_createslot(v, -3))) {
812 std::ostringstream msg;
813 msg << "Couldn't register function'set_mode'";
814 throw SquirrelError(v, msg.str());
817 if(SQ_FAILED(sq_createslot(v, -3))) {
818 std::ostringstream msg;
819 msg << "Couldn't register class'Camera'";
820 throw SquirrelError(v, msg.str());
823 // Register class Level
824 sq_pushstring(v, "Level", -1);
825 if(sq_newclass(v, SQFalse) < 0) {
826 std::ostringstream msg;
827 msg << "Couldn't create new class 'Level'";
828 throw SquirrelError(v, msg.str());
830 sq_pushstring(v, "finish", -1);
831 sq_newclosure(v, &Level_finish_wrapper, 0);
832 if(SQ_FAILED(sq_createslot(v, -3))) {
833 std::ostringstream msg;
834 msg << "Couldn't register function'finish'";
835 throw SquirrelError(v, msg.str());
838 sq_pushstring(v, "spawn", -1);
839 sq_newclosure(v, &Level_spawn_wrapper, 0);
840 if(SQ_FAILED(sq_createslot(v, -3))) {
841 std::ostringstream msg;
842 msg << "Couldn't register function'spawn'";
843 throw SquirrelError(v, msg.str());
846 sq_pushstring(v, "flip_vertically", -1);
847 sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
848 if(SQ_FAILED(sq_createslot(v, -3))) {
849 std::ostringstream msg;
850 msg << "Couldn't register function'flip_vertically'";
851 throw SquirrelError(v, msg.str());
854 if(SQ_FAILED(sq_createslot(v, -3))) {
855 std::ostringstream msg;
856 msg << "Couldn't register class'Level'";
857 throw SquirrelError(v, msg.str());
860 // Register class ScriptedObject
861 sq_pushstring(v, "ScriptedObject", -1);
862 if(sq_newclass(v, SQFalse) < 0) {
863 std::ostringstream msg;
864 msg << "Couldn't create new class 'ScriptedObject'";
865 throw SquirrelError(v, msg.str());
867 sq_pushstring(v, "set_animation", -1);
868 sq_newclosure(v, &ScriptedObject_set_animation_wrapper, 0);
869 if(SQ_FAILED(sq_createslot(v, -3))) {
870 std::ostringstream msg;
871 msg << "Couldn't register function'set_animation'";
872 throw SquirrelError(v, msg.str());
875 sq_pushstring(v, "get_animation", -1);
876 sq_newclosure(v, &ScriptedObject_get_animation_wrapper, 0);
877 if(SQ_FAILED(sq_createslot(v, -3))) {
878 std::ostringstream msg;
879 msg << "Couldn't register function'get_animation'";
880 throw SquirrelError(v, msg.str());
883 sq_pushstring(v, "move", -1);
884 sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
885 if(SQ_FAILED(sq_createslot(v, -3))) {
886 std::ostringstream msg;
887 msg << "Couldn't register function'move'";
888 throw SquirrelError(v, msg.str());
891 sq_pushstring(v, "set_pos", -1);
892 sq_newclosure(v, &ScriptedObject_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, "get_pos_x", -1);
900 sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
901 if(SQ_FAILED(sq_createslot(v, -3))) {
902 std::ostringstream msg;
903 msg << "Couldn't register function'get_pos_x'";
904 throw SquirrelError(v, msg.str());
907 sq_pushstring(v, "get_pos_y", -1);
908 sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
909 if(SQ_FAILED(sq_createslot(v, -3))) {
910 std::ostringstream msg;
911 msg << "Couldn't register function'get_pos_y'";
912 throw SquirrelError(v, msg.str());
915 sq_pushstring(v, "set_velocity", -1);
916 sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
917 if(SQ_FAILED(sq_createslot(v, -3))) {
918 std::ostringstream msg;
919 msg << "Couldn't register function'set_velocity'";
920 throw SquirrelError(v, msg.str());
923 sq_pushstring(v, "get_velocity_x", -1);
924 sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
925 if(SQ_FAILED(sq_createslot(v, -3))) {
926 std::ostringstream msg;
927 msg << "Couldn't register function'get_velocity_x'";
928 throw SquirrelError(v, msg.str());
931 sq_pushstring(v, "get_velocity_y", -1);
932 sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
933 if(SQ_FAILED(sq_createslot(v, -3))) {
934 std::ostringstream msg;
935 msg << "Couldn't register function'get_velocity_y'";
936 throw SquirrelError(v, msg.str());
939 sq_pushstring(v, "set_visible", -1);
940 sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
941 if(SQ_FAILED(sq_createslot(v, -3))) {
942 std::ostringstream msg;
943 msg << "Couldn't register function'set_visible'";
944 throw SquirrelError(v, msg.str());
947 sq_pushstring(v, "is_visible", -1);
948 sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
949 if(SQ_FAILED(sq_createslot(v, -3))) {
950 std::ostringstream msg;
951 msg << "Couldn't register function'is_visible'";
952 throw SquirrelError(v, msg.str());
955 sq_pushstring(v, "get_name", -1);
956 sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
957 if(SQ_FAILED(sq_createslot(v, -3))) {
958 std::ostringstream msg;
959 msg << "Couldn't register function'get_name'";
960 throw SquirrelError(v, msg.str());
963 if(SQ_FAILED(sq_createslot(v, -3))) {
964 std::ostringstream msg;
965 msg << "Couldn't register class'ScriptedObject'";
966 throw SquirrelError(v, msg.str());
969 // Register class Sound
970 sq_pushstring(v, "Sound", -1);
971 if(sq_newclass(v, SQFalse) < 0) {
972 std::ostringstream msg;
973 msg << "Couldn't create new class 'Sound'";
974 throw SquirrelError(v, msg.str());
976 sq_pushstring(v, "play_music", -1);
977 sq_newclosure(v, &Sound_play_music_wrapper, 0);
978 if(SQ_FAILED(sq_createslot(v, -3))) {
979 std::ostringstream msg;
980 msg << "Couldn't register function'play_music'";
981 throw SquirrelError(v, msg.str());
984 sq_pushstring(v, "play", -1);
985 sq_newclosure(v, &Sound_play_wrapper, 0);
986 if(SQ_FAILED(sq_createslot(v, -3))) {
987 std::ostringstream msg;
988 msg << "Couldn't register function'play'";
989 throw SquirrelError(v, msg.str());
992 if(SQ_FAILED(sq_createslot(v, -3))) {
993 std::ostringstream msg;
994 msg << "Couldn't register class'Sound'";
995 throw SquirrelError(v, msg.str());
998 // Register class Text
999 sq_pushstring(v, "Text", -1);
1000 if(sq_newclass(v, SQFalse) < 0) {
1001 std::ostringstream msg;
1002 msg << "Couldn't create new class 'Text'";
1003 throw SquirrelError(v, msg.str());
1005 sq_pushstring(v, "set_text", -1);
1006 sq_newclosure(v, &Text_set_text_wrapper, 0);
1007 if(SQ_FAILED(sq_createslot(v, -3))) {
1008 std::ostringstream msg;
1009 msg << "Couldn't register function'set_text'";
1010 throw SquirrelError(v, msg.str());
1013 sq_pushstring(v, "set_font", -1);
1014 sq_newclosure(v, &Text_set_font_wrapper, 0);
1015 if(SQ_FAILED(sq_createslot(v, -3))) {
1016 std::ostringstream msg;
1017 msg << "Couldn't register function'set_font'";
1018 throw SquirrelError(v, msg.str());
1021 sq_pushstring(v, "fade_in", -1);
1022 sq_newclosure(v, &Text_fade_in_wrapper, 0);
1023 if(SQ_FAILED(sq_createslot(v, -3))) {
1024 std::ostringstream msg;
1025 msg << "Couldn't register function'fade_in'";
1026 throw SquirrelError(v, msg.str());
1029 sq_pushstring(v, "fade_out", -1);
1030 sq_newclosure(v, &Text_fade_out_wrapper, 0);
1031 if(SQ_FAILED(sq_createslot(v, -3))) {
1032 std::ostringstream msg;
1033 msg << "Couldn't register function'fade_out'";
1034 throw SquirrelError(v, msg.str());
1037 sq_pushstring(v, "set_visible", -1);
1038 sq_newclosure(v, &Text_set_visible_wrapper, 0);
1039 if(SQ_FAILED(sq_createslot(v, -3))) {
1040 std::ostringstream msg;
1041 msg << "Couldn't register function'set_visible'";
1042 throw SquirrelError(v, msg.str());
1045 if(SQ_FAILED(sq_createslot(v, -3))) {
1046 std::ostringstream msg;
1047 msg << "Couldn't register class'Text'";
1048 throw SquirrelError(v, msg.str());
1051 // Register class Player
1052 sq_pushstring(v, "Player", -1);
1053 if(sq_newclass(v, SQFalse) < 0) {
1054 std::ostringstream msg;
1055 msg << "Couldn't create new class 'Player'";
1056 throw SquirrelError(v, msg.str());
1058 if(SQ_FAILED(sq_createslot(v, -3))) {
1059 std::ostringstream msg;
1060 msg << "Couldn't register class'Player'";
1061 throw SquirrelError(v, msg.str());
1067 } // end of namespace Scripting