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>
33 IGUISkin_getColor (SCM gui_skin,
36 gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_pointer (gui_skin);
37 video::SColor scolor = skin->getColor (scm_to_default_color (color));
38 return scm_from_color (scolor);
43 IGUISkin_getFont (SCM gui_skin,
46 gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_pointer (gui_skin);
47 gui::IGUIFont* font = skin->getFont (scm_to_default_font (which));
48 return scm_from_pointer ((void*) font, NULL);
53 IGUISkin_setColor (SCM gui_skin,
57 gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_pointer (gui_skin);
58 skin->setColor (scm_to_default_color (which),
59 scm_to_color (new_color));
60 return SCM_UNSPECIFIED;
65 IGUISkin_setFont (SCM gui_skin,
69 gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_pointer (gui_skin);
70 skin->setFont ((gui::IGUIFont*) scm_to_pointer (font),
71 scm_to_default_font (which));
72 return SCM_UNSPECIFIED;
81 DEFINE_GSUBR ("IGUISkin_getColor", 2, 0, 0, IGUISkin_getColor);
82 DEFINE_GSUBR ("IGUISkin_getFont", 2, 0, 0, IGUISkin_getFont);
83 DEFINE_GSUBR ("IGUISkin_setColor", 3, 0, 0, IGUISkin_setColor);
84 DEFINE_GSUBR ("IGUISkin_setFont", 3, 0, 0, IGUISkin_setFont);
89 gui::EGUI_DEFAULT_COLOR
90 scm_to_default_color (SCM default_color)
92 char* color = scm_to_utf8_stringn (scm_symbol_to_string (default_color), NULL);
93 if (!strcmp (color, "3d-dark-shadow"))
95 return gui::EGDC_3D_DARK_SHADOW;
97 else if (!strcmp (color, "3d-shadow"))
99 return gui::EGDC_3D_SHADOW;
101 else if (!strcmp (color, "3d-face"))
103 return gui::EGDC_3D_FACE;
105 else if (!strcmp (color, "3d-high-light"))
107 return gui::EGDC_3D_HIGH_LIGHT;
109 else if (!strcmp (color, "3d-light"))
111 return gui::EGDC_3D_LIGHT;
113 else if (!strcmp (color, "active-border"))
115 return gui::EGDC_ACTIVE_BORDER;
117 else if (!strcmp (color, "active-caption"))
119 return gui::EGDC_ACTIVE_CAPTION;
121 else if (!strcmp (color, "app-workspace"))
123 return gui::EGDC_APP_WORKSPACE;
125 else if (!strcmp (color, "button-text"))
127 return gui::EGDC_BUTTON_TEXT;
129 else if (!strcmp (color, "gray-text"))
131 return gui::EGDC_GRAY_TEXT;
133 else if (!strcmp (color, "high-light"))
135 return gui::EGDC_HIGH_LIGHT;
137 else if (!strcmp (color, "high-light-text"))
139 return gui::EGDC_HIGH_LIGHT_TEXT;
141 else if (!strcmp (color, "inactive-border"))
143 return gui::EGDC_INACTIVE_BORDER;
145 else if (!strcmp (color, "inactive-caption"))
147 return gui::EGDC_INACTIVE_CAPTION;
149 else if (!strcmp (color, "tooltip"))
151 return gui::EGDC_TOOLTIP;
153 else if (!strcmp (color, "tooltip-background"))
155 return gui::EGDC_TOOLTIP_BACKGROUND;
157 else if (!strcmp (color, "scrollbar"))
159 return gui::EGDC_SCROLLBAR;
161 else if (!strcmp (color, "window"))
163 return gui::EGDC_WINDOW;
165 else if (!strcmp (color, "window-symbol"))
167 return gui::EGDC_WINDOW_SYMBOL;
169 else if (!strcmp (color, "icon"))
171 return gui::EGDC_ICON;
173 else if (!strcmp (color, "icon-high-light"))
175 return gui::EGDC_ICON_HIGH_LIGHT;
177 else if (!strcmp (color, "gray-window-symbol"))
179 return gui::EGDC_GRAY_WINDOW_SYMBOL;
181 else if (!strcmp (color, "editable"))
183 return gui::EGDC_EDITABLE;
185 else if (!strcmp (color, "gray-editable"))
187 return gui::EGDC_GRAY_EDITABLE;
189 else if (!strcmp (color, "focused-editable"))
191 return gui::EGDC_FOCUSED_EDITABLE;
195 scm_error (scm_arg_type_key, NULL, "Wrong default color: ~S",
196 scm_list_1 (default_color), scm_list_1 (default_color));
201 gui::EGUI_DEFAULT_FONT
202 scm_to_default_font (SCM default_font)
204 char* font = scm_to_utf8_stringn (scm_symbol_to_string (default_font), NULL);
205 if (!strcmp (font, "default"))
207 return gui::EGDF_DEFAULT;
209 else if (!strcmp (font, "button"))
211 return gui::EGDF_BUTTON;
213 else if (!strcmp (font, "window"))
215 return gui::EGDF_WINDOW;
217 else if (!strcmp (font, "menu"))
219 return gui::EGDF_MENU;
221 else if (!strcmp (font, "tooltip"))
223 return gui::EGDF_TOOLTIP;
227 scm_error (scm_arg_type_key, NULL, "Wrong default font: ~S",
228 scm_list_1 (default_font), scm_list_1 (default_font));