From: Javier Sancho Date: Tue, 21 Apr 2020 06:13:08 +0000 (+0200) Subject: set-skin-font! get-built-in-font X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=5780991d786b994724112c97f691d9e2b9f2f1c5;p=guile-irrlicht.git set-skin-font! get-built-in-font --- diff --git a/src/gui-environment.cpp b/src/gui-environment.cpp index 692075f..6244147 100644 --- a/src/gui-environment.cpp +++ b/src/gui-environment.cpp @@ -44,6 +44,7 @@ extern "C" { init_gui_environment_type (); DEFINE_GSUBR ("add-image!", 3, 0, 1, irr_gui_addImage); DEFINE_GSUBR ("add-static-text!", 3, 0, 1, irr_gui_addStaticText); + DEFINE_GSUBR ("get-built-in-font", 1, 0, 0, irr_gui_getBuiltInFont); DEFINE_GSUBR ("get-font", 2, 0, 0, irr_gui_getFont); DEFINE_GSUBR ("get-gui-environment", 1, 0, 0, irr_getGUIEnvironment); DEFINE_GSUBR ("get-skin", 1, 0, 0, irr_gui_getSkin); @@ -130,6 +131,14 @@ extern "C" { return wrap_gui_static_text (staticText); } + SCM + irr_gui_getBuiltInFont (SCM wrapped_gui_environment) + { + irr::gui::IGUIEnvironment* guienv = unwrap_gui_environment (wrapped_gui_environment); + irr::gui::IGUIFont* font = guienv->getBuiltInFont (); + return wrap_gui_font (font); + } + SCM irr_gui_getFont (SCM wrapped_gui_environment, SCM filename) diff --git a/src/gui-environment.h b/src/gui-environment.h index 1cc5cc6..b03aac4 100644 --- a/src/gui-environment.h +++ b/src/gui-environment.h @@ -49,6 +49,9 @@ extern "C" { SCM rectangle, SCM rest); + SCM + irr_gui_getBuiltInFont (SCM wrapped_gui_environment); + SCM irr_gui_getFont (SCM wrapped_gui_environment, SCM filename); diff --git a/src/gui-skin.cpp b/src/gui-skin.cpp index cfc9edb..4d1f0ec 100644 --- a/src/gui-skin.cpp +++ b/src/gui-skin.cpp @@ -34,6 +34,7 @@ extern "C" { { init_gui_skin_type (); DEFINE_GSUBR ("get-skin-font", 1, 0, 1, irr_gui_getSkinFont); + DEFINE_GSUBR ("set-skin-font!", 2, 0, 1, irr_gui_setSkinFont); } DEFINE_WRAPPED_TYPE (irr::gui::IGUISkin*, "gui-skin", @@ -55,6 +56,23 @@ extern "C" { return wrap_gui_font (font); } + SCM + irr_gui_setSkinFont (SCM wrapped_gui_skin, + SCM font, + SCM rest) + { + SCM which = scm_from_utf8_symbol ("default"); + + scm_c_bind_keyword_arguments ("get-skin-font", rest, (scm_t_keyword_arguments_flags)0, + scm_from_utf8_keyword ("which"), &which, + SCM_UNDEFINED); + + irr::gui::IGUISkin* skin = unwrap_gui_skin (wrapped_gui_skin); + skin->setFont (unwrap_gui_font (font), + scm_to_default_font (which)); + return SCM_UNSPECIFIED; + } + irr::gui::EGUI_DEFAULT_FONT scm_to_default_font (SCM default_font) { diff --git a/src/gui-skin.h b/src/gui-skin.h index 5a86bb1..529eb0c 100644 --- a/src/gui-skin.h +++ b/src/gui-skin.h @@ -38,6 +38,11 @@ extern "C" { irr_gui_getSkinFont (SCM wrapped_gui_skin, SCM rest); + SCM + irr_gui_setSkinFont (SCM wrapped_gui_skin, + SCM font, + SCM rest); + irr::gui::EGUI_DEFAULT_FONT scm_to_default_font (SCM default_font);