]> git.jsancho.org Git - c-irrlicht.git/commitdiff
Replace void* with appropiate types
authorJavier Sancho <jsf@jsancho.org>
Sun, 13 Oct 2019 07:34:44 +0000 (09:34 +0200)
committerJavier Sancho <jsf@jsancho.org>
Sun, 13 Oct 2019 07:34:44 +0000 (09:34 +0200)
12 files changed:
Makefile.am
include/IGUIElement.h [new file with mode: 0644]
include/IGUIEnvironment.h
include/IGUIStaticText.h [new file with mode: 0644]
include/IVideoDriver.h
include/IrrlichtDevice.h
include/SExposedVideoData.h [new file with mode: 0644]
include/cirrlicht.h
src/CIrrlicht.cpp
src/IGUIEnvironment.cpp
src/IVideoDriver.cpp
src/IrrlichtDevice.cpp

index 94fd41df7ce488570347314e8a8932ec45e184a9..45b7bdbfd4043f9112e905fa42585112ba6f37f2 100644 (file)
@@ -17,7 +17,9 @@ include_HEADERS = \
   include/EMaterialFlags.h \
   include/IAnimatedMeshMD2.h \
   include/IAnimatedMeshSceneNode.h \
+  include/IGUIElement.h \
   include/IGUIEnvironment.h \
+  include/IGUIStaticText.h \
   include/IrrlichtDevice.h \
   include/ISceneManager.h \
   include/ISceneNode.h \
@@ -25,4 +27,5 @@ include_HEADERS = \
   include/IVideoDriver.h \
   include/rect.h \
   include/SColor.h \
+  include/SExposedVideoData.h \
   include/vector3d.h
diff --git a/include/IGUIElement.h b/include/IGUIElement.h
new file mode 100644 (file)
index 0000000..97e94cf
--- /dev/null
@@ -0,0 +1,27 @@
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+   Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+   This file is part of c-irrlicht.
+
+   c-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.
+
+   c-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 __C_I_GUI_ELEMENT_H_INCLUDED__
+#define __C_I_GUI_ELEMENT_H_INCLUDED__
+
+typedef void irr_gui_IGUIElement;
+
+#endif
index 73ffe37a5b1ce82f2a9f34afef28ca7c903013ae..721d02919ec4d9539e31120ce4c64beabdec11c6 100644 (file)
 #ifndef __C_GUI_ENVIRONMENT_H_INCLUDED__
 #define __C_GUI_ENVIRONMENT_H_INCLUDED__
 
+#include "IGUIElement.h"
+#include "IGUIStaticText.h"
 #include "rect.h"
 
+typedef void irr_gui_IGUIEnvironment;
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-  void* irr_gui_IGUIEnvironment_addStaticText(void* guienv,
-                                              const char* text,
-                                              const irr_core_rect_s32* rectangle,
-                                              bool border,
-                                              bool wordWrap,
-                                              void* parent,
-                                              int32_t id,
-                                              bool fillBackground);
-
-  void irr_gui_IGUIEnvironment_drawAll(void* guienv);
+  irr_gui_IGUIStaticText*
+  irr_gui_IGUIEnvironment_addStaticText(irr_gui_IGUIEnvironment* guienv,
+                                        const char* text,
+                                        const irr_core_rect_s32* rectangle,
+                                        bool border,
+                                        bool wordWrap,
+                                        irr_gui_IGUIElement* parent,
+                                        int32_t id,
+                                        bool fillBackground);
+
+  void
+  irr_gui_IGUIEnvironment_drawAll(irr_gui_IGUIEnvironment* guienv);
 
 #ifdef __cplusplus
 }
diff --git a/include/IGUIStaticText.h b/include/IGUIStaticText.h
new file mode 100644 (file)
index 0000000..f4e91b0
--- /dev/null
@@ -0,0 +1,27 @@
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+   Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+   This file is part of c-irrlicht.
+
+   c-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.
+
+   c-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 __C_I_GUI_STATIC_TEXT_H_INCLUDED__
+#define __C_I_GUI_STATIC_TEXT_H_INCLUDED__
+
+typedef void irr_gui_IGUIStaticText;
+
+#endif
index 260d0124e8e8063025153608f96c4c4874562965..042ee6b79265cc120c3ce58192959fe855171bd7 100644 (file)
 #define __C_IRR_I_VIDEO_DRIVER_H_INCLUDED__
 
 #include "SColor.h"
+#include "SExposedVideoData.h"
 #include "rect.h"
 
+typedef void irr_video_IVideoDriver;
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-  bool irr_video_IVideoDriver_beginScene(void* driver,
-                                         bool backBuffer,
-                                         bool zBuffer,
-                                         const irr_video_SColor* color,
-                                         void* videoData, // not used for now
-                                         const irr_core_rect_s32* sourceRect);
+  bool
+  irr_video_IVideoDriver_beginScene(irr_video_IVideoDriver* driver,
+                                    bool backBuffer,
+                                    bool zBuffer,
+                                    const irr_video_SColor* color,
+                                    irr_video_SExposedVideoData* videoData,
+                                    const irr_core_rect_s32* sourceRect);
 
