From 60376e14c4cc35b3c8d7e069b083881b5ffe9032 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sun, 19 Apr 2020 20:21:17 +0200 Subject: [PATCH] get-skin --- Makefile.am | 1 + src/gui-environment.cpp | 10 ++++++++++ src/gui-environment.h | 3 +++ src/gui-skin.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ src/gui-skin.h | 38 ++++++++++++++++++++++++++++++++++++++ src/guile-irrlicht.cpp | 2 ++ 6 files changed, 94 insertions(+) create mode 100644 src/gui-skin.cpp create mode 100644 src/gui-skin.h diff --git a/Makefile.am b/Makefile.am index c8a062c..498cc78 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,6 +41,7 @@ libguile_irrlicht_la_SOURCES = \ src/gui-element.cpp \ src/gui-environment.cpp \ src/gui-image.cpp \ + src/gui-skin.cpp \ src/gui-static-text.cpp \ src/guile-irrlicht.cpp \ src/keycodes.cpp \ diff --git a/src/gui-environment.cpp b/src/gui-environment.cpp index 3268ab0..6a46191 100644 --- a/src/gui-environment.cpp +++ b/src/gui-environment.cpp @@ -27,6 +27,7 @@ #include "gui-element.h" #include "gui-environment.h" #include "gui-image.h" +#include "gui-skin.h" #include "gui-static-text.h" #include "position2d.h" #include "rect.h" @@ -43,6 +44,7 @@ extern "C" { DEFINE_GSUBR ("add-image!", 3, 0, 1, irr_gui_addImage); DEFINE_GSUBR ("add-static-text!", 3, 0, 1, irr_gui_addStaticText); DEFINE_GSUBR ("get-gui-environment", 1, 0, 0, irr_getGUIEnvironment); + DEFINE_GSUBR ("get-skin", 1, 0, 0, irr_gui_getSkin); } DEFINE_WRAPPED_TYPE (irr::gui::IGUIEnvironment*, "gui-environment", @@ -126,4 +128,12 @@ extern "C" { return wrap_gui_static_text (staticText); } + SCM + irr_gui_getSkin (SCM wrapped_gui_environment) + { + irr::gui::IGUIEnvironment* guienv = unwrap_gui_environment (wrapped_gui_environment); + irr::gui::IGUISkin* skin = guienv->getSkin (); + return wrap_gui_skin (skin); + } + } diff --git a/src/gui-environment.h b/src/gui-environment.h index 85ea250..c1e80d8 100644 --- a/src/gui-environment.h +++ b/src/gui-environment.h @@ -49,6 +49,9 @@ extern "C" { SCM rectangle, SCM rest); + SCM + irr_gui_getSkin (SCM wrapped_gui_environment); + } #endif diff --git a/src/gui-skin.cpp b/src/gui-skin.cpp new file mode 100644 index 0000000..6dc6139 --- /dev/null +++ b/src/gui-skin.cpp @@ -0,0 +1,40 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + 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 + . +*/ + +#include +#include + +#include "gui-skin.h" +#include "wrapped.h" + +extern "C" { + + void + init_gui_skin (void) + { + init_gui_skin_type (); + } + + DEFINE_WRAPPED_TYPE (irr::gui::IGUISkin*, "gui-skin", + init_gui_skin_type, gui_skin_p, + wrap_gui_skin, unwrap_gui_skin); + +} diff --git a/src/gui-skin.h b/src/gui-skin.h new file mode 100644 index 0000000..ca43d2b --- /dev/null +++ b/src/gui-skin.h @@ -0,0 +1,38 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + 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 + . +*/ + +#ifndef __GUILE_IRRLICHT_GUI_SKIN_H_INCLUDED__ +#define __GUILE_IRRLICHT_GUI_SKIN_H_INCLUDED__ + +#include +#include +#include "wrapped.h" + +extern "C" { + + void + init_gui_skin (void); + + DECLARE_WRAPPED_TYPE (irr::gui::IGUISkin*, init_gui_skin_type, + gui_skin_p, wrap_gui_skin, unwrap_gui_skin); +} + +#endif diff --git a/src/guile-irrlicht.cpp b/src/guile-irrlicht.cpp index 4531715..1be3a39 100644 --- a/src/guile-irrlicht.cpp +++ b/src/guile-irrlicht.cpp @@ -36,6 +36,7 @@ #include "gui-element.h" #include "gui-environment.h" #include "gui-image.h" +#include "gui-skin.h" #include "gui-static-text.h" #include "guile-irrlicht.h" #include "keymap.h" @@ -72,6 +73,7 @@ extern "C" { init_gui_element (); init_gui_environment (); init_gui_image (); + init_gui_skin (); init_gui_static_text (); init_keymap (); init_material (); -- 2.39.5