]> git.jsancho.org Git - c-irrlicht.git/commitdiff
C types
authorJavier Sancho <jsf@jsancho.org>
Thu, 5 Dec 2019 11:05:17 +0000 (12:05 +0100)
committerJavier Sancho <jsf@jsancho.org>
Thu, 5 Dec 2019 11:05:17 +0000 (12:05 +0100)
21 files changed:
include/ICursorControl.h
include/IFileSystem.h
include/IGUIEnvironment.h
include/ISceneManager.h
include/ISceneNode.h
include/IVideoDriver.h
include/IrrlichtDevice.h
include/SColor.h
include/SMaterial.h
include/cirrlicht.h
include/dimension2d.h
include/rect.h
include/vector2d.h
include/vector3d.h
src/CIrrlicht.cpp
src/ICursorControl.cpp
src/IFileSystem.cpp
src/IGUIEnvironment.cpp
src/ISceneManager.cpp
src/ISceneNode.cpp
src/IVideoDriver.cpp

index f2afcf6df93ef4a8e7e23f56a693d190103fc00f..77dccf14b3233add96ec7664e69504b225b976d2 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef __C_I_CURSOR_CONTROL_H_INCLUDED__
 #define __C_I_CURSOR_CONTROL_H_INCLUDED__
 
+#include <stdbool.h>
+
 typedef void irr_gui_ICursorControl;
 
 #ifdef __cplusplus
@@ -30,7 +32,7 @@ extern "C" {
 
   void
   irr_gui_setVisibleCursor(irr_gui_ICursorControl* cursorControl,
-                           int visible);
+                           bool visible);
 
 #ifdef __cplusplus
 }
index 7b278d0de14cde9433c76cca489e5111a1685b49..26ab0f313e400ffcd51d41e7c0210be67343d619 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef __C_I_FILE_SYSTEM_H_INCLUDED__
 #define __C_I_FILE_SYSTEM_H_INCLUDED__
 
+#include <stdbool.h>
 #include "IFileArchive.h"
 
 typedef void irr_io_IFileSystem;
