]> git.jsancho.org Git - guile-irrlicht.git/blob - irrlicht.i
'Hello World' example using SWIG generated wrapper
[guile-irrlicht.git] / irrlicht.i
1 /*
2 guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
3
4 Copyright (C) 2021 Javier Sancho <jsf@jsancho.org>
5
6 This file is part of guile-irrlicht.
7
8 guile-irrlicht is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation; either version 3 of the
11 License, or (at your option) any later version.
12
13 guile-irrlicht is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with guile-irrlicht. If not, see
20 <http://www.gnu.org/licenses/>.
21 */
22
23 %module irrlicht
24 %{
25 #include <irrlicht/irrlicht.h>
26 using namespace irr;
27 using namespace core;
28 using namespace scene;
29 using namespace video;
30 using namespace io;
31 using namespace gui;
32 %}
33
34 %typecheck(SWIG_TYPECHECK_POINTER) const IRR_CHAR_TYPE &
35 {
36   $1 = scm_is_string ($input);
37 }
38 %typemap(in) const IRR_CHAR_TYPE &
39 {
40   $1 = ($ltype) scm_to_utf8_string ($input);
41 }
42 %typemap(freearg) const IRR_CHAR_TYPE &
43 {
44   free ($1);
45 }
46
47 %typecheck(SWIG_TYPECHECK_POINTER) const IRR_WCHAR_TYPE &
48 {
49   $1 = scm_is_string ($input);
50 }
51 %typemap(in) const IRR_WCHAR_TYPE &
52 {
53   $1 = ($ltype) scm_to_utf32_string ($input);
54 }
55 %typemap(freearg) const IRR_WCHAR_TYPE &
56 {
57   free ($1);
58 }
59
60 %typecheck(SWIG_TYPECHECK_POINTER) const IRR_IO_PATH &
61 {
62   $1 = scm_is_string ($input);
63 }
64 %typemap(in) const IRR_IO_PATH &
65 {
66   $1 = new $*1_ltype (scm_to_utf8_string ($input));
67 }
68 %typemap(freearg) const IRR_IO_PATH &
69 {
70   delete $1;
71 }
72
73 %include irrString.h
74 %apply const IRR_CHAR_TYPE & { const irr::core::stringc & };
75 %apply const IRR_WCHAR_TYPE & { const wchar_t *, const irr::core::stringw & };
76 %apply const IRR_IO_PATH & { const irr::io::path &, const path &, irr::io::path &, path & };
77
78 typedef int s32;
79 typedef unsigned int u32;
80 typedef float f32;
81 typedef double f64;
82
83 #define _IRR_DEPRECATED_
84
85 %rename(add) operator+;
86 %rename(substract) operator-;
87 %rename(product) operator*;
88 %rename(divide) operator/;
89 %rename(equal) operator==;
90 %ignore operator+=;
91 %ignore operator-=;
92 %ignore operator*=;
93 %ignore operator/=;
94 %ignore operator!=;
95
96 %include dimension2d.h
97 %template(dimension2df) irr::core::dimension2d<irr::f32>;
98 %template(dimension2du) irr::core::dimension2d<irr::u32>;
99 %template(dimension2di) irr::core::dimension2d<irr::s32>;
100
101 %include rect.h
102 %template(rectf) irr::core::rect<irr::f32>;
103 %template(recti) irr::core::rect<irr::s32>;
104
105 %include vector3d.h
106 %template(vector3df) irr::core::vector3d<irr::f32>;
107 %template(vector3di) irr::core::vector3d<irr::s32>;
108
109 %rename("%(undercase)s", %$not %$isconstant, %$not %$isenumitem) "";
110 %feature("constasvar");
111
112 %include EDriverTypes.h
113 %include EMaterialFlags.h
114 %include IrrCompileConfig.h
115
116 %rename("%(regex:/(.*)SColor(.*)/\\1s_color\\2/)s") "";
117 %rename(get_color_alpha) irr::video::SColor::getAlpha;
118 %rename(get_color_red) irr::video::SColor::getRed;
119 %rename(get_color_green) irr::video::SColor::getGreen;
120 %rename(get_color_blue) irr::video::SColor::getBlue;
121 %rename(get_color_average) irr::video::SColor::getAverage;
122 %rename(get_colorf_alpha) irr::video::SColorf::getAlpha;
123 %rename(get_colorf_red) irr::video::SColorf::getRed;
124 %rename(get_colorf_green) irr::video::SColorf::getGreen;
125 %rename(get_colorf_blue) irr::video::SColorf::getBlue;
126 %rename(get_colorf_average) irr::video::SColorf::getAverage;
127 %include SColor.h
128
129 %rename("%(regex:/(.*)IAnimatedMesh(.*)/\\1animated_mesh\\2/)s") "";
130 %rename (set_md2_animation) setMD2Animation;
131 %include IAnimatedMesh.h
132 %include IAnimatedMeshMD2.h
133 %include SAnimatedMesh.h
134
135 %rename("%(regex:/(.*)ISceneNode(.*)/\\1scene_node\\2/)s") "";
136 %include ISceneNode.h
137
138 %rename("%(regex:/(.*)IAnimatedMeshSceneNode(.*)/\\1animated_mesh_scene_node\\2/)s") "";
139 %include IAnimatedMeshSceneNode.h
140
141 %rename("%(regex:/(.*)IGUIStaticText(.*)/\\1gui_static_text\\2/)s") "";
142 %include IGUIStaticText.h
143
144 %rename(get_gui_environment) getGUIEnvironment;
145 %rename("%(regex:/(.*)IGUIEnvironment(.*)/\\1gui_environment\\2/)s") "";
146 %include IGUIEnvironment.h
147
148 %rename("%(regex:/(.*)ISceneManager(.*)/\\1scene_manager\\2/)s") "";
149 %include ISceneManager.h
150
151 %ignore irr::video::IVideoDriver::createImage;
152 %rename(apply_material) apply;
153 %rename("%(regex:/(.*)IVideoDriver(.*)/\\1video_driver\\2/)s") "";
154 %include IVideoDriver.h
155
156 %rename(yield_device) yield;
157 %rename(sleep_device) sleep;
158 %include IrrlichtDevice.h
159 %include irrlicht.h
160
161 %scheme %{ (load-extension "libguile-irrlicht" "scm_init_irrlicht_module") %}