src/gui-environment.cpp \
src/gui-font.cpp \
src/gui-image.cpp \
+ src/gui-in-out-fader.cpp \
src/gui-scrollbar.cpp \
src/gui-skin.cpp \
src/gui-static-text.cpp \
extern "C" {
+ SCM
+ scm_from_color (irr::video::SColor color)
+ {
+ return scm_list_4 (scm_from_uint32 (color.getAlpha ()),
+ scm_from_uint32 (color.getRed ()),
+ scm_from_uint32 (color.getGreen ()),
+ scm_from_uint32 (color.getBlue ()));
+ }
+
irr::video::SColor
scm_to_color (SCM color)
{
extern "C" {
+ SCM
+ scm_from_color (irr::video::SColor color);
+
irr::video::SColor
scm_to_color (SCM color);
DECLARE_WRAPPED_TYPE (irr::gui::IGUIImage*, init_gui_image_type,
gui_image_p, wrap_gui_image, unwrap_gui_image);
+
}
#endif
--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+
+#include "gui-in-out-fader.h"
+#include "wrapped.h"
+
+extern "C" {
+
+ void
+ init_gui_in_out_fader (void)
+ {
+ init_gui_in_out_fader_type ();
+ }
+
+ DEFINE_WRAPPED_TYPE (irr::gui::IGUIInOutFader*, "gui-in-out-fader",
+ init_gui_in_out_fader_type, gui_in_out_fader_p,
+ wrap_gui_in_out_fader, unwrap_gui_in_out_fader);
+
+}
--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __GUILE_IRRLICHT_GUI_IN_OUT_FADER_H_INCLUDED__
+#define __GUILE_IRRLICHT_GUI_IN_OUT_FADER_H_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "wrapped.h"
+
+extern "C" {
+
+ void
+ init_gui_in_out_fader (void);
+
+ DECLARE_WRAPPED_TYPE (irr::gui::IGUIInOutFader*, init_gui_in_out_fader_type,
+ gui_in_out_fader_p, wrap_gui_in_out_fader, unwrap_gui_in_out_fader);
+
+}
+
+#endif
#include <irrlicht/irrlicht.h>
#include <libguile.h>
+#include "color.h"
#include "gsubr.h"
#include "gui-font.h"
#include "gui-skin.h"
init_gui_skin (void)
{
init_gui_skin_type ();
- DEFINE_GSUBR ("get-skin-font", 1, 0, 1, irr_gui_getSkinFont);
DEFINE_GSUBR ("set-font!", 2, 0, 1, irr_gui_setFont);
}
wrap_gui_skin, unwrap_gui_skin);
SCM
- irr_gui_getSkinFont (SCM wrapped_gui_skin,
- SCM rest)
+ irr_gui_IGUISkin_getColor (SCM wrapped_gui_skin,
+ SCM color)
{
- 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);
- irr::gui::IGUIFont* font = skin->getFont (scm_to_default_font (which));
- return wrap_gui_font (font);
+ irr::video::SColor scolor = skin->getColor (scm_to_default_color (color));
+ return scm_from_color (scolor);
}
SCM
return SCM_UNSPECIFIED;
}
+ irr::gui::EGUI_DEFAULT_COLOR
+ scm_to_default_color (SCM default_color)
+ {
+ char* color = scm_to_utf8_stringn (scm_symbol_to_string (default_color), NULL);
+ if (!strcmp (color, "3d-dark-shadow"))
+ {
+ return irr::gui::EGDC_3D_DARK_SHADOW;
+ }
+ else if (!strcmp (color, "3d-shadow"))
+ {
+ return irr::gui::EGDC_3D_SHADOW;
+ }
+ else if (!strcmp (color, "3d-face"))
+ {
+ return irr::gui::EGDC_3D_FACE;
+ }
+ else if (!strcmp (color, "3d-high-light"))
+ {
+ return irr::gui::EGDC_3D_HIGH_LIGHT;
+ }
+ else if (!strcmp (color, "3d-light"))
+ {
+ return irr::gui::EGDC_3D_LIGHT;
+ }
+ else if (!strcmp (color, "active-border"))
+ {
+ return irr::gui::EGDC_ACTIVE_BORDER;
+ }
+ else if (!strcmp (color, "active-caption"))
+ {
+ return irr::gui::EGDC_ACTIVE_CAPTION;
+ }
+ else if (!strcmp (color, "app-workspace"))
+ {
+ return irr::gui::EGDC_APP_WORKSPACE;
+ }
+ else if (!strcmp (color, "button-text"))
+ {
+ return irr::gui::EGDC_BUTTON_TEXT;
+ }
+ else if (!strcmp (color, "gray-text"))
+ {
+ return irr::gui::EGDC_GRAY_TEXT;
+ }
+ else if (!strcmp (color, "high-light"))
+ {
+ return irr::gui::EGDC_HIGH_LIGHT;
+ }
+ else if (!strcmp (color, "high-light-text"))
+ {
+ return irr::gui::EGDC_HIGH_LIGHT_TEXT;
+ }
+ else if (!strcmp (color, "inactive-border"))
+ {
+ return irr::gui::EGDC_INACTIVE_BORDER;
+ }
+ else if (!strcmp (color, "inactive-caption"))
+ {
+ return irr::gui::EGDC_INACTIVE_CAPTION;
+ }
+ else if (!strcmp (color, "tooltip"))
+ {
+ return irr::gui::EGDC_TOOLTIP;
+ }
+ else if (!strcmp (color, "tooltip-background"))
+ {
+ return irr::gui::EGDC_TOOLTIP_BACKGROUND;
+ }
+ else if (!strcmp (color, "scrollbar"))
+ {
+ return irr::gui::EGDC_SCROLLBAR;
+ }
+ else if (!strcmp (color, "window"))
+ {
+ return irr::gui::EGDC_WINDOW;
+ }
+ else if (!strcmp (color, "window-symbol"))
+ {
+ return irr::gui::EGDC_WINDOW_SYMBOL;
+ }
+ else if (!strcmp (color, "icon"))
+ {
+ return irr::gui::EGDC_ICON;
+ }
+ else if (!strcmp (color, "icon-high-light"))
+ {
+ return irr::gui::EGDC_ICON_HIGH_LIGHT;
+ }
+ else if (!strcmp (color, "gray-window-symbol"))
+ {
+ return irr::gui::EGDC_GRAY_WINDOW_SYMBOL;
+ }
+ else if (!strcmp (color, "editable"))
+ {
+ return irr::gui::EGDC_EDITABLE;
+ }
+ else if (!strcmp (color, "gray-editable"))
+ {
+ return irr::gui::EGDC_GRAY_EDITABLE;
+ }
+ else if (!strcmp (color, "focused-editable"))
+ {
+ return irr::gui::EGDC_FOCUSED_EDITABLE;
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Wrong default color: ~S",
+ scm_list_1 (default_color), scm_list_1 (default_color));
+ }
+ }
+
irr::gui::EGUI_DEFAULT_FONT
scm_to_default_font (SCM default_font)
{
gui_skin_p, wrap_gui_skin, unwrap_gui_skin);
SCM
- irr_gui_getSkinFont (SCM wrapped_gui_skin,
- SCM rest);
+ irr_gui_IGUISkin_getColor (SCM wrapped_gui_skin,
+ SCM color);
SCM
irr_gui_IGUISkin_getFont (SCM wrapped_gui_skin,
SCM font,
SCM rest);
+ irr::gui::EGUI_DEFAULT_COLOR
+ scm_to_default_color (SCM default_color);
+
irr::gui::EGUI_DEFAULT_FONT
scm_to_default_font (SCM default_font);
#include "gui-environment.h"
#include "gui-font.h"
#include "gui-image.h"
+#include "gui-in-out-fader.h"
#include "gui-scrollbar.h"
#include "gui-skin.h"
#include "gui-static-text.h"
init_gui_environment ();
init_gui_font ();
init_gui_image ();
+ init_gui_in_out_fader ();
init_gui_scrollbar ();
init_gui_skin ();
init_gui_static_text ();
// Shared procedures (used by two or more objects)
DEFINE_GSUBR ("add-button!", 1, 1, 1, irr_gui_addButton);
+ DEFINE_GSUBR ("get-color", 1, 1, 0, irr_gui_getColor);
DEFINE_GSUBR ("get-font", 1, 1, 1, irr_gui_getFont);
DEFINE_GSUBR ("set-max!", 2, 0, 0, irr_gui_setMax);
DEFINE_GSUBR ("set-override-color!", 2, 0, 0, irr_gui_setOverrideColor);
}
}
+ SCM
+ irr_gui_getColor (SCM wrapped_obj,
+ SCM color)
+ {
+#define GET_COLOR(OBJ) scm_from_color (OBJ->getColor ());
+
+ if (gui_image_p (wrapped_obj))
+ {
+ return GET_COLOR (unwrap_gui_image (wrapped_obj));
+ }
+ else if (gui_in_out_fader_p (wrapped_obj))
+ {
+ return GET_COLOR (unwrap_gui_in_out_fader (wrapped_obj));
+ }
+ else if (gui_skin_p (wrapped_obj))
+ {
+ return irr_gui_IGUISkin_getColor (wrapped_obj, color);
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Cannot get color from object: ~S",
+ scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
+ }
+ }
+
SCM
irr_gui_getFont (SCM wrapped_obj,
SCM filename,
SCM rectangle,
SCM rest);
+ SCM
+ irr_gui_getColor (SCM wrapped_obj,
+ SCM color);
+
SCM
irr_gui_getFont (SCM wrapped_obj,
SCM filename,