From afe624d2b1339c6b76408ecbfd95d072d2a661ad Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Fri, 4 Oct 2019 17:50:54 +0200 Subject: [PATCH] run and drop device --- examples/hello.scm | 4 ++++ irrlicht.scm | 10 +++++++++- irrlicht/bindings.scm | 12 ++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/examples/hello.scm b/examples/hello.scm index c8643b5..cee3c64 100644 --- a/examples/hello.scm +++ b/examples/hello.scm @@ -25,3 +25,7 @@ (define scene-manager (get-scene-manager device)) (set-window-caption! device "Hello World!") + +(while (run? device)) + +(drop! device) diff --git a/irrlicht.scm b/irrlicht.scm index 6e7ccff..4633241 100644 --- a/irrlicht.scm +++ b/irrlicht.scm @@ -27,7 +27,9 @@ #:export (create-device get-video-driver get-scene-manager - set-window-caption!)) + set-window-caption! + run? + drop!)) (define* (create-device #:optional (device-type 'software) @@ -58,3 +60,9 @@ (define (set-window-caption! device text) (ffi:set-window-caption device (string->pointer text))) + +(define (run? device) + (if (> (ffi:run device) 0) #t #f)) + +(define (drop! device) + (if (> (ffi:drop device) 0) #t #f)) diff --git a/irrlicht/bindings.scm b/irrlicht/bindings.scm index 148a785..e54de96 100644 --- a/irrlicht/bindings.scm +++ b/irrlicht/bindings.scm @@ -46,3 +46,15 @@ void (dynamic-func "irr_IrrlichtDevice_setWindowCaption" cirr) (list '* '*))) + +(define-public run + (pointer->procedure + int + (dynamic-func "irr_IrrlichtDevice_run" cirr) + (list '*))) + +(define-public drop + (pointer->procedure + int + (dynamic-func "irr_IrrlichtDevice_drop" cirr) + (list '*))) -- 2.39.2