From: Javier Sancho Date: Fri, 4 Oct 2019 15:50:54 +0000 (+0200) Subject: run and drop device X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=afe624d2b1339c6b76408ecbfd95d072d2a661ad;p=guile-irrlicht.git run and drop device --- 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 '*)))