+++ /dev/null
-/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
-
- Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
-
- 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
- <http://www.gnu.org/licenses/>.
-*/
-
-#include <irrlicht/irrlicht.h>
-#include <libguile.h>
-
-#include "dimension2d.h"
-#include "EDriverTypes.h"
-#include "IGUIEnvironment.h"
-#include "IrrlichtDevice.h"
-#include "ISceneManager.h"
-#include "IVideoDriver.h"
-#include "wchar.h"
-#include "wrapped.h"
-
-extern "C" {
-
- void
- init_device (void)
- {
- init_device_type ();
- scm_c_define_gsubr ("create-device", 7, 0, 0, (scm_t_subr)irr_createDevice);
- scm_c_define_gsubr ("get-gui-environment", 1, 0, 0, (scm_t_subr)irr_getGUIEnvironment);
- scm_c_define_gsubr ("get-scene-manager", 1, 0, 0, (scm_t_subr)irr_getSceneManager);
- scm_c_define_gsubr ("get-video-driver", 1, 0, 0, (scm_t_subr)irr_getVideoDriver);
- scm_c_define_gsubr ("set-window-caption!", 2, 0, 0, (scm_t_subr)irr_setWindowCaption);
- }
-
- DEFINE_WRAPPED_TYPE (irr::IrrlichtDevice*, "device",
- init_device_type, device_p,
- wrap_device, unwrap_device);
-
- SCM
- irr_createDevice (SCM deviceType,
- SCM windowSize,
- SCM bits,
- SCM fullscreen,
- SCM stencilbuffer,
- SCM vsync,
- SCM receiver)
- {
- irr::IrrlichtDevice* device =
- irr::createDevice (scm_to_driver_type (deviceType),
- scm_to_dimension2d_u32 (windowSize),
- scm_to_uint32 (bits),
- scm_to_bool (fullscreen),
- scm_to_bool (stencilbuffer),
- scm_to_bool (vsync));
- return wrap_device (device);
- }
-
- SCM
- irr_getGUIEnvironment (SCM wrapped_device)
- {
- irr::IrrlichtDevice* device = unwrap_device (wrapped_device);
- irr::gui::IGUIEnvironment* gui_environment = device->getGUIEnvironment ();
- return wrap_gui_environment (gui_environment);
- }
-
- SCM
- irr_getSceneManager (SCM wrapped_device)
- {
- irr::IrrlichtDevice* device = unwrap_device (wrapped_device);
- irr::scene::ISceneManager* scene_manager = device->getSceneManager ();
- return wrap_scene_manager (scene_manager);
- }
-
- SCM
- irr_getVideoDriver (SCM wrapped_device)
- {
- irr::IrrlichtDevice* device = unwrap_device (wrapped_device);
- irr::video::IVideoDriver* driver = device->getVideoDriver ();
- return wrap_video_driver (driver);
- }
-
- SCM
- irr_setWindowCaption (SCM wrapped_device,
- SCM text)
- {
- irr::IrrlichtDevice* device = unwrap_device (wrapped_device);
- device->setWindowCaption (scm_to_wide_char_string (text));
- return SCM_UNSPECIFIED;
- }
-
-}