From: Javier Sancho Date: Mon, 11 May 2020 06:36:03 +0000 (+0200) Subject: get-mesh is-empty? X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=73e48b7e6472724899af8284491802e950156004;p=guile-irrlicht.git get-mesh is-empty? --- diff --git a/examples/01-hello-world.scm b/examples/01-hello-world.scm index b480c89..4029b7e 100644 --- a/examples/01-hello-world.scm +++ b/examples/01-hello-world.scm @@ -47,7 +47,7 @@ ;; load a Quake2 model (define mesh (get-mesh scene-manager "media/sydney.md2")) -(when (not mesh) +(when (is-empty? mesh) (drop! device) (exit #f)) diff --git a/irrlicht.scm b/irrlicht.scm index d6c4b90..2930493 100644 --- a/irrlicht.scm +++ b/irrlicht.scm @@ -19,11 +19,15 @@ (define-module (irrlicht) + #:use-module (irrlicht base) #:use-module (irrlicht device) #:use-module (irrlicht gui) + #:use-module (irrlicht scene) #:re-export (add-static-text! create-device get-gui-environment + get-mesh get-scene-manager get-video-driver + is-empty? set-window-caption!)) diff --git a/irrlicht/base.scm b/irrlicht/base.scm index 4a5d9ae..dba889b 100644 --- a/irrlicht/base.scm +++ b/irrlicht/base.scm @@ -23,8 +23,12 @@ #:use-module (system foreign) #:export ( irr-class - irr-pointer)) + irr-pointer + is-empty?)) (define-class () (irr-class #:init-value "" #:getter irr-class) (irr-pointer #:init-value %null-pointer #:getter irr-pointer #:init-keyword #:irr-pointer)) + +(define-method (is-empty? (obj )) + (equal? (irr-pointer obj) %null-pointer)) diff --git a/irrlicht/scene.scm b/irrlicht/scene.scm index e5cd422..6f6d5e9 100644 --- a/irrlicht/scene.scm +++ b/irrlicht/scene.scm @@ -20,12 +20,34 @@ (define-module (irrlicht scene) #:use-module (oop goops) + #:use-module (irrlicht base) #:use-module (irrlicht foreign) #:use-module (irrlicht irr)) +;; IMesh +(define-class () + (irr-class #:init-value "IMesh" #:getter irr-class)) + +(export ) + + +;; IAnimatedMesh +(define-class () + (irr-class #:init-value "IAnimatedMesh" #:getter irr-class)) + +(export ) + + ;; ISceneManager (define-class () (irr-class #:init-value "ISceneManager" #:getter irr-class)) -(export ) +(define-method (get-mesh (scene-manager ) filename) + (make + #:irr-pointer + ((get-irrlicht-proc "getMesh" scene-manager) + (irr-pointer scene-manager) + filename))) + +(export get-mesh)