]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - irrlicht/device.scm
dimension2d as a foreign record type
[guile-irrlicht.git] / irrlicht / device.scm
index 9a009ef2cd13f8d5cd3fde000533f10e228a3d1c..25ec8ca78bf0328711471b04a2f3df3660fcb17e 100644 (file)
@@ -22,8 +22,8 @@
   #:use-module (ice-9 match)
   #:use-module (system foreign)
   #:use-module ((irrlicht bindings) #:prefix ffi:)
-  #:use-module ((irrlicht bindings core) #:prefix ffi-core:)
   #:use-module ((irrlicht bindings video) #:prefix ffi-video:)
+  #:use-module (irrlicht util)
   #:export (create-device
             get-cursor-control
             get-file-system
                        ('direct3d9 ffi-video:EDT_DIRECT3D9)
                        ('opengl ffi-video:EDT_OPENGL)
                        ('count ffi-video:EDT_COUNT)))
-        (wsize (make-c-struct ffi-core:dimension2d window-size)))
+        (wsize (foreign-record-pointer window-size)))
     (let ((device (ffi:create-device driver wsize bits
-                                     (if fullscreen 1 0)
-                                     (if stencilbuffer 1 0)
-                                     (if vsync 1 0))))
+                                     (bool->integer fullscreen)
+                                     (bool->integer stencilbuffer)
+                                     (bool->integer vsync))))
       (if (null-pointer? device) #f device))))
 
 (define (get-cursor-control device)
   (ffi:get-scene-manager device))
 
 (define (is-window-active? device)
-  (if (> (ffi:is-window-active device) 0) #t #f))
+  (integer->bool (ffi:is-window-active device)))
 
 (define (set-window-caption! device text)
   (ffi:set-window-caption device (string->pointer text)))
 
 (define (device-run? device)
-  (if (> (ffi:run device) 0) #t #f))
+  (integer->bool (ffi:run device)))
 
 (define (device-drop! device)
-  (if (> (ffi:drop device) 0) #t #f))
+  (integer->bool (ffi:drop device)))