;;; http://irrlicht.sourceforge.net/docu/example001.html
-(use-modules (irrlicht))
+(use-modules (irrlicht)
+ (oop goops))
+
+(define (media-path file)
+ (let ((current-path (dirname (current-filename))))
+ (string-join (list current-path "media" file) file-name-separator-string)))
;; start up the engine
(define device
(create-device
- #:device-type 'software
- #:window-size '(640 480)))
+ EDT-SOFTWARE
+ (make <dimension2du> #:args '(640 480))))
-(set-window-caption! device "Hello World! - Irrlicht Engine Demo")
+(set-window-caption device "Hello World! - Irrlicht Engine Demo")
(define driver (get-video-driver device))
(define scene-manager (get-scene-manager device))
(define gui-env (get-gui-environment device))
;; static text
-(add-static-text!
+(add-static-text
gui-env
"Hello World! This is the Irrlicht Software renderer!"
- '(10 10 260 22)
- #:border #t)
+ (make <recti> #:args '(10 10 260 22))
+ #t)
;; load a Quake2 model
-(define mesh (get-mesh scene-manager "media/sydney.md2"))
-(define node (add-animated-mesh-scene-node! scene-manager mesh))
-(set-material-flag! node 'lighting #f)
-(set-md2-animation! node 'stand)
-(set-material-texture! node 0 (get-texture driver "media/sydney.bmp"))
+(define mesh (get-mesh scene-manager (media-path "sydney.md2")))
+(define node (add-animated-mesh-scene-node scene-manager mesh))
+(set-material-flag node EMF-LIGHTING #f)
+(set-md2-animation node EMAT-STAND)
+(set-material-texture node 0 (get-texture driver (media-path "sydney.bmp")))
;; place camera
-(add-camera-scene-node! scene-manager #:position '(0 30 -40) #:lookat '(0 5 0))
+(let ((position (make <vector3df> #:args '(0 30 -40)))
+ (lookat (make <vector3df> #:args '(0 5 0))))
+ (add-camera-scene-node scene-manager node position lookat))
;; draw everything
-(while (run device)
- (begin-scene driver #:color '(255 100 101 140))
- (draw-all scene-manager)
- (draw-all gui-env)
- (end-scene driver))
+(let ((back-buffer #t)
+ (z-buffer #t)
+ (color (make <s-color> #:args '(255 100 101 140))))
+ (while (run device)
+ (begin-scene driver back-buffer z-buffer color)
+ (draw-all scene-manager)
+ (draw-all gui-env)
+ (end-scene driver)))
;; delete device
-(drop! device)
+(drop device)
(exit #t)
using namespace gui;
%}
+%typecheck(SWIG_TYPECHECK_POINTER) const IRR_CHAR_TYPE &
+{
+ $1 = scm_is_string ($input);
+}
+%typemap(in) const IRR_CHAR_TYPE &
+{
+ $1 = ($ltype) scm_to_utf8_string ($input);
+}
+%typemap(freearg) const IRR_CHAR_TYPE &
+{
+ free ($1);
+}
+
+%typecheck(SWIG_TYPECHECK_POINTER) const IRR_WCHAR_TYPE &
+{
+ $1 = scm_is_string ($input);
+}
+%typemap(in) const IRR_WCHAR_TYPE &
+{
+ $1 = ($ltype) scm_to_utf32_string ($input);
+}
+%typemap(freearg) const IRR_WCHAR_TYPE &
+{
+ free ($1);
+}
+
+%typecheck(SWIG_TYPECHECK_POINTER) const IRR_IO_PATH &
+{
+ $1 = scm_is_string ($input);
+}
+%typemap(in) const IRR_IO_PATH &
+{
+ $1 = new $*1_ltype (scm_to_utf8_string ($input));
+}
+%typemap(freearg) const IRR_IO_PATH &
+{
+ delete $1;
+}
+
+%include irrString.h
+%apply const IRR_CHAR_TYPE & { const irr::core::stringc & };
+%apply const IRR_WCHAR_TYPE & { const wchar_t *, const irr::core::stringw & };
+%apply const IRR_IO_PATH & { const irr::io::path &, const path &, irr::io::path &, path & };
+
typedef int s32;
typedef unsigned int u32;
typedef float f32;
typedef double f64;
+#define _IRR_DEPRECATED_
+
%rename(add) operator+;
%rename(substract) operator-;
%rename(product) operator*;
%include dimension2d.h
%template(dimension2df) irr::core::dimension2d<irr::f32>;
-%template(dimension2ds) irr::core::dimension2d<irr::s32>;
%template(dimension2du) irr::core::dimension2d<irr::u32>;
+%template(dimension2di) irr::core::dimension2d<irr::s32>;
+
+%include rect.h
+%template(rectf) irr::core::rect<irr::f32>;
+%template(recti) irr::core::rect<irr::s32>;
+
+%include vector3d.h
+%template(vector3df) irr::core::vector3d<irr::f32>;
+%template(vector3di) irr::core::vector3d<irr::s32>;
%rename("%(undercase)s", %$not %$isconstant, %$not %$isenumitem) "";
%feature("constasvar");
%include EDriverTypes.h
+%include EMaterialFlags.h
%include IrrCompileConfig.h
+
+%rename("%(regex:/(.*)SColor(.*)/\\1s_color\\2/)s") "";
+%rename(get_color_alpha) irr::video::SColor::getAlpha;
+%rename(get_color_red) irr::video::SColor::getRed;
+%rename(get_color_green) irr::video::SColor::getGreen;
+%rename(get_color_blue) irr::video::SColor::getBlue;
+%rename(get_color_average) irr::video::SColor::getAverage;
+%rename(get_colorf_alpha) irr::video::SColorf::getAlpha;
+%rename(get_colorf_red) irr::video::SColorf::getRed;
+%rename(get_colorf_green) irr::video::SColorf::getGreen;
+%rename(get_colorf_blue) irr::video::SColorf::getBlue;
+%rename(get_colorf_average) irr::video::SColorf::getAverage;
+%include SColor.h
+
+%rename("%(regex:/(.*)IAnimatedMesh(.*)/\\1animated_mesh\\2/)s") "";
+%rename (set_md2_animation) setMD2Animation;
+%include IAnimatedMesh.h
+%include IAnimatedMeshMD2.h
+%include SAnimatedMesh.h
+
+%rename("%(regex:/(.*)ISceneNode(.*)/\\1scene_node\\2/)s") "";
+%include ISceneNode.h
+
+%rename("%(regex:/(.*)IAnimatedMeshSceneNode(.*)/\\1animated_mesh_scene_node\\2/)s") "";
+%include IAnimatedMeshSceneNode.h
+
+%rename("%(regex:/(.*)IGUIStaticText(.*)/\\1gui_static_text\\2/)s") "";
+%include IGUIStaticText.h
+
+%rename(get_gui_environment) getGUIEnvironment;
+%rename("%(regex:/(.*)IGUIEnvironment(.*)/\\1gui_environment\\2/)s") "";
+%include IGUIEnvironment.h
+
+%rename("%(regex:/(.*)ISceneManager(.*)/\\1scene_manager\\2/)s") "";
+%include ISceneManager.h
+
+%ignore irr::video::IVideoDriver::createImage;
+%rename(apply_material) apply;
+%rename("%(regex:/(.*)IVideoDriver(.*)/\\1video_driver\\2/)s") "";
+%include IVideoDriver.h
+
+%rename(yield_device) yield;
+%rename(sleep_device) sleep;
+%include IrrlichtDevice.h
%include irrlicht.h
%scheme %{ (load-extension "libguile-irrlicht" "scm_init_irrlicht_module") %}