SOURCES = \
irrlicht.scm \
irrlicht/base.scm \
+ irrlicht/device.scm \
irrlicht/foreign.scm \
irrlicht/gui.scm \
+ irrlicht/io.scm \
irrlicht/irr.scm \
irrlicht/scene.scm \
irrlicht/video.scm
(define-module (irrlicht)
- #:use-module (irrlicht irr)
- #:re-export (create-device
+ #:use-module (irrlicht device)
+ #:use-module (irrlicht gui)
+ #:re-export (add-static-text!
+ create-device
get-gui-environment
get-scene-manager
get-video-driver
--- /dev/null
+;;; guile-irrlicht --- FFI 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/>.
+
+
+(define-module (irrlicht device)
+ #:use-module (oop goops)
+ #:use-module (irrlicht base)
+ #:use-module (irrlicht foreign)
+ #:use-module (irrlicht irr)
+ #:use-module (irrlicht gui)
+ #:use-module (irrlicht scene)
+ #:use-module (irrlicht video))
+
+
+;; IrrlichtDevice
+(define-class <irrlicht-device> (<reference-counted>))
+
+(define* (create-device #:key
+ (device-type 'software)
+ (window-size '(640 480))
+ (bits 16)
+ (fullscreen #f)
+ (stencilbuffer #f)
+ (vsync #f)
+ (receiver (make <event-receiver>)))
+ (if (not (is-a? receiver <event-receiver>))
+ (error
+ "In procedure create-device: Wrong type argument (expecting <event-receiver>):"
+ receiver))
+
+ (make <irrlicht-device>
+ #:irr-pointer
+ (irr_createDevice
+ device-type
+ window-size
+ bits
+ fullscreen
+ stencilbuffer
+ vsync
+ (irr-pointer receiver))))
+
+(define-method (get-gui-environment (device <irrlicht-device>))
+ (make <gui-environment>
+ #:irr-pointer (irr_IrrlichtDevice_getGUIEnvironment (irr-pointer device))))
+
+(define-method (get-scene-manager (device <irrlicht-device>))
+ (make <scene-manager>
+ #:irr-pointer (irr_IrrlichtDevice_getSceneManager (irr-pointer device))))
+
+(define-method (get-video-driver (device <irrlicht-device>))
+ (make <video-driver>
+ #:irr-pointer (irr_IrrlichtDevice_getVideoDriver (irr-pointer device))))
+
+(define-method (set-window-caption! (device <irrlicht-device>) text)
+ (irr_IrrlichtDevice_setWindowCaption (irr-pointer device) text))
+
+(export create-device get-gui-environment get-scene-manager get-video-driver set-window-caption!)
(define-module (irrlicht gui)
#:use-module (oop goops)
+ #:use-module (ice-9 optargs)
#:use-module (irrlicht base)
- #:use-module (irrlicht foreign))
+ #:use-module (irrlicht foreign)
+ #:use-module (irrlicht io)
+ #:use-module (irrlicht irr))
-;; IVideoDriver
-(define-class <gui-environment> (<irrlicht-base>))
+;; IGUIElement
+(define-class <gui-element> (<attribute-exchanging-object> <event-receiver>))
-(export <gui-environment>)
+(export <gui-element>)
+
+
+;; IGUIEnvironment
+(define-class <gui-environment> (<reference-counted>))
+
+(define-method (add-static-text! (gui-environment <gui-environment>) text rectangle . rest)
+ (let-keywords rest #f
+ ((border #f)
+ (word-wrap #t)
+ (parent (make <gui-element>))
+ (id -1)
+ (fill-background #f))
+ (make <gui-static-text>
+ #:irr-pointer
+ (irr_gui_IGUIEnvironment_addStaticText (irr-pointer gui-environment)
+ text
+ rectangle
+ border
+ word-wrap
+ (irr-pointer parent)
+ id
+ fill-background))))
+
+(export <gui-environment> add-static-text!)
+
+
+;; IGUIStaticText
+(define-class <gui-static-text> (<gui-element>))
+
+(export <gui-static-text>)
--- /dev/null
+;;; guile-irrlicht --- FFI 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/>.
+
+
+(define-module (irrlicht io)
+ #:use-module (oop goops)
+ #:use-module (irrlicht foreign)
+ #:use-module (irrlicht irr))
+
+
+;; IAttributeExchangingObject
+(define-class <attribute-exchanging-object> (<reference-counted>))
+
+(export <attribute-exchanging-object>)
(define-module (irrlicht irr)
#:use-module (oop goops)
#:use-module (irrlicht base)
- #:use-module (irrlicht foreign)
- #:use-module (irrlicht gui)
- #:use-module (irrlicht scene)
- #:use-module (irrlicht video))
+ #:use-module (irrlicht foreign))
;; IReferenceCounted
(define-class <event-receiver> (<irrlicht-base>))
(export <event-receiver>)
-
-
-;; IrrlichtDevice
-(define-class <irrlicht-device> (<reference-counted>))
-
-(define* (create-device #:key
- (device-type 'software)
- (window-size '(640 480))
- (bits 16)
- (fullscreen #f)
- (stencilbuffer #f)
- (vsync #f)
- (receiver (make <event-receiver>)))
- (if (not (is-a? receiver <event-receiver>))
- (error
- "In procedure create-device: Wrong type argument (expecting <event-receiver>):"
- receiver))
-
- (make <irrlicht-device>
- #:irr-pointer
- (irr_createDevice
- device-type
- window-size
- bits
- fullscreen
- stencilbuffer
- vsync
- (irr-pointer receiver))))
-
-(define-method (get-gui-environment (device <irrlicht-device>))
- (make <gui-environment>
- #:irr-pointer (irr_IrrlichtDevice_getGUIEnvironment (irr-pointer device))))
-
-(define-method (get-scene-manager (device <irrlicht-device>))
- (make <scene-manager>
- #:irr-pointer (irr_IrrlichtDevice_getSceneManager (irr-pointer device))))
-
-(define-method (get-video-driver (device <irrlicht-device>))
- (make <video-driver>
- #:irr-pointer (irr_IrrlichtDevice_getVideoDriver (irr-pointer device))))
-
-(define-method (set-window-caption! (device <irrlicht-device>) text)
- (irr_IrrlichtDevice_setWindowCaption (irr-pointer device) text))
-
-(export create-device get-gui-environment get-scene-manager get-video-driver set-window-caption!)
(define-module (irrlicht scene)
#:use-module (oop goops)
- #:use-module (irrlicht base)
- #:use-module (irrlicht foreign))
+ #:use-module (irrlicht foreign)
+ #:use-module (irrlicht irr))
-;; IVideoDriver
-(define-class <scene-manager> (<irrlicht-base>))
+;; ISceneManager
+(define-class <scene-manager> (<reference-counted>))
(export <scene-manager>)
#include "wchar.h"
#include "wrapped.h"
+using namespace irr;
+
extern "C" {
void
init_gui_environment (void)
{
init_gui_environment_type ();
+ DEFINE_GSUBR ("irr_gui_IGUIEnvironment_addStaticText", 8, 0, 0,
+ irr_gui_IGUIEnvironment_addStaticText);
DEFINE_GSUBR ("add-image!", 3, 0, 1, irr_gui_addImage);
DEFINE_GSUBR ("add-editbox!", 3, 0, 1, irr_gui_addEditBox);
DEFINE_GSUBR ("add-listbox!", 2, 0, 1, irr_gui_addListBox);
DEFINE_GSUBR ("add-scrollbar!", 3, 0, 1, irr_gui_addScrollBar);
- DEFINE_GSUBR ("add-static-text!", 3, 0, 1, irr_gui_addStaticText);
DEFINE_GSUBR ("add-window!", 2, 0, 1, irr_gui_addWindow);
DEFINE_GSUBR ("get-built-in-font", 1, 0, 0, irr_gui_getBuiltInFont);
DEFINE_GSUBR ("get-skin", 1, 0, 0, irr_gui_getSkin);
init_gui_environment_type, gui_environment_p,
wrap_gui_environment, unwrap_gui_environment);
+ SCM
+ irr_gui_IGUIEnvironment_addStaticText (SCM gui_environment,
+ SCM text,
+ SCM rectangle,
+ SCM border,
+ SCM word_wrap,
+ SCM parent,
+ SCM id,
+ SCM fill_background)
+ {
+ gui::IGUIStaticText* static_text =
+ ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))->
+ addStaticText (scm_to_wide_char_string (text),
+ scm_to_rect_s32 (rectangle),
+ scm_to_bool (border),
+ scm_to_bool (word_wrap),
+ (gui::IGUIElement*)scm_to_pointer (parent),
+ scm_to_int32 (id),
+ scm_to_bool (fill_background));
+ return scm_from_pointer ((void*)static_text, NULL);
+ }
+
SCM
irr_gui_addImage (SCM wrapped_gui_environment,
SCM image,
return wrap_gui_scrollbar (scrollbar);
}
- SCM
- irr_gui_addStaticText (SCM wrapped_gui_environment,
- SCM text,
- SCM rectangle,
- SCM rest)
- {
- SCM border = SCM_BOOL_F;
- SCM word_wrap = SCM_BOOL_T;
- SCM parent = SCM_UNDEFINED;
- SCM id = scm_from_int32 (-1);
- SCM fill_background = SCM_BOOL_F;
-
- scm_c_bind_keyword_arguments ("add-static-text!", rest, (scm_t_keyword_arguments_flags)0,
- scm_from_utf8_keyword ("border"), &border,
- scm_from_utf8_keyword ("word-wrap"), &word_wrap,
- scm_from_utf8_keyword ("parent"), &parent,
- scm_from_utf8_keyword ("id"), &id,
- scm_from_utf8_keyword ("fill-background"), &fill_background,
- SCM_UNDEFINED);
-
- irr::gui::IGUIEnvironment* guienv = unwrap_gui_environment (wrapped_gui_environment);
- irr::gui::IGUIStaticText* staticText =
- guienv->addStaticText (scm_to_wide_char_string (text),
- scm_to_rect_s32 (rectangle),
- scm_to_bool (border),
- scm_to_bool (word_wrap),
- parent == SCM_UNDEFINED ? 0 : unwrap_gui_element (parent),
- scm_to_int32 (id),
- scm_to_bool (fill_background));
- return wrap_gui_static_text (staticText);
- }
-
SCM
irr_gui_addWindow (SCM wrapped_gui_environment,
SCM rectangle,
DECLARE_WRAPPED_TYPE (irr::gui::IGUIEnvironment*, init_gui_environment_type,
gui_environment_p, wrap_gui_environment, unwrap_gui_environment);
+ SCM
+ irr_gui_IGUIEnvironment_addStaticText (SCM gui_environment,
+ SCM text,
+ SCM rectangle,
+ SCM border,
+ SCM word_wrap,
+ SCM parent,
+ SCM id,
+ SCM fill_background);
+
SCM
irr_gui_addImage (SCM wrapped_gui_environment,
SCM image,
SCM rectangle,
SCM rest);
- SCM
- irr_gui_addStaticText (SCM wrapped_gui_environment,
- SCM text,
- SCM rectangle,
- SCM rest);
-
SCM
irr_gui_addWindow (SCM wrapped_gui_environment,
SCM rectangle,