From: Javier Sancho Date: Thu, 5 Dec 2019 11:05:17 +0000 (+0100) Subject: C types X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=59b625c207d1ee8368f04f3c4d675fa393fe94f4;p=c-irrlicht.git C types --- diff --git a/include/ICursorControl.h b/include/ICursorControl.h index f2afcf6..77dccf1 100644 --- a/include/ICursorControl.h +++ b/include/ICursorControl.h @@ -22,6 +22,8 @@ #ifndef __C_I_CURSOR_CONTROL_H_INCLUDED__ #define __C_I_CURSOR_CONTROL_H_INCLUDED__ +#include + 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 } diff --git a/include/IFileSystem.h b/include/IFileSystem.h index 7b278d0..26ab0f3 100644 --- a/include/IFileSystem.h +++ b/include/IFileSystem.h @@ -22,6 +22,7 @@ #ifndef __C_I_FILE_SYSTEM_H_INCLUDED__ #define __C_I_FILE_SYSTEM_H_INCLUDED__ +#include #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); diff --git a/include/IGUIEnvironment.h b/include/IGUIEnvironment.h index e97f3d3..e6f2706 100644 --- a/include/IGUIEnvironment.h +++ b/include/IGUIEnvironment.h @@ -22,6 +22,9 @@ #ifndef __C_I_GUI_ENVIRONMENT_H_INCLUDED__ #define __C_I_GUI_ENVIRONMENT_H_INCLUDED__ +#include +#include + #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); diff --git a/include/ISceneManager.h b/include/ISceneManager.h index e87b5a7..3074f57 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -22,6 +22,10 @@ #ifndef __C_I_SCENE_MANAGER_H_INCLUDED__ #define __C_I_SCENE_MANAGER_H_INCLUDED__ +#include +#include +#include + #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); diff --git a/include/ISceneNode.h b/include/ISceneNode.h index 16731a4..c7b1916 100644 --- a/include/ISceneNode.h +++ b/include/ISceneNode.h @@ -22,6 +22,9 @@ #ifndef __C_I_SCENE_NODE_H_INCLUDED__ #define __C_I_SCENE_NODE_H_INCLUDED__ +#include +#include + #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 diff --git a/include/IVideoDriver.h b/include/IVideoDriver.h index d9c3e6b..a03cbde 100644 --- a/include/IVideoDriver.h +++ b/include/IVideoDriver.h @@ -22,6 +22,9 @@ #ifndef __C_I_VIDEO_DRIVER_H_INCLUDED__ #define __C_I_VIDEO_DRIVER_H_INCLUDED__ +#include +#include + #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); diff --git a/include/IrrlichtDevice.h b/include/IrrlichtDevice.h index 5728c9f..335fe4b 100644 --- a/include/IrrlichtDevice.h +++ b/include/IrrlichtDevice.h @@ -54,7 +54,7 @@ extern "C" { void irr_setWindowCaption(irr_IrrlichtDevice* device, - const char* text); + const char* text); int irr_run(irr_IrrlichtDevice* device); diff --git a/include/SColor.h b/include/SColor.h index 0c6e809..ccd8a1e 100644 --- a/include/SColor.h +++ b/include/SColor.h @@ -22,12 +22,14 @@ #ifndef __C_IRR_COLOR_H_INCLUDED__ #define __C_IRR_COLOR_H_INCLUDED__ +#include + 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 diff --git a/include/SMaterial.h b/include/SMaterial.h index 6004657..5a27f34 100644 --- a/include/SMaterial.h +++ b/include/SMaterial.h @@ -22,10 +22,12 @@ #ifndef __C_IRR_S_MATERIAL_H_INCLUDED__ #define __C_IRR_S_MATERIAL_H_INCLUDED__ +#include + typedef struct { - int wireframe; - int lighting; + bool wireframe; + bool lighting; } irr_video_SMaterial; #endif diff --git a/include/cirrlicht.h b/include/cirrlicht.h index fc08e12..8841fe4 100644 --- a/include/cirrlicht.h +++ b/include/cirrlicht.h @@ -22,6 +22,9 @@ #ifndef __C_IRRLICHT_H_INCLUDED__ #define __C_IRRLICHT_H_INCLUDED__ +#include +#include + #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 } diff --git a/include/dimension2d.h b/include/dimension2d.h index 1f2daca..58926c9 100644 --- a/include/dimension2d.h +++ b/include/dimension2d.h @@ -22,10 +22,12 @@ #ifndef __C_IRR_DIMENSION2D_H_INCLUDED__ #define __C_IRR_DIMENSION2D_H_INCLUDED__ +#include + typedef struct { - unsigned int width; - unsigned int height; + uint32_t width; + uint32_t height; } irr_core_dimension2d_u32; #endif diff --git a/include/rect.h b/include/rect.h index 395446a..3bdc222 100644 --- a/include/rect.h +++ b/include/rect.h @@ -22,12 +22,14 @@ #ifndef __C_IRR_RECT_H_INCLUDED__ #define __C_IRR_RECT_H_INCLUDED__ +#include + 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 diff --git a/include/vector2d.h b/include/vector2d.h index b3ae149..2a92c64 100644 --- a/include/vector2d.h +++ b/include/vector2d.h @@ -22,10 +22,12 @@ #ifndef __C_IRR_VECTOR_2D_H_INCLUDED__ #define __C_IRR_VECTOR_2D_H_INCLUDED__ +#include + typedef struct { - float x; - float y; + float_t x; + float_t y; } irr_core_vector2df; #endif diff --git a/include/vector3d.h b/include/vector3d.h index fd94026..a03a825 100644 --- a/include/vector3d.h +++ b/include/vector3d.h @@ -22,11 +22,13 @@ #ifndef __C_IRR_VECTOR_3D_H_INCLUDED__ #define __C_IRR_VECTOR_3D_H_INCLUDED__ +#include + typedef struct { - float x; - float y; - float z; + float_t x; + float_t y; + float_t z; } irr_core_vector3df; #endif diff --git a/src/CIrrlicht.cpp b/src/CIrrlicht.cpp index c17daa2..0c35adb 100644 --- a/src/CIrrlicht.cpp +++ b/src/CIrrlicht.cpp @@ -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 wsize = irr::core::dimension2d(windowSize->width, diff --git a/src/ICursorControl.cpp b/src/ICursorControl.cpp index a07c05b..e35ff31 100644 --- a/src/ICursorControl.cpp +++ b/src/ICursorControl.cpp @@ -25,7 +25,7 @@ extern "C" { void irr_gui_setVisibleCursor(irr_gui_ICursorControl* cursorControl, - int visible) + bool visible) { ((irr::gui::ICursorControl*)cursorControl) ->setVisible(visible); diff --git a/src/IFileSystem.cpp b/src/IFileSystem.cpp index 1cc7689..42ff300 100644 --- a/src/IFileSystem.cpp +++ b/src/IFileSystem.cpp @@ -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) diff --git a/src/IGUIEnvironment.cpp b/src/IGUIEnvironment.cpp index 57d6bb9..f64f5a8 100644 --- a/src/IGUIEnvironment.cpp +++ b/src/IGUIEnvironment.cpp @@ -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)); diff --git a/src/ISceneManager.cpp b/src/ISceneManager.cpp index 3585216..f4f2c87 100644 --- a/src/ISceneManager.cpp +++ b/src/ISceneManager.cpp @@ -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, diff --git a/src/ISceneNode.cpp b/src/ISceneNode.cpp index 9b03003..57273ab 100644 --- a/src/ISceneNode.cpp +++ b/src/ISceneNode.cpp @@ -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) diff --git a/src/IVideoDriver.cpp b/src/IVideoDriver.cpp index 14d8fa9..e04dbf6 100644 --- a/src/IVideoDriver.cpp +++ b/src/IVideoDriver.cpp @@ -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