]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
Rect foreign record
authorJavier Sancho <jsf@jsancho.org>
Mon, 30 Dec 2019 19:45:38 +0000 (20:45 +0100)
committerJavier Sancho <jsf@jsancho.org>
Mon, 30 Dec 2019 19:45:38 +0000 (20:45 +0100)
examples/01.HelloWorld.scm
irrlicht.scm
irrlicht/bindings/core.scm
irrlicht/device.scm
irrlicht/dimension2d.scm
irrlicht/gui.scm
irrlicht/rect.scm [new file with mode: 0644]

index 40b0acadba2e9809566a6bc82a7527fbc823639d..5a3411609ecfbd8cffce4a6950f78e177e6e596b 100644 (file)
@@ -42,7 +42,7 @@
 (add-static-text!
  gui-env
  "Hello World! This is the Irrlicht Software renderer!"
'(10 10 260 22)
(make-rect 10 10 260 22)
  #:border #t)
 
 ;; load a Quake2 model
index c70a122b5c4f57a7364939b3b49c046c2a984dc2..e7dcb4ba942a6bdeb1dcc26518a67ca1512f61f2 100644 (file)
@@ -28,6 +28,7 @@
            (irrlicht dimension2d)
            (irrlicht gui)
            (irrlicht io)
+           (irrlicht rect)
            (irrlicht scene)
            (irrlicht video)))
         (current-interface
index 8605919dd10a4138812409ed052ef70128b5e68c..20d8e8405ae352061a80f64d42711c78179b00fc 100644 (file)
   #:use-module (system foreign)
   #:use-module (irrlicht util))
 
-;; rect struct
-(define-public rect
-  (list int32 int32 int32 int32))
-
 ;; vector2df struct
 (define-public vector2df
   (list float float float))
index 04b3648e07913f8a689690354d64ff9610c99169..051cddddada3942b0ec3072172f9d38d6900035b 100644 (file)
@@ -52,7 +52,7 @@
                        ('opengl ffi-video:EDT_OPENGL)
                        ('count ffi-video:EDT_COUNT))))
     (let ((device (ffi:create-device driver
-                                     (dimension2d-pointer window-size)
+                                     (dimension2d->pointer window-size)
                                      bits
                                      (bool->integer fullscreen)
                                      (bool->integer stencilbuffer)
index 91de9a4a57c5b83c8623dc33202b2fdc8bb4ccad..6b03cd0e824e3b52c2c47e2a69572e85ff5b87eb 100644 (file)
@@ -24,7 +24,7 @@
   #:export (dimension2d
             make-dimension2d
             dimension2d?
-            dimension2d-pointer
+            dimension2d->pointer
             dimension2d-width
             dimension2d-height))
 
@@ -32,6 +32,6 @@
 (define-foreign-record-type dimension2d
   (make-dimension2d width height)
   dimension2d?
-  dimension2d-pointer
+  dimension2d->pointer
   (width uint32 dimension2d-width)
   (height uint32 dimension2d-height))
index 09102694c5f6b1621ece4a5c3d3274ac52c17059..495a9c748e05905a643005bfb1ce3fb3d9592c20 100644 (file)
@@ -23,6 +23,7 @@
   #:use-module (system foreign)
   #:use-module ((irrlicht bindings core) #:prefix ffi-core:)
   #:use-module ((irrlicht bindings gui) #:prefix ffi-gui:)
+  #:use-module (irrlicht rect)
   #:use-module (irrlicht util)
   #:export (add-static-text!
             gui-draw-all
@@ -37,7 +38,7 @@
                            (fill-background #f))
   (ffi-gui:add-static-text gui-env
                            (string->pointer text)
-                           (make-c-struct ffi-core:rect rectangle)
+                           (rect->pointer rectangle)
                            (bool->integer border)
                            (bool->integer word-wrap)
                            parent
diff --git a/irrlicht/rect.scm b/irrlicht/rect.scm
new file mode 100644 (file)
index 0000000..f481a7c
--- /dev/null
@@ -0,0 +1,41 @@
+;;; guile-irrlicht --- FFI bindings for Irrlicht Engine
+;;; Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+;;;
+;;; This file is part of guile-irrlicht.
+;;;
+;;; Guile-irrlicht is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU Lesser General Public License as
+;;; published by the Free Software Foundation; either version 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; Guile-irrlicht is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with guile-irrlicht.  If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+
+(define-module (irrlicht rect)
+  #:use-module (system foreign)
+  #:use-module (irrlicht util)
+  #:export (rect
+            make-rect
+            rect?
+            rect->pointer
+            rect-x
+            rect-y
+            rect-x2
+            rect-y2))
+
+;; rect struct
+(define-foreign-record-type rect
+  (make-rect x y x2 y2)
+  rect?
+  rect->pointer
+  (x int32 rect-x)
+  (y int32 rect-y)
+  (x2 int32 rect-x2)
+  (y2 int32 rect-y2))