X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=irrlicht.scm;h=f3474c63dd48071b6eee9be7d459e7267f600ae7;hb=eaa186435f0c641c53841d8d15581525bd542249;hp=0ff6e3a6083358af344f25911a9f21b2be555abb;hpb=6926f985d7c92c543969ae8957645815dc58f098;p=guile-irrlicht.git diff --git a/irrlicht.scm b/irrlicht.scm index 0ff6e3a..f3474c6 100644 --- a/irrlicht.scm +++ b/irrlicht.scm @@ -18,52 +18,19 @@ ;;; . -(define-module (irrlicht) - #: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:) - #:export (create-device - get-video-driver - get-scene-manager - set-window-caption! - device-run? - device-drop!)) - -(define* (create-device #:optional - (device-type 'software) - (window-size '(640 480)) - (bits 16) - (fullscreen #f) - (stencilbuffer #f) - (vsync #f)) - (let ((driver (match device-type - ('null ffi-video:EDT_NULL) - ('software ffi-video:EDT_SOFTWARE) - ('burnings ffi-video:EDT_BURNINGSVIDEO) - ('direct3d8 ffi-video:EDT_DIRECT3D8) - ('direct3d9 ffi-video:EDT_DIRECT3D9) - ('opengl ffi-video:EDT_OPENGL) - ('count ffi-video:EDT_COUNT))) - (wsize (make-c-struct ffi-core:dimension2d window-size))) - (let ((device (ffi:create-device driver wsize bits - (if fullscreen 1 0) - (if stencilbuffer 1 0) - (if vsync 1 0)))) - (if (null-pointer? device) #f device)))) - -(define (get-video-driver device) - (ffi:get-video-driver device)) - -(define (get-scene-manager device) - (ffi:get-scene-manager 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)) - -(define (device-drop! device) - (if (> (ffi:drop device) 0) #t #f)) +(define-module (irrlicht)) + +(eval-when (eval load compile) + ;; load public symbols into current module + (let ((public-modules + '((irrlicht device) + (irrlicht gui) + (irrlicht io) + (irrlicht scene) + (irrlicht video))) + (current-interface + (module-public-interface (current-module)))) + (for-each + (lambda (m) + (module-use! current-interface (resolve-interface m))) + public-modules)))