X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=irrlicht%2Fgui.scm;h=3d0e091e06b47ef11b44c0d4700f229580e056a1;hb=c4d9e46f268b4f7f738dd77685c632991125cec9;hp=bd5eedee204e0d8e1030956390b1770165ccdebc;hpb=71e6e638cba09643fca5dccd1b7295b7db0def06;p=guile-irrlicht.git diff --git a/irrlicht/gui.scm b/irrlicht/gui.scm index bd5eede..3d0e091 100644 --- a/irrlicht/gui.scm +++ b/irrlicht/gui.scm @@ -1,5 +1,5 @@ ;;; guile-irrlicht --- FFI bindings for Irrlicht Engine -;;; Copyright (C) 2019 Javier Sancho +;;; Copyright (C) 2020 Javier Sancho ;;; ;;; This file is part of guile-irrlicht. ;;; @@ -19,35 +19,53 @@ (define-module (irrlicht gui) - #:use-module (ice-9 match) - #:use-module (system foreign) - #:use-module ((irrlicht bindings core) #:prefix ffi-core:) - #:use-module ((irrlicht bindings gui) #:prefix ffi-gui:) - #:use-module (irrlicht util) - #:export (add-static-text! - gui-draw-all - set-visible-cursor!)) - -(define* (add-static-text! gui-env text rectangle - #:key - (border #f) - (word-wrap #t) - (parent %null-pointer) - (id -1) - (fill-background #f)) - (ffi-gui:add-static-text gui-env - (string->pointer text) - (foreign-record->pointer rectangle) - (bool->integer border) - (bool->integer word-wrap) - parent - id - (bool->integer fill-background))) - -(define (gui-draw-all gui-env) - (ffi-gui:draw-all gui-env)) - -(define (set-visible-cursor! cursor-control visible) - (ffi-gui:set-visible-cursor - cursor-control - (bool->integer visible))) + #:use-module (oop goops) + #:use-module (ice-9 optargs) + #:use-module (irrlicht base) + #:use-module (irrlicht foreign) + #:use-module (irrlicht io) + #:use-module (irrlicht irr)) + + +;; IGUIElement +(define-class ( ) + (irr-class #:init-value "IGUIElement" #:getter irr-class)) + +(export ) + + +;; IGUIEnvironment +(define-class () + (irr-class #:init-value "IGUIEnvironment" #:getter irr-class)) + +(define-method (add-static-text! (gui-environment ) text rectangle . rest) + (let-keywords rest #f + ((border #f) + (word-wrap #t) + (parent (make )) + (id -1) + (fill-background #f)) + (make + #:irr-pointer + ((get-irrlicht-proc "addStaticText" gui-environment parent) + gui-environment + text + rectangle + border + word-wrap + parent + id + fill-background)))) + +(define-method (draw-all (gui-environment )) + ((get-irrlicht-proc "drawAll" gui-environment) + gui-environment)) + +(export add-static-text! draw-all) + + +;; IGUIStaticText +(define-class () + (irr-class #:init-value "IGUIStaticText" #:getter irr-class)) + +(export )