-  bool irr_video_IVideoDriver_endScene(void* driver);
+  bool
+  irr_video_IVideoDriver_endScene(irr_video_IVideoDriver* driver);
 
 #ifdef __cplusplus
 }
index b6a459e4b73c45cdec684530c80d13341b1cc639..9ca9589e56253fd21a630ac9d50ec34d488400d2 100644 (file)
 #ifndef __C_IRRLICHT_DEVICE_H_INCLUDED__
 #define __C_IRRLICHT_DEVICE_H_INCLUDED__
 
+#include "IGUIEnvironment.h"
+#include "ISceneManager.h"
+#include "IVideoDriver.h"
+
+typedef void irr_IrrlichtDevice;
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-  void* irr_IrrlichtDevice_getGUIEnvironment(void* device);
-  void* irr_IrrlichtDevice_getSceneManager(void* device);
-  void* irr_IrrlichtDevice_getVideoDriver(void* device);
-  void irr_IrrlichtDevice_setWindowCaption(void* device, const char* text);
-  int irr_IrrlichtDevice_run(void* device);
-  int irr_IrrlichtDevice_drop(void* device);
+  irr_gui_IGUIEnvironment*
+  irr_IrrlichtDevice_getGUIEnvironment(irr_IrrlichtDevice* device);
+
+  irr_scene_ISceneManager*
+  irr_IrrlichtDevice_getSceneManager(irr_IrrlichtDevice* device);
+
+  irr_video_IVideoDriver*
+  irr_IrrlichtDevice_getVideoDriver(irr_IrrlichtDevice* device);
+
+  void
+  irr_IrrlichtDevice_setWindowCaption(irr_IrrlichtDevice* device,
+                                      const char* text);
+
+  int
+  irr_IrrlichtDevice_run(irr_IrrlichtDevice* device);
+
+  int
+  irr_IrrlichtDevice_drop(irr_IrrlichtDevice* device);
 
 #ifdef __cplusplus
 }
diff --git a/include/SExposedVideoData.h b/include/SExposedVideoData.h
new file mode 100644 (file)
index 0000000..94ab2db
--- /dev/null
@@ -0,0 +1,27 @@
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+   Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+   This file is part of c-irrlicht.
+
+   c-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.
+
+   c-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 __C_S_EXPOSED_VIDEO_DATA_H_INCLUDED__
+#define __C_S_EXPOSED_VIDEO_DATA_H_INCLUDED__
+
+typedef void irr_video_SExposedVideoData;
+
+#endif
index 6401841b44016dac7f43542fa0257e3e30937859..a091b5fc260de3faf1653313fae71995851b2449 100644 (file)
@@ -28,6 +28,8 @@
 #include "IAnimatedMeshMD2.h"
 #include "IAnimatedMeshSceneNode.h"
 #include "IGUIEnvironment.h"
+#include "IGUIElement.h"
+#include "IGUIStaticText.h"
 #include "IrrlichtDevice.h"
 #include "ISceneManager.h"
 #include "ISceneNode.h"
 #include "IVideoDriver.h"
 #include "rect.h"
 #include "SColor.h"
+#include "SExposedVideoData.h"
 #include "vector3d.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-  void* irr_createDevice(irr_video_E_DRIVER_TYPE deviceType,
-                         const irr_core_dimension2d_u32* windowSize,
-                         u_int32_t bits,
-                         bool fullscreen,
-                         bool stencilbuffer,
-                         bool vsync);
+  irr_IrrlichtDevice*
+  irr_createDevice(irr_video_E_DRIVER_TYPE deviceType,
+                   const irr_core_dimension2d_u32* windowSize,
+                   u_int32_t bits,
+                   bool fullscreen,
+                   bool stencilbuffer,
+                   bool vsync);
 
 #ifdef __cplusplus
 }
