1 /* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
3 Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
5 This file is part of guile-irrlicht.
7 guile-irrlicht is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 3 of the
10 License, or (at your option) any later version.
12 guile-irrlicht is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with guile-irrlicht. If not, see
19 <http://www.gnu.org/licenses/>.
22 #include <irrlicht/irrlicht.h>
35 init_gui_skin_type ();
36 DEFINE_GSUBR ("get-skin-font", 1, 0, 1, irr_gui_getSkinFont);
39 DEFINE_WRAPPED_TYPE (irr::gui::IGUISkin*, "gui-skin",
40 init_gui_skin_type, gui_skin_p,
41 wrap_gui_skin, unwrap_gui_skin);
44 irr_gui_getSkinFont (SCM wrapped_gui_skin,
47 SCM which = scm_from_utf8_symbol ("default");
49 scm_c_bind_keyword_arguments ("get-skin-font", rest, (scm_t_keyword_arguments_flags)0,
50 scm_from_utf8_keyword ("which"), &which,
53 irr::gui::IGUISkin* skin = unwrap_gui_skin (wrapped_gui_skin);
54 irr::gui::IGUIFont* font = skin->getFont (scm_to_default_font (which));
55 return wrap_gui_font (font);
58 irr::gui::EGUI_DEFAULT_FONT
59 scm_to_default_font (SCM default_font)
61 char* font = scm_to_utf8_stringn (scm_symbol_to_string (default_font), NULL);
62 if (!strcmp (font, "default"))
64 return irr::gui::EGDF_DEFAULT;
66 else if (!strcmp (font, "button"))
68 return irr::gui::EGDF_BUTTON;
70 else if (!strcmp (font, "window"))
72 return irr::gui::EGDF_WINDOW;
74 else if (!strcmp (font, "menu"))
76 return irr::gui::EGDF_MENU;
78 else if (!strcmp (font, "tooltip"))
80 return irr::gui::EGDF_TOOLTIP;
84 scm_error (scm_arg_type_key, NULL, "Wrong default font: ~S",
85 scm_list_1 (default_font), scm_list_1 (default_font));