1 /* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
3 Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
5 This file is part of guile-irrlicht.
7 guile-irrlicht is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 3 of the
10 License, or (at your option) any later version.
12 guile-irrlicht is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with guile-irrlicht. If not, see
19 <http://www.gnu.org/licenses/>.
22 #include <irrlicht/irrlicht.h>
25 #include "dimension2d.h"
26 #include "driver-types.h"
34 irr_createDevice (SCM device_type,
42 IrrlichtDevice* device =
43 createDevice (scm_to_driver_type (device_type),
44 scm_to_dimension2d_u32 (window_size),
46 scm_to_bool (fullscreen),
47 scm_to_bool (stencilbuffer),
49 (IEventReceiver*)scm_to_irr_pointer (receiver));
50 return scm_from_pointer ((void*)device, NULL);
54 IrrlichtDevice_getCursorControl (SCM device)
56 gui::ICursorControl* cursor_control =
57 ((IrrlichtDevice*)scm_to_irr_pointer (device))->getCursorControl ();
58 return scm_from_pointer ((void*)cursor_control, NULL);
62 IrrlichtDevice_getFileSystem (SCM device)
64 io::IFileSystem* file_system =
65 ((IrrlichtDevice*)scm_to_irr_pointer (device))->getFileSystem ();
66 return scm_from_pointer ((void*)file_system, NULL);
70 IrrlichtDevice_getGUIEnvironment (SCM device)
72 gui::IGUIEnvironment* gui_env =
73 ((IrrlichtDevice*)scm_to_irr_pointer (device))->getGUIEnvironment ();
74 return scm_from_pointer ((void*)gui_env, NULL);
78 IrrlichtDevice_getSceneManager (SCM device)
80 scene::ISceneManager* manager =
81 ((IrrlichtDevice*)scm_to_irr_pointer (device))->getSceneManager ();
82 return scm_from_pointer ((void*)manager, NULL);
86 IrrlichtDevice_getTimer (SCM device)
89 ((IrrlichtDevice*)scm_to_irr_pointer (device))->getTimer ();
90 return scm_from_pointer ((void*)timer, NULL);
94 IrrlichtDevice_getVideoDriver (SCM device)
96 video::IVideoDriver* driver =
97 ((IrrlichtDevice*)scm_to_irr_pointer (device))->getVideoDriver ();
98 return scm_from_pointer ((void*)driver, NULL);
102 IrrlichtDevice_isWindowActive (SCM device)
105 (((IrrlichtDevice*)scm_to_irr_pointer (device))->isWindowActive ());
109 IrrlichtDevice_run (SCM device)
112 (((IrrlichtDevice*)scm_to_irr_pointer (device))->run ());
115 template <typename TEventReceiver>
117 IrrlichtDevice_setEventReceiver (SCM device,
120 ((IrrlichtDevice*)scm_to_irr_pointer (device))->
121 setEventReceiver ((TEventReceiver)scm_to_irr_pointer (receiver));
122 return SCM_UNSPECIFIED;
126 IrrlichtDevice_setResizable (SCM device,
129 ((IrrlichtDevice*)scm_to_irr_pointer (device))->
130 setResizable (scm_to_bool (resize));
131 return SCM_UNSPECIFIED;
135 IrrlichtDevice_setWindowCaption (SCM device,
138 ((IrrlichtDevice*)scm_to_irr_pointer (device))->
139 setWindowCaption (scm_to_wide_char_string (text));
140 return SCM_UNSPECIFIED;
144 IrrlichtDevice_yield (SCM device)
146 ((IrrlichtDevice*)scm_to_irr_pointer (device))->yield ();
147 return SCM_UNSPECIFIED;
153 DEFINE_GSUBR ("createDevice", 7, 0, 0, irr_createDevice);
154 DEFINE_GSUBR ("IrrlichtDevice_getCursorControl", 1, 0, 0, IrrlichtDevice_getCursorControl);
155 DEFINE_GSUBR ("IrrlichtDevice_getFileSystem", 1, 0, 0, IrrlichtDevice_getFileSystem);
156 DEFINE_GSUBR ("IrrlichtDevice_getGUIEnvironment", 1, 0, 0, IrrlichtDevice_getGUIEnvironment);
157 DEFINE_GSUBR ("IrrlichtDevice_getSceneManager", 1, 0, 0, IrrlichtDevice_getSceneManager);
158 DEFINE_GSUBR ("IrrlichtDevice_getTimer", 1, 0, 0, IrrlichtDevice_getTimer);
159 DEFINE_GSUBR ("IrrlichtDevice_getVideoDriver", 1, 0, 0, IrrlichtDevice_getVideoDriver);
160 DEFINE_GSUBR ("IrrlichtDevice_isWindowActive", 1, 0, 0, IrrlichtDevice_isWindowActive);
161 DEFINE_GSUBR ("IrrlichtDevice_run", 1, 0, 0, IrrlichtDevice_run);
162 DEFINE_GSUBR ("IrrlichtDevice_setEventReceiver_IEventReceiver", 2, 0, 0,
163 IrrlichtDevice_setEventReceiver<IEventReceiver*>);
164 DEFINE_GSUBR ("IrrlichtDevice_setResizable", 2, 0, 0, IrrlichtDevice_setResizable);
165 DEFINE_GSUBR ("IrrlichtDevice_setWindowCaption", 2, 0, 0, IrrlichtDevice_setWindowCaption);
166 DEFINE_GSUBR ("IrrlichtDevice_yield", 1, 0, 0, IrrlichtDevice_yield);