index e87663d4af3318dd37974697a615f547edc66319..dc0c20d3a496fba0b1f7877ba452c5a39791c742 100644 (file)
 #include "cirrlicht.h"
 
 extern "C" {
-  void* irr_createDevice(irr_video_E_DRIVER_TYPE deviceType,
-                         const irr_core_dimension2d_u32* windowSize,
-                         u_int32_t bits,
-                         bool fullscreen,
-                         bool stencilbuffer,
-                         bool vsync)
+  irr_IrrlichtDevice*
+  irr_createDevice(irr_video_E_DRIVER_TYPE deviceType,
+                   const irr_core_dimension2d_u32* windowSize,
+                   u_int32_t bits,
+                   bool fullscreen,
+                   bool stencilbuffer,
+                   bool vsync)
   {
     irr::core::dimension2d<irr::u32> wsize =                    \
       irr::core::dimension2d<irr::u32>(windowSize->width,
@@ -37,6 +38,6 @@ extern "C" {
       irr::createDevice((irr::video::E_DRIVER_TYPE)deviceType,
                         wsize, bits, fullscreen, stencilbuffer,
                         vsync);
-    return device;
+    return (irr_IrrlichtDevice*)device;
   }
 }
index a77c678feb6b7bbd38c1c5e9b48820a08a1a6098..7f92386c26b5f5ad4786829cd79fc686ee481930 100644 (file)
 #include "IGUIEnvironment.h"
 
 extern "C" {
-  void* irr_gui_IGUIEnvironment_addStaticText(void* guienv,
-                                              const char* text,
-                                              const irr_core_rect_s32* rectangle,
-                                              bool border,
-                                              bool wordWrap,
-                                              void* parent,
-                                              int32_t id,
-                                              bool fillBackground)
+  irr_gui_IGUIStaticText*
+  irr_gui_IGUIEnvironment_addStaticText(irr_gui_IGUIEnvironment* guienv,
+                                        const char* text,
+                                        const irr_core_rect_s32* rectangle,
+                                        bool border,
+                                        bool wordWrap,
+                                        irr_gui_IGUIElement* parent,
+                                        int32_t id,
+                                        bool fillBackground)
   {
     // Convert to wide char text
     wchar_t *wtext = (wchar_t*)malloc((strlen(text) + 1) * sizeof(wchar_t));
@@ -56,7 +57,8 @@ extern "C" {
     return staticText;
   }
 
-  void irr_gui_IGUIEnvironment_drawAll(void* guienv)
+  void
+  irr_gui_IGUIEnvironment_drawAll(irr_gui_IGUIEnvironment* guienv)
   {
     ((irr::gui::IGUIEnvironment*)guienv)->drawAll();
   }
index 86d7347b31e7e5baf832f50f7b4957524c478f22..8f3edbc9d869cb369e3759f39714c9007f366735 100644 (file)
 #include "IVideoDriver.h"
 
 extern "C" {
-  bool irr_video_IVideoDriver_beginScene(void* driver,
-                                         bool backBuffer,
-                                         bool zBuffer,
-                                         const irr_video_SColor* color,
-                                         void* videoData, // not used for now
-                                         const irr_core_rect_s32* sourceRect)
+  bool
+  irr_video_IVideoDriver_beginScene(irr_video_IVideoDriver* driver,
+                                    bool backBuffer,
+                                    bool zBuffer,
+                                    const irr_video_SColor* color,
+                                    irr_video_SExposedVideoData* videoData,
+                                    const irr_core_rect_s32* sourceRect)
   {
     // Color
     irr::video::SColor col = irr::video::SColor(color->a, color->r,
                                                 color->g, color->b);
 
     // Video data
+    // TODO
     irr::video::SExposedVideoData vdata = irr::video::SExposedVideoData();
 
     // Source rect
@@ -55,7 +57,8 @@ extern "C" {
                                                            sourceRect != NULL ? &rect : 0);
   }
 
-  bool irr_video_IVideoDriver_endScene(void* driver)
+  bool
+  irr_video_IVideoDriver_endScene(irr_video_IVideoDriver* driver)
   {
     return ((irr::video::IVideoDriver*)driver)->endScene();
   }
index 57fefdfac7251563b920367cb4674a232d8b7270..190800e7c647ffef323d0214a3d701c1c2c94b6e 100644 (file)
 #include "IrrlichtDevice.h"
 
 extern "C" {
-  void* irr_IrrlichtDevice_getGUIEnvironment(void* device)
+  irr_gui_IGUIEnvironment*
+  irr_IrrlichtDevice_getGUIEnvironment(irr_IrrlichtDevice* device)
   {
     return ((irr::IrrlichtDevice*)device)->getGUIEnvironment();
   }
 
-  void* irr_IrrlichtDevice_getSceneManager(void* device)
+  irr_scene_ISceneManager*
+  irr_IrrlichtDevice_getSceneManager(irr_IrrlichtDevice* device)
   {
     return ((irr::IrrlichtDevice*)device)->getSceneManager();
   }
 
-  void* irr_IrrlichtDevice_getVideoDriver(void* device)
+  irr_video_IVideoDriver*
+  irr_IrrlichtDevice_getVideoDriver(irr_IrrlichtDevice* device)
   {
     return ((irr::IrrlichtDevice*)device)->getVideoDriver();
   }
 
-  void irr_IrrlichtDevice_setWindowCaption(void* device, const char* text)
+  void
+  irr_IrrlichtDevice_setWindowCaption(irr_IrrlichtDevice* device,
+                                      const char* text)
   {
     wchar_t *wtext = (wchar_t*)malloc((strlen(text) + 1) * sizeof(wchar_t));
     mbsrtowcs(wtext, &text, strlen(text) + 1, NULL);
     ((irr::IrrlichtDevice*)device)->setWindowCaption(wtext);
   }
 
-  int irr_IrrlichtDevice_run(void* device)
+  int
+  irr_IrrlichtDevice_run(irr_IrrlichtDevice* device)
   {
     return ((irr::IrrlichtDevice*)device)->run() ? 1 : 0;
   }
 
-  int irr_IrrlichtDevice_drop(void* device)
+  int
+  irr_IrrlichtDevice_drop(irr_IrrlichtDevice* device)
   {
     return ((irr::IrrlichtDevice*)device)->drop() ? 1 : 0;
   }