src/gui-static-text.cpp \
src/guile-irrlicht.cpp \
src/material-flags.cpp \
+ src/misc.cpp \
src/rect.cpp \
src/reference-counted.cpp \
src/scene-manager.cpp \
;; instances for doing things
(define driver (get-video-driver device))
(define scene-manager (get-scene-manager device))
-(define driver-name (get-video-driver-name driver))
+(define driver-name (get-name driver))
;; load Quake3 map
(add-file-archive! (get-file-system device) "media/map-20kdm2.pk3")
#include "gui-environment.h"
#include "gui-static-text.h"
#include "material-flags.h"
+#include "misc.h"
#include "reference-counted.h"
#include "scene-manager.h"
#include "scene-node.h"
init_gui_environment ();
init_gui_static_text ();
init_material_flag ();
+ init_misc ();
init_reference_counted ();
init_scene_manager ();
init_scene_node ();
--- /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 "misc.h"
+#include "video-driver.h"
+#include "wchar.h"
+
+extern "C" {
+
+ void
+ init_misc (void)
+ {
+ scm_c_define_gsubr ("get-name", 1, 0, 0, (scm_t_subr)irr_getName);
+ scm_c_export ("get-name", NULL);
+ }
+
+ SCM
+ irr_getName (SCM wrapped_obj)
+ {
+ if (video_driver_p (wrapped_obj))
+ {
+ return scm_from_wide_char_string (unwrap_video_driver (wrapped_obj)->getName ());
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Cannot get name from object: ~S",
+ scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
+ }
+ }
+
+}
--- /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/>.
+*/
+
+#ifndef __GUILE_IRRLICHT_MISC_H_INCLUDED__
+#define __GUILE_IRRLICHT_MISC_H_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+
+extern "C" {
+
+ void
+ init_misc (void);
+
+ SCM
+ irr_getName (SCM wrapped_obj);
+
+}
+
+#endif
{
init_video_driver_type ();
scm_c_define_gsubr ("begin-scene", 1, 0, 1, (scm_t_subr)irr_video_beginScene);
- scm_c_define_gsubr ("draw-all", 1, 0, 0, (scm_t_subr)irr_guiscene_drawAll);
+ scm_c_define_gsubr ("draw-all", 1, 0, 0, (scm_t_subr)irr_drawAll);
scm_c_define_gsubr ("end-scene", 1, 0, 0, (scm_t_subr)irr_video_endScene);
scm_c_define_gsubr ("get-texture", 2, 0, 0, (scm_t_subr)irr_video_getTexture);
scm_c_define_gsubr ("get-video-driver", 1, 0, 0, (scm_t_subr)irr_getVideoDriver);
}
SCM
- irr_guiscene_drawAll (SCM wrapped_obj)
+ irr_drawAll (SCM wrapped_obj)
{
if (gui_environment_p (wrapped_obj))
{
SCM rest);
SCM
- irr_guiscene_drawAll (SCM wrapped_obj);
+ irr_drawAll (SCM wrapped_obj);
SCM
irr_video_endScene (SCM wrapped_video_driver);
#include <wchar.h>
#include "wchar.h"
-wchar_t*
+SCM
+scm_from_wide_char_string (const wchar_t* wtext)
+{
+ size_t nbytes = wcslen (wtext) + 1;
+ char* ctext = (char*)malloc (nbytes);
+ wcstombs (ctext, wtext, nbytes);
+ return scm_from_utf8_string (ctext);
+}
+
+const wchar_t*
scm_to_wide_char_string (SCM text)
{
char* ctext = scm_to_utf8_stringn (text, NULL);
#include <libguile.h>
#include <wchar.h>
-wchar_t*
+SCM
+scm_from_wide_char_string (const wchar_t* wtext);
+
+const wchar_t*
scm_to_wide_char_string (SCM text);
#endif