- #: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 <gui-element> (<attribute-exchanging-object> <event-receiver>)
+ (irr-class #:init-value "IGUIElement"))
+
+(export <gui-element>)
+
+
+;; IGUIEnvironment
+(define-class <gui-environment> (<reference-counted>)
+ (irr-class #:init-value "IGUIEnvironment"))
+
+(define-method (add-static-text! (gui-environment <gui-environment>) text rectangle . rest)
+ (let-keywords rest #f
+ ((border #f)
+ (word-wrap #t)
+ (parent (make <gui-element>))
+ (id -1)
+ (fill-background #f))
+ (make <gui-static-text>
+ #: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 <gui-environment>))
+ ((get-irrlicht-proc "drawAll" gui-environment)
+ gui-environment))
+
+(export <gui-environment> add-static-text! draw-all)
+
+
+;; IGUIStaticText
+(define-class <gui-static-text> (<gui-element>)
+ (irr-class #:init-value "IGUIStaticText"))
+
+(export <gui-static-text>)