From d5b9b4c374ea66da84610d1e6124bd0773e87348 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Tue, 26 May 2020 08:38:12 +0200 Subject: [PATCH] close-device --- irrlicht.scm | 1 + irrlicht/device.scm | 10 +++++++--- src/device.cpp | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/irrlicht.scm b/irrlicht.scm index 69598fd..24a3a13 100644 --- a/irrlicht.scm +++ b/irrlicht.scm @@ -81,6 +81,7 @@ add-sphere-scene-node! add-static-text! begin-scene + close-device create-device create-fly-circle-animator create-fly-straight-animator diff --git a/irrlicht/device.scm b/irrlicht/device.scm index ce97443..0fdeed7 100644 --- a/irrlicht/device.scm +++ b/irrlicht/device.scm @@ -29,6 +29,10 @@ (define-class () (irr-class #:init-value "IrrlichtDevice")) +(define-method (close-device (device )) + (let ((closeDevice (get-irrlicht-proc "closeDevice" device))) + (closeDevice device))) + (define* (create-device #:key (device-type 'software) (window-size '(640 480)) @@ -99,6 +103,6 @@ (let ((yield (get-irrlicht-proc "yield" device))) (yield device))) -(export create-device get-cursor-control get-file-system get-gui-environment - get-scene-manager get-timer get-video-driver is-window-active? run set-event-receiver! - set-resizable! set-window-caption! yield-device) +(export close-device create-device get-cursor-control get-file-system + get-gui-environment get-scene-manager get-timer get-video-driver is-window-active? run + set-event-receiver! set-resizable! set-window-caption! yield-device) diff --git a/src/device.cpp b/src/device.cpp index dbd251c..02edd85 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -49,6 +49,13 @@ irr_createDevice (SCM device_type, return scm_from_irr_pointer ("", (void*) device); } +SCM +IrrlichtDevice_closeDevice (SCM device) +{ + ((IrrlichtDevice*)scm_to_irr_pointer (device))->closeDevice (); + return SCM_UNSPECIFIED; +} + SCM IrrlichtDevice_getCursorControl (SCM device) { @@ -151,6 +158,7 @@ void init_device (void) { DEFINE_GSUBR ("createDevice", 7, 0, 0, irr_createDevice); + DEFINE_GSUBR ("IrrlichtDevice_closeDevice", 1, 0, 0, IrrlichtDevice_closeDevice); DEFINE_GSUBR ("IrrlichtDevice_getCursorControl", 1, 0, 0, IrrlichtDevice_getCursorControl); DEFINE_GSUBR ("IrrlichtDevice_getFileSystem", 1, 0, 0, IrrlichtDevice_getFileSystem); DEFINE_GSUBR ("IrrlichtDevice_getGUIEnvironment", 1, 0, 0, IrrlichtDevice_getGUIEnvironment); -- 2.39.5