src/dimension2d.cpp \
src/EDriverTypes.cpp \
src/GuileIrrlicht.cpp \
+ src/IGUIElement.cpp \
src/IGUIEnvironment.cpp \
+ src/IGUIStaticText.cpp \
src/IrrlichtDevice.cpp \
src/ISceneManager.cpp \
- src/IVideoDriver.cpp
+ src/IVideoDriver.cpp \
+ src/rect.cpp \
+ src/util.cpp
libguile_irrlicht_la_CPPFLAGS = @GUILE_CFLAGS@
libguile_irrlicht_la_LDFLAGS = \
-version-info 0:1 \
(eval-when (eval load compile)
;; load public symbols into current module
(let ((public-modules
- '((irrlicht device)))
+ '((irrlicht device)
+ (irrlicht gui)))
(current-interface
(module-public-interface (current-module))))
(for-each
(load-extension "libguile-irrlicht" "init_guile_irrlicht")
-(define irrlicht-create-device create-device)
+(define irr-create-device create-device)
(define* (create-device #:key
(device-type 'software)
(window-size '(640 480))
(stencilbuffer #f)
(vsync #f)
(receiver 0))
- (irrlicht-create-device device-type
- window-size
- bits
- fullscreen
- stencilbuffer
- vsync
- receiver))
+ (irr-create-device device-type
+ window-size
+ bits
+ fullscreen
+ stencilbuffer
+ vsync
+ receiver))
--- /dev/null
+;;; guile-irrlicht --- FFI bindings for Irrlicht Engine
+;;; Copyright (C) 2019 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/>.
+
+
+(define-module (irrlicht gui)
+ #:export (add-static-text!))
+
+(load-extension "libguile-irrlicht" "init_guile_irrlicht")
+
+(define irr-add-static-text! add-static-text!)
+(define* (add-static-text! guienv text rectangle
+ #:key
+ (border #f)
+ (word-wrap #t)
+ (parent #f)
+ (id -1)
+ (fill-background #f))
+ (irr-add-static-text! guienv
+ text
+ rectangle
+ border
+ word-wrap
+ parent
+ id
+ fill-background))
*/
#include <libguile.h>
+#include "IGUIElement.h"
#include "IGUIEnvironment.h"
+#include "IGUIStaticText.h"
#include "IrrlichtDevice.h"
#include "ISceneManager.h"
#include "IVideoDriver.h"
init_guile_irrlicht (void)
{
init_device ();
+ init_gui_element ();
init_gui_environment ();
+ init_gui_static_text ();
init_scene_manager ();
init_video_driver ();
}
--- /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 "IGUIElement.h"
+#include "util.h"
+
+extern "C" {
+
+ void
+ init_gui_element (void)
+ {
+ init_gui_element_type ();
+ }
+
+ DEFINE_WRAPPED_TYPE (irr::gui::IGUIElement*, "gui-element",
+ init_gui_element_type,
+ wrap_gui_element, unwrap_gui_element);
+
+}
--- /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_I_GUI_ELEMENT_INCLUDED__
+#define __GUILE_I_GUI_ELEMENT_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "util.h"
+
+extern "C" {
+
+ void
+ init_gui_element (void);
+
+ DECLARE_WRAPPED_TYPE (irr::gui::IGUIElement*, init_gui_element_type,
+ wrap_gui_element, unwrap_gui_element);
+}
+
+#endif
#include <irrlicht/irrlicht.h>
#include <libguile.h>
+#include "IGUIElement.h"
#include "IGUIEnvironment.h"
+#include "IGUIStaticText.h"
+#include "rect.h"
#include "util.h"
extern "C" {
init_gui_environment (void)
{
init_gui_environment_type ();
+ scm_c_define_gsubr ("add-static-text!", 8, 0, 0, (scm_t_subr)irr_gui_addStaticText);
}
DEFINE_WRAPPED_TYPE (irr::gui::IGUIEnvironment*, "gui-environment",
init_gui_environment_type,
wrap_gui_environment, unwrap_gui_environment);
+ SCM
+ irr_gui_addStaticText (SCM wrappedGUIEnvironment,
+ SCM text,
+ SCM rectangle,
+ SCM border,
+ SCM wordWrap,
+ SCM parent,
+ SCM id,
+ SCM fillBackground)
+ {
+ irr::gui::IGUIEnvironment* guienv = unwrap_gui_environment (wrappedGUIEnvironment);
+ irr::gui::IGUIStaticText* staticText =
+ guienv->addStaticText (scm_to_wide_char_string (text),
+ scm_to_rect_s32 (rectangle),
+ scm_to_bool (border),
+ scm_to_bool (wordWrap),
+ scm_is_false (parent) ? 0 : unwrap_gui_element (parent),
+ scm_to_int32 (id),
+ scm_to_bool (fillBackground));
+ return wrap_gui_static_text (staticText);
+ }
+
}
DECLARE_WRAPPED_TYPE (irr::gui::IGUIEnvironment*, init_gui_environment_type,
wrap_gui_environment, unwrap_gui_environment);
+
+ SCM
+ irr_gui_addStaticText (SCM guienv,
+ SCM text,
+ SCM rectangle,
+ SCM border,
+ SCM wordWrap,
+ SCM parent,
+ SCM id,
+ SCM fillBackground);
+
}
#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 "IGUIStaticText.h"
+#include "util.h"
+
+extern "C" {
+
+ void
+ init_gui_static_text (void)
+ {
+ init_gui_static_text_type ();
+ }
+
+ DEFINE_WRAPPED_TYPE (irr::gui::IGUIStaticText*, "gui-static-text",
+ init_gui_static_text_type,
+ wrap_gui_static_text, unwrap_gui_static_text);
+
+}
--- /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_I_GUI_STATIC_TEXT_INCLUDED__
+#define __GUILE_I_GUI_STATIC_TEXT_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "util.h"
+
+extern "C" {
+
+ void
+ init_gui_static_text (void);
+
+ DECLARE_WRAPPED_TYPE (irr::gui::IGUIStaticText*, init_gui_static_text_type,
+ wrap_gui_static_text, unwrap_gui_static_text);
+}
+
+#endif
#include <irrlicht/irrlicht.h>
#include <libguile.h>
-#include <wchar.h>
#include "dimension2d.h"
#include "EDriverTypes.h"
SCM text)
{
irr::IrrlichtDevice* device = unwrap_device (device_obj);
- char* ctext;
- wchar_t* wtext;
-
- ctext = scm_to_utf8_stringn (text, NULL);
- wtext = (wchar_t*)malloc ((strlen (ctext) + 1) * sizeof (wchar_t));
- mbstowcs (wtext, ctext, strlen (ctext) + 1);
-
- device->setWindowCaption (wtext);
+ device->setWindowCaption (scm_to_wide_char_string (text));
return SCM_UNSPECIFIED;
}
--- /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 "rect.h"
+
+extern "C" {
+
+ irr::core::rect<irr::s32>
+ scm_to_rect_s32 (SCM rect)
+ {
+ return irr::core::rect<irr::s32>
+ (scm_to_int32 (scm_car (rect)),
+ scm_to_int32 (scm_cadr (rect)),
+ scm_to_int32 (scm_caddr (rect)),
+ scm_to_int32 (scm_cadddr (rect)));
+ }
+
+}
--- /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_RECT_INCLUDED__
+#define __GUILE_IRRLICHT_RECT_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+
+extern "C" {
+
+ irr::core::rect<irr::s32>
+ scm_to_rect_s32 (SCM rect);
+
+}
+
+#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 <libguile.h>
+#include <wchar.h>
+#include "util.h"
+
+wchar_t*
+scm_to_wide_char_string (SCM text)
+{
+ char* ctext = scm_to_utf8_stringn (text, NULL);
+ wchar_t* wtext = (wchar_t*)malloc ((strlen (ctext) + 1) * sizeof (wchar_t));
+ mbstowcs (wtext, ctext, strlen (ctext) + 1);
+ return wtext;
+}
<http://www.gnu.org/licenses/>.
*/
+#include <libguile.h>
+#include <wchar.h>
#define DECLARE_WRAPPED_TYPE(TYPE, INIT, WRAP, UNWRAP) \
void \
scm_assert_foreign_object_type (wrapped_type, wrapped_obj); \
return (TYPE)scm_foreign_object_ref (wrapped_obj, 0); \
}
+
+wchar_t*
+scm_to_wide_char_string (SCM text);