@@ -32,8 +33,8 @@ extern "C" {
 
   int irr_io_addFileArchive(irr_io_IFileSystem* filesystem,
                             const char* filename,
-                            int ignoreCase,
-                            int ignorePaths,
+                            bool ignoreCase,
+                            bool ignorePaths,
                             irr_io_E_FILE_ARCHIVE_TYPE archiveType,
                             const char* password,
                             irr_io_IFileArchive** retArchive);
index e97f3d38d13d837f84e0c64b13a6bd498ef95637..e6f2706e9d06137d35c57e8757688f39c9e11449 100644 (file)
@@ -22,6 +22,9 @@
 #ifndef __C_I_GUI_ENVIRONMENT_H_INCLUDED__
 #define __C_I_GUI_ENVIRONMENT_H_INCLUDED__
 
+#include <inttypes.h>
+#include <stdbool.h>
+
 #include "IGUIElement.h"
 #include "IGUIStaticText.h"
 #include "rect.h"
@@ -36,11 +39,11 @@ extern "C" {
   irr_gui_addStaticText(irr_gui_IGUIEnvironment* guienv,
                         const char* text,
                         const irr_core_rect_s32* rectangle,
-                        int border,
-                        int wordWrap,
+                        bool border,
+                        bool wordWrap,
                         irr_gui_IGUIElement* parent,
-                        int id,
-                        int fillBackground);
+                        int32_t id,
+                        bool fillBackground);
 
   void
   irr_gui_drawAll(irr_gui_IGUIEnvironment* guienv);
index e87b5a7018b46fa856dafd1682cfd9ef696d819c..3074f577035ffaaaf9b6a5f1043e697b7f480ecd 100644 (file)
 #ifndef __C_I_SCENE_MANAGER_H_INCLUDED__
 #define __C_I_SCENE_MANAGER_H_INCLUDED__
 
+#include <inttypes.h>
+#include <math.h>
+#include <stdbool.h>
+
 #include "aabbox3d.h"
 #include "IAnimatedMesh.h"
 #include "IAnimatedMeshSceneNode.h"
@@ -42,52 +46,52 @@ extern "C" {
   irr_scene_addAnimatedMeshSceneNode(irr_scene_ISceneManager* smgr,
                                      irr_scene_IAnimatedMesh* mesh,
                                      irr_scene_ISceneNode* parent,
-                                     int id,
+                                     int32_t id,
                                      irr_core_vector3df* position,
                                      irr_core_vector3df* rotation,
                                      irr_core_vector3df* scale,
-                                     int alsoAddIfMeshPointerZero);
+                                     bool alsoAddIfMeshPointerZero);
 
   irr_scene_ICameraSceneNode*
   irr_scene_addCameraSceneNode(irr_scene_ISceneManager* smgr,
                                irr_scene_ISceneNode* parent,
                                irr_core_vector3df* position,
                                irr_core_vector3df* lookat,
-                               int id,
-                               int makeActive);
+                               int32_t id,
+                               bool makeActive);
 
   irr_scene_ICameraSceneNode*
   irr_scene_addCameraSceneNodeFPS(irr_scene_ISceneManager* smgr,
                                   irr_scene_ISceneNode* parent,
-                                  float rotateSpeed,
-                                  float moveSpeed,
-                                  int id,
+                                  float_t rotateSpeed,
+                                  float_t moveSpeed,
+                                  int32_t id,
                                   irr_SkeyMap* keyMapArray,
-                                  int keyMapSize,
-                                  int noVerticalMovement,
-                                  float jumpSpeed,
-                                  int invertMouse,
-                                  int makeActive);
+                                  int32_t keyMapSize,
+                                  bool noVerticalMovement,
+                                  float_t jumpSpeed,
+                                  bool invertMouse,
+                                  bool makeActive);
 
   irr_scene_ISceneNode*
   irr_scene_addCustomSceneNode(irr_scene_ISceneManager* smgr,
                                irr_scene_ISceneNode* parent,
-                               int id,
+                               int32_t id,
                                irr_core_vector3df* position,
                                irr_core_vector3df* rotation,
                                irr_core_vector3df* scale,
                                void (*render)(),
                                irr_core_aabbox3d_f32* (*getBoundingBox)(),
-                               int (*getMaterialCount)(),
+                               uint32_t (*getMaterialCount)(),
                                irr_video_SMaterial* (*getMaterial)(unsigned int i));
 
   irr_scene_IMeshSceneNode*
   irr_scene_addOctreeSceneNode(irr_scene_ISceneManager* smgr,
                                irr_scene_IAnimatedMesh* mesh,
                                irr_scene_ISceneNode* parent,
-                               int id,
-                               int minimalPolysPerNode,
-                               int alsoAddIfMeshPointerZero);
+                               int32_t id,
+                               int32_t minimalPolysPerNode,
+                               bool alsoAddIfMeshPointerZero);
 
   void
   irr_scene_drawAll(irr_scene_ISceneManager* smgr);
index 16731a4060c786ab3556d27e52bee432e6f792bf..c7b1916fece663b5eced0657c724a4154700f42e 100644 (file)
@@ -22,6 +22,9 @@
 #ifndef __C_I_SCENE_NODE_H_INCLUDED__
 #define __C_I_SCENE_NODE_H_INCLUDED__
 
+#include <inttypes.h>
+#include <stdbool.h>
+
 #include "EMaterialFlags.h"
 #include "ITexture.h"
 #include "matrix4.h"
@@ -39,11 +42,11 @@ extern "C" {
   void
   irr_scene_setMaterialFlag(irr_scene_ISceneNode* node,
                             irr_video_E_MATERIAL_FLAG flag,
-                            int newvalue);
+                            bool newvalue);
 
   void
   irr_scene_setMaterialTexture(irr_scene_ISceneNode* node,
-                               unsigned int textureLayer,
+                               uint32_t textureLayer,
                                irr_video_ITexture* texture);
 
   void
