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"
35 irr_createDevice (SCM device_type,
43 IrrlichtDevice* device =
44 createDevice (scm_to_driver_type (device_type),
45 scm_to_dimension2d_u32 (window_size),
47 scm_to_bool (fullscreen),
48 scm_to_bool (stencilbuffer),
50 (IEventReceiver*)scm_to_pointer (receiver));
51 return scm_from_pointer ((void*)device, NULL);
56 IrrlichtDevice_getCursorControl (SCM device)
58 gui::ICursorControl* cursor_control =
59 ((IrrlichtDevice*)scm_to_pointer (device))->getCursorControl ();
60 return scm_from_pointer ((void*)cursor_control, NULL);
65 IrrlichtDevice_getFileSystem (SCM device)
67 io::IFileSystem* file_system =
68 ((IrrlichtDevice*)scm_to_pointer (device))->getFileSystem ();
69 return scm_from_pointer ((void*)file_system, NULL);
74 IrrlichtDevice_getGUIEnvironment (SCM device)
76 gui::IGUIEnvironment* gui_env =
77 ((IrrlichtDevice*)scm_to_pointer (device))->getGUIEnvironment ();
78 return scm_from_pointer ((void*)gui_env, NULL);
83 IrrlichtDevice_getSceneManager (SCM device)
85 scene::ISceneManager* manager =
86 ((IrrlichtDevice*)scm_to_pointer (device))->getSceneManager ();
87 return scm_from_pointer ((void*)manager, NULL);
92 IrrlichtDevice_getTimer (SCM device)
95 ((IrrlichtDevice*)scm_to_pointer (device))->getTimer ();
96 return scm_from_pointer ((void*)timer, NULL);
101 IrrlichtDevice_getVideoDriver (SCM device)
103 video::IVideoDriver* driver =
104 ((IrrlichtDevice*)scm_to_pointer (device))->getVideoDriver ();
105 return scm_from_pointer ((void*)driver, NULL);
110 IrrlichtDevice_isWindowActive (SCM device)
113 (((IrrlichtDevice*)scm_to_pointer (device))->isWindowActive ());
118 IrrlichtDevice_run (SCM device)
121 (((IrrlichtDevice*)scm_to_pointer (device))->run ());
125 template <typename TEventReceiver>
127 IrrlichtDevice_setEventReceiver (SCM device,
130 ((IrrlichtDevice*)scm_to_pointer (device))->
131 setEventReceiver ((TEventReceiver)scm_to_pointer (receiver));
132 return SCM_UNSPECIFIED;
137 IrrlichtDevice_setResizable (SCM device,
140 ((IrrlichtDevice*)scm_to_pointer (device))->
141 setResizable (scm_to_bool (resize));
142 return SCM_UNSPECIFIED;
147 IrrlichtDevice_setWindowCaption (SCM device,
150 ((IrrlichtDevice*)scm_to_pointer (device))->
151 setWindowCaption (scm_to_wide_char_string (text));
152 return SCM_UNSPECIFIED;
157 IrrlichtDevice_yield (SCM device)
159 ((IrrlichtDevice*)scm_to_pointer (device))->yield ();
160 return SCM_UNSPECIFIED;
169 DEFINE_GSUBR ("createDevice", 7, 0, 0, irr_createDevice);
170 DEFINE_GSUBR ("IrrlichtDevice_getCursorControl", 1, 0, 0, IrrlichtDevice_getCursorControl);
171 DEFINE_GSUBR ("IrrlichtDevice_getFileSystem", 1, 0, 0, IrrlichtDevice_getFileSystem);
172 DEFINE_GSUBR ("IrrlichtDevice_getGUIEnvironment", 1, 0, 0, IrrlichtDevice_getGUIEnvironment);
173 DEFINE_GSUBR ("IrrlichtDevice_getSceneManager", 1, 0, 0, IrrlichtDevice_getSceneManager);
174 DEFINE_GSUBR ("IrrlichtDevice_getTimer", 1, 0, 0, IrrlichtDevice_getTimer);
175 DEFINE_GSUBR ("IrrlichtDevice_getVideoDriver", 1, 0, 0, IrrlichtDevice_getVideoDriver);
176 DEFINE_GSUBR ("IrrlichtDevice_isWindowActive", 1, 0, 0, IrrlichtDevice_isWindowActive);
177 DEFINE_GSUBR ("IrrlichtDevice_run", 1, 0, 0, IrrlichtDevice_run);
178 DEFINE_GSUBR ("IrrlichtDevice_setEventReceiver_IEventReceiver", 2, 0, 0,
179 IrrlichtDevice_setEventReceiver<IEventReceiver*>);
180 DEFINE_GSUBR ("IrrlichtDevice_setResizable", 2, 0, 0, IrrlichtDevice_setResizable);
181 DEFINE_GSUBR ("IrrlichtDevice_setWindowCaption", 2, 0, 0, IrrlichtDevice_setWindowCaption);
182 DEFINE_GSUBR ("IrrlichtDevice_yield", 1, 0, 0, IrrlichtDevice_yield);