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 vm)
30 Scripting::DisplayEffect* _this;
31 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
32 sq_throwerror(vm, _SC("'fade_out' called without instance"));
36 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
37 sq_throwerror(vm, _SC("Argument 1 not a float"));
42 _this->fade_out(arg0);
46 } catch(std::exception& e) {
47 sq_throwerror(vm, e.what());
50 sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
56 static int DisplayEffect_fade_in_wrapper(HSQUIRRELVM vm)
58 Scripting::DisplayEffect* _this;
59 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
60 sq_throwerror(vm, _SC("'fade_in' called without instance"));
64 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
65 sq_throwerror(vm, _SC("Argument 1 not a float"));
74 } catch(std::exception& e) {
75 sq_throwerror(vm, e.what());
78 sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
84 static int DisplayEffect_set_black_wrapper(HSQUIRRELVM vm)
86 Scripting::DisplayEffect* _this;
87 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
88 sq_throwerror(vm, _SC("'set_black' called without instance"));
92 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
93 sq_throwerror(vm, _SC("Argument 1 not a bool"));
98 _this->set_black(arg0);
102 } catch(std::exception& e) {
103 sq_throwerror(vm, e.what());
106 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_black'"));
112 static int DisplayEffect_is_black_wrapper(HSQUIRRELVM vm)
114 Scripting::DisplayEffect* _this;
115 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
116 sq_throwerror(vm, _SC("'is_black' called without instance"));
121 bool return_value = _this->is_black();
123 sq_pushbool(vm, return_value);
126 } catch(std::exception& e) {
127 sq_throwerror(vm, e.what());
130 sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_black'"));
136 static int DisplayEffect_sixteen_to_nine_wrapper(HSQUIRRELVM vm)
138 Scripting::DisplayEffect* _this;
139 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
140 sq_throwerror(vm, _SC("'sixteen_to_nine' called without instance"));
144 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
145 sq_throwerror(vm, _SC("Argument 1 not a float"));
150 _this->sixteen_to_nine(arg0);
154 } catch(std::exception& e) {
155 sq_throwerror(vm, e.what());
158 sq_throwerror(vm, _SC("Unexpected exception while executing function 'sixteen_to_nine'"));
164 static int DisplayEffect_four_to_three_wrapper(HSQUIRRELVM vm)
166 Scripting::DisplayEffect* _this;
167 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
168 sq_throwerror(vm, _SC("'four_to_three' called without instance"));
172 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
173 sq_throwerror(vm, _SC("Argument 1 not a float"));
178 _this->four_to_three(arg0);
182 } catch(std::exception& e) {
183 sq_throwerror(vm, e.what());
186 sq_throwerror(vm, _SC("Unexpected exception while executing function 'four_to_three'"));
192 static int Camera_release_hook(SQUserPointer ptr, int )
194 Scripting::Camera* _this = reinterpret_cast<Scripting::Camera*> (ptr);
199 static int Camera_shake_wrapper(HSQUIRRELVM vm)
201 Scripting::Camera* _this;
202 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
203 sq_throwerror(vm, _SC("'shake' called without instance"));
207 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
208 sq_throwerror(vm, _SC("Argument 1 not a float"));
212 if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
213 sq_throwerror(vm, _SC("Argument 2 not a float"));
217 if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
218 sq_throwerror(vm, _SC("Argument 3 not a float"));
223 _this->shake(arg0, arg1, arg2);
227 } catch(std::exception& e) {
228 sq_throwerror(vm, e.what());
231 sq_throwerror(vm, _SC("Unexpected exception while executing function 'shake'"));
237 static int Camera_set_pos_wrapper(HSQUIRRELVM vm)
239 Scripting::Camera* _this;
240 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
241 sq_throwerror(vm, _SC("'set_pos' called without instance"));
245 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
246 sq_throwerror(vm, _SC("Argument 1 not a float"));
250 if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
251 sq_throwerror(vm, _SC("Argument 2 not a float"));
256 _this->set_pos(arg0, arg1);
260 } catch(std::exception& e) {
261 sq_throwerror(vm, e.what());
264 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
270 static int Camera_set_mode_wrapper(HSQUIRRELVM vm)
272 Scripting::Camera* _this;
273 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
274 sq_throwerror(vm, _SC("'set_mode' called without instance"));
278 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
279 sq_throwerror(vm, _SC("Argument 1 not a string"));
284 _this->set_mode(arg0);
288 } catch(std::exception& e) {
289 sq_throwerror(vm, e.what());
292 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_mode'"));
298 static int Camera_scroll_to_wrapper(HSQUIRRELVM vm)
300 Scripting::Camera* _this;
301 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
302 sq_throwerror(vm, _SC("'scroll_to' called without instance"));
306 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
307 sq_throwerror(vm, _SC("Argument 1 not a float"));
311 if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
312 sq_throwerror(vm, _SC("Argument 2 not a float"));
316 if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
317 sq_throwerror(vm, _SC("Argument 3 not a float"));
322 _this->scroll_to(arg0, arg1, arg2);
326 } catch(std::exception& e) {
327 sq_throwerror(vm, e.what());
330 sq_throwerror(vm, _SC("Unexpected exception while executing function 'scroll_to'"));
336 static int Level_release_hook(SQUserPointer ptr, int )
338 Scripting::Level* _this = reinterpret_cast<Scripting::Level*> (ptr);
343 static int Level_finish_wrapper(HSQUIRRELVM vm)
345 Scripting::Level* _this;
346 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
347 sq_throwerror(vm, _SC("'finish' called without instance"));
351 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
352 sq_throwerror(vm, _SC("Argument 1 not a bool"));
361 } catch(std::exception& e) {
362 sq_throwerror(vm, e.what());
365 sq_throwerror(vm, _SC("Unexpected exception while executing function 'finish'"));
371 static int Level_spawn_wrapper(HSQUIRRELVM vm)
373 Scripting::Level* _this;
374 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
375 sq_throwerror(vm, _SC("'spawn' called without instance"));
379 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
380 sq_throwerror(vm, _SC("Argument 1 not a string"));
384 if(SQ_FAILED(sq_getstring(vm, 3, &arg1))) {
385 sq_throwerror(vm, _SC("Argument 2 not a string"));
390 _this->spawn(arg0, arg1);
394 } catch(std::exception& e) {
395 sq_throwerror(vm, e.what());
398 sq_throwerror(vm, _SC("Unexpected exception while executing function 'spawn'"));
404 static int Level_flip_vertically_wrapper(HSQUIRRELVM vm)
406 Scripting::Level* _this;
407 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
408 sq_throwerror(vm, _SC("'flip_vertically' called without instance"));
413 _this->flip_vertically();
417 } catch(std::exception& e) {
418 sq_throwerror(vm, e.what());
421 sq_throwerror(vm, _SC("Unexpected exception while executing function 'flip_vertically'"));
427 static int ScriptedObject_release_hook(SQUserPointer ptr, int )
429 Scripting::ScriptedObject* _this = reinterpret_cast<Scripting::ScriptedObject*> (ptr);
434 static int ScriptedObject_set_action_wrapper(HSQUIRRELVM vm)
436 Scripting::ScriptedObject* _this;
437 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
438 sq_throwerror(vm, _SC("'set_action' called without instance"));
442 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
443 sq_throwerror(vm, _SC("Argument 1 not a string"));
448 _this->set_action(arg0);
452 } catch(std::exception& e) {
453 sq_throwerror(vm, e.what());
456 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_action'"));
462 static int ScriptedObject_get_action_wrapper(HSQUIRRELVM vm)
464 Scripting::ScriptedObject* _this;
465 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
466 sq_throwerror(vm, _SC("'get_action' called without instance"));
471 std::string return_value = _this->get_action();
473 sq_pushstring(vm, return_value.c_str(), return_value.size());
476 } catch(std::exception& e) {
477 sq_throwerror(vm, e.what());
480 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_action'"));
486 static int ScriptedObject_move_wrapper(HSQUIRRELVM vm)
488 Scripting::ScriptedObject* _this;
489 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
490 sq_throwerror(vm, _SC("'move' called without instance"));
494 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
495 sq_throwerror(vm, _SC("Argument 1 not a float"));
499 if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
500 sq_throwerror(vm, _SC("Argument 2 not a float"));
505 _this->move(arg0, arg1);
509 } catch(std::exception& e) {
510 sq_throwerror(vm, e.what());
513 sq_throwerror(vm, _SC("Unexpected exception while executing function 'move'"));
519 static int ScriptedObject_set_pos_wrapper(HSQUIRRELVM vm)
521 Scripting::ScriptedObject* _this;
522 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
523 sq_throwerror(vm, _SC("'set_pos' called without instance"));
527 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
528 sq_throwerror(vm, _SC("Argument 1 not a float"));
532 if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
533 sq_throwerror(vm, _SC("Argument 2 not a float"));
538 _this->set_pos(arg0, arg1);
542 } catch(std::exception& e) {
543 sq_throwerror(vm, e.what());
546 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
552 static int ScriptedObject_get_pos_x_wrapper(HSQUIRRELVM vm)
554 Scripting::ScriptedObject* _this;
555 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
556 sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
561 float return_value = _this->get_pos_x();
563 sq_pushfloat(vm, return_value);
566 } catch(std::exception& e) {
567 sq_throwerror(vm, e.what());
570 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
576 static int ScriptedObject_get_pos_y_wrapper(HSQUIRRELVM vm)
578 Scripting::ScriptedObject* _this;
579 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
580 sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
585 float return_value = _this->get_pos_y();
587 sq_pushfloat(vm, return_value);
590 } catch(std::exception& e) {
591 sq_throwerror(vm, e.what());
594 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
600 static int ScriptedObject_set_velocity_wrapper(HSQUIRRELVM vm)
602 Scripting::ScriptedObject* _this;
603 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
604 sq_throwerror(vm, _SC("'set_velocity' called without instance"));
608 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
609 sq_throwerror(vm, _SC("Argument 1 not a float"));
613 if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
614 sq_throwerror(vm, _SC("Argument 2 not a float"));
619 _this->set_velocity(arg0, arg1);
623 } catch(std::exception& e) {
624 sq_throwerror(vm, e.what());
627 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_velocity'"));
633 static int ScriptedObject_get_velocity_x_wrapper(HSQUIRRELVM vm)
635 Scripting::ScriptedObject* _this;
636 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
637 sq_throwerror(vm, _SC("'get_velocity_x' called without instance"));
642 float return_value = _this->get_velocity_x();
644 sq_pushfloat(vm, return_value);
647 } catch(std::exception& e) {
648 sq_throwerror(vm, e.what());
651 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_velocity_x'"));
657 static int ScriptedObject_get_velocity_y_wrapper(HSQUIRRELVM vm)
659 Scripting::ScriptedObject* _this;
660 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
661 sq_throwerror(vm, _SC("'get_velocity_y' called without instance"));
666 float return_value = _this->get_velocity_y();
668 sq_pushfloat(vm, return_value);
671 } catch(std::exception& e) {
672 sq_throwerror(vm, e.what());
675 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_velocity_y'"));
681 static int ScriptedObject_set_visible_wrapper(HSQUIRRELVM vm)
683 Scripting::ScriptedObject* _this;
684 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
685 sq_throwerror(vm, _SC("'set_visible' called without instance"));
689 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
690 sq_throwerror(vm, _SC("Argument 1 not a bool"));
695 _this->set_visible(arg0);
699 } catch(std::exception& e) {
700 sq_throwerror(vm, e.what());
703 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
709 static int ScriptedObject_is_visible_wrapper(HSQUIRRELVM vm)
711 Scripting::ScriptedObject* _this;
712 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
713 sq_throwerror(vm, _SC("'is_visible' called without instance"));
718 bool return_value = _this->is_visible();
720 sq_pushbool(vm, return_value);
723 } catch(std::exception& e) {
724 sq_throwerror(vm, e.what());
727 sq_throwerror(vm, _SC("Unexpected exception while executing function 'is_visible'"));
733 static int ScriptedObject_get_name_wrapper(HSQUIRRELVM vm)
735 Scripting::ScriptedObject* _this;
736 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
737 sq_throwerror(vm, _SC("'get_name' called without instance"));
742 std::string return_value = _this->get_name();
744 sq_pushstring(vm, return_value.c_str(), return_value.size());
747 } catch(std::exception& e) {
748 sq_throwerror(vm, e.what());
751 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_name'"));
757 static int Text_release_hook(SQUserPointer ptr, int )
759 Scripting::Text* _this = reinterpret_cast<Scripting::Text*> (ptr);
764 static int Text_set_text_wrapper(HSQUIRRELVM vm)
766 Scripting::Text* _this;
767 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
768 sq_throwerror(vm, _SC("'set_text' called without instance"));
772 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
773 sq_throwerror(vm, _SC("Argument 1 not a string"));
778 _this->set_text(arg0);
782 } catch(std::exception& e) {
783 sq_throwerror(vm, e.what());
786 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_text'"));
792 static int Text_set_font_wrapper(HSQUIRRELVM vm)
794 Scripting::Text* _this;
795 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
796 sq_throwerror(vm, _SC("'set_font' called without instance"));
800 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
801 sq_throwerror(vm, _SC("Argument 1 not a string"));
806 _this->set_font(arg0);
810 } catch(std::exception& e) {
811 sq_throwerror(vm, e.what());
814 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_font'"));
820 static int Text_fade_in_wrapper(HSQUIRRELVM vm)
822 Scripting::Text* _this;
823 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
824 sq_throwerror(vm, _SC("'fade_in' called without instance"));
828 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
829 sq_throwerror(vm, _SC("Argument 1 not a float"));
834 _this->fade_in(arg0);
838 } catch(std::exception& e) {
839 sq_throwerror(vm, e.what());
842 sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_in'"));
848 static int Text_fade_out_wrapper(HSQUIRRELVM vm)
850 Scripting::Text* _this;
851 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
852 sq_throwerror(vm, _SC("'fade_out' called without instance"));
856 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
857 sq_throwerror(vm, _SC("Argument 1 not a float"));
862 _this->fade_out(arg0);
866 } catch(std::exception& e) {
867 sq_throwerror(vm, e.what());
870 sq_throwerror(vm, _SC("Unexpected exception while executing function 'fade_out'"));
876 static int Text_set_visible_wrapper(HSQUIRRELVM vm)
878 Scripting::Text* _this;
879 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
880 sq_throwerror(vm, _SC("'set_visible' called without instance"));
884 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
885 sq_throwerror(vm, _SC("Argument 1 not a bool"));
890 _this->set_visible(arg0);
894 } catch(std::exception& e) {
895 sq_throwerror(vm, e.what());
898 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
904 static int Text_set_centered_wrapper(HSQUIRRELVM vm)
906 Scripting::Text* _this;
907 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
908 sq_throwerror(vm, _SC("'set_centered' called without instance"));
912 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
913 sq_throwerror(vm, _SC("Argument 1 not a bool"));
918 _this->set_centered(arg0);
922 } catch(std::exception& e) {
923 sq_throwerror(vm, e.what());
926 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_centered'"));
932 static int Player_release_hook(SQUserPointer ptr, int )
934 Scripting::Player* _this = reinterpret_cast<Scripting::Player*> (ptr);
939 static int Player_add_bonus_wrapper(HSQUIRRELVM vm)
941 Scripting::Player* _this;
942 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
943 sq_throwerror(vm, _SC("'add_bonus' called without instance"));
947 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
948 sq_throwerror(vm, _SC("Argument 1 not a string"));
953 _this->add_bonus(arg0);
957 } catch(std::exception& e) {
958 sq_throwerror(vm, e.what());
961 sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_bonus'"));
967 static int Player_add_coins_wrapper(HSQUIRRELVM vm)
969 Scripting::Player* _this;
970 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
971 sq_throwerror(vm, _SC("'add_coins' called without instance"));
975 if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
976 sq_throwerror(vm, _SC("Argument 1 not an integer"));
981 _this->add_coins(arg0);
985 } catch(std::exception& e) {
986 sq_throwerror(vm, e.what());
989 sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_coins'"));
995 static int Player_make_invincible_wrapper(HSQUIRRELVM vm)
997 Scripting::Player* _this;
998 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
999 sq_throwerror(vm, _SC("'make_invincible' called without instance"));
1004 _this->make_invincible();
1008 } catch(std::exception& e) {
1009 sq_throwerror(vm, e.what());
1012 sq_throwerror(vm, _SC("Unexpected exception while executing function 'make_invincible'"));
1018 static int Player_deactivate_wrapper(HSQUIRRELVM vm)
1020 Scripting::Player* _this;
1021 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1022 sq_throwerror(vm, _SC("'deactivate' called without instance"));
1027 _this->deactivate();
1031 } catch(std::exception& e) {
1032 sq_throwerror(vm, e.what());
1035 sq_throwerror(vm, _SC("Unexpected exception while executing function 'deactivate'"));
1041 static int Player_activate_wrapper(HSQUIRRELVM vm)
1043 Scripting::Player* _this;
1044 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1045 sq_throwerror(vm, _SC("'activate' called without instance"));
1054 } catch(std::exception& e) {
1055 sq_throwerror(vm, e.what());
1058 sq_throwerror(vm, _SC("Unexpected exception while executing function 'activate'"));
1064 static int Player_walk_wrapper(HSQUIRRELVM vm)
1066 Scripting::Player* _this;
1067 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1068 sq_throwerror(vm, _SC("'walk' called without instance"));
1072 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1073 sq_throwerror(vm, _SC("Argument 1 not a float"));
1082 } catch(std::exception& e) {
1083 sq_throwerror(vm, e.what());
1086 sq_throwerror(vm, _SC("Unexpected exception while executing function 'walk'"));
1092 static int Player_set_visible_wrapper(HSQUIRRELVM vm)
1094 Scripting::Player* _this;
1095 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1096 sq_throwerror(vm, _SC("'set_visible' called without instance"));
1100 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1101 sq_throwerror(vm, _SC("Argument 1 not a bool"));
1106 _this->set_visible(arg0);
1110 } catch(std::exception& e) {
1111 sq_throwerror(vm, e.what());
1114 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1120 static int Player_get_visible_wrapper(HSQUIRRELVM vm)
1122 Scripting::Player* _this;
1123 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1124 sq_throwerror(vm, _SC("'get_visible' called without instance"));
1129 bool return_value = _this->get_visible();
1131 sq_pushbool(vm, return_value);
1134 } catch(std::exception& e) {
1135 sq_throwerror(vm, e.what());
1138 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_visible'"));
1144 static int FloatingImage_release_hook(SQUserPointer ptr, int )
1146 Scripting::FloatingImage* _this = reinterpret_cast<Scripting::FloatingImage*> (ptr);
1151 static int FloatingImage_constructor_wrapper(HSQUIRRELVM vm)
1154 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1155 sq_throwerror(vm, _SC("Argument 1 not a string"));
1160 Scripting::FloatingImage* _this = new Scripting::FloatingImage(arg0);
1161 if(SQ_FAILED(sq_setinstanceup(vm, 1, _this))) {
1162 sq_throwerror(vm, _SC("Couldn't setup instance of 'FloatingImage' class"));
1165 sq_setreleasehook(vm, 1, FloatingImage_release_hook);
1169 } catch(std::exception& e) {
1170 sq_throwerror(vm, e.what());
1173 sq_throwerror(vm, _SC("Unexpected exception while executing function 'constructor'"));
1179 static int FloatingImage_set_layer_wrapper(HSQUIRRELVM vm)
1181 Scripting::FloatingImage* _this;
1182 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1183 sq_throwerror(vm, _SC("'set_layer' called without instance"));
1187 if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1188 sq_throwerror(vm, _SC("Argument 1 not an integer"));
1193 _this->set_layer(arg0);
1197 } catch(std::exception& e) {
1198 sq_throwerror(vm, e.what());
1201 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_layer'"));
1207 static int FloatingImage_get_layer_wrapper(HSQUIRRELVM vm)
1209 Scripting::FloatingImage* _this;
1210 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1211 sq_throwerror(vm, _SC("'get_layer' called without instance"));
1216 int return_value = _this->get_layer();
1218 sq_pushinteger(vm, return_value);
1221 } catch(std::exception& e) {
1222 sq_throwerror(vm, e.what());
1225 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_layer'"));
1231 static int FloatingImage_set_pos_wrapper(HSQUIRRELVM vm)
1233 Scripting::FloatingImage* _this;
1234 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1235 sq_throwerror(vm, _SC("'set_pos' called without instance"));
1239 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1240 sq_throwerror(vm, _SC("Argument 1 not a float"));
1244 if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
1245 sq_throwerror(vm, _SC("Argument 2 not a float"));
1250 _this->set_pos(arg0, arg1);
1254 } catch(std::exception& e) {
1255 sq_throwerror(vm, e.what());
1258 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_pos'"));
1264 static int FloatingImage_get_pos_x_wrapper(HSQUIRRELVM vm)
1266 Scripting::FloatingImage* _this;
1267 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1268 sq_throwerror(vm, _SC("'get_pos_x' called without instance"));
1273 float return_value = _this->get_pos_x();
1275 sq_pushfloat(vm, return_value);
1278 } catch(std::exception& e) {
1279 sq_throwerror(vm, e.what());
1282 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_x'"));
1288 static int FloatingImage_get_pos_y_wrapper(HSQUIRRELVM vm)
1290 Scripting::FloatingImage* _this;
1291 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1292 sq_throwerror(vm, _SC("'get_pos_y' called without instance"));
1297 float return_value = _this->get_pos_y();
1299 sq_pushfloat(vm, return_value);
1302 } catch(std::exception& e) {
1303 sq_throwerror(vm, e.what());
1306 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_pos_y'"));
1312 static int FloatingImage_set_anchor_point_wrapper(HSQUIRRELVM vm)
1314 Scripting::FloatingImage* _this;
1315 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1316 sq_throwerror(vm, _SC("'set_anchor_point' called without instance"));
1320 if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1321 sq_throwerror(vm, _SC("Argument 1 not an integer"));
1326 _this->set_anchor_point(arg0);
1330 } catch(std::exception& e) {
1331 sq_throwerror(vm, e.what());
1334 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_anchor_point'"));
1340 static int FloatingImage_get_anchor_point_wrapper(HSQUIRRELVM vm)
1342 Scripting::FloatingImage* _this;
1343 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1344 sq_throwerror(vm, _SC("'get_anchor_point' called without instance"));
1349 int return_value = _this->get_anchor_point();
1351 sq_pushinteger(vm, return_value);
1354 } catch(std::exception& e) {
1355 sq_throwerror(vm, e.what());
1358 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_anchor_point'"));
1364 static int FloatingImage_set_visible_wrapper(HSQUIRRELVM vm)
1366 Scripting::FloatingImage* _this;
1367 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1368 sq_throwerror(vm, _SC("'set_visible' called without instance"));
1372 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1373 sq_throwerror(vm, _SC("Argument 1 not a bool"));
1378 _this->set_visible(arg0);
1382 } catch(std::exception& e) {
1383 sq_throwerror(vm, e.what());
1386 sq_throwerror(vm, _SC("Unexpected exception while executing function 'set_visible'"));
1392 static int FloatingImage_get_visible_wrapper(HSQUIRRELVM vm)
1394 Scripting::FloatingImage* _this;
1395 if(SQ_FAILED(sq_getinstanceup(vm, 1, reinterpret_cast<SQUserPointer*> (&_this), 0))) {
1396 sq_throwerror(vm, _SC("'get_visible' called without instance"));
1401 bool return_value = _this->get_visible();
1403 sq_pushbool(vm, return_value);
1406 } catch(std::exception& e) {
1407 sq_throwerror(vm, e.what());
1410 sq_throwerror(vm, _SC("Unexpected exception while executing function 'get_visible'"));
1416 static int display_wrapper(HSQUIRRELVM vm)
1418 return Scripting::display(vm);
1421 static int print_stacktrace_wrapper(HSQUIRRELVM vm)
1423 HSQUIRRELVM arg0 = vm;
1426 Scripting::print_stacktrace(arg0);
1430 } catch(std::exception& e) {
1431 sq_throwerror(vm, e.what());
1434 sq_throwerror(vm, _SC("Unexpected exception while executing function 'print_stacktrace'"));
1440 static int get_current_thread_wrapper(HSQUIRRELVM vm)
1442 return Scripting::get_current_thread(vm);
1445 static int display_text_file_wrapper(HSQUIRRELVM vm)
1448 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1449 sq_throwerror(vm, _SC("Argument 1 not a string"));
1454 Scripting::display_text_file(arg0);
1458 } catch(std::exception& e) {
1459 sq_throwerror(vm, e.what());
1462 sq_throwerror(vm, _SC("Unexpected exception while executing function 'display_text_file'"));
1468 static int load_worldmap_wrapper(HSQUIRRELVM vm)
1471 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1472 sq_throwerror(vm, _SC("Argument 1 not a string"));
1477 Scripting::load_worldmap(arg0);
1481 } catch(std::exception& e) {
1482 sq_throwerror(vm, e.what());
1485 sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_worldmap'"));
1491 static int load_level_wrapper(HSQUIRRELVM vm)
1494 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1495 sq_throwerror(vm, _SC("Argument 1 not a string"));
1500 Scripting::load_level(arg0);
1504 } catch(std::exception& e) {
1505 sq_throwerror(vm, e.what());
1508 sq_throwerror(vm, _SC("Unexpected exception while executing function 'load_level'"));
1514 static int wait_wrapper(HSQUIRRELVM vm)
1516 HSQUIRRELVM arg0 = vm;
1518 if(SQ_FAILED(sq_getfloat(vm, 2, &arg1))) {
1519 sq_throwerror(vm, _SC("Argument 1 not a float"));
1524 Scripting::wait(arg0, arg1);
1526 return sq_suspendvm(vm);
1528 } catch(std::exception& e) {
1529 sq_throwerror(vm, e.what());
1532 sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait'"));
1538 static int wait_for_screenswitch_wrapper(HSQUIRRELVM vm)
1540 HSQUIRRELVM arg0 = vm;
1543 Scripting::wait_for_screenswitch(arg0);
1545 return sq_suspendvm(vm);
1547 } catch(std::exception& e) {
1548 sq_throwerror(vm, e.what());
1551 sq_throwerror(vm, _SC("Unexpected exception while executing function 'wait_for_screenswitch'"));
1557 static int exit_screen_wrapper(HSQUIRRELVM vm)
1562 Scripting::exit_screen();
1566 } catch(std::exception& e) {
1567 sq_throwerror(vm, e.what());
1570 sq_throwerror(vm, _SC("Unexpected exception while executing function 'exit_screen'"));
1576 static int fadeout_screen_wrapper(HSQUIRRELVM vm)
1579 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1580 sq_throwerror(vm, _SC("Argument 1 not a float"));
1585 Scripting::fadeout_screen(arg0);
1589 } catch(std::exception& e) {
1590 sq_throwerror(vm, e.what());
1593 sq_throwerror(vm, _SC("Unexpected exception while executing function 'fadeout_screen'"));
1599 static int shrink_screen_wrapper(HSQUIRRELVM vm)
1602 if(SQ_FAILED(sq_getfloat(vm, 2, &arg0))) {
1603 sq_throwerror(vm, _SC("Argument 1 not a float"));
1607 if(SQ_FAILED(sq_getfloat(vm, 3, &arg1))) {
1608 sq_throwerror(vm, _SC("Argument 2 not a float"));
1612 if(SQ_FAILED(sq_getfloat(vm, 4, &arg2))) {
1613 sq_throwerror(vm, _SC("Argument 3 not a float"));
1618 Scripting::shrink_screen(arg0, arg1, arg2);
1622 } catch(std::exception& e) {
1623 sq_throwerror(vm, e.what());
1626 sq_throwerror(vm, _SC("Unexpected exception while executing function 'shrink_screen'"));
1632 static int translate_wrapper(HSQUIRRELVM vm)
1635 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1636 sq_throwerror(vm, _SC("Argument 1 not a string"));
1641 std::string return_value = Scripting::translate(arg0);
1643 sq_pushstring(vm, return_value.c_str(), return_value.size());
1646 } catch(std::exception& e) {
1647 sq_throwerror(vm, e.what());
1650 sq_throwerror(vm, _SC("Unexpected exception while executing function 'translate'"));
1656 static int import_wrapper(HSQUIRRELVM vm)
1658 HSQUIRRELVM arg0 = vm;
1660 if(SQ_FAILED(sq_getstring(vm, 2, &arg1))) {
1661 sq_throwerror(vm, _SC("Argument 1 not a string"));
1666 Scripting::import(arg0, arg1);
1670 } catch(std::exception& e) {
1671 sq_throwerror(vm, e.what());
1674 sq_throwerror(vm, _SC("Unexpected exception while executing function 'import'"));
1680 static int save_state_wrapper(HSQUIRRELVM vm)
1685 Scripting::save_state();
1689 } catch(std::exception& e) {
1690 sq_throwerror(vm, e.what());
1693 sq_throwerror(vm, _SC("Unexpected exception while executing function 'save_state'"));
1699 static int add_key_wrapper(HSQUIRRELVM vm)
1702 if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
1703 sq_throwerror(vm, _SC("Argument 1 not an integer"));
1708 Scripting::add_key(arg0);
1712 } catch(std::exception& e) {
1713 sq_throwerror(vm, e.what());
1716 sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_key'"));
1722 static int debug_collrects_wrapper(HSQUIRRELVM vm)
1725 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1726 sq_throwerror(vm, _SC("Argument 1 not a bool"));
1731 Scripting::debug_collrects(arg0);
1735 } catch(std::exception& e) {
1736 sq_throwerror(vm, e.what());
1739 sq_throwerror(vm, _SC("Unexpected exception while executing function 'debug_collrects'"));
1745 static int debug_draw_fps_wrapper(HSQUIRRELVM vm)
1748 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1749 sq_throwerror(vm, _SC("Argument 1 not a bool"));
1754 Scripting::debug_draw_fps(arg0);
1758 } catch(std::exception& e) {
1759 sq_throwerror(vm, e.what());
1762 sq_throwerror(vm, _SC("Unexpected exception while executing function 'debug_draw_fps'"));
1768 static int debug_draw_solids_only_wrapper(HSQUIRRELVM vm)
1771 if(SQ_FAILED(sq_getbool(vm, 2, &arg0))) {
1772 sq_throwerror(vm, _SC("Argument 1 not a bool"));
1777 Scripting::debug_draw_solids_only(arg0);
1781 } catch(std::exception& e) {
1782 sq_throwerror(vm, e.what());
1785 sq_throwerror(vm, _SC("Unexpected exception while executing function 'debug_draw_solids_only'"));
1791 static int play_music_wrapper(HSQUIRRELVM vm)
1794 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1795 sq_throwerror(vm, _SC("Argument 1 not a string"));
1800 Scripting::play_music(arg0);
1804 } catch(std::exception& e) {
1805 sq_throwerror(vm, e.what());
1808 sq_throwerror(vm, _SC("Unexpected exception while executing function 'play_music'"));
1814 static int play_sound_wrapper(HSQUIRRELVM vm)
1817 if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) {
1818 sq_throwerror(vm, _SC("Argument 1 not a string"));
1823 Scripting::play_sound(arg0);
1827 } catch(std::exception& e) {
1828 sq_throwerror(vm, e.what());
1831 sq_throwerror(vm, _SC("Unexpected exception while executing function 'play_sound'"));
1837 static int grease_wrapper(HSQUIRRELVM vm)
1842 Scripting::grease();
1846 } catch(std::exception& e) {
1847 sq_throwerror(vm, e.what());
1850 sq_throwerror(vm, _SC("Unexpected exception while executing function 'grease'"));
1856 static int invincible_wrapper(HSQUIRRELVM vm)
1861 Scripting::invincible();
1865 } catch(std::exception& e) {
1866 sq_throwerror(vm, e.what());
1869 sq_throwerror(vm, _SC("Unexpected exception while executing function 'invincible'"));
1875 static int mortal_wrapper(HSQUIRRELVM vm)
1880 Scripting::mortal();
1884 } catch(std::exception& e) {
1885 sq_throwerror(vm, e.what());
1888 sq_throwerror(vm, _SC("Unexpected exception while executing function 'mortal'"));
1894 static int shrink_wrapper(HSQUIRRELVM vm)
1899 Scripting::shrink();
1903 } catch(std::exception& e) {
1904 sq_throwerror(vm, e.what());
1907 sq_throwerror(vm, _SC("Unexpected exception while executing function 'shrink'"));
1913 static int kill_wrapper(HSQUIRRELVM vm)
1922 } catch(std::exception& e) {
1923 sq_throwerror(vm, e.what());
1926 sq_throwerror(vm, _SC("Unexpected exception while executing function 'kill'"));
1932 static int restart_wrapper(HSQUIRRELVM vm)
1937 Scripting::restart();
1941 } catch(std::exception& e) {
1942 sq_throwerror(vm, e.what());
1945 sq_throwerror(vm, _SC("Unexpected exception while executing function 'restart'"));
1951 static int whereami_wrapper(HSQUIRRELVM vm)
1956 Scripting::whereami();
1960 } catch(std::exception& e) {
1961 sq_throwerror(vm, e.what());
1964 sq_throwerror(vm, _SC("Unexpected exception while executing function 'whereami'"));
1970 static int gotoend_wrapper(HSQUIRRELVM vm)
1975 Scripting::gotoend();
1979 } catch(std::exception& e) {
1980 sq_throwerror(vm, e.what());
1983 sq_throwerror(vm, _SC("Unexpected exception while executing function 'gotoend'"));
1989 static int camera_wrapper(HSQUIRRELVM vm)
1994 Scripting::camera();
1998 } catch(std::exception& e) {
1999 sq_throwerror(vm, e.what());
2002 sq_throwerror(vm, _SC("Unexpected exception while executing function 'camera'"));
2008 static int quit_wrapper(HSQUIRRELVM vm)
2017 } catch(std::exception& e) {
2018 sq_throwerror(vm, e.what());
2021 sq_throwerror(vm, _SC("Unexpected exception while executing function 'quit'"));
2027 } // end of namespace Wrapper
2029 void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
2031 using namespace Wrapper;
2033 sq_pushroottable(v);
2034 sq_pushstring(v, "DisplayEffect", -1);
2035 if(SQ_FAILED(sq_get(v, -2))) {
2036 std::ostringstream msg;
2037 msg << "Couldn't resolved squirrel type 'DisplayEffect'";
2038 throw SquirrelError(v, msg.str());
2041 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2042 std::ostringstream msg;
2043 msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
2044 throw SquirrelError(v, msg.str());
2046 sq_remove(v, -2); // remove object name
2048 if(setup_releasehook) {
2049 sq_setreleasehook(v, -1, DisplayEffect_release_hook);
2052 sq_remove(v, -2); // remove root table
2055 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Camera* object, bool setup_releasehook)
2057 using namespace Wrapper;
2059 sq_pushroottable(v);
2060 sq_pushstring(v, "Camera", -1);
2061 if(SQ_FAILED(sq_get(v, -2))) {
2062 std::ostringstream msg;
2063 msg << "Couldn't resolved squirrel type 'Camera'";
2064 throw SquirrelError(v, msg.str());
2067 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2068 std::ostringstream msg;
2069 msg << "Couldn't setup squirrel instance for object of type 'Camera'";
2070 throw SquirrelError(v, msg.str());
2072 sq_remove(v, -2); // remove object name
2074 if(setup_releasehook) {
2075 sq_setreleasehook(v, -1, Camera_release_hook);
2078 sq_remove(v, -2); // remove root table
2081 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Level* object, bool setup_releasehook)
2083 using namespace Wrapper;
2085 sq_pushroottable(v);
2086 sq_pushstring(v, "Level", -1);
2087 if(SQ_FAILED(sq_get(v, -2))) {
2088 std::ostringstream msg;
2089 msg << "Couldn't resolved squirrel type 'Level'";
2090 throw SquirrelError(v, msg.str());
2093 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2094 std::ostringstream msg;
2095 msg << "Couldn't setup squirrel instance for object of type 'Level'";
2096 throw SquirrelError(v, msg.str());
2098 sq_remove(v, -2); // remove object name
2100 if(setup_releasehook) {
2101 sq_setreleasehook(v, -1, Level_release_hook);
2104 sq_remove(v, -2); // remove root table
2107 void create_squirrel_instance(HSQUIRRELVM v, Scripting::ScriptedObject* object, bool setup_releasehook)
2109 using namespace Wrapper;
2111 sq_pushroottable(v);
2112 sq_pushstring(v, "ScriptedObject", -1);
2113 if(SQ_FAILED(sq_get(v, -2))) {
2114 std::ostringstream msg;
2115 msg << "Couldn't resolved squirrel type 'ScriptedObject'";
2116 throw SquirrelError(v, msg.str());
2119 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2120 std::ostringstream msg;
2121 msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
2122 throw SquirrelError(v, msg.str());
2124 sq_remove(v, -2); // remove object name
2126 if(setup_releasehook) {
2127 sq_setreleasehook(v, -1, ScriptedObject_release_hook);
2130 sq_remove(v, -2); // remove root table
2133 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Text* object, bool setup_releasehook)
2135 using namespace Wrapper;
2137 sq_pushroottable(v);
2138 sq_pushstring(v, "Text", -1);
2139 if(SQ_FAILED(sq_get(v, -2))) {
2140 std::ostringstream msg;
2141 msg << "Couldn't resolved squirrel type 'Text'";
2142 throw SquirrelError(v, msg.str());
2145 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2146 std::ostringstream msg;
2147 msg << "Couldn't setup squirrel instance for object of type 'Text'";
2148 throw SquirrelError(v, msg.str());
2150 sq_remove(v, -2); // remove object name
2152 if(setup_releasehook) {
2153 sq_setreleasehook(v, -1, Text_release_hook);
2156 sq_remove(v, -2); // remove root table
2159 void create_squirrel_instance(HSQUIRRELVM v, Scripting::Player* object, bool setup_releasehook)
2161 using namespace Wrapper;
2163 sq_pushroottable(v);
2164 sq_pushstring(v, "Player", -1);
2165 if(SQ_FAILED(sq_get(v, -2))) {
2166 std::ostringstream msg;
2167 msg << "Couldn't resolved squirrel type 'Player'";
2168 throw SquirrelError(v, msg.str());
2171 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2172 std::ostringstream msg;
2173 msg << "Couldn't setup squirrel instance for object of type 'Player'";
2174 throw SquirrelError(v, msg.str());
2176 sq_remove(v, -2); // remove object name
2178 if(setup_releasehook) {
2179 sq_setreleasehook(v, -1, Player_release_hook);
2182 sq_remove(v, -2); // remove root table
2185 void create_squirrel_instance(HSQUIRRELVM v, Scripting::FloatingImage* object, bool setup_releasehook)
2187 using namespace Wrapper;
2189 sq_pushroottable(v);
2190 sq_pushstring(v, "FloatingImage", -1);
2191 if(SQ_FAILED(sq_get(v, -2))) {
2192 std::ostringstream msg;
2193 msg << "Couldn't resolved squirrel type 'FloatingImage'";
2194 throw SquirrelError(v, msg.str());
2197 if(SQ_FAILED(sq_createinstance(v, -1)) || SQ_FAILED(sq_setinstanceup(v, -1, object))) {
2198 std::ostringstream msg;
2199 msg << "Couldn't setup squirrel instance for object of type 'FloatingImage'";
2200 throw SquirrelError(v, msg.str());
2202 sq_remove(v, -2); // remove object name
2204 if(setup_releasehook) {
2205 sq_setreleasehook(v, -1, FloatingImage_release_hook);
2208 sq_remove(v, -2); // remove root table
2211 void register_supertux_wrapper(HSQUIRRELVM v)
2213 using namespace Wrapper;
2215 sq_pushstring(v, "KEY_BRASS", -1);
2216 sq_pushinteger(v, 1);
2217 if(SQ_FAILED(sq_createslot(v, -3))) {
2218 throw SquirrelError(v, "Couldn't register constant 'KEY_BRASS'");
2221 sq_pushstring(v, "KEY_IRON", -1);
2222 sq_pushinteger(v, 2);
2223 if(SQ_FAILED(sq_createslot(v, -3))) {
2224 throw SquirrelError(v, "Couldn't register constant 'KEY_IRON'");
2227 sq_pushstring(v, "KEY_BRONZE", -1);
2228 sq_pushinteger(v, 4);
2229 if(SQ_FAILED(sq_createslot(v, -3))) {
2230 throw SquirrelError(v, "Couldn't register constant 'KEY_BRONZE'");
2233 sq_pushstring(v, "KEY_SILVER", -1);
2234 sq_pushinteger(v, 8);
2235 if(SQ_FAILED(sq_createslot(v, -3))) {
2236 throw SquirrelError(v, "Couldn't register constant 'KEY_SILVER'");
2239 sq_pushstring(v, "KEY_GOLD", -1);
2240 sq_pushinteger(v, 16);
2241 if(SQ_FAILED(sq_createslot(v, -3))) {
2242 throw SquirrelError(v, "Couldn't register constant 'KEY_GOLD'");
2245 sq_pushstring(v, "ANCHOR_TOP", -1);
2246 sq_pushinteger(v, 16);
2247 if(SQ_FAILED(sq_createslot(v, -3))) {
2248 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP'");
2251 sq_pushstring(v, "ANCHOR_BOTTOM", -1);
2252 sq_pushinteger(v, 32);
2253 if(SQ_FAILED(sq_createslot(v, -3))) {
2254 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM'");
2257 sq_pushstring(v, "ANCHOR_LEFT", -1);
2258 sq_pushinteger(v, 1);
2259 if(SQ_FAILED(sq_createslot(v, -3))) {
2260 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_LEFT'");
2263 sq_pushstring(v, "ANCHOR_RIGHT", -1);
2264 sq_pushinteger(v, 2);
2265 if(SQ_FAILED(sq_createslot(v, -3))) {
2266 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_RIGHT'");
2269 sq_pushstring(v, "ANCHOR_MIDDLE", -1);
2270 sq_pushinteger(v, 0);
2271 if(SQ_FAILED(sq_createslot(v, -3))) {
2272 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_MIDDLE'");
2275 sq_pushstring(v, "ANCHOR_TOP_LEFT", -1);
2276 sq_pushinteger(v, 17);
2277 if(SQ_FAILED(sq_createslot(v, -3))) {
2278 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_LEFT'");
2281 sq_pushstring(v, "ANCHOR_TOP_RIGHT", -1);
2282 sq_pushinteger(v, 18);
2283 if(SQ_FAILED(sq_createslot(v, -3))) {
2284 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_TOP_RIGHT'");
2287 sq_pushstring(v, "ANCHOR_BOTTOM_LEFT", -1);
2288 sq_pushinteger(v, 33);
2289 if(SQ_FAILED(sq_createslot(v, -3))) {
2290 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_LEFT'");
2293 sq_pushstring(v, "ANCHOR_BOTTOM_RIGHT", -1);
2294 sq_pushinteger(v, 34);
2295 if(SQ_FAILED(sq_createslot(v, -3))) {
2296 throw SquirrelError(v, "Couldn't register constant 'ANCHOR_BOTTOM_RIGHT'");
2299 sq_pushstring(v, "display", -1);
2300 sq_newclosure(v, &display_wrapper, 0);
2301 if(SQ_FAILED(sq_createslot(v, -3))) {
2302 throw SquirrelError(v, "Couldn't register function 'display'");
2305 sq_pushstring(v, "print_stacktrace", -1);
2306 sq_newclosure(v, &print_stacktrace_wrapper, 0);
2307 if(SQ_FAILED(sq_createslot(v, -3))) {
2308 throw SquirrelError(v, "Couldn't register function 'print_stacktrace'");
2311 sq_pushstring(v, "get_current_thread", -1);
2312 sq_newclosure(v, &get_current_thread_wrapper, 0);
2313 if(SQ_FAILED(sq_createslot(v, -3))) {
2314 throw SquirrelError(v, "Couldn't register function 'get_current_thread'");
2317 sq_pushstring(v, "display_text_file", -1);
2318 sq_newclosure(v, &display_text_file_wrapper, 0);
2319 if(SQ_FAILED(sq_createslot(v, -3))) {
2320 throw SquirrelError(v, "Couldn't register function 'display_text_file'");
2323 sq_pushstring(v, "load_worldmap", -1);
2324 sq_newclosure(v, &load_worldmap_wrapper, 0);
2325 if(SQ_FAILED(sq_createslot(v, -3))) {
2326 throw SquirrelError(v, "Couldn't register function 'load_worldmap'");
2329 sq_pushstring(v, "load_level", -1);
2330 sq_newclosure(v, &load_level_wrapper, 0);
2331 if(SQ_FAILED(sq_createslot(v, -3))) {
2332 throw SquirrelError(v, "Couldn't register function 'load_level'");
2335 sq_pushstring(v, "wait", -1);
2336 sq_newclosure(v, &wait_wrapper, 0);
2337 if(SQ_FAILED(sq_createslot(v, -3))) {
2338 throw SquirrelError(v, "Couldn't register function 'wait'");
2341 sq_pushstring(v, "wait_for_screenswitch", -1);
2342 sq_newclosure(v, &wait_for_screenswitch_wrapper, 0);
2343 if(SQ_FAILED(sq_createslot(v, -3))) {
2344 throw SquirrelError(v, "Couldn't register function 'wait_for_screenswitch'");
2347 sq_pushstring(v, "exit_screen", -1);
2348 sq_newclosure(v, &exit_screen_wrapper, 0);
2349 if(SQ_FAILED(sq_createslot(v, -3))) {
2350 throw SquirrelError(v, "Couldn't register function 'exit_screen'");
2353 sq_pushstring(v, "fadeout_screen", -1);
2354 sq_newclosure(v, &fadeout_screen_wrapper, 0);
2355 if(SQ_FAILED(sq_createslot(v, -3))) {
2356 throw SquirrelError(v, "Couldn't register function 'fadeout_screen'");
2359 sq_pushstring(v, "shrink_screen", -1);
2360 sq_newclosure(v, &shrink_screen_wrapper, 0);
2361 if(SQ_FAILED(sq_createslot(v, -3))) {
2362 throw SquirrelError(v, "Couldn't register function 'shrink_screen'");
2365 sq_pushstring(v, "translate", -1);
2366 sq_newclosure(v, &translate_wrapper, 0);
2367 if(SQ_FAILED(sq_createslot(v, -3))) {
2368 throw SquirrelError(v, "Couldn't register function 'translate'");
2371 sq_pushstring(v, "import", -1);
2372 sq_newclosure(v, &import_wrapper, 0);
2373 if(SQ_FAILED(sq_createslot(v, -3))) {
2374 throw SquirrelError(v, "Couldn't register function 'import'");
2377 sq_pushstring(v, "save_state", -1);
2378 sq_newclosure(v, &save_state_wrapper, 0);
2379 if(SQ_FAILED(sq_createslot(v, -3))) {
2380 throw SquirrelError(v, "Couldn't register function 'save_state'");
2383 sq_pushstring(v, "add_key", -1);
2384 sq_newclosure(v, &add_key_wrapper, 0);
2385 if(SQ_FAILED(sq_createslot(v, -3))) {
2386 throw SquirrelError(v, "Couldn't register function 'add_key'");
2389 sq_pushstring(v, "debug_collrects", -1);
2390 sq_newclosure(v, &debug_collrects_wrapper, 0);
2391 if(SQ_FAILED(sq_createslot(v, -3))) {
2392 throw SquirrelError(v, "Couldn't register function 'debug_collrects'");
2395 sq_pushstring(v, "debug_draw_fps", -1);
2396 sq_newclosure(v, &debug_draw_fps_wrapper, 0);
2397 if(SQ_FAILED(sq_createslot(v, -3))) {
2398 throw SquirrelError(v, "Couldn't register function 'debug_draw_fps'");
2401 sq_pushstring(v, "debug_draw_solids_only", -1);
2402 sq_newclosure(v, &debug_draw_solids_only_wrapper, 0);
2403 if(SQ_FAILED(sq_createslot(v, -3))) {
2404 throw SquirrelError(v, "Couldn't register function 'debug_draw_solids_only'");
2407 sq_pushstring(v, "play_music", -1);
2408 sq_newclosure(v, &play_music_wrapper, 0);
2409 if(SQ_FAILED(sq_createslot(v, -3))) {
2410 throw SquirrelError(v, "Couldn't register function 'play_music'");
2413 sq_pushstring(v, "play_sound", -1);
2414 sq_newclosure(v, &play_sound_wrapper, 0);
2415 if(SQ_FAILED(sq_createslot(v, -3))) {
2416 throw SquirrelError(v, "Couldn't register function 'play_sound'");
2419 sq_pushstring(v, "grease", -1);
2420 sq_newclosure(v, &grease_wrapper, 0);
2421 if(SQ_FAILED(sq_createslot(v, -3))) {
2422 throw SquirrelError(v, "Couldn't register function 'grease'");
2425 sq_pushstring(v, "invincible", -1);
2426 sq_newclosure(v, &invincible_wrapper, 0);
2427 if(SQ_FAILED(sq_createslot(v, -3))) {
2428 throw SquirrelError(v, "Couldn't register function 'invincible'");
2431 sq_pushstring(v, "mortal", -1);
2432 sq_newclosure(v, &mortal_wrapper, 0);
2433 if(SQ_FAILED(sq_createslot(v, -3))) {
2434 throw SquirrelError(v, "Couldn't register function 'mortal'");
2437 sq_pushstring(v, "shrink", -1);
2438 sq_newclosure(v, &shrink_wrapper, 0);
2439 if(SQ_FAILED(sq_createslot(v, -3))) {
2440 throw SquirrelError(v, "Couldn't register function 'shrink'");
2443 sq_pushstring(v, "kill", -1);
2444 sq_newclosure(v, &kill_wrapper, 0);
2445 if(SQ_FAILED(sq_createslot(v, -3))) {
2446 throw SquirrelError(v, "Couldn't register function 'kill'");
2449 sq_pushstring(v, "restart", -1);
2450 sq_newclosure(v, &restart_wrapper, 0);
2451 if(SQ_FAILED(sq_createslot(v, -3))) {
2452 throw SquirrelError(v, "Couldn't register function 'restart'");
2455 sq_pushstring(v, "whereami", -1);
2456 sq_newclosure(v, &whereami_wrapper, 0);
2457 if(SQ_FAILED(sq_createslot(v, -3))) {
2458 throw SquirrelError(v, "Couldn't register function 'whereami'");
2461 sq_pushstring(v, "gotoend", -1);
2462 sq_newclosure(v, &gotoend_wrapper, 0);
2463 if(SQ_FAILED(sq_createslot(v, -3))) {
2464 throw SquirrelError(v, "Couldn't register function 'gotoend'");
2467 sq_pushstring(v, "camera", -1);
2468 sq_newclosure(v, &camera_wrapper, 0);
2469 if(SQ_FAILED(sq_createslot(v, -3))) {
2470 throw SquirrelError(v, "Couldn't register function 'camera'");
2473 sq_pushstring(v, "quit", -1);
2474 sq_newclosure(v, &quit_wrapper, 0);
2475 if(SQ_FAILED(sq_createslot(v, -3))) {
2476 throw SquirrelError(v, "Couldn't register function 'quit'");
2479 // Register class DisplayEffect
2480 sq_pushstring(v, "DisplayEffect", -1);
2481 if(sq_newclass(v, SQFalse) < 0) {
2482 std::ostringstream msg;
2483 msg << "Couldn't create new class 'DisplayEffect'";
2484 throw SquirrelError(v, msg.str());
2486 sq_pushstring(v, "fade_out", -1);
2487 sq_newclosure(v, &DisplayEffect_fade_out_wrapper, 0);
2488 if(SQ_FAILED(sq_createslot(v, -3))) {
2489 throw SquirrelError(v, "Couldn't register function 'fade_out'");
2492 sq_pushstring(v, "fade_in", -1);
2493 sq_newclosure(v, &DisplayEffect_fade_in_wrapper, 0);
2494 if(SQ_FAILED(sq_createslot(v, -3))) {
2495 throw SquirrelError(v, "Couldn't register function 'fade_in'");
2498 sq_pushstring(v, "set_black", -1);
2499 sq_newclosure(v, &DisplayEffect_set_black_wrapper, 0);
2500 if(SQ_FAILED(sq_createslot(v, -3))) {
2501 throw SquirrelError(v, "Couldn't register function 'set_black'");
2504 sq_pushstring(v, "is_black", -1);
2505 sq_newclosure(v, &DisplayEffect_is_black_wrapper, 0);
2506 if(SQ_FAILED(sq_createslot(v, -3))) {
2507 throw SquirrelError(v, "Couldn't register function 'is_black'");
2510 sq_pushstring(v, "sixteen_to_nine", -1);
2511 sq_newclosure(v, &DisplayEffect_sixteen_to_nine_wrapper, 0);
2512 if(SQ_FAILED(sq_createslot(v, -3))) {
2513 throw SquirrelError(v, "Couldn't register function 'sixteen_to_nine'");
2516 sq_pushstring(v, "four_to_three", -1);
2517 sq_newclosure(v, &DisplayEffect_four_to_three_wrapper, 0);
2518 if(SQ_FAILED(sq_createslot(v, -3))) {
2519 throw SquirrelError(v, "Couldn't register function 'four_to_three'");
2522 if(SQ_FAILED(sq_createslot(v, -3))) {
2523 throw SquirrelError(v, "Couldn't register class 'DisplayEffect'");
2526 // Register class Camera
2527 sq_pushstring(v, "Camera", -1);
2528 if(sq_newclass(v, SQFalse) < 0) {
2529 std::ostringstream msg;
2530 msg << "Couldn't create new class 'Camera'";
2531 throw SquirrelError(v, msg.str());
2533 sq_pushstring(v, "shake", -1);
2534 sq_newclosure(v, &Camera_shake_wrapper, 0);
2535 if(SQ_FAILED(sq_createslot(v, -3))) {
2536 throw SquirrelError(v, "Couldn't register function 'shake'");
2539 sq_pushstring(v, "set_pos", -1);
2540 sq_newclosure(v, &Camera_set_pos_wrapper, 0);
2541 if(SQ_FAILED(sq_createslot(v, -3))) {
2542 throw SquirrelError(v, "Couldn't register function 'set_pos'");
2545 sq_pushstring(v, "set_mode", -1);
2546 sq_newclosure(v, &Camera_set_mode_wrapper, 0);
2547 if(SQ_FAILED(sq_createslot(v, -3))) {
2548 throw SquirrelError(v, "Couldn't register function 'set_mode'");
2551 sq_pushstring(v, "scroll_to", -1);
2552 sq_newclosure(v, &Camera_scroll_to_wrapper, 0);
2553 if(SQ_FAILED(sq_createslot(v, -3))) {
2554 throw SquirrelError(v, "Couldn't register function 'scroll_to'");
2557 if(SQ_FAILED(sq_createslot(v, -3))) {
2558 throw SquirrelError(v, "Couldn't register class 'Camera'");
2561 // Register class Level
2562 sq_pushstring(v, "Level", -1);
2563 if(sq_newclass(v, SQFalse) < 0) {
2564 std::ostringstream msg;
2565 msg << "Couldn't create new class 'Level'";
2566 throw SquirrelError(v, msg.str());
2568 sq_pushstring(v, "finish", -1);
2569 sq_newclosure(v, &Level_finish_wrapper, 0);
2570 if(SQ_FAILED(sq_createslot(v, -3))) {
2571 throw SquirrelError(v, "Couldn't register function 'finish'");
2574 sq_pushstring(v, "spawn", -1);
2575 sq_newclosure(v, &Level_spawn_wrapper, 0);
2576 if(SQ_FAILED(sq_createslot(v, -3))) {
2577 throw SquirrelError(v, "Couldn't register function 'spawn'");
2580 sq_pushstring(v, "flip_vertically", -1);
2581 sq_newclosure(v, &Level_flip_vertically_wrapper, 0);
2582 if(SQ_FAILED(sq_createslot(v, -3))) {
2583 throw SquirrelError(v, "Couldn't register function 'flip_vertically'");
2586 if(SQ_FAILED(sq_createslot(v, -3))) {
2587 throw SquirrelError(v, "Couldn't register class 'Level'");
2590 // Register class ScriptedObject
2591 sq_pushstring(v, "ScriptedObject", -1);
2592 if(sq_newclass(v, SQFalse) < 0) {
2593 std::ostringstream msg;
2594 msg << "Couldn't create new class 'ScriptedObject'";
2595 throw SquirrelError(v, msg.str());
2597 sq_pushstring(v, "set_action", -1);
2598 sq_newclosure(v, &ScriptedObject_set_action_wrapper, 0);
2599 if(SQ_FAILED(sq_createslot(v, -3))) {
2600 throw SquirrelError(v, "Couldn't register function 'set_action'");
2603 sq_pushstring(v, "get_action", -1);
2604 sq_newclosure(v, &ScriptedObject_get_action_wrapper, 0);
2605 if(SQ_FAILED(sq_createslot(v, -3))) {
2606 throw SquirrelError(v, "Couldn't register function 'get_action'");
2609 sq_pushstring(v, "move", -1);
2610 sq_newclosure(v, &ScriptedObject_move_wrapper, 0);
2611 if(SQ_FAILED(sq_createslot(v, -3))) {
2612 throw SquirrelError(v, "Couldn't register function 'move'");
2615 sq_pushstring(v, "set_pos", -1);
2616 sq_newclosure(v, &ScriptedObject_set_pos_wrapper, 0);
2617 if(SQ_FAILED(sq_createslot(v, -3))) {
2618 throw SquirrelError(v, "Couldn't register function 'set_pos'");
2621 sq_pushstring(v, "get_pos_x", -1);
2622 sq_newclosure(v, &ScriptedObject_get_pos_x_wrapper, 0);
2623 if(SQ_FAILED(sq_createslot(v, -3))) {
2624 throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
2627 sq_pushstring(v, "get_pos_y", -1);
2628 sq_newclosure(v, &ScriptedObject_get_pos_y_wrapper, 0);
2629 if(SQ_FAILED(sq_createslot(v, -3))) {
2630 throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
2633 sq_pushstring(v, "set_velocity", -1);
2634 sq_newclosure(v, &ScriptedObject_set_velocity_wrapper, 0);
2635 if(SQ_FAILED(sq_createslot(v, -3))) {
2636 throw SquirrelError(v, "Couldn't register function 'set_velocity'");
2639 sq_pushstring(v, "get_velocity_x", -1);
2640 sq_newclosure(v, &ScriptedObject_get_velocity_x_wrapper, 0);
2641 if(SQ_FAILED(sq_createslot(v, -3))) {
2642 throw SquirrelError(v, "Couldn't register function 'get_velocity_x'");
2645 sq_pushstring(v, "get_velocity_y", -1);
2646 sq_newclosure(v, &ScriptedObject_get_velocity_y_wrapper, 0);
2647 if(SQ_FAILED(sq_createslot(v, -3))) {
2648 throw SquirrelError(v, "Couldn't register function 'get_velocity_y'");
2651 sq_pushstring(v, "set_visible", -1);
2652 sq_newclosure(v, &ScriptedObject_set_visible_wrapper, 0);
2653 if(SQ_FAILED(sq_createslot(v, -3))) {
2654 throw SquirrelError(v, "Couldn't register function 'set_visible'");
2657 sq_pushstring(v, "is_visible", -1);
2658 sq_newclosure(v, &ScriptedObject_is_visible_wrapper, 0);
2659 if(SQ_FAILED(sq_createslot(v, -3))) {
2660 throw SquirrelError(v, "Couldn't register function 'is_visible'");
2663 sq_pushstring(v, "get_name", -1);
2664 sq_newclosure(v, &ScriptedObject_get_name_wrapper, 0);
2665 if(SQ_FAILED(sq_createslot(v, -3))) {
2666 throw SquirrelError(v, "Couldn't register function 'get_name'");
2669 if(SQ_FAILED(sq_createslot(v, -3))) {
2670 throw SquirrelError(v, "Couldn't register class 'ScriptedObject'");
2673 // Register class Text
2674 sq_pushstring(v, "Text", -1);
2675 if(sq_newclass(v, SQFalse) < 0) {
2676 std::ostringstream msg;
2677 msg << "Couldn't create new class 'Text'";
2678 throw SquirrelError(v, msg.str());
2680 sq_pushstring(v, "set_text", -1);
2681 sq_newclosure(v, &Text_set_text_wrapper, 0);
2682 if(SQ_FAILED(sq_createslot(v, -3))) {
2683 throw SquirrelError(v, "Couldn't register function 'set_text'");
2686 sq_pushstring(v, "set_font", -1);
2687 sq_newclosure(v, &Text_set_font_wrapper, 0);
2688 if(SQ_FAILED(sq_createslot(v, -3))) {
2689 throw SquirrelError(v, "Couldn't register function 'set_font'");
2692 sq_pushstring(v, "fade_in", -1);
2693 sq_newclosure(v, &Text_fade_in_wrapper, 0);
2694 if(SQ_FAILED(sq_createslot(v, -3))) {
2695 throw SquirrelError(v, "Couldn't register function 'fade_in'");
2698 sq_pushstring(v, "fade_out", -1);
2699 sq_newclosure(v, &Text_fade_out_wrapper, 0);
2700 if(SQ_FAILED(sq_createslot(v, -3))) {
2701 throw SquirrelError(v, "Couldn't register function 'fade_out'");
2704 sq_pushstring(v, "set_visible", -1);
2705 sq_newclosure(v, &Text_set_visible_wrapper, 0);
2706 if(SQ_FAILED(sq_createslot(v, -3))) {
2707 throw SquirrelError(v, "Couldn't register function 'set_visible'");
2710 sq_pushstring(v, "set_centered", -1);
2711 sq_newclosure(v, &Text_set_centered_wrapper, 0);
2712 if(SQ_FAILED(sq_createslot(v, -3))) {
2713 throw SquirrelError(v, "Couldn't register function 'set_centered'");
2716 if(SQ_FAILED(sq_createslot(v, -3))) {
2717 throw SquirrelError(v, "Couldn't register class 'Text'");
2720 // Register class Player
2721 sq_pushstring(v, "Player", -1);
2722 if(sq_newclass(v, SQFalse) < 0) {
2723 std::ostringstream msg;
2724 msg << "Couldn't create new class 'Player'";
2725 throw SquirrelError(v, msg.str());
2727 sq_pushstring(v, "add_bonus", -1);
2728 sq_newclosure(v, &Player_add_bonus_wrapper, 0);
2729 if(SQ_FAILED(sq_createslot(v, -3))) {
2730 throw SquirrelError(v, "Couldn't register function 'add_bonus'");
2733 sq_pushstring(v, "add_coins", -1);
2734 sq_newclosure(v, &Player_add_coins_wrapper, 0);
2735 if(SQ_FAILED(sq_createslot(v, -3))) {
2736 throw SquirrelError(v, "Couldn't register function 'add_coins'");
2739 sq_pushstring(v, "make_invincible", -1);
2740 sq_newclosure(v, &Player_make_invincible_wrapper, 0);
2741 if(SQ_FAILED(sq_createslot(v, -3))) {
2742 throw SquirrelError(v, "Couldn't register function 'make_invincible'");
2745 sq_pushstring(v, "deactivate", -1);
2746 sq_newclosure(v, &Player_deactivate_wrapper, 0);
2747 if(SQ_FAILED(sq_createslot(v, -3))) {
2748 throw SquirrelError(v, "Couldn't register function 'deactivate'");
2751 sq_pushstring(v, "activate", -1);
2752 sq_newclosure(v, &Player_activate_wrapper, 0);
2753 if(SQ_FAILED(sq_createslot(v, -3))) {
2754 throw SquirrelError(v, "Couldn't register function 'activate'");
2757 sq_pushstring(v, "walk", -1);
2758 sq_newclosure(v, &Player_walk_wrapper, 0);
2759 if(SQ_FAILED(sq_createslot(v, -3))) {
2760 throw SquirrelError(v, "Couldn't register function 'walk'");
2763 sq_pushstring(v, "set_visible", -1);
2764 sq_newclosure(v, &Player_set_visible_wrapper, 0);
2765 if(SQ_FAILED(sq_createslot(v, -3))) {
2766 throw SquirrelError(v, "Couldn't register function 'set_visible'");
2769 sq_pushstring(v, "get_visible", -1);
2770 sq_newclosure(v, &Player_get_visible_wrapper, 0);
2771 if(SQ_FAILED(sq_createslot(v, -3))) {
2772 throw SquirrelError(v, "Couldn't register function 'get_visible'");
2775 if(SQ_FAILED(sq_createslot(v, -3))) {
2776 throw SquirrelError(v, "Couldn't register class 'Player'");
2779 // Register class FloatingImage
2780 sq_pushstring(v, "FloatingImage", -1);
2781 if(sq_newclass(v, SQFalse) < 0) {
2782 std::ostringstream msg;
2783 msg << "Couldn't create new class 'FloatingImage'";
2784 throw SquirrelError(v, msg.str());
2786 sq_pushstring(v, "constructor", -1);
2787 sq_newclosure(v, &FloatingImage_constructor_wrapper, 0);
2788 if(SQ_FAILED(sq_createslot(v, -3))) {
2789 throw SquirrelError(v, "Couldn't register function 'constructor'");
2792 sq_pushstring(v, "set_layer", -1);
2793 sq_newclosure(v, &FloatingImage_set_layer_wrapper, 0);
2794 if(SQ_FAILED(sq_createslot(v, -3))) {
2795 throw SquirrelError(v, "Couldn't register function 'set_layer'");
2798 sq_pushstring(v, "get_layer", -1);
2799 sq_newclosure(v, &FloatingImage_get_layer_wrapper, 0);
2800 if(SQ_FAILED(sq_createslot(v, -3))) {
2801 throw SquirrelError(v, "Couldn't register function 'get_layer'");
2804 sq_pushstring(v, "set_pos", -1);
2805 sq_newclosure(v, &FloatingImage_set_pos_wrapper, 0);
2806 if(SQ_FAILED(sq_createslot(v, -3))) {
2807 throw SquirrelError(v, "Couldn't register function 'set_pos'");
2810 sq_pushstring(v, "get_pos_x", -1);
2811 sq_newclosure(v, &FloatingImage_get_pos_x_wrapper, 0);
2812 if(SQ_FAILED(sq_createslot(v, -3))) {
2813 throw SquirrelError(v, "Couldn't register function 'get_pos_x'");
2816 sq_pushstring(v, "get_pos_y", -1);
2817 sq_newclosure(v, &FloatingImage_get_pos_y_wrapper, 0);
2818 if(SQ_FAILED(sq_createslot(v, -3))) {
2819 throw SquirrelError(v, "Couldn't register function 'get_pos_y'");
2822 sq_pushstring(v, "set_anchor_point", -1);
2823 sq_newclosure(v, &FloatingImage_set_anchor_point_wrapper, 0);
2824 if(SQ_FAILED(sq_createslot(v, -3))) {
2825 throw SquirrelError(v, "Couldn't register function 'set_anchor_point'");
2828 sq_pushstring(v, "get_anchor_point", -1);
2829 sq_newclosure(v, &FloatingImage_get_anchor_point_wrapper, 0);
2830 if(SQ_FAILED(sq_createslot(v, -3))) {
2831 throw SquirrelError(v, "Couldn't register function 'get_anchor_point'");
2834 sq_pushstring(v, "set_visible", -1);
2835 sq_newclosure(v, &FloatingImage_set_visible_wrapper, 0);
2836 if(SQ_FAILED(sq_createslot(v, -3))) {
2837 throw SquirrelError(v, "Couldn't register function 'set_visible'");
2840 sq_pushstring(v, "get_visible", -1);
2841 sq_newclosure(v, &FloatingImage_get_visible_wrapper, 0);
2842 if(SQ_FAILED(sq_createslot(v, -3))) {
2843 throw SquirrelError(v, "Couldn't register function 'get_visible'");
2846 if(SQ_FAILED(sq_createslot(v, -3))) {
2847 throw SquirrelError(v, "Couldn't register class 'FloatingImage'");
2852 } // end of namespace Scripting