index d9c3e6b2eb2f5e6b72219df90682c882fb402ddf..a03cbde90586f8671caf6a8602ea0490503ff28a 100644 (file)
@@ -22,6 +22,9 @@
 #ifndef __C_I_VIDEO_DRIVER_H_INCLUDED__
 #define __C_I_VIDEO_DRIVER_H_INCLUDED__
 
+#include <inttypes.h>
+#include <stdbool.h>
+
 #include "EPrimitiveTypes.h"
 #include "ITexture.h"
 #include "matrix4.h"
@@ -78,8 +81,8 @@ extern "C" {
 
   int
   irr_video_beginScene(irr_video_IVideoDriver* driver,
-                       int backBuffer,
-                       int zBuffer,
+                       bool backBuffer,
+                       bool zBuffer,
                        const irr_video_SColor* color,
                        irr_video_SExposedVideoData* videoData,
                        const irr_core_rect_s32* sourceRect);
@@ -87,9 +90,9 @@ extern "C" {
   void
   irr_video_drawVertexPrimitiveList(irr_video_IVideoDriver* driver,
                                     const void* vertices,
-                                    unsigned int vertexCount,
+                                    uint32_t vertexCount,
                                     const void* indexList,
-                                    unsigned int primCount,
+                                    uint32_t primCount,
                                     irr_video_E_VERTEX_TYPE vType,
                                     irr_scene_E_PRIMITIVE_TYPE pType,
                                     irr_video_E_INDEX_TYPE iType);
index 5728c9f7800e7130751688a7bbdd92aa374c8bf3..335fe4b3406305bf095bca2680f77de917a942fa 100644 (file)
@@ -54,7 +54,7 @@ extern "C" {
 
   void
   irr_setWindowCaption(irr_IrrlichtDevice* device,
-                                      const char* text);
+                       const char* text);
 
   int
   irr_run(irr_IrrlichtDevice* device);
index 0c6e80932b4ecabd6f3f59769087ef9183f01b94..ccd8a1e9affeb5e81af4a4aef70ca65bc503fd54 100644 (file)
 #ifndef __C_IRR_COLOR_H_INCLUDED__
 #define __C_IRR_COLOR_H_INCLUDED__
 
+#include <inttypes.h>
+
 typedef struct
 {
-  unsigned int a;
-  unsigned int r;
-  unsigned int g;
-  unsigned int b;
+  uint32_t a;
+  uint32_t r;
+  uint32_t g;
+  uint32_t b;
 } irr_video_SColor;
 
 #endif
index 6004657c3b9b277d19f0a4fe5381ad1dd53de4b8..5a27f34ccd858de021899d8cb6f1c2ec3e97cd92 100644 (file)
 #ifndef __C_IRR_S_MATERIAL_H_INCLUDED__
 #define __C_IRR_S_MATERIAL_H_INCLUDED__
 
+#include <stdbool.h>
+
 typedef struct
 {
-  int wireframe;
-  int lighting;
+  bool wireframe;
+  bool lighting;
 } irr_video_SMaterial;
 
 #endif
index fc08e12229b6ba868a8c1d0e265b452436277467..8841fe41a6ac8f6b0b35442a73031fee04b7ac57 100644 (file)
@@ -22,6 +22,9 @@
 #ifndef __C_IRRLICHT_H_INCLUDED__
 #define __C_IRRLICHT_H_INCLUDED__
 
+#include <inttypes.h>
+#include <stdbool.h>
+
 #include "aabbox3d.h"
 #include "dimension2d.h"
 #include "EDriverTypes.h"
@@ -61,10 +64,10 @@ extern "C" {
   irr_IrrlichtDevice*
   irr_createDevice(irr_video_E_DRIVER_TYPE deviceType,
                    const irr_core_dimension2d_u32* windowSize,
-                   unsigned int bits,
-                   int fullscreen,
-                   int stencilbuffer,
-                   int vsync);
+                   uint32_t bits,
+                   bool fullscreen,
+                   bool stencilbuffer,
+                   bool vsync);
 
 #ifdef __cplusplus
 }
index 1f2dacae0c7fe753b96b9ada052429b65b594552..58926c9e4314b837985d1cc1f5aa93d4be7662a9 100644 (file)
 #ifndef __C_IRR_DIMENSION2D_H_INCLUDED__
 #define __C_IRR_DIMENSION2D_H_INCLUDED__
 
+#include <inttypes.h>
+
 typedef struct
 {
-  unsigned int width;
-  unsigned int height;
+  uint32_t width;
+  uint32_t height;
 } irr_core_dimension2d_u32;
 
 #endif
index 395446a216f88757858b3a5d7cb7639b36a9b83f..3bdc22231bb41926bee3c64ccffe32ff6f0edbfc 100644 (file)
 #ifndef __C_IRR_RECT_H_INCLUDED__
 #define __C_IRR_RECT_H_INCLUDED__
 
+#include <inttypes.h>
+
 typedef struct
 {
-  int x;
-  int y;
-  int x2;
-  int y2;
+  int32_t x;
+  int32_t y;
+  int32_t x2;
+  int32_t y2;
 } irr_core_rect_s32;
 
 #endif
index b3ae14921cbfdad20af5e4543b5d378352164e95..2a92c642b48ff46ed12fc7d42b5113bcf8bf9c42 100644 (file)
 #ifndef __C_IRR_VECTOR_2D_H_INCLUDED__
 #define __C_IRR_VECTOR_2D_H_INCLUDED__
 
+#include <math.h>
+
 typedef struct
 {
-  float x;
-  float y;
+  float_t x;
+  float_t y;
 } irr_core_vector2df;
 
 #endif
index fd9402669f7210f323a5c38cd9a7d56d214dc153..a03a82519faf466bc25863917ff1980010445180 100644 (file)
 #ifndef __C_IRR_VECTOR_3D_H_INCLUDED__
 #define __C_IRR_VECTOR_3D_H_INCLUDED__
 
+#include <math.h>
+
 typedef struct
 {
-  float x;
-  float y;
-  float z;
+  float_t x;
+  float_t y;
+  float_t z;
 } irr_core_vector3df;
 
 #endif
index c17daa28dc3b77f1aed1e34bddd4441000f75c14..0c35adbf6299242d9fa8e05c3372a78e67cb6294 100644 (file)
@@ -26,10 +26,10 @@ extern "C" {
   irr_IrrlichtDevice*
   irr_createDevice(irr_video_E_DRIVER_TYPE deviceType,
                    const irr_core_dimension2d_u32* windowSize,
-                   unsigned int bits,
-                   int fullscreen,
-                   int stencilbuffer,
-                   int vsync)
+                   uint32_t bits,
+                   bool fullscreen,
+                   bool stencilbuffer,
+                   bool vsync)
   {
     irr::core::dimension2d<irr::u32> wsize =
       irr::core::dimension2d<irr::u32>(windowSize->width,
index a07c05b71f28030bb0277acd60081d64e6cdf7d8..e35ff310e62d8fb1480bb2b9fbfff1f8a770122e 100644 (file)
@@ -25,7 +25,7 @@
 extern "C" {
   void
   irr_gui_setVisibleCursor(irr_gui_ICursorControl* cursorControl,
-                           int visible)
+                           bool visible)
   {
     ((irr::gui::ICursorControl*)cursorControl)
       ->setVisible(visible);
index 1cc76897a45577ba36f730051505a2bde570dec7..42ff300eb5491f30097977494dbcc625ac537ca0 100644 (file)
@@ -25,8 +25,8 @@
 extern "C" {
   int irr_io_addFileArchive(irr_io_IFileSystem* filesystem,
                             const char* filename,
-                            int ignoreCase,
-                            int ignorePaths,
+                            bool ignoreCase,
+                            bool ignorePaths,
                             irr_io_E_FILE_ARCHIVE_TYPE archiveType,
                             const char* password,
                             irr_io_IFileArchive** retArchive)
index 57d6bb94571f387b1e11a6d4be581806c1d3f418..f64f5a8abca65e859da4aafd768a9f587bbaa499 100644 (file)
@@ -28,11 +28,11 @@ extern "C" {
   irr_gui_addStaticText(irr_gui_IGUIEnvironment* guienv,
                         const char* text,
                         const irr_core_rect_s32* rectangle,
-                        int border,
-                        int wordWrap,
+                        bool border,
+                        bool wordWrap,
                         irr_gui_IGUIElement* parent,
-                        int id,
-                        int fillBackground)
+                        int32_t id,
+                        bool fillBackground)
   {
     // Convert to wide char text
     wchar_t *wtext = (wchar_t*)malloc((strlen(text) + 1) * sizeof(wchar_t));
index 358521607481be30e508ac955724cd02db99da56..f4f2c87e6b05b757a0e8a024f01ec9b85eaa8b63 100644 (file)
@@ -26,7 +26,7 @@ class CustomSceneNode : public irr::scene::ISceneNode
 {
   void (*Render)();
   irr_core_aabbox3d_f32* (*GetBoundingBox)();
-  int (*GetMaterialCount)();
+  uint32_t (*GetMaterialCount)();
   irr_video_SMaterial* (*GetMaterial)(unsigned int i);
 
 public:
@@ -38,7 +38,7 @@ public:
                   const irr::core::vector3df& scale,
                   void (*render)(),
                   irr_core_aabbox3d_f32* (*getBoundingBox)(),
-                  int (*getMaterialCount)(),
+                  uint32_t (*getMaterialCount)(),
                   irr_video_SMaterial* (*getMaterial)(unsigned int i))
   : irr::scene::ISceneNode(parent, smgr, id, position, rotation, scale)
   {
@@ -89,11 +89,11 @@ extern "C" {
   irr_scene_addAnimatedMeshSceneNode(irr_scene_ISceneManager* smgr,
                                      irr_scene_IAnimatedMesh* mesh,
                                      irr_scene_ISceneNode* parent,
-                                     int id,
+                                     int32_t id,
                                      irr_core_vector3df* position,
                                      irr_core_vector3df* rotation,
                                      irr_core_vector3df* scale,
-                                     int alsoAddIfMeshPointerZero)
+                                     bool alsoAddIfMeshPointerZero)
   {
     const irr::core::vector3df iPosition =
       position ?
@@ -126,8 +126,8 @@ extern "C" {
                                irr_scene_ISceneNode* parent,
                                irr_core_vector3df* position,
                                irr_core_vector3df* lookat,
-                               int id,
-                               int makeActive)
+                               int32_t id,
+                               bool makeActive)
   {
     const irr::core::vector3df& iPosition =
       position ?
@@ -151,15 +151,15 @@ extern "C" {
   irr_scene_ICameraSceneNode*
   irr_scene_addCameraSceneNodeFPS(irr_scene_ISceneManager* smgr,
                                   irr_scene_ISceneNode* parent,
-                                  float rotateSpeed,
-                                  float moveSpeed,
-                                  int id,
+                                  float_t rotateSpeed,
+                                  float_t moveSpeed,
+                                  int32_t id,
                                   irr_SkeyMap* keyMapArray,
-                                  int keyMapSize,
-                                  int noVerticalMovement,
-                                  float jumpSpeed,
-                                  int invertMouse,
-                                  int makeActive)
+                                  int32_t keyMapSize,
+                                  bool noVerticalMovement,
+                                  float_t jumpSpeed,
+                                  bool invertMouse,
+                                  bool makeActive)
   {
     return ((irr::scene::ISceneManager*)smgr)
       ->addCameraSceneNodeFPS((irr::scene::ISceneNode*)parent,
@@ -177,13 +177,13 @@ extern "C" {
   irr_scene_ISceneNode*
   irr_scene_addCustomSceneNode(irr_scene_ISceneManager* smgr,
                                irr_scene_ISceneNode* parent,
-                               int id,
+                               int32_t id,
                                irr_core_vector3df* position,
                                irr_core_vector3df* rotation,
                                irr_core_vector3df* scale,
                                void (*render)(),
                                irr_core_aabbox3d_f32* (*getBoundingBox)(),
-                               int (*getMaterialCount)(),
+                               uint32_t (*getMaterialCount)(),
                                irr_video_SMaterial* (*getMaterial)(unsigned int i))
   {
     if (parent == NULL)
@@ -217,9 +217,6 @@ extern "C" {
                           getBoundingBox,
                           getMaterialCount,
                           getMaterial);
-    //node->drop();
-    //node = 0;
-    //return NULL;
     return node;
   }
 
@@ -227,9 +224,9 @@ extern "C" {
   irr_scene_addOctreeSceneNode(irr_scene_ISceneManager* smgr,
                                irr_scene_IAnimatedMesh* mesh,
                                irr_scene_ISceneNode* parent,
-                               int id,
-                               int minimalPolysPerNode,
-                               int alsoAddIfMeshPointerZero)
+                               int32_t id,
+                               int32_t minimalPolysPerNode,
+                               bool alsoAddIfMeshPointerZero)
   {
     return ((irr::scene::ISceneManager*)smgr)
       ->addOctreeSceneNode((irr::scene::IAnimatedMesh*)mesh,
index 9b030034dc597c7f2053bc4fe91d43f8b9527b64..57273ab22038eb58ea1fd9ecf3a7ad77f5420fb1 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
   void
   irr_scene_setMaterialFlag(irr_scene_ISceneNode* node,
                             irr_video_E_MATERIAL_FLAG flag,
-                            int newvalue)
+                            bool newvalue)
   {
     ((irr::scene::ISceneNode*)node)
       ->setMaterialFlag((irr::video::E_MATERIAL_FLAG)flag,
@@ -42,7 +42,7 @@ extern "C" {
 
   void
   irr_scene_setMaterialTexture(irr_scene_ISceneNode* node,
-                               unsigned int textureLayer,
+                               uint32_t textureLayer,
                                irr_video_ITexture* texture)
   {
     ((irr::scene::ISceneNode*)node)
index 14d8fa91c4f27631d8d8487f72046a820910c6b0..e04dbf6ee9d1cf63c133707ad975ddacac5b90af 100644 (file)
@@ -26,8 +26,8 @@
 extern "C" {
   int
   irr_video_beginScene(irr_video_IVideoDriver* driver,
-                       int backBuffer,
-                       int zBuffer,
+                       bool backBuffer,
+                       bool zBuffer,
                        const irr_video_SColor* color,
                        irr_video_SExposedVideoData* videoData,
                        const irr_core_rect_s32* sourceRect)
@@ -62,9 +62,9 @@ extern "C" {
   void
   irr_video_drawVertexPrimitiveList(irr_video_IVideoDriver* driver,
                                     const void* vertices,
-                                    unsigned int vertexCount,
+                                    uint32_t vertexCount,
                                     const void* indexList,
-                                    unsigned int primCount,
+                                    uint32_t primCount,
                                     irr_video_E_VERTEX_TYPE vType,
                                     irr_scene_E_PRIMITIVE_TYPE pType,
                                     irr_video_E_INDEX_TYPE iType)
@@ -92,13 +92,14 @@ extern "C" {
 
     for (int i=0; i<primCount*3; i++)
       {
-        unsigned int *index = (unsigned int*)indexList + i;
         if (iType == irr_video_EIT_16BIT)
           {
+            uint16_t *index = (uint16_t*)indexList + i;
             ((irr::u16*)irrIndexList)[i] = *index;
           }
         else
           {
+            uint32_t *index = (uint32_t*)indexList + i;
             ((irr::u32*)irrIndexList)[i] = *index;
           }
       }