irrlicht.scm \
irrlicht/base.scm \
irrlicht/foreign.scm \
- irrlicht/irr.scm
+ irrlicht/irr.scm \
+ irrlicht/video.scm
(define-module (irrlicht)
#:use-module (irrlicht irr)
#:re-export (create-device
+ get-video-driver
set-window-caption!))
#:use-module (oop goops)
#:use-module (irrlicht base)
#:use-module (irrlicht foreign)
- #:export (<reference-counted>
- <irrlicht-device>
- create-device
- set-window-caption!))
+ #:use-module (irrlicht video))
;; IReferenceCounted
(define-class <reference-counted> (<irrlicht-base>))
+(export <reference-counted>)
+
;; IEventReceiver
(define-class <event-receiver> (<irrlicht-base>))
+(export <event-receiver>)
+
;; IrrlichtDevice
(define-class <irrlicht-device> (<reference-counted>))
vsync
(irr-pointer receiver))))
+(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))
+ (irr_IrrlichtDevice_setWindowCaption (irr-pointer device) text))
+
+(export create-device get-video-driver set-window-caption!)
--- /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 video)
+ #:use-module (oop goops)
+ #:use-module (irrlicht base)
+ #:use-module (irrlicht foreign))
+
+
+;; IVideoDriver
+(define-class <video-driver> (<irrlicht-base>))
+
+(export <video-driver>)
{
init_device_type ();
DEFINE_GSUBR ("irr_createDevice", 7, 0, 0, irr_createDevice);
+ DEFINE_GSUBR ("irr_IrrlichtDevice_getVideoDriver", 1, 0, 0,
+ irr_IrrlichtDevice_getVideoDriver);
DEFINE_GSUBR ("irr_IrrlichtDevice_setWindowCaption", 2, 0, 0,
irr_IrrlichtDevice_setWindowCaption);
DEFINE_GSUBR ("get-timer", 1, 0, 0, irr_getTimer);
return scm_from_pointer ((void*)device, NULL);
}
+ SCM
+ irr_IrrlichtDevice_getVideoDriver (SCM device)
+ {
+ video::IVideoDriver* driver =
+ ((IrrlichtDevice*)scm_to_pointer (device))->getVideoDriver ();
+ return scm_from_pointer ((void*)driver, NULL);
+ }
+
SCM
irr_IrrlichtDevice_setWindowCaption (SCM device,
SCM text)
SCM receiver);
SCM
- irr_IrrlichtDevice_setWindowCaption (SCM wrapped_device,
+ irr_IrrlichtDevice_getVideoDriver (SCM device);
+
+ SCM
+ irr_IrrlichtDevice_setWindowCaption (SCM device,
SCM text);
SCM
#include <libguile.h>
#include "color.h"
-#include "device.h"
#include "gsubr.h"
#include "gui-environment.h"
#include "material.h"
DEFINE_GSUBR ("end-scene", 1, 0, 0, irr_video_endScene);
DEFINE_GSUBR ("get-fps", 1, 0, 0, irr_video_getFPS);
DEFINE_GSUBR ("get-texture", 2, 0, 0, irr_video_getTexture);
- DEFINE_GSUBR ("get-video-driver", 1, 0, 0, irr_getVideoDriver);
DEFINE_GSUBR ("set-transform!", 3, 0, 0, irr_video_setTransform);
}
return SCM_UNSPECIFIED;
}
- SCM
- irr_getVideoDriver (SCM wrapped_obj)
- {
- irr::video::IVideoDriver* driver;
- if (device_p (wrapped_obj))
- {
- driver = unwrap_device (wrapped_obj)->getVideoDriver ();
- }
- else
- {
- scm_error (scm_arg_type_key, NULL, "Cannot get video driver from object: ~S",
- scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
- }
- return wrap_video_driver (driver);
- }
-
irr::video::E_TRANSFORMATION_STATE
scm_to_transformation_state (SCM transformation_state)
{
SCM state,
SCM mat);
- SCM
- irr_getVideoDriver (SCM wrapped_obj);
-
irr::video::E_TRANSFORMATION_STATE
scm_to_transformation_state (SCM transformation_state);