diff options
| -rw-r--r-- | API.md | 196 | ||||
| -rw-r--r-- | ReiLua_API.lua | 188 | ||||
| -rw-r--r-- | changelog | 2 | ||||
| -rw-r--r-- | devnotes | 3 | ||||
| -rw-r--r-- | include/audio.h | 8 | ||||
| -rw-r--r-- | include/lights.h | 2 | ||||
| -rw-r--r-- | include/rgui.h | 5 | ||||
| -rw-r--r-- | include/shapes.h | 4 | ||||
| -rw-r--r-- | include/text.h | 6 | ||||
| -rw-r--r-- | include/textures.h | 34 | ||||
| -rw-r--r-- | src/audio.c | 8 | ||||
| -rw-r--r-- | src/lights.c | 2 | ||||
| -rw-r--r-- | src/lua_core.c | 59 | ||||
| -rw-r--r-- | src/rgui.c | 82 | ||||
| -rw-r--r-- | src/shapes.c | 4 | ||||
| -rw-r--r-- | src/text.c | 6 | ||||
| -rw-r--r-- | src/textures.c | 252 |
17 files changed, 438 insertions, 423 deletions
@@ -4947,7 +4947,7 @@ Read buffer data from binary file --- -## Shapes - Drawing +## Shapes - Basic shapes drawing functions --- @@ -5145,7 +5145,7 @@ Draw a polygon outline of n sides with extended parameters --- -## Shapes - Collision +## Shapes - Basic shapes collision detection functions --- @@ -5229,7 +5229,7 @@ Get collision rectangle for two rectangles collision --- -## Textures - Image Loading +## Textures - Image loading functions --- @@ -5287,7 +5287,7 @@ Export image as code file defining an array of bytes, returns true on success --- -## Textures - Image Generation +## Textures - Image generation functions --- @@ -5363,7 +5363,7 @@ Generate image: grayscale image from text data --- -## Textures - Image Manipulation Functions +## Textures - Image manipulation functions --- @@ -5561,7 +5561,35 @@ Get image pixel color at (x, y) position --- -## Textures - Image Drawing +## Textures - Image configuration functions + +--- + +> size = RL.GetImageSize( Image image ) + +Get image size + +- Success return Vector2 + +--- + +> mipmaps = RL.GetImageMipmaps( Image image ) + +Get image mipmaps. Mipmap levels, 1 by default + +- Success return int + +--- + +> format = RL.GetImageFormat( Image image ) + +Get image data format (PixelFormat type) + +- Success return int + +--- + +## Textures - Image drawing functions --- @@ -5619,35 +5647,7 @@ Draw text (Custom sprite font) within an image (Destination) --- -## Textures - Image Configuration - ---- - -> size = RL.GetImageSize( Image image ) - -Get image size - -- Success return Vector2 - ---- - -> mipmaps = RL.GetImageMipmaps( Image image ) - -Get image mipmaps. Mipmap levels, 1 by default - -- Success return int - ---- - -> format = RL.GetImageFormat( Image image ) - -Get image data format (PixelFormat type) - -- Success return int - ---- - -## Textures - Texture Loading +## Textures - Texture loading functions --- @@ -5742,35 +5742,7 @@ Pixel should be in format { { 255, 255, 255, 255 }... } depending on the pixel f --- -## Textures - Texture Drawing - ---- - -> RL.DrawTexture( Texture texture, Vector2 position, Color tint ) - -Draw a Texture2D - ---- - -> RL.DrawTextureRec( Texture texture, Rectangle source, Vector2 position, Color tint ) - -Draw a part of a texture defined by a rectangle - ---- - -> RL.DrawTexturePro( Texture texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint ) - -Draw a part of a texture defined by a rectangle with "pro" parameters - ---- - -> RL.DrawTextureNPatch( Texture texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint ) - -Draws a texture (or part of it) that stretches or shrinks nicely - ---- - -## Textures - Texture Configuration +## Textures - Texture configuration functions --- @@ -5824,7 +5796,35 @@ Get texture data format (PixelFormat type) --- -## Textures - RenderTexture Configuration +## Textures - Texture drawing functions + +--- + +> RL.DrawTexture( Texture texture, Vector2 position, Color tint ) + +Draw a Texture2D + +--- + +> RL.DrawTextureRec( Texture texture, Rectangle source, Vector2 position, Color tint ) + +Draw a part of a texture defined by a rectangle + +--- + +> RL.DrawTexturePro( Texture texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint ) + +Draw a part of a texture defined by a rectangle with "pro" parameters + +--- + +> RL.DrawTextureNPatch( Texture texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint ) + +Draws a texture (or part of it) that stretches or shrinks nicely + +--- + +## Textures - RenderTexture configuration functions --- @@ -5852,7 +5852,7 @@ Get depth buffer attachment texture. Returns as lightuserdata --- -## Textures - Color/pixel +## Textures - Color/pixel related functions --- @@ -5968,7 +5968,7 @@ Get pixel data size in bytes for certain format --- -## Text - Loading +## Text - Font loading/unloading functions --- @@ -6018,7 +6018,7 @@ Unload font from GPU memory (VRAM) --- -## Text - Draw +## Text - Text drawing functions --- @@ -6074,7 +6074,7 @@ Draw text using font inside rectangle limits with support for tint and backgroun --- -## Text - Font info functions +## Text - Text font info functions --- @@ -6766,7 +6766,7 @@ Get collision info between ray and quad --- -## Audio - Audio device management +## Audio - Audio device management functions --- @@ -6776,7 +6776,7 @@ Set master volume (listener) --- -## Audio - Wave/Sound Loading +## Audio - Wave/Sound loading/unloading functions --- @@ -6850,7 +6850,7 @@ Export wave sample data to code (.h), returns true on success --- -## Audio - Wave/Sound management +## Audio - Wave/Sound management functions --- @@ -6924,7 +6924,7 @@ Crop a wave to defined samples range --- -## Audio - Music management +## Audio - Music management functions --- @@ -7957,7 +7957,7 @@ Check whether two given quaternions are almost equal --- -## Gui - Global +## Gui - Global gui state control functions --- @@ -8013,7 +8013,7 @@ Get gui state (global state) --- -## Gui - Font +## Gui - Font set/get functions --- @@ -8031,7 +8031,7 @@ Get gui custom font (global state) --- -## Gui - Style +## Gui - Style set/get functions --- @@ -8049,22 +8049,7 @@ Get one style property --- -> success = RL.GuiLoadStyle( string fileName ) - -Load style file over global style variable (.rgs) - -- Failure return false -- Success return true - ---- - -> RL.GuiLoadStyleDefault() - -Load style default over global style - ---- - -## Gui - Container +## Gui - Container/separator controls, useful for controls organization --- @@ -8102,7 +8087,7 @@ Scroll Panel control --- -## Gui - Basic +## Gui - Basic controls set --- @@ -8252,7 +8237,7 @@ Grid control, returns mouse cell position --- -## Gui - Advanced +## Gui - Advance controls set --- @@ -8320,7 +8305,26 @@ Color Bar Hue control --- -## Gui - Icons +## Gui - Styles loading functions + +--- + +> success = RL.GuiLoadStyle( string fileName ) + +Load style file over global style variable (.rgs) + +- Failure return false +- Success return true + +--- + +> RL.GuiLoadStyleDefault() + +Load style default over global style + +--- + +## Gui - Icons functionality --- @@ -8364,7 +8368,7 @@ Check icon pixel value --- -## Lights - Basics +## Lights - Light management functions --- diff --git a/ReiLua_API.lua b/ReiLua_API.lua index 5ca1c59..839ff74 100644 --- a/ReiLua_API.lua +++ b/ReiLua_API.lua @@ -2323,7 +2323,7 @@ function RL.ExportBuffer( buffer, path ) end ---@return any buffer function RL.LoadBufferFromFile( path, int ) end --- Shapes - Drawing +-- Shapes - Basic shapes drawing functions ---Set texture and rectangle to be used on shapes drawing ---NOTE: It can be useful when using basic shapes and one single font, @@ -2583,7 +2583,7 @@ function RL.DrawPolyLines( center, sides, radius, rotation, color ) end ---@return any RL.DrawPolyLinesEx function RL.DrawPolyLinesEx( center, sides, radius, rotation, lineThick, color ) end --- Shapes - Collision +-- Shapes - Basic shapes collision detection functions ---Check collision between two rectangles ---- Success return bool @@ -2666,7 +2666,7 @@ function RL.CheckCollisionPointLine( point, p1, p2, threshold ) end ---@return any rectangle function RL.GetCollisionRec( rec1, rec2 ) end --- Textures - Image Loading +-- Textures - Image loading functions ---Load image from file into CPU memory (RAM) ---- Success return Image @@ -2710,7 +2710,7 @@ function RL.ExportImage( image, fileName ) end ---@return any success function RL.ExportImageAsCode( image, fileName ) end --- Textures - Image Generation +-- Textures - Image generation functions ---Generate image: plain color ---- Success return Image @@ -2782,7 +2782,7 @@ function RL.GenImageCellular( size, tileSize ) end ---@return any image function RL.GenImageText( size, text ) end --- Textures - Image Manipulation Functions +-- Textures - Image manipulation functions ---Create an image duplicate (useful for transformations) ---- Success return Image @@ -2968,7 +2968,27 @@ function RL.GetImageAlphaBorder( image, threshold ) end ---@return any color function RL.GetImageColor( image, pixelPos ) end --- Textures - Image Drawing +-- Textures - Image configuration functions + +---Get image size +---- Success return Vector2 +---@param image any +---@return any size +function RL.GetImageSize( image ) end + +---Get image mipmaps. Mipmap levels, 1 by default +---- Success return int +---@param image any +---@return any mipmaps +function RL.GetImageMipmaps( image ) end + +---Get image data format (PixelFormat type) +---- Success return int +---@param image any +---@return any format +function RL.GetImageFormat( image ) end + +-- Textures - Image drawing functions ---Clear image background with given color ---@param dst any @@ -3042,27 +3062,7 @@ function RL.ImageDraw( dst, src, srcRec, dstRec, tint ) end ---@return any RL.ImageDrawTextEx function RL.ImageDrawTextEx( dst, font, text, position, fontSize, spacing, tint ) end --- Textures - Image Configuration - ----Get image size ----- Success return Vector2 ----@param image any ----@return any size -function RL.GetImageSize( image ) end - ----Get image mipmaps. Mipmap levels, 1 by default ----- Success return int ----@param image any ----@return any mipmaps -function RL.GetImageMipmaps( image ) end - ----Get image data format (PixelFormat type) ----- Success return int ----@param image any ----@return any format -function RL.GetImageFormat( image ) end - --- Textures - Texture Loading +-- Textures - Texture loading functions ---Load texture from file into GPU memory ( VRAM ) ---- Failure return nil @@ -3139,44 +3139,7 @@ function RL.UpdateTexture( texture, pixels ) end ---@return any RL.UpdateTextureRec function RL.UpdateTextureRec( texture, rec, pixels ) end --- Textures - Texture Drawing - ----Draw a Texture2D ----@param texture any ----@param position table ----@param tint table ----@return any RL.DrawTexture -function RL.DrawTexture( texture, position, tint ) end - ----Draw a part of a texture defined by a rectangle ----@param texture any ----@param source table ----@param position table ----@param tint table ----@return any RL.DrawTextureRec -function RL.DrawTextureRec( texture, source, position, tint ) end - ----Draw a part of a texture defined by a rectangle with "pro" parameters ----@param texture any ----@param source table ----@param dest table ----@param origin table ----@param rotation number ----@param tint table ----@return any RL.DrawTexturePro -function RL.DrawTexturePro( texture, source, dest, origin, rotation, tint ) end - ----Draws a texture (or part of it) that stretches or shrinks nicely ----@param texture any ----@param nPatchInfo any ----@param dest table ----@param origin table ----@param rotation number ----@param tint table ----@return any RL.DrawTextureNPatch -function RL.DrawTextureNPatch( texture, nPatchInfo, dest, origin, rotation, tint ) end - --- Textures - Texture Configuration +-- Textures - Texture configuration functions ---Generate GPU mipmaps for a texture ---@param texture any @@ -3219,7 +3182,44 @@ function RL.GetTextureMipmaps( texture ) end ---@return any format function RL.GetTextureFormat( texture ) end --- Textures - RenderTexture Configuration +-- Textures - Texture drawing functions + +---Draw a Texture2D +---@param texture any +---@param position table +---@param tint table +---@return any RL.DrawTexture +function RL.DrawTexture( texture, position, tint ) end + +---Draw a part of a texture defined by a rectangle +---@param texture any +---@param source table +---@param position table +---@param tint table +---@return any RL.DrawTextureRec +function RL.DrawTextureRec( texture, source, position, tint ) end + +---Draw a part of a texture defined by a rectangle with "pro" parameters +---@param texture any +---@param source table +---@param dest table +---@param origin table +---@param rotation number +---@param tint table +---@return any RL.DrawTexturePro +function RL.DrawTexturePro( texture, source, dest, origin, rotation, tint ) end + +---Draws a texture (or part of it) that stretches or shrinks nicely +---@param texture any +---@param nPatchInfo any +---@param dest table +---@param origin table +---@param rotation number +---@param tint table +---@return any RL.DrawTextureNPatch +function RL.DrawTextureNPatch( texture, nPatchInfo, dest, origin, rotation, tint ) end + +-- Textures - RenderTexture configuration functions ---Get OpenGL framebuffer object id ---- Success return int @@ -3239,7 +3239,7 @@ function RL.GetRenderTextureTexture( renderTexture ) end ---@return any texture function RL.GetRenderTextureDepthTexture( renderTexture ) end --- Textures - Color/pixel +-- Textures - Color/pixel related functions ---Returns color with alpha applied, alpha goes from 0.0f to 1.0f ---- Success return Color @@ -3337,7 +3337,7 @@ function RL.GetPixelColor( texture, position ) end ---@return any size function RL.GetPixelDataSize( width, height, format ) end --- Text - Loading +-- Text - Font loading/unloading functions ---Get the default Font. Return as lightuserdata ---@return any RL.GetFontDefault @@ -3378,7 +3378,7 @@ function RL.IsFontReady( font ) end ---@return any RL.UnloadFont function RL.UnloadFont( font ) end --- Text - Draw +-- Text - Text drawing functions ---Draw current FPS ---@param pos table @@ -3459,7 +3459,7 @@ function RL.DrawTextBoxed( font, text, rec, fontSize, spacing, wordWrap, tint ) ---@return any mouseCharId function RL.DrawTextBoxedTinted( font, text, rec, fontSize, spacing, wordWrap, tints, backTints ) end --- Text - Font info functions +-- Text - Text font info functions ---Measure string size for Font ---- Success return Vector2 @@ -4155,14 +4155,14 @@ function RL.GetRayCollisionTriangle( ray, p1, p2, p3 ) end ---@return any rayCollision function RL.GetRayCollisionQuad( ray, p1, p2, p3, p4 ) end --- Audio - Audio device management +-- Audio - Audio device management functions ---Set master volume (listener) ---@param volume number ---@return any RL.SetMasterVolume function RL.SetMasterVolume( volume ) end --- Audio - Wave/Sound Loading +-- Audio - Wave/Sound loading/unloading functions ---Load sound from file ---- Failure return nil @@ -4220,7 +4220,7 @@ function RL.ExportWave( wave, fileName ) end ---@return any success function RL.ExportWaveAsCode( wave, fileName ) end --- Audio - Wave/Sound management +-- Audio - Wave/Sound management functions ---Play a sound ---@param sound any @@ -4287,7 +4287,7 @@ function RL.WaveCopy( wave ) end ---@return any RL.WaveCrop function RL.WaveCrop( wave, initSample, finalSample ) end --- Audio - Music management +-- Audio - Music management functions ---Load music stream from file ---- Success return Music @@ -5175,7 +5175,7 @@ function RL.QuaternionTransform( q, mat ) end ---@return any result function RL.QuaternionEquals( q1, q2 ) end --- Gui - Global +-- Gui - Global gui state control functions ---Enable gui controls (global state) ---@return any RL.GuiEnable @@ -5213,7 +5213,7 @@ function RL.GuiSetState( state ) end ---@return any state function RL.GuiGetState() end --- Gui - Font +-- Gui - Font set/get functions ---Set gui custom font (global state) ---@param font any @@ -5225,7 +5225,7 @@ function RL.GuiSetFont( font ) end ---@return any font function RL.GuiGetFont() end --- Gui - Style +-- Gui - Style set/get functions ---Set one style property ---@param control integer @@ -5241,18 +5241,7 @@ function RL.GuiSetStyle( control, property, value ) end ---@return any value function RL.GuiGetStyle( control, property ) end ----Load style file over global style variable (.rgs) ----- Failure return false ----- Success return true ----@param fileName string ----@return any success -function RL.GuiLoadStyle( fileName ) end - ----Load style default over global style ----@return any RL.GuiLoadStyleDefault -function RL.GuiLoadStyleDefault() end - --- Gui - Container +-- Gui - Container/separator controls, useful for controls organization ---Window Box control, shows a window that can be closed ---- Success return bool @@ -5289,7 +5278,7 @@ function RL.GuiPanel( bounds, text ) end ---@return any scroll function RL.GuiScrollPanel( bounds, text, content, scroll ) end --- Gui - Basic +-- Gui - Basic controls set ---Label control, shows text ---@param bounds table @@ -5460,7 +5449,7 @@ function RL.GuiDummyRec( bounds, text ) end ---@return any cell function RL.GuiGrid( bounds, text, spacing, subdivs ) end --- Gui - Advanced +-- Gui - Advance controls set ---List View control, returns selected list item index and scroll index ---- Success return int, int @@ -5539,7 +5528,20 @@ function RL.GuiColorBarAlpha( bounds, text, alpha ) end ---@return any hue function RL.GuiColorBarHue( bounds, text, value ) end --- Gui - Icons +-- Gui - Styles loading functions + +---Load style file over global style variable (.rgs) +---- Failure return false +---- Success return true +---@param fileName string +---@return any success +function RL.GuiLoadStyle( fileName ) end + +---Load style default over global style +---@return any RL.GuiLoadStyleDefault +function RL.GuiLoadStyleDefault() end + +-- Gui - Icons functionality ---Get text with icon id prepended (if supported) ---- Success return string @@ -5580,7 +5582,7 @@ function RL.GuiClearIconPixel( iconId, pos ) end ---@return any value function RL.GuiCheckIconPixel( iconId, pos ) end --- Lights - Basics +-- Lights - Light management functions ---Create a light and get shader locations ---- Success return Light @@ -16,6 +16,7 @@ KEY CHANGES: - ADDED: DrawTextEx. - CHANGED: DrawText is now DrawTextEx like in Raylib. - ADDED: Global variable descriptions for API. + - CHANGED: Organized functions by putting them in the same order as in Raylib. DETAILED CHANGES: - CHANGED: GenImageColor now takes Vector2 as size. @@ -48,6 +49,7 @@ DETAILED CHANGES: - ADDED: DrawModelWires and DrawModelWiresEx. - ADDED: LoadMaterials. - CHANGED: Organized core functions. + - CHANGED: Organized shapes, textures, audio, text, lights and gui functions. ------------------------------------------------------------------------ Release: ReiLua version 0.5.0 Using Raylib 4.5 @@ -12,7 +12,8 @@ Backlog { * LoadMaterials (Load materials from model file). * LoadMaterialsFromModel (Could then for example edit and set back to model). * rlgl - * Shader buffer storage object management (ssbo) + * More Textures management functions. + * Shader buffer storage object management (ssbo). * Extend color lib functionality. diff --git a/include/audio.h b/include/audio.h index edc47ee..09b5bb3 100644 --- a/include/audio.h +++ b/include/audio.h @@ -1,8 +1,8 @@ #pragma once -/* Audio device management. */ +/* Audio device management functions. */ int laudioSetMasterVolume( lua_State *L ); -/* Wave/Sound Loading. */ +/* Wave/Sound loading/unloading functions. */ int laudioLoadSound( lua_State *L ); int laudioLoadWave( lua_State *L ); int laudioIsWaveReady( lua_State *L ); @@ -12,7 +12,7 @@ int laudioUnloadWave( lua_State *L ); int laudioUnloadSound( lua_State *L ); int laudioExportWave( lua_State *L ); int laudioExportWaveAsCode( lua_State *L ); -/* Wave/Sound management. */ +/* Wave/Sound management functions. */ int laudioPlaySound( lua_State *L ); int laudioStopSound( lua_State *L ); int laudioPauseSound( lua_State *L ); @@ -24,7 +24,7 @@ int laudioSetSoundPan( lua_State *L ); int laudioWaveFormat( lua_State *L ); int laudioWaveCopy( lua_State *L ); int laudioWaveCrop( lua_State *L ); -/* Music management. */ +/* Music management functions. */ int laudioLoadMusicStream( lua_State *L ); int laudioIsMusicReady( lua_State *L ); int laudioUnloadMusicStream( lua_State *L ); diff --git a/include/lights.h b/include/lights.h index f6c0f5f..24bbbb4 100644 --- a/include/lights.h +++ b/include/lights.h @@ -1,6 +1,6 @@ #pragma once -/* Basics. */ +/* Light management functions. */ int llightsCreateLight( lua_State *L ); int llightsUpdateLightValues( lua_State *L ); int llightsSetLightType( lua_State *L ); diff --git a/include/rgui.h b/include/rgui.h index 576c0c6..1406fcd 100644 --- a/include/rgui.h +++ b/include/rgui.h @@ -15,8 +15,6 @@ int lguiGuiGetFont( lua_State *L ); /* Style */ int lguiGuiSetStyle( lua_State *L ); int lguiGuiGetStyle( lua_State *L ); -int lguiGuiLoadStyle( lua_State *L ); -int lguiGuiLoadStyleDefault( lua_State *L ); /* Container. */ int lguiGuiWindowBox( lua_State *L ); int lguiGuiGroupBox( lua_State *L ); @@ -52,6 +50,9 @@ int lguiGuiColorPicker( lua_State *L ); int lguiGuiColorPanel( lua_State *L ); int lguiGuiColorBarAlpha( lua_State *L ); int lguiGuiColorBarHue( lua_State *L ); +/* Styles loading functions */ +int lguiGuiLoadStyle( lua_State *L ); +int lguiGuiLoadStyleDefault( lua_State *L ); /* Icons. */ int lguiGuiIconText( lua_State *L ); int lguiGuiDrawIcon( lua_State *L ); diff --git a/include/shapes.h b/include/shapes.h index 6618524..3fde097 100644 --- a/include/shapes.h +++ b/include/shapes.h @@ -1,6 +1,6 @@ #pragma once -/* Drawing. */ +/* Basic shapes drawing functions. */ int lshapesSetShapesTexture( lua_State *L ); int lshapesDrawPixel( lua_State *L ); int lshapesDrawLine( lua_State *L ); @@ -33,7 +33,7 @@ int lshapesDrawTriangleStrip( lua_State *L ); int lshapesDrawPoly( lua_State *L ); int lshapesDrawPolyLines( lua_State *L ); int lshapesDrawPolyLinesEx( lua_State *L ); -/* Collision. */ +/* Basic shapes collision detection functions. */ int lshapesCheckCollisionRecs( lua_State *L ); int lshapesCheckCollisionCircles( lua_State *L ); int lshapesCheckCollisionCircleRec( lua_State *L ); diff --git a/include/text.h b/include/text.h index ad5851d..a0b5c05 100644 --- a/include/text.h +++ b/include/text.h @@ -1,13 +1,13 @@ #pragma once -/* Loading. */ +/* Font loading/unloading functions. */ int ltextGetFontDefault( lua_State *L ); int ltextLoadFont( lua_State *L ); int ltextLoadFontEx( lua_State *L ); int ltextLoadFontFromImage( lua_State *L ); int ltextIsFontReady( lua_State *L ); int ltextUnloadFont( lua_State *L ); -/* Drawing. */ +/* Text drawing functions. */ int ltextDrawFPS( lua_State *L ); int ltextDrawText( lua_State *L ); int ltextDrawTextEx( lua_State *L ); @@ -16,7 +16,7 @@ int ltextDrawTextCodepoint( lua_State *L ); int ltextDrawTextCodepoints( lua_State *L ); int ltextDrawTextBoxed( lua_State *L ); int ltextDrawTextBoxedTinted( lua_State *L ); -/* Font info functions. */ +/* Text font info functions. */ int ltextMeasureText( lua_State *L ); int ltextGetGlyphIndex( lua_State *L ); int ltextGetGlyphInfo( lua_State *L ); diff --git a/include/textures.h b/include/textures.h index 237dc60..e755576 100644 --- a/include/textures.h +++ b/include/textures.h @@ -1,6 +1,6 @@ #pragma once -/* Image Loading. */ +/* Image loading functions. */ int ltexturesLoadImage( lua_State *L ); int ltexturesLoadImageFromTexture( lua_State *L ); int ltexturesLoadImageFromScreen( lua_State *L ); @@ -8,7 +8,7 @@ int ltextureIsImageReady( lua_State *L ); int ltextureUnloadImage( lua_State *L ); int ltexturesExportImage( lua_State *L ); int ltexturesExportImageAsCode( lua_State *L ); -/* Image Generation. */ +/* Image generation functions. */ int ltexturesGenImageColor( lua_State *L ); int ltexturesGenImageGradientV( lua_State *L ); int ltexturesGenImageGradientH( lua_State *L ); @@ -18,7 +18,7 @@ int ltexturesGenImageWhiteNoise( lua_State *L ); int ltexturesGenImagePerlinNoise( lua_State *L ); int ltexturesGenImageCellular( lua_State *L ); int ltexturesGenImageText( lua_State *L ); -/* Image Manipulation Functions. */ +/* Image manipulation functions. */ int ltexturesImageCopy( lua_State *L ); int ltexturesImageFromImage( lua_State *L ); int ltexturesImageText( lua_State *L ); @@ -49,7 +49,11 @@ int ltexturesLoadImageColors( lua_State *L ); int ltexturesLoadImagePalette( lua_State *L ); int ltexturesGetImageAlphaBorder( lua_State *L ); int ltexturesGetImageColor( lua_State *L ); -/* Image Drawing. */ +/* Image configuration functions. */ +int ltexturesGetImageSize( lua_State *L ); +int ltexturesGetImageMipmaps( lua_State *L ); +int ltexturesGetImageFormat( lua_State *L ); +/* Image drawing functions. */ int ltexturesImageClearBackground( lua_State *L ); int ltexturesImageDrawPixel( lua_State *L ); int ltexturesImageDrawLine( lua_State *L ); @@ -59,11 +63,7 @@ int ltexturesImageDrawRectangle( lua_State *L ); int ltexturesImageDrawRectangleLines( lua_State *L ); int ltexturesImageDraw( lua_State *L ); int ltexturesImageDrawTextEx( lua_State *L ); -/* Image Configuration. */ -int ltexturesGetImageSize( lua_State *L ); -int ltexturesGetImageMipmaps( lua_State *L ); -int ltexturesGetImageFormat( lua_State *L ); -/* Texture Loading. */ +/* Texture loading functions. */ int ltexturesLoadTexture( lua_State *L ); int ltexturesLoadTextureFromImage( lua_State *L ); int ltexturesLoadTextureCubemap( lua_State *L ); @@ -76,12 +76,7 @@ int ltexturesIsRenderTextureReady( lua_State *L ); int ltextureUnloadRenderTexture( lua_State *L ); int ltexturesUpdateTexture( lua_State *L ); int ltexturesUpdateTextureRec( lua_State *L ); -/* Texture Drawing. */ -int ltexturesDrawTexture( lua_State *L ); -int ltexturesDrawTextureRec( lua_State *L ); -int ltexturesDrawTexturePro( lua_State *L ); -int ltexturesDrawTextureNPatch( lua_State *L ); -/* Texture Configuration. */ +/* Texture configuration functions. */ int ltexturesGenTextureMipmaps( lua_State *L ); int ltexturesSetTextureFilter( lua_State *L ); int ltexturesSetTextureWrap( lua_State *L ); @@ -89,11 +84,16 @@ int ltexturesGetTextureId( lua_State *L ); int ltexturesGetTextureSize( lua_State *L ); int ltexturesGetTextureMipmaps( lua_State *L ); int ltexturesGetTextureFormat( lua_State *L ); -/* RenderTexture Configuration. */ +/* Texture drawing functions. */ +int ltexturesDrawTexture( lua_State *L ); +int ltexturesDrawTextureRec( lua_State *L ); +int ltexturesDrawTexturePro( lua_State *L ); +int ltexturesDrawTextureNPatch( lua_State *L ); +/* RenderTexture configuration functions. */ int ltexturesGetRenderTextureId( lua_State *L ); int ltexturesGetRenderTextureTexture( lua_State *L ); int ltexturesGetRenderTextureDepthTexture( lua_State *L ); -/* Color/pixel */ +/* Color/pixel related functions. */ int ltexturesFade( lua_State *L ); int ltexturesColorToInt( lua_State *L ); int ltexturesColorNormalize( lua_State *L ); diff --git a/src/audio.c b/src/audio.c index f1ef460..0b793b2 100644 --- a/src/audio.c +++ b/src/audio.c @@ -4,7 +4,7 @@ #include "lua_core.h" /* -## Audio - Audio device management +## Audio - Audio device management functions */ /* @@ -21,7 +21,7 @@ int laudioSetMasterVolume( lua_State *L ) { } /* -## Audio - Wave/Sound Loading +## Audio - Wave/Sound loading/unloading functions */ /* @@ -166,7 +166,7 @@ int laudioExportWaveAsCode( lua_State *L ) { } /* -## Audio - Wave/Sound management +## Audio - Wave/Sound management functions */ /* @@ -325,7 +325,7 @@ int laudioWaveCrop( lua_State *L ) { } /* -## Audio - Music management +## Audio - Music management functions */ /* diff --git a/src/lights.c b/src/lights.c index dc8b25e..7131c99 100644 --- a/src/lights.c +++ b/src/lights.c @@ -8,7 +8,7 @@ #include "rlights.h" /* -## Lights - Basics +## Lights - Light management functions */ /* diff --git a/src/lua_core.c b/src/lua_core.c index b32fd57..843a38a 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -1704,7 +1704,7 @@ void luaRegister() { assingGlobalFunction( "LoadBufferFromFile", lcoreLoadBufferFromFile ); /* Shapes. */ - /* Drawing. */ + /* Basic shapes drawing functions. */ assingGlobalFunction( "SetShapesTexture", lshapesSetShapesTexture ); assingGlobalFunction( "DrawPixel", lshapesDrawPixel ); assingGlobalFunction( "DrawLine", lshapesDrawLine ); @@ -1737,7 +1737,7 @@ void luaRegister() { assingGlobalFunction( "DrawPoly", lshapesDrawPoly ); assingGlobalFunction( "DrawPolyLines", lshapesDrawPolyLines ); assingGlobalFunction( "DrawPolyLinesEx", lshapesDrawPolyLinesEx ); - /* Collision. */ + /* Basic shapes collision detection functions. */ assingGlobalFunction( "CheckCollisionRecs", lshapesCheckCollisionRecs ); assingGlobalFunction( "CheckCollisionCircles", lshapesCheckCollisionCircles ); assingGlobalFunction( "CheckCollisionCircleRec", lshapesCheckCollisionCircleRec ); @@ -1750,7 +1750,7 @@ void luaRegister() { assingGlobalFunction( "GetCollisionRec", lshapesGetCollisionRec ); /* Textures. */ - /* Image Loading. */ + /* Image loading functions. */ assingGlobalFunction( "LoadImage", ltexturesLoadImage ); assingGlobalFunction( "LoadImageFromTexture", ltexturesLoadImageFromTexture ); assingGlobalFunction( "LoadImageFromScreen", ltexturesLoadImageFromScreen ); @@ -1758,7 +1758,7 @@ void luaRegister() { assingGlobalFunction( "UnloadImage", ltextureUnloadImage ); assingGlobalFunction( "ExportImage", ltexturesExportImage ); assingGlobalFunction( "ExportImageAsCode", ltexturesExportImageAsCode ); - /* Image Generation. */ + /* Image generation functions. */ assingGlobalFunction( "GenImageColor", ltexturesGenImageColor ); assingGlobalFunction( "GenImageGradientV", ltexturesGenImageGradientV ); assingGlobalFunction( "GenImageGradientH", ltexturesGenImageGradientH ); @@ -1768,7 +1768,7 @@ void luaRegister() { assingGlobalFunction( "GenImagePerlinNoise", ltexturesGenImagePerlinNoise ); assingGlobalFunction( "GenImageCellular", ltexturesGenImageCellular ); assingGlobalFunction( "GenImageText", ltexturesGenImageText ); - /* Image Manipulation Functions. */ + /* Image manipulation functions. */ assingGlobalFunction( "ImageCopy", ltexturesImageCopy ); assingGlobalFunction( "ImageFromImage", ltexturesImageFromImage ); assingGlobalFunction( "ImageText", ltexturesImageText ); @@ -1799,7 +1799,11 @@ void luaRegister() { assingGlobalFunction( "LoadImagePalette", ltexturesLoadImagePalette ); assingGlobalFunction( "GetImageAlphaBorder", ltexturesGetImageAlphaBorder ); assingGlobalFunction( "GetImageColor", ltexturesGetImageColor ); - /* Image Drawing. */ + /* Image configuration functions. */ + assingGlobalFunction( "GetImageSize", ltexturesGetImageSize ); + assingGlobalFunction( "GetImageMipmaps", ltexturesGetImageMipmaps ); + assingGlobalFunction( "GetImageFormat", ltexturesGetImageFormat ); + /* Image drawing functions. */ assingGlobalFunction( "ImageClearBackground", ltexturesImageClearBackground ); assingGlobalFunction( "ImageDrawPixel", ltexturesImageDrawPixel ); assingGlobalFunction( "ImageDrawLine", ltexturesImageDrawLine ); @@ -1809,11 +1813,7 @@ void luaRegister() { assingGlobalFunction( "ImageDrawRectangleLines", ltexturesImageDrawRectangleLines ); assingGlobalFunction( "ImageDraw", ltexturesImageDraw ); assingGlobalFunction( "ImageDrawTextEx", ltexturesImageDrawTextEx ); - /* Image Configuration. */ - assingGlobalFunction( "GetImageSize", ltexturesGetImageSize ); - assingGlobalFunction( "GetImageMipmaps", ltexturesGetImageMipmaps ); - assingGlobalFunction( "GetImageFormat", ltexturesGetImageFormat ); - /* Texture Loading. */ + /* Texture loading functions. */ assingGlobalFunction( "LoadTexture", ltexturesLoadTexture ); assingGlobalFunction( "LoadTextureFromImage", ltexturesLoadTextureFromImage ); assingGlobalFunction( "LoadTextureCubemap", ltexturesLoadTextureCubemap ); @@ -1826,12 +1826,7 @@ void luaRegister() { assingGlobalFunction( "UnloadRenderTexture", ltextureUnloadRenderTexture ); assingGlobalFunction( "UpdateTexture", ltexturesUpdateTexture ); assingGlobalFunction( "UpdateTextureRec", ltexturesUpdateTextureRec ); - /* Texture Drawing. */ - assingGlobalFunction( "DrawTexture", ltexturesDrawTexture ); - assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec ); - assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro ); - assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch ); - /* Texture Configuration. */ + /* Texture configuration functions. */ assingGlobalFunction( "GenTextureMipmaps", ltexturesGenTextureMipmaps ); assingGlobalFunction( "SetTextureFilter", ltexturesSetTextureFilter ); assingGlobalFunction( "SetTextureWrap", ltexturesSetTextureWrap ); @@ -1839,11 +1834,16 @@ void luaRegister() { assingGlobalFunction( "GetTextureSize", ltexturesGetTextureSize ); assingGlobalFunction( "GetTextureMipmaps", ltexturesGetTextureMipmaps ); assingGlobalFunction( "GetTextureFormat", ltexturesGetTextureFormat ); - /* RenderTexture Configuration. */ + /* Texture drawing functions. */ + assingGlobalFunction( "DrawTexture", ltexturesDrawTexture ); + assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec ); + assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro ); + assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch ); + /* RenderTexture configuration functions. */ assingGlobalFunction( "GetRenderTextureId", ltexturesGetRenderTextureId ); assingGlobalFunction( "GetRenderTextureTexture", ltexturesGetRenderTextureTexture ); assingGlobalFunction( "GetRenderTextureDepthTexture", ltexturesGetRenderTextureDepthTexture ); - /* Color/pixel */ + /* Color/pixel related functions */ assingGlobalFunction( "Fade", ltexturesFade ); assingGlobalFunction( "ColorToInt", ltexturesColorToInt ); assingGlobalFunction( "ColorNormalize", ltexturesColorNormalize ); @@ -1953,14 +1953,14 @@ void luaRegister() { assingGlobalFunction( "GetRayCollisionQuad", lmodelsGetRayCollisionQuad ); /* Text. */ - /* Loading. */ + /* Font loading/unloading functions. */ assingGlobalFunction( "GetFontDefault", ltextGetFontDefault ); assingGlobalFunction( "LoadFont", ltextLoadFont ); assingGlobalFunction( "LoadFontEx", ltextLoadFontEx ); assingGlobalFunction( "LoadFontFromImage", ltextLoadFontFromImage ); assingGlobalFunction( "IsFontReady", ltextIsFontReady ); assingGlobalFunction( "UnloadFont", ltextUnloadFont ); - /* Drawing. */ + /* Text drawing functions. */ assingGlobalFunction( "DrawFPS", ltextDrawFPS ); assingGlobalFunction( "DrawText", ltextDrawText ); assingGlobalFunction( "DrawTextEx", ltextDrawTextEx ); @@ -1969,7 +1969,7 @@ void luaRegister() { assingGlobalFunction( "DrawTextCodepoints", ltextDrawTextCodepoints ); assingGlobalFunction( "DrawTextBoxed", ltextDrawTextBoxed ); assingGlobalFunction( "DrawTextBoxedTinted", ltextDrawTextBoxedTinted ); - /* Font info functions. */ + /* Text font info functions. */ assingGlobalFunction( "MeasureText", ltextMeasureText ); assingGlobalFunction( "GetGlyphIndex", ltextGetGlyphIndex ); assingGlobalFunction( "GetGlyphInfo", ltextGetGlyphInfo ); @@ -1980,9 +1980,9 @@ void luaRegister() { assingGlobalFunction( "GetFontTexture", ltextGetFontTexture ); /* Audio. */ - /* Audio device management. */ + /* Audio device management functions. */ assingGlobalFunction( "SetMasterVolume", laudioSetMasterVolume ); - /* Wave/Sound Loading. */ + /* Wave/Sound loading/unloading functions. */ assingGlobalFunction( "LoadSound", laudioLoadSound ); assingGlobalFunction( "LoadWave", laudioLoadWave ); assingGlobalFunction( "IsWaveReady", laudioIsWaveReady ); @@ -1992,7 +1992,7 @@ void luaRegister() { assingGlobalFunction( "UnloadSound", laudioUnloadSound ); assingGlobalFunction( "ExportWave", laudioExportWave ); assingGlobalFunction( "ExportWaveAsCode", laudioExportWaveAsCode ); - /* Wave/Sound management */ + /* Wave/Sound management functions. */ assingGlobalFunction( "PlaySound", laudioPlaySound ); assingGlobalFunction( "StopSound", laudioStopSound ); assingGlobalFunction( "PauseSound", laudioPauseSound ); @@ -2004,7 +2004,7 @@ void luaRegister() { assingGlobalFunction( "WaveFormat", laudioWaveFormat ); assingGlobalFunction( "WaveCopy", laudioWaveCopy ); assingGlobalFunction( "WaveCrop", laudioWaveCrop ); - /* Music management. */ + /* Music management functions. */ assingGlobalFunction( "LoadMusicStream", laudioLoadMusicStream ); assingGlobalFunction( "IsMusicReady", laudioIsMusicReady ); assingGlobalFunction( "UnloadMusicStream", laudioUnloadMusicStream ); @@ -2155,8 +2155,6 @@ void luaRegister() { /* Style. */ assingGlobalFunction( "GuiSetStyle", lguiGuiSetStyle ); assingGlobalFunction( "GuiGetStyle", lguiGuiGetStyle ); - assingGlobalFunction( "GuiLoadStyle", lguiGuiLoadStyle ); - assingGlobalFunction( "GuiLoadStyleDefault", lguiGuiLoadStyleDefault ); /* Container. */ assingGlobalFunction( "GuiWindowBox", lguiGuiWindowBox ); assingGlobalFunction( "GuiGroupBox", lguiGuiGroupBox ); @@ -2192,6 +2190,9 @@ void luaRegister() { assingGlobalFunction( "GuiColorPanel", lguiGuiColorPanel ); assingGlobalFunction( "GuiColorBarAlpha", lguiGuiColorBarAlpha ); assingGlobalFunction( "GuiColorBarHue", lguiGuiColorBarHue ); + /* Styles loading functions */ + assingGlobalFunction( "GuiLoadStyle", lguiGuiLoadStyle ); + assingGlobalFunction( "GuiLoadStyleDefault", lguiGuiLoadStyleDefault ); /* Icons. */ assingGlobalFunction( "GuiIconText", lguiGuiIconText ); assingGlobalFunction( "GuiDrawIcon", lguiGuiDrawIcon ); @@ -2201,7 +2202,7 @@ void luaRegister() { assingGlobalFunction( "GuiCheckIconPixel", lguiGuiCheckIconPixel ); /* Lights */ - /* Basics. */ + /* Light management functions. */ assingGlobalFunction( "CreateLight", llightsCreateLight ); assingGlobalFunction( "UpdateLightValues", llightsUpdateLightValues ); assingGlobalFunction( "SetLightType", llightsSetLightType ); @@ -7,7 +7,7 @@ #include "raygui.h" /* -## Gui - Global +## Gui - Global gui state control functions */ /* @@ -107,7 +107,7 @@ int lguiGuiGetState( lua_State *L ) { } /* -## Gui - Font +## Gui - Font set/get functions */ /* @@ -137,7 +137,7 @@ int lguiGuiGetFont( lua_State *L ) { } /* -## Gui - Style +## Gui - Style set/get functions */ /* @@ -172,39 +172,7 @@ int lguiGuiGetStyle( lua_State *L ) { } /* -> success = RL.GuiLoadStyle( string fileName ) - -Load style file over global style variable (.rgs) - -- Failure return false -- Success return true -*/ -int lguiGuiLoadStyle( lua_State *L ) { - if ( FileExists( luaL_checkstring( L, 1 ) ) ) { - GuiLoadStyle( lua_tostring( L, 1 ) ); - lua_pushboolean( L, true ); - - return 1; - } - TraceLog( state->logLevelInvalid, "Invalid file '%s'", lua_tostring( L, 1 ) ); - lua_pushboolean( L, false ); - - return 1; -} - -/* -> RL.GuiLoadStyleDefault() - -Load style default over global style -*/ -int lguiGuiLoadStyleDefault( lua_State *L ) { - GuiLoadStyleDefault(); - - return 0; -} - -/* -## Gui - Container +## Gui - Container/separator controls, useful for controls organization */ /* @@ -280,7 +248,7 @@ int lguiGuiScrollPanel( lua_State *L ) { } /* -## Gui - Basic +## Gui - Basic controls set */ /* @@ -606,7 +574,7 @@ int lguiGuiGrid( lua_State *L ) { } /* -## Gui - Advanced +## Gui - Advance controls set */ /* @@ -750,7 +718,43 @@ int lguiGuiColorBarHue( lua_State *L ) { } /* -## Gui - Icons +## Gui - Styles loading functions +*/ + +/* +> success = RL.GuiLoadStyle( string fileName ) + +Load style file over global style variable (.rgs) + +- Failure return false +- Success return true +*/ +int lguiGuiLoadStyle( lua_State *L ) { + if ( FileExists( luaL_checkstring( L, 1 ) ) ) { + GuiLoadStyle( lua_tostring( L, 1 ) ); + lua_pushboolean( L, true ); + + return 1; + } + TraceLog( state->logLevelInvalid, "Invalid file '%s'", lua_tostring( L, 1 ) ); + lua_pushboolean( L, false ); + + return 1; +} + +/* +> RL.GuiLoadStyleDefault() + +Load style default over global style +*/ +int lguiGuiLoadStyleDefault( lua_State *L ) { + GuiLoadStyleDefault(); + + return 0; +} + +/* +## Gui - Icons functionality */ /* diff --git a/src/shapes.c b/src/shapes.c index 33896ed..c68504c 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -5,7 +5,7 @@ #include "textures.h" /* -## Shapes - Drawing +## Shapes - Basic shapes drawing functions */ /* @@ -556,7 +556,7 @@ int lshapesDrawPolyLinesEx( lua_State *L ) { } /* -## Shapes - Collision +## Shapes - Basic shapes collision detection functions */ /* @@ -158,7 +158,7 @@ bool wordWrap, Color *tints, int tintCount, Color *backTints, int backTintCount } /* -## Text - Loading +## Text - Font loading/unloading functions */ /* @@ -278,7 +278,7 @@ int ltextUnloadFont( lua_State *L ) { } /* -## Text - Draw +## Text - Text drawing functions */ /* @@ -457,7 +457,7 @@ int ltextDrawTextBoxedTinted( lua_State *L ) { } /* -## Text - Font info functions +## Text - Text font info functions */ /* diff --git a/src/textures.c b/src/textures.c index 2274aa9..c5b07e4 100644 --- a/src/textures.c +++ b/src/textures.c @@ -5,7 +5,7 @@ #include "lua_core.h" /* -## Textures - Image Loading +## Textures - Image loading functions */ /* @@ -111,7 +111,7 @@ int ltexturesExportImageAsCode( lua_State *L ) { } /* -## Textures - Image Generation +## Textures - Image generation functions */ /* @@ -265,7 +265,7 @@ int ltexturesGenImageText( lua_State *L ) { } /* -## Textures - Image Manipulation Functions +## Textures - Image manipulation functions */ /* @@ -717,7 +717,56 @@ int ltexturesGetImageColor( lua_State *L ) { } /* -## Textures - Image Drawing +## Textures - Image configuration functions +*/ + +/* +> size = RL.GetImageSize( Image image ) + +Get image size + +- Success return Vector2 +*/ +int ltexturesGetImageSize( lua_State *L ) { + Image *image = uluaGetImage( L, 1 ); + + uluaPushVector2( L, (Vector2){ image->width, image->height } ); + + return 1; +} + +/* +> mipmaps = RL.GetImageMipmaps( Image image ) + +Get image mipmaps. Mipmap levels, 1 by default + +- Success return int +*/ +int ltexturesGetImageMipmaps( lua_State *L ) { + Image *image = uluaGetImage( L, 1 ); + + lua_pushinteger( L, image->mipmaps ); + + return 1; +} + +/* +> format = RL.GetImageFormat( Image image ) + +Get image data format (PixelFormat type) + +- Success return int +*/ +int ltexturesGetImageFormat( lua_State *L ) { + Image *image = uluaGetImage( L, 1 ); + + lua_pushinteger( L, image->format ); + + return 1; +} + +/* +## Textures - Image drawing functions */ /* @@ -864,56 +913,7 @@ int ltexturesImageDrawTextEx( lua_State *L ) { } /* -## Textures - Image Configuration -*/ - -/* -> size = RL.GetImageSize( Image image ) - -Get image size - -- Success return Vector2 -*/ -int ltexturesGetImageSize( lua_State *L ) { - Image *image = uluaGetImage( L, 1 ); - - uluaPushVector2( L, (Vector2){ image->width, image->height } ); - - return 1; -} - -/* -> mipmaps = RL.GetImageMipmaps( Image image ) - -Get image mipmaps. Mipmap levels, 1 by default - -- Success return int -*/ -int ltexturesGetImageMipmaps( lua_State *L ) { - Image *image = uluaGetImage( L, 1 ); - - lua_pushinteger( L, image->mipmaps ); - - return 1; -} - -/* -> format = RL.GetImageFormat( Image image ) - -Get image data format (PixelFormat type) - -- Success return int -*/ -int ltexturesGetImageFormat( lua_State *L ) { - Image *image = uluaGetImage( L, 1 ); - - lua_pushinteger( L, image->format ); - - return 1; -} - -/* -## Textures - Texture Loading +## Textures - Texture loading functions */ /* @@ -1190,76 +1190,7 @@ int ltexturesUpdateTextureRec( lua_State *L ) { } /* -## Textures - Texture Drawing -*/ - -/* -> RL.DrawTexture( Texture texture, Vector2 position, Color tint ) - -Draw a Texture2D -*/ -int ltexturesDrawTexture( lua_State *L ) { - Texture *texture = uluaGetTexture( L, 1 ); - Vector2 pos = uluaGetVector2( L, 2 ); - Color color = uluaGetColor( L, 3 ); - - DrawTexture( *texture, pos.x, pos.y, color ); - return 0; -} - -/* -> RL.DrawTextureRec( Texture texture, Rectangle source, Vector2 position, Color tint ) - -Draw a part of a texture defined by a rectangle -*/ -int ltexturesDrawTextureRec( lua_State *L ) { - Texture *texture = uluaGetTexture( L, 1 ); - Rectangle srcRect = uluaGetRectangle( L, 2 ); - Vector2 pos = uluaGetVector2( L, 3 ); - Color tint = uluaGetColor( L, 4 ); - - DrawTextureRec( *texture, srcRect, pos, tint ); - return 0; -} - -/* -> RL.DrawTexturePro( Texture texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint ) - -Draw a part of a texture defined by a rectangle with "pro" parameters -*/ -int ltexturesDrawTexturePro( lua_State *L ) { - Texture *texture = uluaGetTexture( L, 1 ); - Rectangle srcRect = uluaGetRectangle( L, 2 ); - Rectangle dstRect = uluaGetRectangle( L, 3 ); - Vector2 origin = uluaGetVector2( L, 4 ); - float rot = luaL_checknumber( L, 5 ); - Color color = uluaGetColor( L, 6 ); - - DrawTexturePro( *texture, srcRect, dstRect, origin, rot, color ); - - return 0; -} - -/* -> RL.DrawTextureNPatch( Texture texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint ) - -Draws a texture (or part of it) that stretches or shrinks nicely -*/ -int ltexturesDrawTextureNPatch( lua_State *L ) { - Texture *texture = uluaGetTexture( L, 1 ); - NPatchInfo nPatchInfo = uluaGetNPatchInfo( L, 2 ); - Rectangle dest = uluaGetRectangle( L, 3 ); - Vector2 origin = uluaGetVector2( L, 4 ); - float rotation = luaL_checknumber( L, 5 ); - Color tint = uluaGetColor( L, 6 ); - - DrawTextureNPatch( *texture, nPatchInfo, dest, origin, rotation, tint ); - - return 0; -} - -/* -## Textures - Texture Configuration +## Textures - Texture configuration functions */ /* @@ -1364,7 +1295,76 @@ int ltexturesGetTextureFormat( lua_State *L ) { } /* -## Textures - RenderTexture Configuration +## Textures - Texture drawing functions +*/ + +/* +> RL.DrawTexture( Texture texture, Vector2 position, Color tint ) + +Draw a Texture2D +*/ +int ltexturesDrawTexture( lua_State *L ) { + Texture *texture = uluaGetTexture( L, 1 ); + Vector2 pos = uluaGetVector2( L, 2 ); + Color color = uluaGetColor( L, 3 ); + + DrawTexture( *texture, pos.x, pos.y, color ); + return 0; +} + +/* +> RL.DrawTextureRec( Texture texture, Rectangle source, Vector2 position, Color tint ) + +Draw a part of a texture defined by a rectangle +*/ +int ltexturesDrawTextureRec( lua_State *L ) { + Texture *texture = uluaGetTexture( L, 1 ); + Rectangle srcRect = uluaGetRectangle( L, 2 ); + Vector2 pos = uluaGetVector2( L, 3 ); + Color tint = uluaGetColor( L, 4 ); + + DrawTextureRec( *texture, srcRect, pos, tint ); + return 0; +} + +/* +> RL.DrawTexturePro( Texture texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint ) + +Draw a part of a texture defined by a rectangle with "pro" parameters +*/ +int ltexturesDrawTexturePro( lua_State *L ) { + Texture *texture = uluaGetTexture( L, 1 ); + Rectangle srcRect = uluaGetRectangle( L, 2 ); + Rectangle dstRect = uluaGetRectangle( L, 3 ); + Vector2 origin = uluaGetVector2( L, 4 ); + float rot = luaL_checknumber( L, 5 ); + Color color = uluaGetColor( L, 6 ); + + DrawTexturePro( *texture, srcRect, dstRect, origin, rot, color ); + + return 0; +} + +/* +> RL.DrawTextureNPatch( Texture texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint ) + +Draws a texture (or part of it) that stretches or shrinks nicely +*/ +int ltexturesDrawTextureNPatch( lua_State *L ) { + Texture *texture = uluaGetTexture( L, 1 ); + NPatchInfo nPatchInfo = uluaGetNPatchInfo( L, 2 ); + Rectangle dest = uluaGetRectangle( L, 3 ); + Vector2 origin = uluaGetVector2( L, 4 ); + float rotation = luaL_checknumber( L, 5 ); + Color tint = uluaGetColor( L, 6 ); + + DrawTextureNPatch( *texture, nPatchInfo, dest, origin, rotation, tint ); + + return 0; +} + +/* +## Textures - RenderTexture configuration functions */ /* @@ -1413,7 +1413,7 @@ int ltexturesGetRenderTextureDepthTexture( lua_State *L ) { } /* -## Textures - Color/pixel +## Textures - Color/pixel related functions */ /* |
