X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2FIGUIEnvironment.cpp;h=bea7f1e06bed4fd6e0ba82d774e0ebcacc389815;hb=a8ec20de5146479a15d388393b37bbf3e346f619;hp=0f66f7210b7017803ad4c28ed40584aebc13f3ff;hpb=84e93e7eac45dde889fc436a247838da3c87edf6;p=guile-irrlicht.git diff --git a/src/IGUIEnvironment.cpp b/src/IGUIEnvironment.cpp index 0f66f72..bea7f1e 100644 --- a/src/IGUIEnvironment.cpp +++ b/src/IGUIEnvironment.cpp @@ -21,7 +21,12 @@ #include #include +#include "IGUIElement.h" #include "IGUIEnvironment.h" +#include "IGUIStaticText.h" +#include "rect.h" +#include "wchar.h" +#include "wrapped.h" extern "C" { @@ -29,35 +34,33 @@ extern "C" { init_gui_environment (void) { init_gui_environment_type (); + scm_c_define_gsubr ("add-static-text!", 8, 0, 0, (scm_t_subr)irr_gui_addStaticText); } - static SCM gui_environment_type; - - void - init_gui_environment_type (void) - { - SCM name, slots; - scm_t_struct_finalize finalizer; - - name = scm_from_utf8_symbol ("gui_environment"); - slots = scm_list_1 (scm_from_utf8_symbol ("data")); - finalizer = NULL; - - gui_environment_type = - scm_make_foreign_object_type (name, slots, finalizer); - } + DEFINE_WRAPPED_TYPE (irr::gui::IGUIEnvironment*, "gui-environment", + init_gui_environment_type, gui_environment_p, + wrap_gui_environment, unwrap_gui_environment); SCM - wrap_gui_environment (irr::gui::IGUIEnvironment* gui_environment) - { - return scm_make_foreign_object_1 (gui_environment_type, gui_environment); - } - - irr::gui::IGUIEnvironment* - unwrap_gui_environment (SCM gui_environment_obj) + irr_gui_addStaticText (SCM wrappedGUIEnvironment, + SCM text, + SCM rectangle, + SCM border, + SCM wordWrap, + SCM parent, + SCM id, + SCM fillBackground) { - scm_assert_foreign_object_type (gui_environment_type, gui_environment_obj); - return (irr::gui::IGUIEnvironment*)scm_foreign_object_ref (gui_environment_obj, 0); + irr::gui::IGUIEnvironment* guienv = unwrap_gui_environment (wrappedGUIEnvironment); + irr::gui::IGUIStaticText* staticText = + guienv->addStaticText (scm_to_wide_char_string (text), + scm_to_rect_s32 (rectangle), + scm_to_bool (border), + scm_to_bool (wordWrap), + scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + scm_to_int32 (id), + scm_to_bool (fillBackground)); + return wrap_gui_static_text (staticText); } }