From: Javier Sancho Date: Wed, 13 May 2020 08:53:19 +0000 (+0200) Subject: Unwrap Irrlicht objects in C++ instead of Guile X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=c4d9e46f268b4f7f738dd77685c632991125cec9;p=guile-irrlicht.git Unwrap Irrlicht objects in C++ instead of Guile --- diff --git a/Makefile.am b/Makefile.am index c4a5bfb..f7c37c1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,7 +58,8 @@ libguile_irrlicht_la_SOURCES = \ src/vector3d.cpp \ src/vertex3d.cpp \ src/video-driver.cpp \ - src/wchar.cpp + src/wchar.cpp \ + src/wrapped.cpp libguile_irrlicht_la_CPPFLAGS = @GUILE_CFLAGS@ libguile_irrlicht_la_LDFLAGS = \ -version-info 0:1 \ diff --git a/irrlicht/device.scm b/irrlicht/device.scm index 4db0e94..97e2bba 100644 --- a/irrlicht/device.scm +++ b/irrlicht/device.scm @@ -54,26 +54,27 @@ fullscreen stencilbuffer vsync - (irr-pointer receiver)))) + receiver))) (define-method (get-gui-environment (device )) - (make - #:irr-pointer ((get-irrlicht-proc "getGUIEnvironment" device) (irr-pointer device)))) + (let ((getGUIEnvironment (get-irrlicht-proc "getGUIEnvironment" device))) + (make + #:irr-pointer (getGUIEnvironment device)))) (define-method (get-scene-manager (device )) (make - #:irr-pointer ((get-irrlicht-proc "getSceneManager" device) (irr-pointer device)))) + #:irr-pointer ((get-irrlicht-proc "getSceneManager" device) device))) (define-method (get-video-driver (device )) (make - #:irr-pointer ((get-irrlicht-proc "getVideoDriver" device) (irr-pointer device)))) + #:irr-pointer ((get-irrlicht-proc "getVideoDriver" device) device))) (define-method (run (device )) - ((get-irrlicht-proc "run" device) (irr-pointer device))) + ((get-irrlicht-proc "run" device) device)) (define-method (set-window-caption! (device ) text) ((get-irrlicht-proc "setWindowCaption" device) - (irr-pointer device) text)) + device text)) (export create-device get-gui-environment get-scene-manager get-video-driver run set-window-caption!) diff --git a/irrlicht/gui.scm b/irrlicht/gui.scm index 1d79f29..3d0e091 100644 --- a/irrlicht/gui.scm +++ b/irrlicht/gui.scm @@ -48,18 +48,18 @@ (make #:irr-pointer ((get-irrlicht-proc "addStaticText" gui-environment parent) - (irr-pointer gui-environment) + gui-environment text rectangle border word-wrap - (irr-pointer parent) + parent id fill-background)))) (define-method (draw-all (gui-environment )) ((get-irrlicht-proc "drawAll" gui-environment) - (irr-pointer gui-environment))) + gui-environment)) (export add-static-text! draw-all) diff --git a/irrlicht/irr.scm b/irrlicht/irr.scm index 16cbf0d..19af56f 100644 --- a/irrlicht/irr.scm +++ b/irrlicht/irr.scm @@ -29,8 +29,8 @@ (irr-class #:init-value "IReferenceCounted" #:getter irr-class)) (define-method (drop! (obj )) - ((get-irrlicht-proc "drop" obj) - (irr-pointer obj))) + (let ((drop (get-irrlicht-proc "drop" obj))) + (drop obj))) (export drop!) diff --git a/irrlicht/scene.scm b/irrlicht/scene.scm index cf51aa5..a59e0fa 100644 --- a/irrlicht/scene.scm +++ b/irrlicht/scene.scm @@ -59,9 +59,9 @@ (make #:irr-pointer ((get-irrlicht-proc "addAnimatedMeshSceneNode" scene-manager parent) - (irr-pointer scene-manager) - (irr-pointer mesh) - (irr-pointer parent) + scene-manager + mesh + parent id position rotation @@ -78,8 +78,8 @@ (make #:irr-pointer ((get-irrlicht-proc "addCameraSceneNode" scene-manager parent) - (irr-pointer scene-manager) - (irr-pointer parent) + scene-manager + parent position lookat id @@ -87,13 +87,13 @@ (define-method (draw-all (scene-manager )) ((get-irrlicht-proc "drawAll" scene-manager) - (irr-pointer scene-manager))) + scene-manager)) (define-method (get-mesh (scene-manager ) filename) (make #:irr-pointer ((get-irrlicht-proc "getMesh" scene-manager) - (irr-pointer scene-manager) + scene-manager filename))) (export add-animated-mesh-scene-node! add-camera-scene-node! draw-all get-mesh) @@ -105,15 +105,15 @@ (define-method (set-material-flag! (node ) flag new-value) ((get-irrlicht-proc "setMaterialFlag" node) - (irr-pointer node) + node flag new-value)) (define-method (set-material-texture! (node ) texture-layer (texture )) ((get-irrlicht-proc "setMaterialTexture" node) - (irr-pointer node) + node texture-layer - (irr-pointer texture))) + texture)) (export set-material-flag! set-material-texture!) @@ -124,7 +124,7 @@ (define-method (set-md2-animation! (node ) anim) ((get-irrlicht-proc "setMD2Animation" node) - (irr-pointer node) + node anim)) (export set-md2-animation!) diff --git a/irrlicht/video.scm b/irrlicht/video.scm index 53b28a6..ee1f767 100644 --- a/irrlicht/video.scm +++ b/irrlicht/video.scm @@ -44,7 +44,7 @@ video-data source-rect) ((get-irrlicht-proc "beginScene" video-driver) - (irr-pointer video-driver) + video-driver back-buffer z-buffer color @@ -53,13 +53,13 @@ (define-method (end-scene (video-driver )) ((get-irrlicht-proc "endScene" video-driver) - (irr-pointer video-driver))) + video-driver)) (define-method (get-texture (video-driver ) filename) (make #:irr-pointer ((get-irrlicht-proc "getTexture" video-driver) - (irr-pointer video-driver) + video-driver filename))) (export begin-scene end-scene get-texture) diff --git a/src/animated-mesh-scene-node.cpp b/src/animated-mesh-scene-node.cpp index 3496b3a..040b7cd 100644 --- a/src/animated-mesh-scene-node.cpp +++ b/src/animated-mesh-scene-node.cpp @@ -24,6 +24,7 @@ #include "animated-mesh-md2.h" #include "animated-mesh-scene-node.h" #include "gsubr.h" +#include "wrapped.h" using namespace irr; @@ -33,7 +34,7 @@ IAnimatedMeshSceneNode_setFrameLoop (SCM animated_mesh_scene_node, SCM end) { return scm_from_bool - (((scene::IAnimatedMeshSceneNode*)scm_to_pointer (animated_mesh_scene_node))-> + (((scene::IAnimatedMeshSceneNode*)scm_to_irr_pointer (animated_mesh_scene_node))-> setFrameLoop (scm_to_int32 (begin), scm_to_int32 (end))); } @@ -43,7 +44,7 @@ IAnimatedMeshSceneNode_setMD2Animation (SCM animated_mesh_scene_node, SCM anim) { return scm_from_bool - (((scene::IAnimatedMeshSceneNode*)scm_to_pointer (animated_mesh_scene_node))-> + (((scene::IAnimatedMeshSceneNode*)scm_to_irr_pointer (animated_mesh_scene_node))-> setMD2Animation (scm_to_md2_animation_type (anim))); } diff --git a/src/animated-mesh.cpp b/src/animated-mesh.cpp index cb88225..896cfe9 100644 --- a/src/animated-mesh.cpp +++ b/src/animated-mesh.cpp @@ -23,6 +23,7 @@ #include #include "animated-mesh.h" #include "gsubr.h" +#include "wrapped.h" using namespace irr; @@ -30,7 +31,7 @@ SCM IAnimatedMesh_setAnimationSpeed (SCM animated_mesh, SCM frames_per_second) { - ((scene::IAnimatedMesh*)scm_to_pointer (animated_mesh))-> + ((scene::IAnimatedMesh*)scm_to_irr_pointer (animated_mesh))-> setAnimationSpeed (scm_to_double (frames_per_second)); return SCM_UNSPECIFIED; } diff --git a/src/box3d.cpp b/src/box3d.cpp index ed56fdc..b1b873c 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -24,6 +24,7 @@ #include "box3d.h" #include "gsubr.h" #include "vector3d.h" +#include "wrapped.h" using namespace irr; @@ -31,7 +32,7 @@ SCM aabbox3d_addInternalPoint (SCM box3d, SCM point) { - ((core::aabbox3df*)scm_to_pointer (box3d))->addInternalPoint (scm_to_vector3df (point)); + ((core::aabbox3df*)scm_to_irr_pointer (box3d))->addInternalPoint (scm_to_vector3df (point)); return SCM_UNSPECIFIED; } @@ -46,7 +47,7 @@ SCM aabbox3d_reset (SCM box3d, SCM init_value) { - ((core::aabbox3df*)scm_to_pointer (box3d))->reset (scm_to_vector3df (init_value)); + ((core::aabbox3df*)scm_to_irr_pointer (box3d))->reset (scm_to_vector3df (init_value)); return SCM_UNSPECIFIED; } diff --git a/src/cursor-control.cpp b/src/cursor-control.cpp index 55f6622..781fed7 100644 --- a/src/cursor-control.cpp +++ b/src/cursor-control.cpp @@ -24,6 +24,7 @@ #include "cursor-control.h" #include "gsubr.h" #include "position2d.h" +#include "wrapped.h" using namespace irr; @@ -31,14 +32,14 @@ SCM ICursorControl_getPosition (SCM cursor_control) { return scm_from_position2d_s32 - (((gui::ICursorControl*)scm_to_pointer (cursor_control))->getPosition ()); + (((gui::ICursorControl*)scm_to_irr_pointer (cursor_control))->getPosition ()); } SCM ICursorControl_setPosition (SCM cursor_control, SCM position) { - ((gui::ICursorControl*)scm_to_pointer (cursor_control))-> + ((gui::ICursorControl*)scm_to_irr_pointer (cursor_control))-> setPosition (scm_to_position2d_s32 (position)); return SCM_UNSPECIFIED; } diff --git a/src/device.cpp b/src/device.cpp index 55c752f..503f11c 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -26,6 +26,7 @@ #include "driver-types.h" #include "gsubr.h" #include "wchar.h" +#include "wrapped.h" using namespace irr; @@ -45,7 +46,7 @@ irr_createDevice (SCM device_type, scm_to_bool (fullscreen), scm_to_bool (stencilbuffer), scm_to_bool (vsync), - (IEventReceiver*)scm_to_pointer (receiver)); + (IEventReceiver*)scm_to_irr_pointer (receiver)); return scm_from_pointer ((void*)device, NULL); } @@ -53,7 +54,7 @@ SCM IrrlichtDevice_getCursorControl (SCM device) { gui::ICursorControl* cursor_control = - ((IrrlichtDevice*)scm_to_pointer (device))->getCursorControl (); + ((IrrlichtDevice*)scm_to_irr_pointer (device))->getCursorControl (); return scm_from_pointer ((void*)cursor_control, NULL); } @@ -61,7 +62,7 @@ SCM IrrlichtDevice_getFileSystem (SCM device) { io::IFileSystem* file_system = - ((IrrlichtDevice*)scm_to_pointer (device))->getFileSystem (); + ((IrrlichtDevice*)scm_to_irr_pointer (device))->getFileSystem (); return scm_from_pointer ((void*)file_system, NULL); } @@ -69,7 +70,7 @@ SCM IrrlichtDevice_getGUIEnvironment (SCM device) { gui::IGUIEnvironment* gui_env = - ((IrrlichtDevice*)scm_to_pointer (device))->getGUIEnvironment (); + ((IrrlichtDevice*)scm_to_irr_pointer (device))->getGUIEnvironment (); return scm_from_pointer ((void*)gui_env, NULL); } @@ -77,7 +78,7 @@ SCM IrrlichtDevice_getSceneManager (SCM device) { scene::ISceneManager* manager = - ((IrrlichtDevice*)scm_to_pointer (device))->getSceneManager (); + ((IrrlichtDevice*)scm_to_irr_pointer (device))->getSceneManager (); return scm_from_pointer ((void*)manager, NULL); } @@ -85,7 +86,7 @@ SCM IrrlichtDevice_getTimer (SCM device) { ITimer* timer = - ((IrrlichtDevice*)scm_to_pointer (device))->getTimer (); + ((IrrlichtDevice*)scm_to_irr_pointer (device))->getTimer (); return scm_from_pointer ((void*)timer, NULL); } @@ -93,7 +94,7 @@ SCM IrrlichtDevice_getVideoDriver (SCM device) { video::IVideoDriver* driver = - ((IrrlichtDevice*)scm_to_pointer (device))->getVideoDriver (); + ((IrrlichtDevice*)scm_to_irr_pointer (device))->getVideoDriver (); return scm_from_pointer ((void*)driver, NULL); } @@ -101,14 +102,14 @@ SCM IrrlichtDevice_isWindowActive (SCM device) { return scm_from_bool - (((IrrlichtDevice*)scm_to_pointer (device))->isWindowActive ()); + (((IrrlichtDevice*)scm_to_irr_pointer (device))->isWindowActive ()); } SCM IrrlichtDevice_run (SCM device) { return scm_from_bool - (((IrrlichtDevice*)scm_to_pointer (device))->run ()); + (((IrrlichtDevice*)scm_to_irr_pointer (device))->run ()); } template @@ -116,8 +117,8 @@ SCM IrrlichtDevice_setEventReceiver (SCM device, SCM receiver) { - ((IrrlichtDevice*)scm_to_pointer (device))-> - setEventReceiver ((TEventReceiver)scm_to_pointer (receiver)); + ((IrrlichtDevice*)scm_to_irr_pointer (device))-> + setEventReceiver ((TEventReceiver)scm_to_irr_pointer (receiver)); return SCM_UNSPECIFIED; } @@ -125,7 +126,7 @@ SCM IrrlichtDevice_setResizable (SCM device, SCM resize) { - ((IrrlichtDevice*)scm_to_pointer (device))-> + ((IrrlichtDevice*)scm_to_irr_pointer (device))-> setResizable (scm_to_bool (resize)); return SCM_UNSPECIFIED; } @@ -134,7 +135,7 @@ SCM IrrlichtDevice_setWindowCaption (SCM device, SCM text) { - ((IrrlichtDevice*)scm_to_pointer (device))-> + ((IrrlichtDevice*)scm_to_irr_pointer (device))-> setWindowCaption (scm_to_wide_char_string (text)); return SCM_UNSPECIFIED; } @@ -142,7 +143,7 @@ IrrlichtDevice_setWindowCaption (SCM device, SCM IrrlichtDevice_yield (SCM device) { - ((IrrlichtDevice*)scm_to_pointer (device))->yield (); + ((IrrlichtDevice*)scm_to_irr_pointer (device))->yield (); return SCM_UNSPECIFIED; } diff --git a/src/event-receiver.cpp b/src/event-receiver.cpp index cae9191..12ff718 100644 --- a/src/event-receiver.cpp +++ b/src/event-receiver.cpp @@ -24,6 +24,7 @@ #include "event-receiver.h" #include "gsubr.h" #include "keycodes.h" +#include "wrapped.h" using namespace irr; @@ -54,14 +55,14 @@ SCM SEvent_EventType (SCM event) { return scm_from_event_type - (((SEvent*)scm_to_pointer (event))->EventType); + (((SEvent*)scm_to_irr_pointer (event))->EventType); } SCM SEvent_SGUIEvent_Caller (SCM event) { gui::IGUIElement* caller = - ((SEvent*)scm_to_pointer (event))->GUIEvent.Caller; + ((SEvent*)scm_to_irr_pointer (event))->GUIEvent.Caller; return scm_from_pointer ((void*)caller, NULL); } @@ -69,21 +70,21 @@ SCM SEvent_SGUIEvent_EventType (SCM event) { return scm_from_gui_event_type - (((SEvent*)scm_to_pointer (event))->GUIEvent.EventType); + (((SEvent*)scm_to_irr_pointer (event))->GUIEvent.EventType); } SCM SEvent_SKeyInput_Key (SCM event) { return scm_from_key_code - (((SEvent*)scm_to_pointer (event))->KeyInput.Key); + (((SEvent*)scm_to_irr_pointer (event))->KeyInput.Key); } SCM SEvent_SKeyInput_PressedDown (SCM event) { return scm_from_bool - (((SEvent*)scm_to_pointer (event))->KeyInput.PressedDown); + (((SEvent*)scm_to_irr_pointer (event))->KeyInput.PressedDown); } void diff --git a/src/file-system.cpp b/src/file-system.cpp index 204e25d..fe9b062 100644 --- a/src/file-system.cpp +++ b/src/file-system.cpp @@ -24,6 +24,7 @@ #include "file-archive.h" #include "file-system.h" #include "gsubr.h" +#include "wrapped.h" using namespace irr; @@ -36,7 +37,7 @@ IFileSystem_addFileArchive (SCM file_system, SCM password, SCM ret_archive) { - io::IFileArchive* retArchive = (io::IFileArchive*)scm_to_pointer (ret_archive); + io::IFileArchive* retArchive = (io::IFileArchive*)scm_to_irr_pointer (ret_archive); io::IFileArchive** retArchiveReference = 0; if (retArchive != NULL) { @@ -44,7 +45,7 @@ IFileSystem_addFileArchive (SCM file_system, } return scm_from_bool - (((io::IFileSystem*)scm_to_pointer (file_system))-> + (((io::IFileSystem*)scm_to_irr_pointer (file_system))-> addFileArchive (scm_to_utf8_stringn (filename, NULL), scm_to_bool (ignore_case), scm_to_bool (ignore_paths), diff --git a/src/gui-environment.cpp b/src/gui-environment.cpp index 9c45b35..1ee3e5d 100644 --- a/src/gui-environment.cpp +++ b/src/gui-environment.cpp @@ -26,6 +26,7 @@ #include "position2d.h" #include "rect.h" #include "wchar.h" +#include "wrapped.h" using namespace irr; @@ -39,9 +40,9 @@ IGUIEnvironment_addButton (SCM gui_environment, SCM tooltiptext) { gui::IGUIButton* button = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))-> + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))-> addButton (scm_to_rect_s32 (rectangle), - (TParent)scm_to_pointer (parent), + (TParent)scm_to_irr_pointer (parent), scm_to_int32 (id), scm_to_wide_char_string (text), scm_to_wide_char_string (tooltiptext)); @@ -58,11 +59,11 @@ IGUIEnvironment_addEditBox (SCM gui_environment, SCM id) { gui::IGUIEditBox* editbox = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))-> + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))-> addEditBox (scm_to_wide_char_string (text), scm_to_rect_s32 (rectangle), scm_to_bool (border), - (TParent)scm_to_pointer (parent), + (TParent)scm_to_irr_pointer (parent), scm_to_int32 (id)); return scm_from_pointer ((void*)editbox, NULL); } @@ -77,12 +78,12 @@ IGUIEnvironment_addImage (SCM gui_environment, SCM id, SCM text) { - gui::IGUIEnvironment* guienv = (gui::IGUIEnvironment*)scm_to_pointer (gui_environment); + gui::IGUIEnvironment* guienv = (gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment); gui::IGUIImage* new_image = - guienv->addImage ((video::ITexture*)scm_to_pointer (image), + guienv->addImage ((video::ITexture*)scm_to_irr_pointer (image), scm_to_position2d_s32 (position), scm_to_bool (use_alpha_channel), - (TParent)scm_to_pointer (parent), + (TParent)scm_to_irr_pointer (parent), scm_to_int32 (id), scm_to_wide_char_string (text)); return scm_from_pointer ((void*) new_image, NULL); @@ -97,9 +98,9 @@ IGUIEnvironment_addListBox (SCM gui_environment, SCM draw_background) { gui::IGUIListBox* listbox = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))-> + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))-> addListBox (scm_to_rect_s32 (rectangle), - (TParent)scm_to_pointer (parent), + (TParent)scm_to_irr_pointer (parent), scm_to_int32 (id), scm_to_bool (draw_background)); return scm_from_pointer ((void*)listbox, NULL); @@ -114,10 +115,10 @@ IGUIEnvironment_addScrollBar (SCM gui_environment, SCM id) { gui::IGUIScrollBar* scrollbar = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))-> + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))-> addScrollBar (scm_to_bool (horizontal), scm_to_rect_s32 (rectangle), - (TParent)scm_to_pointer (parent), + (TParent)scm_to_irr_pointer (parent), scm_to_int32 (id)); return scm_from_pointer ((void*)scrollbar, NULL); } @@ -134,12 +135,12 @@ IGUIEnvironment_addStaticText (SCM gui_environment, SCM fill_background) { gui::IGUIStaticText* static_text = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))-> + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))-> addStaticText (scm_to_wide_char_string (text), scm_to_rect_s32 (rectangle), scm_to_bool (border), scm_to_bool (word_wrap), - (TParent)scm_to_pointer (parent), + (TParent)scm_to_irr_pointer (parent), scm_to_int32 (id), scm_to_bool (fill_background)); return scm_from_pointer ((void*)static_text, NULL); @@ -155,11 +156,11 @@ IGUIEnvironment_addWindow (SCM gui_environment, SCM id) { gui::IGUIWindow* window = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))-> + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))-> addWindow (scm_to_rect_s32 (rectangle), scm_to_bool (modal), scm_to_wide_char_string (text), - (TParent)scm_to_pointer (parent), + (TParent)scm_to_irr_pointer (parent), scm_to_int32 (id)); return scm_from_pointer ((void*)window, NULL); } @@ -167,7 +168,7 @@ IGUIEnvironment_addWindow (SCM gui_environment, SCM IGUIEnvironment_drawAll (SCM gui_environment) { - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))->drawAll (); + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->drawAll (); return SCM_UNSPECIFIED; } @@ -175,7 +176,7 @@ SCM IGUIEnvironment_getBuiltInFont (SCM gui_environment) { gui::IGUIFont* font = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))->getBuiltInFont (); + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->getBuiltInFont (); return scm_from_pointer ((void*)font, NULL); } @@ -184,7 +185,7 @@ IGUIEnvironment_getFont (SCM gui_environment, SCM filename) { gui::IGUIFont* font = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))-> + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))-> getFont (scm_to_utf8_stringn (filename, NULL)); return scm_from_pointer ((void*)font, NULL); } @@ -193,7 +194,7 @@ SCM IGUIEnvironment_getSkin (SCM gui_environment) { gui::IGUISkin* skin = - ((gui::IGUIEnvironment*)scm_to_pointer (gui_environment))->getSkin (); + ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->getSkin (); return scm_from_pointer ((void*)skin, NULL); } diff --git a/src/gui-in-out-fader.cpp b/src/gui-in-out-fader.cpp index 0e39bca..ea296a5 100644 --- a/src/gui-in-out-fader.cpp +++ b/src/gui-in-out-fader.cpp @@ -24,6 +24,7 @@ #include "color.h" #include "gsubr.h" #include "gui-in-out-fader.h" +#include "wrapped.h" using namespace irr; @@ -32,7 +33,7 @@ IGUIInOutFader_setColor (SCM in_out_fader, SCM color, SCM dest_color) { - gui::IGUIInOutFader* fader = (gui::IGUIInOutFader*)scm_to_pointer (in_out_fader); + gui::IGUIInOutFader* fader = (gui::IGUIInOutFader*)scm_to_irr_pointer (in_out_fader); if (dest_color == SCM_UNDEFINED) { fader->setColor (scm_to_color (color)); diff --git a/src/gui-listbox.cpp b/src/gui-listbox.cpp index e53ba49..b723250 100644 --- a/src/gui-listbox.cpp +++ b/src/gui-listbox.cpp @@ -24,6 +24,7 @@ #include "gui-listbox.h" #include "gsubr.h" #include "wchar.h" +#include "wrapped.h" using namespace irr; @@ -32,7 +33,7 @@ IGUIListBox_addItem (SCM gui_listbox, SCM text, SCM icon) { - gui::IGUIListBox* listbox = (gui::IGUIListBox*)scm_to_pointer (gui_listbox); + gui::IGUIListBox* listbox = (gui::IGUIListBox*)scm_to_irr_pointer (gui_listbox); u32 item_id; if (icon == SCM_UNDEFINED) { diff --git a/src/gui-scrollbar.cpp b/src/gui-scrollbar.cpp index 236dd75..bf9bd1c 100644 --- a/src/gui-scrollbar.cpp +++ b/src/gui-scrollbar.cpp @@ -23,6 +23,7 @@ #include #include "gui-scrollbar.h" #include "gsubr.h" +#include "wrapped.h" using namespace irr; @@ -30,14 +31,14 @@ SCM IGUIScrollBar_getPos (SCM gui_scrollbar) { return scm_from_int32 - (((gui::IGUIScrollBar*)scm_to_pointer (gui_scrollbar))->getPos ()); + (((gui::IGUIScrollBar*)scm_to_irr_pointer (gui_scrollbar))->getPos ()); } SCM IGUIScrollBar_setMax (SCM gui_scrollbar, SCM max) { - ((gui::IGUIScrollBar*) scm_to_pointer (gui_scrollbar))->setMax (scm_to_int32 (max)); + ((gui::IGUIScrollBar*) scm_to_irr_pointer (gui_scrollbar))->setMax (scm_to_int32 (max)); return SCM_UNSPECIFIED; } @@ -45,7 +46,7 @@ SCM IGUIScrollBar_setPos (SCM gui_scrollbar, SCM pos) { - ((gui::IGUIScrollBar*) scm_to_pointer (gui_scrollbar))->setPos (scm_to_int32 (pos)); + ((gui::IGUIScrollBar*) scm_to_irr_pointer (gui_scrollbar))->setPos (scm_to_int32 (pos)); return SCM_UNSPECIFIED; } diff --git a/src/gui-skin.cpp b/src/gui-skin.cpp index f6628f1..fae5c3d 100644 --- a/src/gui-skin.cpp +++ b/src/gui-skin.cpp @@ -24,6 +24,7 @@ #include "color.h" #include "gsubr.h" #include "gui-skin.h" +#include "wrapped.h" using namespace irr; @@ -31,7 +32,7 @@ SCM IGUISkin_getColor (SCM gui_skin, SCM color) { - gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_pointer (gui_skin); + gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_irr_pointer (gui_skin); video::SColor scolor = skin->getColor (scm_to_default_color (color)); return scm_from_color (scolor); } @@ -40,7 +41,7 @@ SCM IGUISkin_getFont (SCM gui_skin, SCM which) { - gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_pointer (gui_skin); + gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_irr_pointer (gui_skin); gui::IGUIFont* font = skin->getFont (scm_to_default_font (which)); return scm_from_pointer ((void*) font, NULL); } @@ -50,7 +51,7 @@ IGUISkin_setColor (SCM gui_skin, SCM which, SCM new_color) { - gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_pointer (gui_skin); + gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_irr_pointer (gui_skin); skin->setColor (scm_to_default_color (which), scm_to_color (new_color)); return SCM_UNSPECIFIED; @@ -61,8 +62,8 @@ IGUISkin_setFont (SCM gui_skin, SCM font, SCM which) { - gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_pointer (gui_skin); - skin->setFont ((gui::IGUIFont*) scm_to_pointer (font), + gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_irr_pointer (gui_skin); + skin->setFont ((gui::IGUIFont*) scm_to_irr_pointer (font), scm_to_default_font (which)); return SCM_UNSPECIFIED; } diff --git a/src/gui-toolbar.cpp b/src/gui-toolbar.cpp index 997de68..ace658c 100644 --- a/src/gui-toolbar.cpp +++ b/src/gui-toolbar.cpp @@ -24,6 +24,7 @@ #include "gsubr.h" #include "gui-toolbar.h" #include "wchar.h" +#include "wrapped.h" using namespace irr; @@ -37,13 +38,13 @@ IGUIToolBar_addButton (SCM gui_toolbar, SCM is_push_button, SCM use_alpha_channel) { - gui::IGUIToolBar* toolbar = (gui::IGUIToolBar*) scm_to_pointer (gui_toolbar); + gui::IGUIToolBar* toolbar = (gui::IGUIToolBar*) scm_to_irr_pointer (gui_toolbar); gui::IGUIButton* button = toolbar->addButton (scm_to_int32 (id), scm_to_wide_char_string (text), scm_to_wide_char_string (tooltiptext), - (video::ITexture*) scm_to_pointer (img), - (video::ITexture*) scm_to_pointer (pressedimg), + (video::ITexture*) scm_to_irr_pointer (img), + (video::ITexture*) scm_to_irr_pointer (pressedimg), scm_to_bool (is_push_button), scm_to_bool (use_alpha_channel)); return scm_from_pointer ((void*) button, NULL); diff --git a/src/reference-counted.cpp b/src/reference-counted.cpp index 1bdc8da..f01287f 100644 --- a/src/reference-counted.cpp +++ b/src/reference-counted.cpp @@ -23,6 +23,7 @@ #include #include "gsubr.h" #include "reference-counted.h" +#include "wrapped.h" using namespace irr; @@ -30,7 +31,7 @@ template SCM IReferenceCounted_drop (SCM obj) { - return scm_from_bool (((T) scm_to_pointer (obj))->drop ()); + return scm_from_bool (((T) scm_to_irr_pointer (obj))->drop ()); } void diff --git a/src/scene-manager.cpp b/src/scene-manager.cpp index 427faf5..f120955 100644 --- a/src/scene-manager.cpp +++ b/src/scene-manager.cpp @@ -24,6 +24,7 @@ #include "gsubr.h" #include "scene-manager.h" #include "vector3d.h" +#include "wrapped.h" using namespace irr; @@ -38,10 +39,10 @@ ISceneManager_addAnimatedMeshSceneNode (SCM scene_manager, SCM scale, SCM also_add_if_mesh_pointer_zero) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::IAnimatedMeshSceneNode* node = - smgr->addAnimatedMeshSceneNode ((scene::IAnimatedMesh*) scm_to_pointer (mesh), - (TParent) scm_to_pointer (parent), + smgr->addAnimatedMeshSceneNode ((scene::IAnimatedMesh*) scm_to_irr_pointer (mesh), + (TParent) scm_to_irr_pointer (parent), scm_to_int32 (id), scm_to_vector3df (position), scm_to_vector3df (rotation), @@ -59,9 +60,9 @@ ISceneManager_addCameraSceneNode (SCM scene_manager, SCM id, SCM make_active) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::ICameraSceneNode* camera = - smgr->addCameraSceneNode ((TParent) scm_to_pointer (parent), + smgr->addCameraSceneNode ((TParent) scm_to_irr_pointer (parent), scm_to_vector3df (position), scm_to_vector3df (lookat), scm_to_int32 (id), @@ -99,13 +100,13 @@ ISceneManager_addCameraSceneNodeFPS (SCM scene_manager, scm_from_utf8_keyword ("make-active"), &make_active, SCM_UNDEFINED); - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::ICameraSceneNode* camera = - smgr->addCameraSceneNodeFPS ((TParent) scm_to_pointer (parent), + smgr->addCameraSceneNodeFPS ((TParent) scm_to_irr_pointer (parent), scm_to_double (rotate_speed), scm_to_double (move_speed), scm_to_int32 (id), - (SKeyMap*) scm_to_pointer (key_map_array), + (SKeyMap*) scm_to_irr_pointer (key_map_array), scm_to_int32 (key_map_size), scm_to_bool (no_vertical_movement), scm_to_double (jump_speed), @@ -124,10 +125,10 @@ ISceneManager_addCubeSceneNode (SCM scene_manager, SCM rotation, SCM scale) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::IMeshSceneNode* node = smgr->addCubeSceneNode (scm_to_double (size), - (TParent) scm_to_pointer (parent), + (TParent) scm_to_irr_pointer (parent), scm_to_int32 (id), scm_to_vector3df (position), scm_to_vector3df (rotation), @@ -191,7 +192,7 @@ ISceneManager_addCustomSceneNode (SCM scene_manager, virtual const core::aabbox3d& getBoundingBox () const { SCM box = scm_call_0 (scm_get_bounding_box); - return *((core::aabbox3d*) scm_to_pointer (box)); + return *((core::aabbox3d*) scm_to_irr_pointer (box)); } virtual u32 getMaterialCount () const @@ -202,13 +203,13 @@ ISceneManager_addCustomSceneNode (SCM scene_manager, virtual video::SMaterial& getMaterial (u32 i) { SCM material = scm_call_1 (scm_get_material, scm_from_uint32 (i)); - return *((video::SMaterial*) scm_to_pointer (material)); + return *((video::SMaterial*) scm_to_irr_pointer (material)); } }; CustomSceneNode* node = - new CustomSceneNode ((TParent) scm_to_pointer (parent), - (scene::ISceneManager*) scm_to_pointer (scene_manager), + new CustomSceneNode ((TParent) scm_to_irr_pointer (parent), + (scene::ISceneManager*) scm_to_irr_pointer (scene_manager), scm_to_int32 (id), scm_to_vector3df (position), scm_to_vector3df (rotation), @@ -229,10 +230,10 @@ ISceneManager_addOctreeSceneNode (SCM scene_manager, SCM minimal_polys_per_node, SCM also_add_if_mesh_pointer_zero) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::IMeshSceneNode* node = - smgr->addOctreeSceneNode ((TMesh) scm_to_pointer (mesh), - (TParent) scm_to_pointer (parent), + smgr->addOctreeSceneNode ((TMesh) scm_to_irr_pointer (mesh), + (TParent) scm_to_irr_pointer (parent), scm_to_int32 (id), scm_to_int32 (minimal_polys_per_node), scm_to_bool (also_add_if_mesh_pointer_zero)); @@ -250,11 +251,11 @@ ISceneManager_addSphereSceneNode (SCM scene_manager, SCM rotation, SCM scale) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::IMeshSceneNode* node = smgr->addSphereSceneNode (scm_to_double (radius), scm_to_int32 (poly_count), - (TParent) scm_to_pointer (parent), + (TParent) scm_to_irr_pointer (parent), scm_to_int32 (id), scm_to_vector3df (position), scm_to_vector3df (rotation), @@ -271,7 +272,7 @@ ISceneManager_createFlyCircleAnimator (SCM scene_manager, SCM start_position, SCM radius_ellipsoid) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator (scm_to_vector3df (center), scm_to_double (radius), @@ -290,7 +291,7 @@ ISceneManager_createFlyStraightAnimator (SCM scene_manager, SCM loop, SCM pingpong) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::ISceneNodeAnimator* anim = smgr->createFlyStraightAnimator (scm_to_vector3df (start_point), scm_to_vector3df (end_point), @@ -304,7 +305,7 @@ SCM ISceneManager_createRotationAnimator (SCM scene_manager, SCM rotation_speed) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::ISceneNodeAnimator* anim = smgr->createRotationAnimator (scm_to_vector3df (rotation_speed)); return scm_from_pointer ((void*) anim, NULL); @@ -313,7 +314,7 @@ ISceneManager_createRotationAnimator (SCM scene_manager, SCM ISceneManager_drawAll (SCM scene_manager) { - ((scene::ISceneManager*) scm_to_pointer (scene_manager))->drawAll (); + ((scene::ISceneManager*) scm_to_irr_pointer (scene_manager))->drawAll (); return SCM_UNSPECIFIED; } @@ -321,7 +322,7 @@ SCM ISceneManager_getMesh (SCM scene_manager, SCM filename) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); scene::IAnimatedMesh* mesh = smgr->getMesh(scm_to_utf8_stringn (filename, NULL)); return scm_from_pointer ((void*) mesh, NULL); } @@ -329,7 +330,7 @@ ISceneManager_getMesh (SCM scene_manager, SCM ISceneManager_getRootSceneNode (SCM scene_manager) { - scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager); + scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager); return scm_from_pointer ((void*) smgr->getRootSceneNode (), NULL); } diff --git a/src/scene-node.cpp b/src/scene-node.cpp index 29d5214..3700818 100644 --- a/src/scene-node.cpp +++ b/src/scene-node.cpp @@ -26,6 +26,7 @@ #include "matrix4.h" #include "scene-node.h" #include "vector3d.h" +#include "wrapped.h" using namespace irr; @@ -34,8 +35,8 @@ SCM ISceneNode_addAnimator (SCM scene_node, SCM animator) { - TSceneNode node = (TSceneNode) scm_to_pointer (scene_node); - node->addAnimator ((scene::ISceneNodeAnimator*) scm_to_pointer (animator)); + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + node->addAnimator ((scene::ISceneNodeAnimator*) scm_to_irr_pointer (animator)); return SCM_UNSPECIFIED; } @@ -43,7 +44,7 @@ template SCM ISceneNode_getAbsoluteTransformation (SCM scene_node) { - TSceneNode node = (TSceneNode) scm_to_pointer (scene_node); + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); return scm_from_matrix4 (node->getAbsoluteTransformation ()); } @@ -51,7 +52,7 @@ template SCM ISceneNode_getPosition (SCM scene_node) { - TSceneNode node = (TSceneNode) scm_to_pointer (scene_node); + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); return scm_from_vector3df (node->getPosition ()); } @@ -61,7 +62,7 @@ ISceneNode_setMaterialFlag (SCM scene_node, SCM flag, SCM newvalue) { - TSceneNode node = (TSceneNode) scm_to_pointer (scene_node); + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); node->setMaterialFlag (scm_to_material_flag (flag), scm_to_bool (newvalue)); return SCM_UNSPECIFIED; } @@ -72,9 +73,9 @@ ISceneNode_setMaterialTexture (SCM scene_node, SCM texture_layer, SCM texture) { - TSceneNode node = (TSceneNode) scm_to_pointer (scene_node); + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); node->setMaterialTexture (scm_to_uint32 (texture_layer), - (video::ITexture*) scm_to_pointer (texture)); + (video::ITexture*) scm_to_irr_pointer (texture)); return SCM_UNSPECIFIED; } @@ -83,7 +84,7 @@ SCM ISceneNode_setPosition (SCM scene_node, SCM position) { - TSceneNode node = (TSceneNode) scm_to_pointer (scene_node); + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); node->setPosition (scm_to_vector3df (position)); return SCM_UNSPECIFIED; } @@ -93,7 +94,7 @@ SCM ISceneNode_setRotation (SCM scene_node, SCM rotation) { - TSceneNode node = (TSceneNode) scm_to_pointer (scene_node); + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); node->setRotation (scm_to_vector3df (rotation)); return SCM_UNSPECIFIED; } @@ -103,7 +104,7 @@ SCM ISceneNode_setScale (SCM scene_node, SCM scale) { - TSceneNode node = (TSceneNode) scm_to_pointer (scene_node); + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); node->setScale (scm_to_vector3df (scale)); return SCM_UNSPECIFIED; } diff --git a/src/timer.cpp b/src/timer.cpp index 4a04254..e557217 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -23,13 +23,14 @@ #include #include "gsubr.h" #include "timer.h" +#include "wrapped.h" using namespace irr; SCM ITimer_getTime (SCM timer) { - return scm_from_uint32 (((ITimer*) scm_to_pointer (timer))->getTime()); + return scm_from_uint32 (((ITimer*) scm_to_irr_pointer (timer))->getTime()); } void diff --git a/src/vertex3d.cpp b/src/vertex3d.cpp index 649bc56..9b7a1e8 100644 --- a/src/vertex3d.cpp +++ b/src/vertex3d.cpp @@ -26,6 +26,7 @@ #include "vector2d.h" #include "vector3d.h" #include "vertex3d.h" +#include "wrapped.h" using namespace irr; @@ -45,7 +46,7 @@ video_S3DVertex_make (SCM position, SCM video_S3DVertex_Pos (SCM vertex) { - video::S3DVertex* s3dvertex = (video::S3DVertex*) scm_to_pointer (vertex); + video::S3DVertex* s3dvertex = (video::S3DVertex*) scm_to_irr_pointer (vertex); return scm_from_vector3df (s3dvertex->Pos); } diff --git a/src/video-driver.cpp b/src/video-driver.cpp index 6ec0183..b52b24f 100644 --- a/src/video-driver.cpp +++ b/src/video-driver.cpp @@ -28,6 +28,7 @@ #include "rect.h" #include "vertex3d.h" #include "video-driver.h" +#include "wrapped.h" using namespace irr; @@ -39,7 +40,7 @@ IVideoDriver_beginScene (SCM video_driver, SCM video_data, SCM source_rect) { - video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_pointer (video_driver); + video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver); // Source rect core::rect* sourceRectAddress = 0; @@ -69,7 +70,7 @@ IVideoDriver_drawVertexPrimitiveList (SCM video_driver, for (int i = 0; i < vertex_count; i++) { video::S3DVertex* vertex = - (video::S3DVertex*) scm_to_pointer (scm_list_ref (vertices, scm_from_int (i))); + (video::S3DVertex*) scm_to_irr_pointer (scm_list_ref (vertices, scm_from_int (i))); s3d_vertices[i] = video::S3DVertex (vertex->Pos, vertex->Normal, vertex->Color, @@ -88,7 +89,7 @@ IVideoDriver_drawVertexPrimitiveList (SCM video_driver, } // Draw vertices - video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_pointer (video_driver); + video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver); driver->drawVertexPrimitiveList (&s3d_vertices[0], vertex_count, &c_indices[0], @@ -102,14 +103,14 @@ IVideoDriver_drawVertexPrimitiveList (SCM video_driver, SCM IVideoDriver_endScene (SCM video_driver) { - video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_pointer (video_driver); + video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver); return scm_from_bool (driver->endScene ()); } SCM IVideoDriver_getFPS (SCM video_driver) { - video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_pointer (video_driver); + video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver); return scm_from_int32 (driver->getFPS ()); } @@ -117,7 +118,7 @@ SCM IVideoDriver_getTexture (SCM video_driver, SCM filename) { - video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_pointer (video_driver); + video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver); video::ITexture* texture = driver->getTexture (scm_to_utf8_stringn (filename, NULL)); return scm_from_pointer ((void*) texture, NULL); } @@ -126,8 +127,8 @@ SCM IVideoDriver_setMaterial (SCM video_driver, SCM material) { - video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_pointer (video_driver); - driver->setMaterial (*((video::SMaterial*) scm_to_pointer (material))); + video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver); + driver->setMaterial (*((video::SMaterial*) scm_to_irr_pointer (material))); return SCM_UNSPECIFIED; } @@ -136,7 +137,7 @@ IVideoDriver_setTransform (SCM video_driver, SCM state, SCM mat) { - video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_pointer (video_driver); + video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver); driver->setTransform (scm_to_transformation_state (state), scm_to_matrix4 (mat)); return SCM_UNSPECIFIED; diff --git a/src/wrapped.cpp b/src/wrapped.cpp new file mode 100644 index 0000000..81d4130 --- /dev/null +++ b/src/wrapped.cpp @@ -0,0 +1,31 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + 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 + . +*/ + +#include +#include "wrapped.h" + +/* Extract C++ irrlicht object pointer from Guile object */ +void* +scm_to_irr_pointer (SCM obj) +{ + SCM slot = scm_slot_ref (obj, scm_from_utf8_symbol ("irr-pointer")); + return scm_to_pointer (slot); +} diff --git a/src/wrapped.h b/src/wrapped.h new file mode 100644 index 0000000..136a6cd --- /dev/null +++ b/src/wrapped.h @@ -0,0 +1,30 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + 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 + . +*/ + +#ifndef __GUILE_IRRLICHT_WRAPPED_H_INCLUDED__ +#define __GUILE_IRRLICHT_WRAPPED_H_INCLUDED__ + +#include + +void* +scm_to_irr_pointer (SCM obj); + +#endif