From 08677eca02dfe600ae413ec9f052308b322ad767 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Wed, 2 Oct 2019 17:19:37 +0200 Subject: [PATCH] Window size for create-device --- irrlicht.scm | 11 ++++++++--- irrlicht/bindings.scm | 2 +- irrlicht/bindings/core.scm | 26 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 irrlicht/bindings/core.scm diff --git a/irrlicht.scm b/irrlicht.scm index d6d64ad..8c51780 100644 --- a/irrlicht.scm +++ b/irrlicht.scm @@ -20,11 +20,15 @@ (define-module (irrlicht) #:use-module (ice-9 match) + #:use-module (system foreign) #:use-module ((irrlicht bindings) #:prefix ffi:) + #:use-module ((irrlicht bindings core) #:prefix ffi-core:) #:use-module ((irrlicht bindings video) #:prefix ffi-video:) #:export (create-device)) -(define* (create-device #:optional (device-type 'software)) +(define* (create-device #:optional + (device-type 'software) + (window-size '(640 480))) (let ((driver (match device-type ('null ffi-video:EDT_NULL) ('software ffi-video:EDT_SOFTWARE) @@ -32,5 +36,6 @@ ('direct3d8 ffi-video:EDT_DIRECT3D8) ('direct3d9 ffi-video:EDT_DIRECT3D9) ('opengl ffi-video:EDT_OPENGL) - ('count ffi-video:EDT_COUNT)))) - (ffi:create-device driver))) + ('count ffi-video:EDT_COUNT))) + (wsize (make-c-struct ffi-core:dimension2d window-size))) + (ffi:create-device driver wsize))) diff --git a/irrlicht/bindings.scm b/irrlicht/bindings.scm index 8ef1fa0..d2647ff 100644 --- a/irrlicht/bindings.scm +++ b/irrlicht/bindings.scm @@ -28,4 +28,4 @@ (pointer->procedure int (dynamic-func "irr_createDevice" cirr) - (list int))) + (list int '*))) diff --git a/irrlicht/bindings/core.scm b/irrlicht/bindings/core.scm new file mode 100644 index 0000000..2058d8a --- /dev/null +++ b/irrlicht/bindings/core.scm @@ -0,0 +1,26 @@ +;;; guile-irrlicht --- FFI bindings for Irrlicht Engine +;;; Copyright (C) 2019 Javier Sancho +;;; +;;; 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 +;;; . + + +(define-module (irrlicht bindings core) + #:use-module (system foreign)) + +;; dimension2d struct +(define-public dimension2d + (list uint32 uint32)) -- 2.39.5