From 49de44490e084c26d61647216607351e5739f8dc Mon Sep 17 00:00:00 2001 From: Astie Teddy Date: Mon, 16 Nov 2020 16:18:24 +0100 Subject: [PATCH] Update binding, add embedding logo demo. --- examples/embedding/main.lua | 18 +++ examples/embedding/ressources/logo.png | Bin 0 -> 2532 bytes examples/models_waving_cubes.lua | 4 +- raylib | 2 +- src/raylib.lua | 79 ++++++++----- tools/api.h | 151 +++++++++++++------------ tools/genbind.lua | 3 +- tools/raymath.h | 7 +- 8 files changed, 155 insertions(+), 109 deletions(-) create mode 100644 examples/embedding/main.lua create mode 100644 examples/embedding/ressources/logo.png diff --git a/examples/embedding/main.lua b/examples/embedding/main.lua new file mode 100644 index 0000000..ae9b2f3 --- /dev/null +++ b/examples/embedding/main.lua @@ -0,0 +1,18 @@ +local width, height = 800, 450 + +rl.SetConfigFlags(rl.FLAG_VSYNC_HINT) +rl.InitWindow(800, 450, "raylib [shapes] example - basic shapes drawing") + +local logo = rl.LoadTexture "ressources/logo.png" + +while not rl.WindowShouldClose() do + rl.BeginDrawing() + rl.ClearBackground(rl.RAYWHITE) + + rl.DrawTexture(logo, width/2 - logo.width/2, height/2 - logo.height/2, rl.WHITE) + rl.DrawText("this is a texture!", 350, 370, 10, rl.GRAY) + + rl.EndDrawing() +end + +rl.CloseWindow() diff --git a/examples/embedding/ressources/logo.png b/examples/embedding/ressources/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a8bedc4f0fc14061ca0e7fa98e25f3ac7baefe4e GIT binary patch literal 2532 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLlCbx$lZxy-8q?;Kn_c~qpu?a z!^VE@KZ&eBK4*bPWHAE+-(e7DJf6QI1t?bO>Eakt5%+eo;W}qeK4$S5-RGC8$Fo;) zGJldTVm8~&HFc$Gbj73p|9(D?Ka#D=P_dPTVf{3Q2Ump{_Czr?gnKi5$l_#((`7uc z8mHvj+l)W>A9PPF?iFHK;dIW_i(vtm<#i3l2CXMCi&+>}O&FCJ4U*BsK<#WGaqriK ze;e1!xz<^EF(g#HcK&^QUzNzum%xnoa4r8^`QNVspDYLFzqajmTk7AecAq%EPly3k z(~k%3{~oL;hsfCdSZHtYDi)%LzwQNpUzIq-v}XBV&5Q3r>_KRWlVym^ee6>+;nlI3 zKOU@>yZ?H1Q@zgBUgMAFJ*uZL)Br^lK)i$Dw)?J!v;L1*C7u3g{={z@j6ZseKRSYV z&Fiab*01OKw=u;0+!1@_w}DI_B!QwJ9((-PA93-bf09?`&FQRnyS13*fiX}N#N*%h z>f_#hT0f2l-L(+@-?PP?^T74B&;Cz^8MeO4Y_I+jTQ7!vd8Yr@*Ia#ET^stLzxL|p zm$ix@D@s@YtbYo1@0->0eBX0t_6s$vk3Rcf8)j+z*PN<&urKar{fqy(>iG9xs~*Vz zUX_0Nw-d-IC$fwxfnNU*+W-D*=t28$q34%E(0Yt$wq2L#+rGLgB)H-QeqbkyvVz>tQ7HnIh`eZK95h1tGW zH^1zg0E`5SO}ElE0bP&j1GCAs>oLL-<{EGW1c^SscsLp!)iRO3YWcu;0mX;>60LKK z+qc8x+G5izpL-zTU4?3P9-(vG`SU|zkzJ5tI&%+5xD=F(R$27R-CG5ZZD3tQQe~LC zI<~v!vIgUen72_+X1jq>0VoVX$rx-LB&eqX^9jfqpeP5$2q?66PXM|3L>4gO!ht~s zaS9}Uy?}x8#tGyD<<+@r`Bk>h)#~{{E(J+fUVd$9{<9jcdv@IUohR=%!wkRorRtpT zKRJ+BKz4sxcD*?7({}}HnmFxu94KYhvx0)OZ_T!uZ>m9A?XM`zc2FV%W{+^VV?k+j z_PuyVnBR~Mu!9vSprQj3P1F;rDrH!}Pi)I%pDe=>H9}1vtnDK4-{<%LXMb?@ka4@j Sf%(9e8H1;*pUXO@geCy1tyoV0 literal 0 HcmV?d00001 diff --git a/examples/models_waving_cubes.lua b/examples/models_waving_cubes.lua index eedcca1..ef6767a 100644 --- a/examples/models_waving_cubes.lua +++ b/examples/models_waving_cubes.lua @@ -48,9 +48,7 @@ while not rl.WindowShouldClose() do (z - num_blocks / 2) * (scale * 3.0) + scatter) local cube_color = rl.ColorFromHSV( - rl.new("Vector3", - (((x + y + z) * 18) % 360), 0.75, 0.9 - ) + (((x + y + z) * 18) % 360), 0.75, 0.9 ) local cube_size = (2.4 - scale) * block_scale diff --git a/raylib b/raylib index 41192c6..a54d9f7 160000 --- a/raylib +++ b/raylib @@ -1 +1 @@ -Subproject commit 41192c6d4a66b45017af3a285ba3b6a7835b5989 +Subproject commit a54d9f734b7d473c44386217cf653976c22d44da diff --git a/src/raylib.lua b/src/raylib.lua index dedebbf..a1af7de 100644 --- a/src/raylib.lua +++ b/src/raylib.lua @@ -98,30 +98,6 @@ ffi.cdef [[ typedef enum { OPENGL_11 = 1, OPENGL_21, OPENGL_33, OPENGL_ES_20 } GlVersion; - typedef enum { - RL_ATTACHMENT_COLOR_CHANNEL0 = 0, - RL_ATTACHMENT_COLOR_CHANNEL1, - RL_ATTACHMENT_COLOR_CHANNEL2, - RL_ATTACHMENT_COLOR_CHANNEL3, - RL_ATTACHMENT_COLOR_CHANNEL4, - RL_ATTACHMENT_COLOR_CHANNEL5, - RL_ATTACHMENT_COLOR_CHANNEL6, - RL_ATTACHMENT_COLOR_CHANNEL7, - RL_ATTACHMENT_DEPTH = 100, - RL_ATTACHMENT_STENCIL = 200, - } FramebufferAttachType; - - typedef enum { - RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, - RL_ATTACHMENT_CUBEMAP_NEGATIVE_X, - RL_ATTACHMENT_CUBEMAP_POSITIVE_Y, - RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y, - RL_ATTACHMENT_CUBEMAP_POSITIVE_Z, - RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z, - RL_ATTACHMENT_TEXTURE2D = 100, - RL_ATTACHMENT_RENDERBUFFER = 200, - } FramebufferTexType; - typedef struct NPatchInfo { Rectangle sourceRec; int left; @@ -438,6 +414,20 @@ ffi.cdef [[ MOUSE_MIDDLE_BUTTON = 2 } MouseButton; + typedef enum { + MOUSE_CURSOR_DEFAULT = 0, + MOUSE_CURSOR_ARROW = 1, + MOUSE_CURSOR_IBEAM = 2, + MOUSE_CURSOR_CROSSHAIR = 3, + MOUSE_CURSOR_POINTING_HAND = 4, + MOUSE_CURSOR_RESIZE_EW = 5, + MOUSE_CURSOR_RESIZE_NS = 6, + MOUSE_CURSOR_RESIZE_NWSE = 7, + MOUSE_CURSOR_RESIZE_NESW = 8, + MOUSE_CURSOR_RESIZE_ALL = 9, + MOUSE_CURSOR_NOT_ALLOWED = 10 + } MouseCursor; + typedef enum { GAMEPAD_PLAYER1 = 0, GAMEPAD_PLAYER2 = 1, @@ -563,6 +553,13 @@ ffi.cdef [[ FILTER_ANISOTROPIC_16X, } TextureFilterMode; + typedef enum { + WRAP_REPEAT = 0, + WRAP_CLAMP, + WRAP_MIRROR_REPEAT, + WRAP_MIRROR_CLAMP + } TextureWrapMode; + typedef enum { CUBEMAP_AUTO_DETECT = 0, CUBEMAP_LINE_VERTICAL, @@ -572,13 +569,6 @@ ffi.cdef [[ CUBEMAP_PANORAMA } CubemapLayoutType; - typedef enum { - WRAP_REPEAT = 0, - WRAP_CLAMP, - WRAP_MIRROR_REPEAT, - WRAP_MIRROR_CLAMP - } TextureWrapMode; - typedef enum { FONT_DEFAULT = 0, FONT_BITMAP, @@ -636,6 +626,33 @@ ffi.cdef [[ typedef struct float16 { float v[16]; } float16; ]] +-- rlgl cdef +ffi.cdef [[ + typedef enum { + RL_ATTACHMENT_COLOR_CHANNEL0 = 0, + RL_ATTACHMENT_COLOR_CHANNEL1, + RL_ATTACHMENT_COLOR_CHANNEL2, + RL_ATTACHMENT_COLOR_CHANNEL3, + RL_ATTACHMENT_COLOR_CHANNEL4, + RL_ATTACHMENT_COLOR_CHANNEL5, + RL_ATTACHMENT_COLOR_CHANNEL6, + RL_ATTACHMENT_COLOR_CHANNEL7, + RL_ATTACHMENT_DEPTH = 100, + RL_ATTACHMENT_STENCIL = 200, + } FramebufferAttachType; + + typedef enum { + RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_X, + RL_ATTACHMENT_CUBEMAP_POSITIVE_Y, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y, + RL_ATTACHMENT_CUBEMAP_POSITIVE_Z, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z, + RL_ATTACHMENT_TEXTURE2D = 100, + RL_ATTACHMENT_RENDERBUFFER = 200, + } FramebufferTexType; +]] + -- Physac cdef ffi.cdef [[ typedef struct PhysicsBodyData *PhysicsBody; diff --git a/tools/api.h b/tools/api.h index 45d99d0..65d8b19 100644 --- a/tools/api.h +++ b/tools/api.h @@ -33,8 +33,8 @@ int GetMonitorRefreshRate(int monitor) Vector2 GetWindowPosition(void) Vector2 GetWindowScaleDPI(void) const char *GetMonitorName(int monitor) -const char *GetClipboardText(void) void SetClipboardText(const char *text) +const char *GetClipboardText(void) void ShowCursor(void) void HideCursor(void) bool IsCursorHidden(void) @@ -63,13 +63,6 @@ void SetTargetFPS(int fps) int GetFPS(void) float GetFrameTime(void) double GetTime(void) -int ColorToInt(Color color) -Vector4 ColorNormalize(Color color) -Color ColorFromNormalized(Vector4 normalized) -Vector3 ColorToHSV(Color color) -Color ColorFromHSV(Vector3 hsv) -Color GetColor(int hexValue) -Color Fade(Color color, float alpha) void SetConfigFlags(unsigned int flags) void SetTraceLogLevel(int logType) void SetTraceLogExit(int logType) @@ -77,13 +70,13 @@ void SetTraceLogCallback(TraceLogCallback callback) void TraceLog(int logType, const char *text, ...) void TakeScreenshot(const char *fileName) int GetRandomValue(int min, int max) -unsigned char *LoadFileData(const char *fileName, int *bytesRead) -void SaveFileData(const char *fileName, void *data, int bytesToWrite) +uint8_t *LoadFileData(const char *fileName, unsigned int *bytesRead) +void SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite) char *LoadFileText(const char *fileName) void SaveFileText(const char *fileName, char *text) bool FileExists(const char *fileName) -bool IsFileExtension(const char *fileName, const char *ext) bool DirectoryExists(const char *dirPath) +bool IsFileExtension(const char *fileName, const char *ext) const char *GetFileExtension(const char *fileName) const char *GetFileName(const char *filePath) const char *GetFileNameWithoutExt(const char *filePath) @@ -97,10 +90,10 @@ bool IsFileDropped(void) char **GetDroppedFiles(int *count) void ClearDroppedFiles(void) long GetFileModTime(const char *fileName) -unsigned char *CompressData(unsigned char *data, int dataLength, int *compDataLength) -unsigned char *DecompressData(unsigned char *compData, int compDataLength, int *dataLength) -void SaveStorageValue(int position, int value) -int LoadStorageValue(int position) +uint8_t *CompressData(uint8_t *data, int dataLength, int *compDataLength) +uint8_t *DecompressData(uint8_t *compData, int compDataLength, int *dataLength) +void SaveStorageValue(unsigned int position, int value) +int LoadStorageValue(unsigned int position) void OpenURL(const char *url) bool IsKeyPressed(int key) bool IsKeyDown(int key) @@ -129,6 +122,8 @@ void SetMousePosition(int x, int y) void SetMouseOffset(int offsetX, int offsetY) void SetMouseScale(float scaleX, float scaleY) float GetMouseWheelMove(void) +int GetMouseCursor(void) +void SetMouseCursor(int cursor) int GetTouchX(void) int GetTouchY(void) Vector2 GetTouchPosition(int index) @@ -191,55 +186,34 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 Image LoadImage(const char *fileName) Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize) Image LoadImageAnim(const char *fileName, int *frames) -Image LoadImageFromMemory(const char *fileType, const char *fileData, int dataSize) +Image LoadImageFromMemory(const char *fileType, const uint8_t *fileData, int dataSize) +void UnloadImage(Image image) void ExportImage(Image image, const char *fileName) void ExportImageAsCode(Image image, const char *fileName) -Texture2D LoadTexture(const char *fileName) -Texture2D LoadTextureFromImage(Image image) -TextureCubemap LoadTextureCubemap(Image image, int layoutType) -RenderTexture2D LoadRenderTexture(int width, int height) -void UnloadImage(Image image) -void UnloadTexture(Texture2D texture) -void UnloadRenderTexture(RenderTexture2D target) -Color *GetImageData(Image image) -Vector4 *GetImageDataNormalized(Image image) -Rectangle GetImageAlphaBorder(Image image, float threshold) -int GetPixelDataSize(int width, int height, int format) -Image GetTextureData(Texture2D texture) -Image GetScreenData(void) -void UpdateTexture(Texture2D texture, const void *pixels) -void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels) +Image GenImageColor(int width, int height, Color color) +Image GenImageGradientV(int width, int height, Color top, Color bottom) +Image GenImageGradientH(int width, int height, Color left, Color right) +Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer) +Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2) +Image GenImageWhiteNoise(int width, int height, float factor) +Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale) +Image GenImageCellular(int width, int height, int tileSize) Image ImageCopy(Image image) Image ImageFromImage(Image image, Rectangle rec) -void ImageToPOT(Image *image, Color fillColor) -void ImageFormat(Image *image, int newFormat) -void ImageAlphaMask(Image *image, Image alphaMask) -void ImageAlphaClear(Image *image, Color color, float threshold) -void ImageAlphaCrop(Image *image, float threshold) -void ImageAlphaPremultiply(Image *image) -void ImageCrop(Image *image, Rectangle crop) -void ImageResize(Image *image, int newWidth, int newHeight) -void ImageResizeNN(Image *image, int newWidth,int newHeight) -void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color color) -void ImageMipmaps(Image *image) -void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp) -Color *GetImagePalette(Image image, int maxPaletteSize, int *extractCount) Image ImageText(const char *text, int fontSize, Color color) Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint) -void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint) -void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color) -void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color) -void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color) -void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color) -void ImageClearBackground(Image *dst, Color color) -void ImageDrawPixel(Image *dst, int posX, int posY, Color color) -void ImageDrawPixelV(Image *dst, Vector2 position, Color color) -void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color) -void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color) -void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color) -void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color) -void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color) -void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) +void ImageFormat(Image *image, int newFormat) +void ImageToPOT(Image *image, Color fill) +void ImageCrop(Image *image, Rectangle crop) +void ImageAlphaCrop(Image *image, float threshold) +void ImageAlphaClear(Image *image, Color color, float threshold) +void ImageAlphaMask(Image *image, Image alphaMask) +void ImageAlphaPremultiply(Image *image) +void ImageResize(Image *image, int newWidth, int newHeight) +void ImageResizeNN(Image *image, int newWidth,int newHeight) +void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill) +void ImageMipmaps(Image *image) +void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp) void ImageFlipVertical(Image *image) void ImageFlipHorizontal(Image *image) void ImageRotateCW(Image *image) @@ -250,14 +224,34 @@ void ImageColorGrayscale(Image *image) void ImageColorContrast(Image *image, float contrast) void ImageColorBrightness(Image *image, int brightness) void ImageColorReplace(Image *image, Color color, Color replace) -Image GenImageColor(int width, int height, Color color) -Image GenImageGradientV(int width, int height, Color top, Color bottom) -Image GenImageGradientH(int width, int height, Color left, Color right) -Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer) -Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2) -Image GenImageWhiteNoise(int width, int height, float factor) -Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale) -Image GenImageCellular(int width, int height, int tileSize) +Color *GetImageData(Image image) +Color *GetImagePalette(Image image, int maxPaletteSize, int *extractCount) +Vector4 *GetImageDataNormalized(Image image) +Rectangle GetImageAlphaBorder(Image image, float threshold) +void ImageClearBackground(Image *dst, Color color) +void ImageDrawPixel(Image *dst, int posX, int posY, Color color) +void ImageDrawPixelV(Image *dst, Vector2 position, Color color) +void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color) +void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color) +void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color) +void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color) +void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color) +void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color) +void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color) +void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color) +void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint) +void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color) +void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) +Texture2D LoadTexture(const char *fileName) +Texture2D LoadTextureFromImage(Image image) +TextureCubemap LoadTextureCubemap(Image image, int layoutType) +RenderTexture2D LoadRenderTexture(int width, int height) +void UnloadTexture(Texture2D texture) +void UnloadRenderTexture(RenderTexture2D target) +void UpdateTexture(Texture2D texture, const void *pixels) +void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels) +Image GetTextureData(Texture2D texture) +Image GetScreenData(void) void GenTextureMipmaps(Texture2D *texture) void SetTextureFilter(Texture2D texture, int filterMode) void SetTextureWrap(Texture2D texture, int wrapMode) @@ -266,21 +260,33 @@ void DrawTextureV(Texture2D texture, Vector2 position, Color tint) void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint) void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint) void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint) +void DrawTextureTiled(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, float scale, Color tint) void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint) void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle destRec, Vector2 origin, float rotation, Color tint) +Color Fade(Color color, float alpha) +int ColorToInt(Color color) +Vector4 ColorNormalize(Color color) +Color ColorFromNormalized(Vector4 normalized) +Vector3 ColorToHSV(Color color) +Color ColorFromHSV(float hue, float saturation, float value) +Color ColorAlpha(Color color, float alpha) +Color ColorAlphaBlend(Color dst, Color src, Color tint) +Color GetColor(int hexValue) +Color GetPixelColor(void *srcPtr, int format) +void SetPixelColor(void *dstPtr, Color color, int format) +int GetPixelDataSize(int width, int height, int format) Font GetFontDefault(void) Font LoadFont(const char *fileName) Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount) Font LoadFontFromImage(Image image, Color key, int firstChar) -Font LoadFontFromMemory(const char *fileType, const char *fileData, int dataSize, int fontSize, int *fontChars, int charsCount) -CharInfo *LoadFontData(const char *fileData, int dataSize, int fontSize, int *fontChars, int charsCount, int type) +Font LoadFontFromMemory(const char *fileType, const uint8_t *fileData, int dataSize, int fontSize, int *fontChars, int charsCount) +CharInfo *LoadFontData(const uint8_t *fileData, int dataSize, int fontSize, int *fontChars, int charsCount, int type) Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod) void UnloadFont(Font font) void DrawFPS(int posX, int posY) void DrawText(const char *text, int posX, int posY, int fontSize, Color color) void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint) -void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint) void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float scale, Color tint) int MeasureText(const char *text, int fontSize) Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing) @@ -308,6 +314,8 @@ const char *CodepointToUtf8(int codepoint, int *byteLength) void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color) void DrawPoint3D(Vector3 position, Color color) void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color) +void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color) +void DrawTriangleStrip3D(Vector3 *points, int pointsCount, Color color) void DrawCube(Vector3 position, float width, float height, float length, Color color) void DrawCubeV(Vector3 position, Vector3 size, Color color) void DrawCubeWires(Vector3 position, float width, float height, float length, Color color) @@ -361,6 +369,7 @@ void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vec bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB) bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2) bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius) +bool CheckCollisionRaySphere(Ray ray, Vector3 center, float radius) bool CheckCollisionRaySphereEx(Ray ray, Vector3 center, float radius, Vector3 *collisionPoint) bool CheckCollisionRayBox(Ray ray, BoundingBox box) RayHitInfo GetCollisionRayModel(Ray ray, Model model) @@ -384,7 +393,7 @@ void SetMatrixProjection(Matrix proj) void SetMatrixModelview(Matrix view) Matrix GetMatrixModelview(void) Matrix GetMatrixProjection(void) -TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size) +TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format) TextureCubemap GenTextureIrradiance(Shader shader, TextureCubemap cubemap, int size) TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int size) Texture2D GenTextureBRDF(Shader shader, int size) @@ -405,7 +414,7 @@ void CloseAudioDevice(void) bool IsAudioDeviceReady(void) void SetMasterVolume(float volume) Wave LoadWave(const char *fileName) -Wave LoadWaveFromMemory(const char *fileType, const char *fileData, int dataSize) +Wave LoadWaveFromMemory(const char *fileType, const uint8_t *fileData, int dataSize) Sound LoadSound(const char *fileName) Sound LoadSoundFromWave(Wave wave) void UpdateSound(Sound sound, const void *data, int samplesCount) diff --git a/tools/genbind.lua b/tools/genbind.lua index 6dc3176..782f26d 100644 --- a/tools/genbind.lua +++ b/tools/genbind.lua @@ -52,7 +52,8 @@ for _,modname in ipairs(modules) do line = line:gsub("(%W)([%l%d][%w_]*)", function (before, part) for i,keyword in ipairs(keywords) do - if part == keyword then + if part == keyword + or part == "t" then -- uintX_t workaround return before .. part end end diff --git a/tools/raymath.h b/tools/raymath.h index 19944bd..50d9406 100644 --- a/tools/raymath.h +++ b/tools/raymath.h @@ -9,6 +9,7 @@ Vector2 Vector2AddValue(Vector2 v, float add) Vector2 Vector2Subtract(Vector2 v1, Vector2 v2) Vector2 Vector2SubtractValue(Vector2 v, float sub) float Vector2Length(Vector2 v) +float Vector2LengthSqr(Vector2 v) float Vector2DotProduct(Vector2 v1, Vector2 v2) float Vector2Distance(Vector2 v1, Vector2 v2) float Vector2Angle(Vector2 v1, Vector2 v2) @@ -32,6 +33,7 @@ Vector3 Vector3Multiply(Vector3 v1, Vector3 v2) Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2) Vector3 Vector3Perpendicular(Vector3 v) float Vector3Length(const Vector3 v) +float Vector3LengthSqr(const Vector3 v) float Vector3DotProduct(Vector3 v1, Vector3 v2) float Vector3Distance(Vector3 v1, Vector3 v2) Vector3 Vector3Negate(Vector3 v) @@ -54,14 +56,15 @@ Matrix MatrixNormalize(Matrix mat) Matrix MatrixIdentity(void) Matrix MatrixAdd(Matrix left, Matrix right) Matrix MatrixSubtract(Matrix left, Matrix right) +Matrix MatrixMultiply(Matrix left, Matrix right) Matrix MatrixTranslate(float x, float y, float z) Matrix MatrixRotate(Vector3 axis, float angle) -Matrix MatrixRotateXYZ(Vector3 ang) Matrix MatrixRotateX(float angle) Matrix MatrixRotateY(float angle) Matrix MatrixRotateZ(float angle) +Matrix MatrixRotateXYZ(Vector3 ang) +Matrix MatrixRotateZYX(Vector3 ang) Matrix MatrixScale(float x, float y, float z) -Matrix MatrixMultiply(Matrix left, Matrix right) Matrix MatrixFrustum(double left, double right, double bottom, double top, double near, double far) Matrix MatrixPerspective(double fovy, double aspect, double near, double far) Matrix MatrixOrtho(double left, double right, double bottom, double top, double near, double far)