X-Git-Url: https://git.jsancho.org/?p=guile-irrlicht.git;a=blobdiff_plain;f=irrlicht%2Fgui.scm;fp=irrlicht%2Fgui.scm;h=0000000000000000000000000000000000000000;hp=3430e4d3a3cfa180414f10943f3eca950271f0a2;hb=d392bfc335713faab44275624d8fd78139880975;hpb=3bb58c2b45af12c0f9c9eac648e67ac6fa90e104 diff --git a/irrlicht/gui.scm b/irrlicht/gui.scm deleted file mode 100644 index 3430e4d..0000000 --- a/irrlicht/gui.scm +++ /dev/null @@ -1,264 +0,0 @@ -;;; guile-irrlicht --- FFI bindings for Irrlicht Engine -;;; Copyright (C) 2020 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 gui) - #:use-module (oop goops) - #:use-module (ice-9 optargs) - #:use-module (irrlicht base) - #:use-module (irrlicht foreign) - #:use-module ((irrlicht io) #:select ()) - #:use-module ((irrlicht irr) #:select ( ))) - - -;; ICursorControl -(define-class () - (irr-class #:init-value "ICursorControl")) - -(define-method (set-visible! (cursor-control ) visible) - (let ((setVisible (get-irrlicht-proc "setVisible" cursor-control))) - (setVisible cursor-control visible))) - -(export set-visible!) - - -;; IGUIElement -(define-class ( ) - (irr-class #:init-value "IGUIElement")) - -(define-method (get-id (element )) - (let ((getID (get-irrlicht-proc "getID" element))) - (getID element))) - -(export get-id) - - -;; IGUIEnvironment -(define-class () - (irr-class #:init-value "IGUIEnvironment")) - -(define-method (add-button! (gui-environment ) rectangle . rest) - (let-keywords rest #f - ((parent (make )) - (id -1) - (text "") - (tooltiptext "")) - (let* ((addButton (get-irrlicht-proc "addButton" gui-environment parent)) - (button (addButton gui-environment rectangle parent id text tooltiptext))) - (mem-wrapped button)))) - -(define-method (add-editbox! (gui-environment ) text rectangle . rest) - (let-keywords rest #f - ((border #t) - (parent (make )) - (id -1)) - (let* ((addEditBox (get-irrlicht-proc "addEditBox" gui-environment parent)) - (editbox (addEditBox gui-environment text rectangle border parent id))) - (mem-wrapped editbox)))) - -(define-method (add-file-open-dialog! (gui-environment ) . rest) - (let-keywords rest #f - ((title "") - (modal #t) - (parent (make )) - (id -1) - (restore-cwd #f) - (start-dir "")) - (let* ((addFileOpenDialog (get-irrlicht-proc "addFileOpenDialog" gui-environment parent)) - (dialog (addFileOpenDialog gui-environment title modal parent id restore-cwd start-dir))) - (mem-wrapped dialog)))) - -(define-method (add-image! (gui-environment ) image pos . rest) - (let-keywords rest #f - ((use-alpha-channel #t) - (parent (make )) - (id -1) - (text "")) - (let* ((addImage (get-irrlicht-proc "addImage" gui-environment parent)) - (img (addImage gui-environment image pos use-alpha-channel parent id text))) - (mem-wrapped img)))) - -(define-method (add-listbox! (gui-environment ) rectangle . rest) - (let-keywords rest #f - ((parent (make )) - (id -1) - (draw-background #f)) - (let* ((addListBox (get-irrlicht-proc "addListBox" gui-environment parent)) - (listbox (addListBox gui-environment rectangle parent id draw-background))) - (mem-wrapped listbox)))) - -(define-method (add-scrollbar! (gui-environment ) horizontal rectangle . rest) - (let-keywords rest #f - ((parent (make )) - (id -1)) - (let* ((addScrollBar (get-irrlicht-proc "addScrollBar" gui-environment parent)) - (scrollbar (addScrollBar gui-environment horizontal rectangle parent id))) - (mem-wrapped scrollbar)))) - -(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)) - (let* ((addStaticText (get-irrlicht-proc "addStaticText" gui-environment parent)) - (static-text (addStaticText gui-environment text rectangle border word-wrap parent - id fill-background))) - (mem-wrapped static-text)))) - -(define-method (add-window! (gui-environment ) rectangle . rest) - (let-keywords rest #f - ((modal #f) - (text "") - (parent (make )) - (id -1)) - (let* ((addWindow (get-irrlicht-proc "addWindow" gui-environment parent)) - (window (addWindow gui-environment rectangle modal text parent id))) - (mem-wrapped window)))) - -(define-method (draw-all (gui-environment )) - ((get-irrlicht-proc "drawAll" gui-environment) - gui-environment)) - -(define-method (get-built-in-font (gui-environment )) - (let ((getBuiltInFont (get-irrlicht-proc "getBuiltInFont" gui-environment))) - (getBuiltInFont gui-environment))) - -(define-method (get-font (gui-environment ) filename) - (let* ((getFont (get-irrlicht-proc "getFont" gui-environment)) - (font (getFont gui-environment filename))) - (if (null-object? font) - (error "In procedure get-font: Font unavailable") - font))) - -(define-method (get-skin (gui-environment )) - (let ((getSkin (get-irrlicht-proc "getSkin" gui-environment))) - (getSkin gui-environment))) - -(export add-button! add-editbox! add-file-open-dialog! add-image! add-listbox! - add-scrollbar! add-static-text! add-window! draw-all get-built-in-font get-font get-skin) - - -;; IGUIStaticText -(define-class () - (irr-class #:init-value "IGUIStaticText")) - -(define-method (set-override-color! (static-text ) color) - (let ((setOverrideColor (get-irrlicht-proc "setOverrideColor" static-text))) - (setOverrideColor static-text color))) - -(export set-override-color!) - - -;; IGUIImage -(define-class () - (irr-class #:init-value "IGUIImage")) - -(export ) - - -;; IGUISkin -(define-class () - (irr-class #:init-value "IGUISkin")) - -(define-method (get-color (skin ) color) - (let ((getColor (get-irrlicht-proc "getColor" skin))) - (getColor skin color))) - -(define-method (set-font! (skin ) font . rest) - (let-keywords rest #f - ((which 'default)) - (let ((setFont (get-irrlicht-proc "setFont" skin))) - (setFont skin font which)))) - -(define-method (set-color! (skin ) which new-color) - (let ((setColor (get-irrlicht-proc "setColor" skin))) - (setColor skin which new-color))) - -(export get-color set-font! set-color!) - - -;; IGUIFont -(define-class () - (irr-class #:init-value "IGUIFont")) - -(export ) - - -;; IGUIButton -(define-class () - (irr-class #:init-value "IGUIButton")) - -(export ) - - -;; IGUIScrollBar -(define-class () - (irr-class #:init-value "IGUIScrollBar")) - -(define-method (get-position (scrollbar )) - (let ((getPos (get-irrlicht-proc "getPos" scrollbar))) - (getPos scrollbar))) - -(define-method (set-max! (scrollbar ) max) - (let ((setMax (get-irrlicht-proc "setMax" scrollbar))) - (setMax scrollbar max))) - -(define-method (set-position! (scrollbar ) pos) - (let ((setPos (get-irrlicht-proc "setPos" scrollbar))) - (setPos scrollbar pos))) - -(export get-position set-max! set-position!) - - -;; IGUIListBox -(define-class () - (irr-class #:init-value "IGUIListBox")) - -(define-method (add-item! (listbox ) text) - (let ((addItem (get-irrlicht-proc "addItem" listbox))) - (addItem listbox text))) - -(export add-item!) - - -;; IGUIEditBox -(define-class () - (irr-class #:init-value "IGUIEditBox")) - -(export ) - - -;; IGUIWindow -(define-class () - (irr-class #:init-value "IGUIWindow")) - -(export ) - - -;; IGUIFileOpenDialog -(define-class () - (irr-class #:init-value "IGUIFileOpenDialog")) - -(define-method (get-file-name (dialog )) - (let ((getFileName (get-irrlicht-proc "getFileName" dialog))) - (getFileName dialog))) - -(export get-file-name)