From 73e48b7e6472724899af8284491802e950156004 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Mon, 11 May 2020 08:36:03 +0200 Subject: [PATCH] get-mesh is-empty? --- examples/01-hello-world.scm | 2 +- irrlicht.scm | 4 ++++ irrlicht/base.scm | 6 +++++- irrlicht/scene.scm | 24 +++++++++++++++++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) 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) -- 2.39.5