UNPKG

raylib

Version:
2,669 lines (2,482 loc) 354 kB
/** * node-raylib * * @module raylib * @file Definitions file for node-raylib. * * GENERATED CODE: DO NOT MODIFY */ const r = require('../../build/Release/node-raylib-drm.node') const raylib = {} /** * Initialize window and OpenGL context * * @param {number} width * @param {number} height * @param {string} title * * @return {undefined} */ function InitWindow (width, height, title) { return r.BindInitWindow( width, height, title ) } raylib.InitWindow = InitWindow /** * Check if KEY_ESCAPE pressed or Close icon pressed * * @return {boolean} The resulting bool. */ function WindowShouldClose () { return r.BindWindowShouldClose() } raylib.WindowShouldClose = WindowShouldClose /** * Close window and unload OpenGL context * * @return {undefined} */ function CloseWindow () { return r.BindCloseWindow() } raylib.CloseWindow = CloseWindow /** * Check if window has been initialized successfully * * @return {boolean} The resulting bool. */ function IsWindowReady () { return r.BindIsWindowReady() } raylib.IsWindowReady = IsWindowReady /** * Check if window is currently fullscreen * * @return {boolean} The resulting bool. */ function IsWindowFullscreen () { return r.BindIsWindowFullscreen() } raylib.IsWindowFullscreen = IsWindowFullscreen /** * Check if window is currently hidden (only PLATFORM_DESKTOP) * * @return {boolean} The resulting bool. */ function IsWindowHidden () { return r.BindIsWindowHidden() } raylib.IsWindowHidden = IsWindowHidden /** * Check if window is currently minimized (only PLATFORM_DESKTOP) * * @return {boolean} The resulting bool. */ function IsWindowMinimized () { return r.BindIsWindowMinimized() } raylib.IsWindowMinimized = IsWindowMinimized /** * Check if window is currently maximized (only PLATFORM_DESKTOP) * * @return {boolean} The resulting bool. */ function IsWindowMaximized () { return r.BindIsWindowMaximized() } raylib.IsWindowMaximized = IsWindowMaximized /** * Check if window is currently focused (only PLATFORM_DESKTOP) * * @return {boolean} The resulting bool. */ function IsWindowFocused () { return r.BindIsWindowFocused() } raylib.IsWindowFocused = IsWindowFocused /** * Check if window has been resized last frame * * @return {boolean} The resulting bool. */ function IsWindowResized () { return r.BindIsWindowResized() } raylib.IsWindowResized = IsWindowResized /** * Check if one specific window flag is enabled * * @param {number} flag * * @return {boolean} The resulting bool. */ function IsWindowState (flag) { return r.BindIsWindowState( flag ) } raylib.IsWindowState = IsWindowState /** * Set window configuration state using flags (only PLATFORM_DESKTOP) * * @param {number} flags * * @return {undefined} */ function SetWindowState (flags) { return r.BindSetWindowState( flags ) } raylib.SetWindowState = SetWindowState /** * Clear window configuration state flags * * @param {number} flags * * @return {undefined} */ function ClearWindowState (flags) { return r.BindClearWindowState( flags ) } raylib.ClearWindowState = ClearWindowState /** * Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) * * @return {undefined} */ function ToggleFullscreen () { return r.BindToggleFullscreen() } raylib.ToggleFullscreen = ToggleFullscreen /** * Set window state: maximized, if resizable (only PLATFORM_DESKTOP) * * @return {undefined} */ function MaximizeWindow () { return r.BindMaximizeWindow() } raylib.MaximizeWindow = MaximizeWindow /** * Set window state: minimized, if resizable (only PLATFORM_DESKTOP) * * @return {undefined} */ function MinimizeWindow () { return r.BindMinimizeWindow() } raylib.MinimizeWindow = MinimizeWindow /** * Set window state: not minimized/maximized (only PLATFORM_DESKTOP) * * @return {undefined} */ function RestoreWindow () { return r.BindRestoreWindow() } raylib.RestoreWindow = RestoreWindow /** * Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) * * @param {Image} image * * @return {undefined} */ function SetWindowIcon (image) { return r.BindSetWindowIcon( image.data, image.width, image.height, image.mipmaps, image.format ) } raylib.SetWindowIcon = SetWindowIcon /** * Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) * * @param {number} images * @param {number} count * * @return {undefined} */ function SetWindowIcons (images, count) { return r.BindSetWindowIcons( images, count ) } raylib.SetWindowIcons = SetWindowIcons /** * Set title for window (only PLATFORM_DESKTOP) * * @param {string} title * * @return {undefined} */ function SetWindowTitle (title) { return r.BindSetWindowTitle( title ) } raylib.SetWindowTitle = SetWindowTitle /** * Set window position on screen (only PLATFORM_DESKTOP) * * @param {number} x * @param {number} y * * @return {undefined} */ function SetWindowPosition (x, y) { return r.BindSetWindowPosition( x, y ) } raylib.SetWindowPosition = SetWindowPosition /** * Set monitor for the current window (fullscreen mode) * * @param {number} monitor * * @return {undefined} */ function SetWindowMonitor (monitor) { return r.BindSetWindowMonitor( monitor ) } raylib.SetWindowMonitor = SetWindowMonitor /** * Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) * * @param {number} width * @param {number} height * * @return {undefined} */ function SetWindowMinSize (width, height) { return r.BindSetWindowMinSize( width, height ) } raylib.SetWindowMinSize = SetWindowMinSize /** * Set window dimensions * * @param {number} width * @param {number} height * * @return {undefined} */ function SetWindowSize (width, height) { return r.BindSetWindowSize( width, height ) } raylib.SetWindowSize = SetWindowSize /** * Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) * * @param {number} opacity * * @return {undefined} */ function SetWindowOpacity (opacity) { return r.BindSetWindowOpacity( opacity ) } raylib.SetWindowOpacity = SetWindowOpacity /** * Get native window handle * * @return {number} The resulting void *. */ function GetWindowHandle () { return r.BindGetWindowHandle() } raylib.GetWindowHandle = GetWindowHandle /** * Get current screen width * * @return {number} The resulting int. */ function GetScreenWidth () { return r.BindGetScreenWidth() } raylib.GetScreenWidth = GetScreenWidth /** * Get current screen height * * @return {number} The resulting int. */ function GetScreenHeight () { return r.BindGetScreenHeight() } raylib.GetScreenHeight = GetScreenHeight /** * Get current render width (it considers HiDPI) * * @return {number} The resulting int. */ function GetRenderWidth () { return r.BindGetRenderWidth() } raylib.GetRenderWidth = GetRenderWidth /** * Get current render height (it considers HiDPI) * * @return {number} The resulting int. */ function GetRenderHeight () { return r.BindGetRenderHeight() } raylib.GetRenderHeight = GetRenderHeight /** * Get number of connected monitors * * @return {number} The resulting int. */ function GetMonitorCount () { return r.BindGetMonitorCount() } raylib.GetMonitorCount = GetMonitorCount /** * Get current connected monitor * * @return {number} The resulting int. */ function GetCurrentMonitor () { return r.BindGetCurrentMonitor() } raylib.GetCurrentMonitor = GetCurrentMonitor /** * Get specified monitor position * * @param {number} monitor * * @return {Vector2} The resulting Vector2. */ function GetMonitorPosition (monitor) { return r.BindGetMonitorPosition( monitor ) } raylib.GetMonitorPosition = GetMonitorPosition /** * Get specified monitor width (current video mode used by monitor) * * @param {number} monitor * * @return {number} The resulting int. */ function GetMonitorWidth (monitor) { return r.BindGetMonitorWidth( monitor ) } raylib.GetMonitorWidth = GetMonitorWidth /** * Get specified monitor height (current video mode used by monitor) * * @param {number} monitor * * @return {number} The resulting int. */ function GetMonitorHeight (monitor) { return r.BindGetMonitorHeight( monitor ) } raylib.GetMonitorHeight = GetMonitorHeight /** * Get specified monitor physical width in millimetres * * @param {number} monitor * * @return {number} The resulting int. */ function GetMonitorPhysicalWidth (monitor) { return r.BindGetMonitorPhysicalWidth( monitor ) } raylib.GetMonitorPhysicalWidth = GetMonitorPhysicalWidth /** * Get specified monitor physical height in millimetres * * @param {number} monitor * * @return {number} The resulting int. */ function GetMonitorPhysicalHeight (monitor) { return r.BindGetMonitorPhysicalHeight( monitor ) } raylib.GetMonitorPhysicalHeight = GetMonitorPhysicalHeight /** * Get specified monitor refresh rate * * @param {number} monitor * * @return {number} The resulting int. */ function GetMonitorRefreshRate (monitor) { return r.BindGetMonitorRefreshRate( monitor ) } raylib.GetMonitorRefreshRate = GetMonitorRefreshRate /** * Get window position XY on monitor * * @return {Vector2} The resulting Vector2. */ function GetWindowPosition () { return r.BindGetWindowPosition() } raylib.GetWindowPosition = GetWindowPosition /** * Get window scale DPI factor * * @return {Vector2} The resulting Vector2. */ function GetWindowScaleDPI () { return r.BindGetWindowScaleDPI() } raylib.GetWindowScaleDPI = GetWindowScaleDPI /** * Get the human-readable, UTF-8 encoded name of the primary monitor * * @param {number} monitor * * @return {string} The resulting const char *. */ function GetMonitorName (monitor) { return r.BindGetMonitorName( monitor ) } raylib.GetMonitorName = GetMonitorName /** * Set clipboard text content * * @param {string} text * * @return {undefined} */ function SetClipboardText (text) { return r.BindSetClipboardText( text ) } raylib.SetClipboardText = SetClipboardText /** * Get clipboard text content * * @return {string} The resulting const char *. */ function GetClipboardText () { return r.BindGetClipboardText() } raylib.GetClipboardText = GetClipboardText /** * Enable waiting for events on EndDrawing(), no automatic event polling * * @return {undefined} */ function EnableEventWaiting () { return r.BindEnableEventWaiting() } raylib.EnableEventWaiting = EnableEventWaiting /** * Disable waiting for events on EndDrawing(), automatic events polling * * @return {undefined} */ function DisableEventWaiting () { return r.BindDisableEventWaiting() } raylib.DisableEventWaiting = DisableEventWaiting /** * Swap back buffer with front buffer (screen drawing) * * @return {undefined} */ function SwapScreenBuffer () { return r.BindSwapScreenBuffer() } raylib.SwapScreenBuffer = SwapScreenBuffer /** * Register all input events * * @return {undefined} */ function PollInputEvents () { return r.BindPollInputEvents() } raylib.PollInputEvents = PollInputEvents /** * Wait for some time (halt program execution) * * @param {number} seconds * * @return {undefined} */ function WaitTime (seconds) { return r.BindWaitTime( seconds ) } raylib.WaitTime = WaitTime /** * Shows cursor * * @return {undefined} */ function ShowCursor () { return r.BindShowCursor() } raylib.ShowCursor = ShowCursor /** * Hides cursor * * @return {undefined} */ function HideCursor () { return r.BindHideCursor() } raylib.HideCursor = HideCursor /** * Check if cursor is not visible * * @return {boolean} The resulting bool. */ function IsCursorHidden () { return r.BindIsCursorHidden() } raylib.IsCursorHidden = IsCursorHidden /** * Enables cursor (unlock cursor) * * @return {undefined} */ function EnableCursor () { return r.BindEnableCursor() } raylib.EnableCursor = EnableCursor /** * Disables cursor (lock cursor) * * @return {undefined} */ function DisableCursor () { return r.BindDisableCursor() } raylib.DisableCursor = DisableCursor /** * Check if cursor is on the screen * * @return {boolean} The resulting bool. */ function IsCursorOnScreen () { return r.BindIsCursorOnScreen() } raylib.IsCursorOnScreen = IsCursorOnScreen /** * Set background color (framebuffer clear color) * * @param {Color} color * * @return {undefined} */ function ClearBackground (color) { return r.BindClearBackground( color.r, color.g, color.b, color.a ) } raylib.ClearBackground = ClearBackground /** * Setup canvas (framebuffer) to start drawing * * @return {undefined} */ function BeginDrawing () { return r.BindBeginDrawing() } raylib.BeginDrawing = BeginDrawing /** * End canvas drawing and swap buffers (double buffering) * * @return {undefined} */ function EndDrawing () { return r.BindEndDrawing() } raylib.EndDrawing = EndDrawing /** * Begin 2D mode with custom camera (2D) * * @param {Camera2D} camera * * @return {undefined} */ function BeginMode2D (camera) { return r.BindBeginMode2D( camera.offset.x, camera.offset.y, camera.target.x, camera.target.y, camera.rotation, camera.zoom ) } raylib.BeginMode2D = BeginMode2D /** * Ends 2D mode with custom camera * * @return {undefined} */ function EndMode2D () { return r.BindEndMode2D() } raylib.EndMode2D = EndMode2D /** * Begin 3D mode with custom camera (3D) * * @param {Camera3D} camera * * @return {undefined} */ function BeginMode3D (camera) { return r.BindBeginMode3D( camera.position.x, camera.position.y, camera.position.z, camera.target.x, camera.target.y, camera.target.z, camera.up.x, camera.up.y, camera.up.z, camera.fovy, camera.projection ) } raylib.BeginMode3D = BeginMode3D /** * Ends 3D mode and returns to default 2D orthographic mode * * @return {undefined} */ function EndMode3D () { return r.BindEndMode3D() } raylib.EndMode3D = EndMode3D /** * Begin drawing to render texture * * @param {RenderTexture2D} target * * @return {undefined} */ function BeginTextureMode (target) { return r.BindBeginTextureMode( target.id, target.texture.id, target.texture.width, target.texture.height, target.texture.mipmaps, target.texture.format, target.depth.id, target.depth.width, target.depth.height, target.depth.mipmaps, target.depth.format ) } raylib.BeginTextureMode = BeginTextureMode /** * Ends drawing to render texture * * @return {undefined} */ function EndTextureMode () { return r.BindEndTextureMode() } raylib.EndTextureMode = EndTextureMode /** * Begin custom shader drawing * * @param {Shader} shader * * @return {undefined} */ function BeginShaderMode (shader) { return r.BindBeginShaderMode( shader.id, shader.locs ) } raylib.BeginShaderMode = BeginShaderMode /** * End custom shader drawing (use default shader) * * @return {undefined} */ function EndShaderMode () { return r.BindEndShaderMode() } raylib.EndShaderMode = EndShaderMode /** * Begin blending mode (alpha, additive, multiplied, subtract, custom) * * @param {number} mode * * @return {undefined} */ function BeginBlendMode (mode) { return r.BindBeginBlendMode( mode ) } raylib.BeginBlendMode = BeginBlendMode /** * End blending mode (reset to default: alpha blending) * * @return {undefined} */ function EndBlendMode () { return r.BindEndBlendMode() } raylib.EndBlendMode = EndBlendMode /** * Begin scissor mode (define screen area for following drawing) * * @param {number} x * @param {number} y * @param {number} width * @param {number} height * * @return {undefined} */ function BeginScissorMode (x, y, width, height) { return r.BindBeginScissorMode( x, y, width, height ) } raylib.BeginScissorMode = BeginScissorMode /** * End scissor mode * * @return {undefined} */ function EndScissorMode () { return r.BindEndScissorMode() } raylib.EndScissorMode = EndScissorMode /** * End stereo rendering (requires VR simulator) * * @return {undefined} */ function EndVrStereoMode () { return r.BindEndVrStereoMode() } raylib.EndVrStereoMode = EndVrStereoMode /** * Load shader from files and bind default locations * * @param {string} vsFileName * @param {string} fsFileName * * @return {Shader} The resulting Shader. */ function LoadShader (vsFileName, fsFileName) { return r.BindLoadShader( vsFileName, fsFileName ) } raylib.LoadShader = LoadShader /** * Load shader from code strings and bind default locations * * @param {string} vsCode * @param {string} fsCode * * @return {Shader} The resulting Shader. */ function LoadShaderFromMemory (vsCode, fsCode) { return r.BindLoadShaderFromMemory( vsCode, fsCode ) } raylib.LoadShaderFromMemory = LoadShaderFromMemory /** * Check if a shader is ready * * @param {Shader} shader * * @return {boolean} The resulting bool. */ function IsShaderReady (shader) { return r.BindIsShaderReady( shader.id, shader.locs ) } raylib.IsShaderReady = IsShaderReady /** * Get shader uniform location * * @param {Shader} shader * @param {string} uniformName * * @return {number} The resulting int. */ function GetShaderLocation (shader, uniformName) { return r.BindGetShaderLocation( shader.id, shader.locs, uniformName ) } raylib.GetShaderLocation = GetShaderLocation /** * Get shader attribute location * * @param {Shader} shader * @param {string} attribName * * @return {number} The resulting int. */ function GetShaderLocationAttrib (shader, attribName) { return r.BindGetShaderLocationAttrib( shader.id, shader.locs, attribName ) } raylib.GetShaderLocationAttrib = GetShaderLocationAttrib /** * Set shader uniform value (matrix 4x4) * * @param {Shader} shader * @param {number} locIndex * @param {Matrix} mat * * @return {undefined} */ function SetShaderValueMatrix (shader, locIndex, mat) { return r.BindSetShaderValueMatrix( shader.id, shader.locs, locIndex, mat.m0, mat.m4, mat.m8, mat.m12, mat.m1, mat.m5, mat.m9, mat.m13, mat.m2, mat.m6, mat.m10, mat.m14, mat.m3, mat.m7, mat.m11, mat.m15 ) } raylib.SetShaderValueMatrix = SetShaderValueMatrix /** * Set shader uniform value for texture (sampler2d) * * @param {Shader} shader * @param {number} locIndex * @param {Texture2D} texture * * @return {undefined} */ function SetShaderValueTexture (shader, locIndex, texture) { return r.BindSetShaderValueTexture( shader.id, shader.locs, locIndex, texture.id, texture.width, texture.height, texture.mipmaps, texture.format ) } raylib.SetShaderValueTexture = SetShaderValueTexture /** * Unload shader from GPU memory (VRAM) * * @param {Shader} shader * * @return {undefined} */ function UnloadShader (shader) { return r.BindUnloadShader( shader.id, shader.locs ) } raylib.UnloadShader = UnloadShader /** * Get a ray trace from mouse position * * @param {Vector2} mousePosition * @param {Camera} camera * * @return {Ray} The resulting Ray. */ function GetMouseRay (mousePosition, camera) { return r.BindGetMouseRay( mousePosition.x, mousePosition.y, camera.position.x, camera.position.y, camera.position.z, camera.target.x, camera.target.y, camera.target.z, camera.up.x, camera.up.y, camera.up.z, camera.fovy, camera.projection ) } raylib.GetMouseRay = GetMouseRay /** * Get camera transform matrix (view matrix) * * @param {Camera} camera * * @return {Matrix} The resulting Matrix. */ function GetCameraMatrix (camera) { return r.BindGetCameraMatrix( camera.position.x, camera.position.y, camera.position.z, camera.target.x, camera.target.y, camera.target.z, camera.up.x, camera.up.y, camera.up.z, camera.fovy, camera.projection ) } raylib.GetCameraMatrix = GetCameraMatrix /** * Get camera 2d transform matrix * * @param {Camera2D} camera * * @return {Matrix} The resulting Matrix. */ function GetCameraMatrix2D (camera) { return r.BindGetCameraMatrix2D( camera.offset.x, camera.offset.y, camera.target.x, camera.target.y, camera.rotation, camera.zoom ) } raylib.GetCameraMatrix2D = GetCameraMatrix2D /** * Get the screen space position for a 3d world space position * * @param {Vector3} position * @param {Camera} camera * * @return {Vector2} The resulting Vector2. */ function GetWorldToScreen (position, camera) { return r.BindGetWorldToScreen( position.x, position.y, position.z, camera.position.x, camera.position.y, camera.position.z, camera.target.x, camera.target.y, camera.target.z, camera.up.x, camera.up.y, camera.up.z, camera.fovy, camera.projection ) } raylib.GetWorldToScreen = GetWorldToScreen /** * Get the world space position for a 2d camera screen space position * * @param {Vector2} position * @param {Camera2D} camera * * @return {Vector2} The resulting Vector2. */ function GetScreenToWorld2D (position, camera) { return r.BindGetScreenToWorld2D( position.x, position.y, camera.offset.x, camera.offset.y, camera.target.x, camera.target.y, camera.rotation, camera.zoom ) } raylib.GetScreenToWorld2D = GetScreenToWorld2D /** * Get size position for a 3d world space position * * @param {Vector3} position * @param {Camera} camera * @param {number} width * @param {number} height * * @return {Vector2} The resulting Vector2. */ function GetWorldToScreenEx (position, camera, width, height) { return r.BindGetWorldToScreenEx( position.x, position.y, position.z, camera.position.x, camera.position.y, camera.position.z, camera.target.x, camera.target.y, camera.target.z, camera.up.x, camera.up.y, camera.up.z, camera.fovy, camera.projection, width, height ) } raylib.GetWorldToScreenEx = GetWorldToScreenEx /** * Get the screen space position for a 2d camera world space position * * @param {Vector2} position * @param {Camera2D} camera * * @return {Vector2} The resulting Vector2. */ function GetWorldToScreen2D (position, camera) { return r.BindGetWorldToScreen2D( position.x, position.y, camera.offset.x, camera.offset.y, camera.target.x, camera.target.y, camera.rotation, camera.zoom ) } raylib.GetWorldToScreen2D = GetWorldToScreen2D /** * Set target FPS (maximum) * * @param {number} fps * * @return {undefined} */ function SetTargetFPS (fps) { return r.BindSetTargetFPS( fps ) } raylib.SetTargetFPS = SetTargetFPS /** * Get current FPS * * @return {number} The resulting int. */ function GetFPS () { return r.BindGetFPS() } raylib.GetFPS = GetFPS /** * Get time in seconds for last frame drawn (delta time) * * @return {number} The resulting float. */ function GetFrameTime () { return r.BindGetFrameTime() } raylib.GetFrameTime = GetFrameTime /** * Get elapsed time in seconds since InitWindow() * * @return {number} The resulting double. */ function GetTime () { return r.BindGetTime() } raylib.GetTime = GetTime /** * Get a random value between min and max (both included) * * @param {number} min * @param {number} max * * @return {number} The resulting int. */ function GetRandomValue (min, max) { return r.BindGetRandomValue( min, max ) } raylib.GetRandomValue = GetRandomValue /** * Set the seed for the random number generator * * @param {number} seed * * @return {undefined} */ function SetRandomSeed (seed) { return r.BindSetRandomSeed( seed ) } raylib.SetRandomSeed = SetRandomSeed /** * Takes a screenshot of current screen (filename extension defines format) * * @param {string} fileName * * @return {undefined} */ function TakeScreenshot (fileName) { return r.BindTakeScreenshot( fileName ) } raylib.TakeScreenshot = TakeScreenshot /** * Setup init configuration flags (view FLAGS) * * @param {number} flags * * @return {undefined} */ function SetConfigFlags (flags) { return r.BindSetConfigFlags( flags ) } raylib.SetConfigFlags = SetConfigFlags /** * Set the current threshold (minimum) log level * * @param {number} logLevel * * @return {undefined} */ function SetTraceLogLevel (logLevel) { return r.BindSetTraceLogLevel( logLevel ) } raylib.SetTraceLogLevel = SetTraceLogLevel /** * Internal memory allocator * * @param {number} size * * @return {number} The resulting void *. */ function MemAlloc (size) { return r.BindMemAlloc( size ) } raylib.MemAlloc = MemAlloc /** * Internal memory reallocator * * @param {number} ptr * @param {number} size * * @return {number} The resulting void *. */ function MemRealloc (ptr, size) { return r.BindMemRealloc( ptr, size ) } raylib.MemRealloc = MemRealloc /** * Internal memory free * * @param {number} ptr * * @return {undefined} */ function MemFree (ptr) { return r.BindMemFree( ptr ) } raylib.MemFree = MemFree /** * Open URL with default system browser (if available) * * @param {string} url * * @return {undefined} */ function OpenURL (url) { return r.BindOpenURL( url ) } raylib.OpenURL = OpenURL /** * Load file data as byte array (read) * * @param {string} fileName * @param {number} bytesRead * * @return {Buffer} The resulting unsigned char *. */ function LoadFileData (fileName, bytesRead) { return r.BindLoadFileData( fileName, bytesRead ) } raylib.LoadFileData = LoadFileData /** * Unload file data allocated by LoadFileData() * * @param {Buffer} data * * @return {undefined} */ function UnloadFileData (data) { return r.BindUnloadFileData( data ) } raylib.UnloadFileData = UnloadFileData /** * Save data to file from byte array (write), returns true on success * * @param {string} fileName * @param {number} data * @param {number} bytesToWrite * * @return {boolean} The resulting bool. */ function SaveFileData (fileName, data, bytesToWrite) { return r.BindSaveFileData( fileName, data, bytesToWrite ) } raylib.SaveFileData = SaveFileData /** * Export data to code (.h), returns true on success * * @param {Buffer} data * @param {number} size * @param {string} fileName * * @return {boolean} The resulting bool. */ function ExportDataAsCode (data, size, fileName) { return r.BindExportDataAsCode( data, size, fileName ) } raylib.ExportDataAsCode = ExportDataAsCode /** * Load text data from file (read), returns a '\0' terminated string * * @param {string} fileName * * @return {string} The resulting char *. */ function LoadFileText (fileName) { return r.BindLoadFileText( fileName ) } raylib.LoadFileText = LoadFileText /** * Unload file text data allocated by LoadFileText() * * @param {string} text * * @return {undefined} */ function UnloadFileText (text) { return r.BindUnloadFileText( text ) } raylib.UnloadFileText = UnloadFileText /** * Save text data to file (write), string must be '\0' terminated, returns true on success * * @param {string} fileName * @param {string} text * * @return {boolean} The resulting bool. */ function SaveFileText (fileName, text) { return r.BindSaveFileText( fileName, text ) } raylib.SaveFileText = SaveFileText /** * Check if file exists * * @param {string} fileName * * @return {boolean} The resulting bool. */ function FileExists (fileName) { return r.BindFileExists( fileName ) } raylib.FileExists = FileExists /** * Check if a directory path exists * * @param {string} dirPath * * @return {boolean} The resulting bool. */ function DirectoryExists (dirPath) { return r.BindDirectoryExists( dirPath ) } raylib.DirectoryExists = DirectoryExists /** * Check file extension (including point: .png, .wav) * * @param {string} fileName * @param {string} ext * * @return {boolean} The resulting bool. */ function IsFileExtension (fileName, ext) { return r.BindIsFileExtension( fileName, ext ) } raylib.IsFileExtension = IsFileExtension /** * Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) * * @param {string} fileName * * @return {number} The resulting int. */ function GetFileLength (fileName) { return r.BindGetFileLength( fileName ) } raylib.GetFileLength = GetFileLength /** * Get pointer to extension for a filename string (includes dot: '.png') * * @param {string} fileName * * @return {string} The resulting const char *. */ function GetFileExtension (fileName) { return r.BindGetFileExtension( fileName ) } raylib.GetFileExtension = GetFileExtension /** * Get pointer to filename for a path string * * @param {string} filePath * * @return {string} The resulting const char *. */ function GetFileName (filePath) { return r.BindGetFileName( filePath ) } raylib.GetFileName = GetFileName /** * Get filename string without extension (uses static string) * * @param {string} filePath * * @return {string} The resulting const char *. */ function GetFileNameWithoutExt (filePath) { return r.BindGetFileNameWithoutExt( filePath ) } raylib.GetFileNameWithoutExt = GetFileNameWithoutExt /** * Get full path for a given fileName with path (uses static string) * * @param {string} filePath * * @return {string} The resulting const char *. */ function GetDirectoryPath (filePath) { return r.BindGetDirectoryPath( filePath ) } raylib.GetDirectoryPath = GetDirectoryPath /** * Get previous directory path for a given path (uses static string) * * @param {string} dirPath * * @return {string} The resulting const char *. */ function GetPrevDirectoryPath (dirPath) { return r.BindGetPrevDirectoryPath( dirPath ) } raylib.GetPrevDirectoryPath = GetPrevDirectoryPath /** * Get current working directory (uses static string) * * @return {string} The resulting const char *. */ function GetWorkingDirectory () { return r.BindGetWorkingDirectory() } raylib.GetWorkingDirectory = GetWorkingDirectory /** * Get the directory if the running application (uses static string) * * @return {string} The resulting const char *. */ function GetApplicationDirectory () { return r.BindGetApplicationDirectory() } raylib.GetApplicationDirectory = GetApplicationDirectory /** * Change working directory, return true on success * * @param {string} dir * * @return {boolean} The resulting bool. */ function ChangeDirectory (dir) { return r.BindChangeDirectory( dir ) } raylib.ChangeDirectory = ChangeDirectory /** * Check if a given path is a file or a directory * * @param {string} path * * @return {boolean} The resulting bool. */ function IsPathFile (path) { return r.BindIsPathFile( path ) } raylib.IsPathFile = IsPathFile /** * Load directory filepaths * * @param {string} dirPath * * @return {FilePathList} The resulting FilePathList. */ function LoadDirectoryFiles (dirPath) { return r.BindLoadDirectoryFiles( dirPath ) } raylib.LoadDirectoryFiles = LoadDirectoryFiles /** * Load directory filepaths with extension filtering and recursive directory scan * * @param {string} basePath * @param {string} filter * @param {boolean} scanSubdirs * * @return {FilePathList} The resulting FilePathList. */ function LoadDirectoryFilesEx (basePath, filter, scanSubdirs) { return r.BindLoadDirectoryFilesEx( basePath, filter, scanSubdirs ) } raylib.LoadDirectoryFilesEx = LoadDirectoryFilesEx /** * Unload filepaths * * @param {FilePathList} files * * @return {undefined} */ function UnloadDirectoryFiles (files) { return r.BindUnloadDirectoryFiles( files.capacity, files.count, files.paths ) } raylib.UnloadDirectoryFiles = UnloadDirectoryFiles /** * Check if a file has been dropped into window * * @return {boolean} The resulting bool. */ function IsFileDropped () { return r.BindIsFileDropped() } raylib.IsFileDropped = IsFileDropped /** * Load dropped filepaths * * @return {FilePathList} The resulting FilePathList. */ function LoadDroppedFiles () { return r.BindLoadDroppedFiles() } raylib.LoadDroppedFiles = LoadDroppedFiles /** * Unload dropped filepaths * * @param {FilePathList} files * * @return {undefined} */ function UnloadDroppedFiles (files) { return r.BindUnloadDroppedFiles( files.capacity, files.count, files.paths ) } raylib.UnloadDroppedFiles = UnloadDroppedFiles /** * Get file modification time (last write time) * * @param {string} fileName * * @return {number} The resulting long. */ function GetFileModTime (fileName) { return r.BindGetFileModTime( fileName ) } raylib.GetFileModTime = GetFileModTime /** * Compress data (DEFLATE algorithm), memory must be MemFree() * * @param {Buffer} data * @param {number} dataSize * @param {number} compDataSize * * @return {Buffer} The resulting unsigned char *. */ function CompressData (data, dataSize, compDataSize) { return r.BindCompressData( data, dataSize, compDataSize ) } raylib.CompressData = CompressData /** * Decompress data (DEFLATE algorithm), memory must be MemFree() * * @param {Buffer} compData * @param {number} compDataSize * @param {number} dataSize * * @return {Buffer} The resulting unsigned char *. */ function DecompressData (compData, compDataSize, dataSize) { return r.BindDecompressData( compData, compDataSize, dataSize ) } raylib.DecompressData = DecompressData /** * Encode data to Base64 string, memory must be MemFree() * * @param {Buffer} data * @param {number} dataSize * @param {number} outputSize * * @return {string} The resulting char *. */ function EncodeDataBase64 (data, dataSize, outputSize) { return r.BindEncodeDataBase64( data, dataSize, outputSize ) } raylib.EncodeDataBase64 = EncodeDataBase64 /** * Decode Base64 string data, memory must be MemFree() * * @param {Buffer} data * @param {number} outputSize * * @return {Buffer} The resulting unsigned char *. */ function DecodeDataBase64 (data, outputSize) { return r.BindDecodeDataBase64( data, outputSize ) } raylib.DecodeDataBase64 = DecodeDataBase64 /** * Check if a key has been pressed once * * @param {number} key * * @return {boolean} The resulting bool. */ function IsKeyPressed (key) { return r.BindIsKeyPressed( key ) } raylib.IsKeyPressed = IsKeyPressed /** * Check if a key is being pressed * * @param {number} key * * @return {boolean} The resulting bool. */ function IsKeyDown (key) { return r.BindIsKeyDown( key ) } raylib.IsKeyDown = IsKeyDown /** * Check if a key has been released once * * @param {number} key * * @return {boolean} The resulting bool. */ function IsKeyReleased (key) { return r.BindIsKeyReleased( key ) } raylib.IsKeyReleased = IsKeyReleased /** * Check if a key is NOT being pressed * * @param {number} key * * @return {boolean} The resulting bool. */ function IsKeyUp (key) { return r.BindIsKeyUp( key ) } raylib.IsKeyUp = IsKeyUp /** * Set a custom key to exit program (default is ESC) * * @param {number} key * * @return {undefined} */ function SetExitKey (key) { return r.BindSetExitKey( key ) } raylib.SetExitKey = SetExitKey /** * Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty * * @return {number} The resulting int. */ function GetKeyPressed () { return r.BindGetKeyPressed() } raylib.GetKeyPressed = GetKeyPressed /** * Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty * * @return {number} The resulting int. */ function GetCharPressed () { return r.BindGetCharPressed() } raylib.GetCharPressed = GetCharPressed /** * Check if a gamepad is available * * @param {number} gamepad * * @return {boolean} The resulting bool. */ function IsGamepadAvailable (gamepad) { return r.BindIsGamepadAvailable( gamepad ) } raylib.IsGamepadAvailable = IsGamepadAvailable /** * Get gamepad internal name id * * @param {number} gamepad * * @return {string} The resulting const char *. */ function GetGamepadName (gamepad) { return r.BindGetGamepadName( gamepad ) } raylib.GetGamepadName = GetGamepadName /** * Check if a gamepad button has been pressed once * * @param {number} gamepad * @param {number} button * * @return {boolean} The resulting bool. */ function IsGamepadButtonPressed (gamepad, button) { return r.BindIsGamepadButtonPressed( gamepad, button ) } raylib.IsGamepadButtonPressed = IsGamepadButtonPressed /** * Check if a gamepad button is being pressed * * @param {number} gamepad * @param {number} button * * @return {boolean} The resulting bool. */ function IsGamepadButtonDown (gamepad, button) { return r.BindIsGamepadButtonDown( gamepad, button ) } raylib.IsGamepadButtonDown = IsGamepadButtonDown /** * Check if a gamepad button has been released once * * @param {number} gamepad * @param {number} button * * @return {boolean} The resulting bool. */ function IsGamepadButtonReleased (gamepad, button) { return r.BindIsGamepadButtonReleased( gamepad, button ) } raylib.IsGamepadButtonReleased = IsGamepadButtonReleased /** * Check if a gamepad button is NOT being pressed * * @param {number} gamepad * @param {number} button * * @return {boolean} The resulting bool. */ function IsGamepadButtonUp (gamepad, button) { return r.BindIsGamepadButtonUp( gamepad, button ) } raylib.IsGamepadButtonUp = IsGamepadButtonUp /** * Get the last gamepad button pressed * * @return {number} The resulting int. */ function GetGamepadButtonPressed () { return r.BindGetGamepadButtonPressed() } raylib.GetGamepadButtonPressed = GetGamepadButtonPressed /** * Get gamepad axis count for a gamepad * * @param {number} gamepad * * @return {number} The resulting int. */ function GetGamepadAxisCount (gamepad) { return r.BindGetGamepadAxisCount( gamepad ) } raylib.GetGamepadAxisCount = GetGamepadAxisCount /** * Get axis movement value for a gamepad axis * * @param {number} gamepad * @param {number} axis * * @return {number} The resulting float. */ function GetGamepadAxisMovement (gamepad, axis) { return r.BindGetGamepadAxisMovement( gamepad, axis ) } raylib.GetGamepadAxisMovement = GetGamepadAxisMovement /** * Set internal gamepad mappings (SDL_GameControllerDB) * * @param {string} mappings * * @return {number} The resulting int. */ function SetGamepadMappings (mappings) { return r.BindSetGamepadMappings( mappings ) } raylib.SetGamepadMappings = SetGamepadMappings /** * Check if a mouse button has been pressed once * * @param {number} button * * @return {boolean} The resulting bool. */ function IsMouseButtonPressed (button) { return r.BindIsMouseButtonPressed( button ) } raylib.IsMouseButtonPressed = IsMouseButtonPressed /** * Check if a mouse button is being pressed * * @param {number} button * * @return {boolean} The resulting bool. */ function IsMouseButtonDown (button) { return r.BindIsMouseButtonDown( button ) } raylib.IsMouseButtonDown = IsMouseButtonDown /** * Check if a mouse button has been released once * * @param {number} button * * @return {boolean} The resulting bool. */ function IsMouseButtonReleased (button) { return r.BindIsMouseButtonReleased( button ) } raylib.IsMouseButtonReleased = IsMouseButtonReleased /** * Check if a mouse button is NOT being pressed * * @param {number} button * * @return {boolean} The resulting bool. */ function IsMouseButtonUp (button) { return r.BindIsMouseButtonUp( button ) } raylib.IsMouseButtonUp = IsMouseButtonUp /** * Get mouse position X * * @return {number} The resulting int. */ function GetMouseX () { return r.BindGetMouseX() } raylib.GetMouseX = GetMouseX /** * Get mouse position Y * * @return {number} The resulting int. */ function GetMouseY () { return r.BindGetMouseY() } raylib.GetMouseY = GetMouseY /** * Get mouse position XY * * @return {Vector2} The resulting Vector2. */ function GetMousePosition () { return r.BindGetMousePosition() } raylib.GetMousePosition = GetMousePosition /** * Get mouse delta between frames * * @return {Vector2} The resulting Vector2. */ function GetMouseDelta () { return r.BindGetMouseDelta() } raylib.GetMouseDelta = GetMouseDelta /** * Set mouse position XY * * @param {number} x * @param {number} y * * @return {undefined} */ function SetMousePosition (x, y) { return r.BindSetMousePosition( x, y ) } raylib.SetMousePosition = SetMousePosition /** * Set mouse offset * * @param {number} offsetX * @param {number} offsetY * * @return {undefined} */ function SetMouseOffset (offsetX, offsetY) { return r.BindSetMouseOffset( offsetX, offsetY ) } raylib.SetMouseOffset = SetMouseOffset /** * Set mouse scaling * * @param {number} scaleX * @param {number} scaleY * * @return {undefined} */ function SetMouseScale (scaleX, scaleY) { return r.BindSetMouseScale( scaleX, scaleY ) } raylib.SetMouseScale = SetMouseScale /** * Get mouse wheel movement for X or Y, whichever is larger * * @return {number} The resulting float. */ function GetMouseWheelMove () { return r.BindGetMouseWheelMove() } raylib.GetMouseWheelMove = GetMouseWheelMove /** * Get mouse wheel movement for both X and Y * * @return {Vector2} The resulting Vector2. */ function GetMouseWheelMoveV () { return r.BindGetMouseWheelMoveV() } raylib.GetMouseWheelMoveV = GetMouseWheelMoveV /** * Set mouse cursor * * @param {number} cursor * * @return {undefined} */ function SetMouseCursor (cursor) { return r.BindSetMouseCursor( cursor ) } raylib.SetMouseCursor = SetMouseCursor /** * Get touch position X for touch point 0 (relative to screen size) * * @return {number} The resulting int. */ function GetTouchX () { return r.BindGetTouchX() } raylib.GetTouchX = GetTouchX /** * Get touch position Y for touch point 0 (relative to screen size) * * @return {number} The resulting int. */ function GetTouchY () { return r.BindGetTouchY() } raylib.GetTouchY = GetTouchY /** * Get touch position XY for a touch point index (relative to screen size) * * @param {number} index * * @return {Vector2} The resulting Vector2. */ function GetTouchPosition (index) { return r.BindGetTouchPosition( index ) } raylib.GetTouchPosition = GetTouchPosition /** * Get touch point identifier for given index * * @param {number} index * * @return {number} The resulting int. */ function GetTouchPointId (index) { return r.BindGetTouchPointId( index ) } raylib.GetTouchPointId = GetTouchPointId /** * Get number of touch points * * @return {number} The resulting int. */ function GetTouchPointCount () { return r.BindGetTouchPointCount() } raylib.GetTouchPointCount = GetTouchPointCount /** * Enable a set of gestures using flags * * @param {number} flags * * @return {undefined} */ function SetGesturesEnabled (flags) { return r.BindSetGesturesEnabled( flags ) } raylib.SetGesturesEnabled = SetGesturesEnabled /** * Check if a gesture have been detected * * @param {number} gesture * * @return {boolean} The resulting bool. */ function IsGestureDetected (gesture) { return r.BindIsGestureDetected( gesture ) } raylib.IsGestureDetected = IsGestureDetected /** * Get latest detected gesture * * @return {number} The resulting int. */ function GetGestureDetected () { return r.BindGetGestureDetected() } raylib.GetGestureDetected = GetGestureDetected /** * Get gesture hold time in milliseconds * * @return {number} The resulting float. */ function GetGestureHoldDuration () { return r.BindGetGestureHoldDuration() } raylib.GetGestureHoldDuration = GetGestureHoldDuration /** * Get gesture drag vector * * @return {Vector2} The resulting Vector2. */ function GetGestureDragVector () { return r.BindGetGestureDragVector() } raylib.GetGestureDragVector = GetGestureDragVector /** * Get gesture drag angle * * @return {number} The resulting float. */ function GetGestureDragAngle () { return r.BindGetGestureDragAngle() } raylib.GetGestureDragAngle = GetGestureDragAngle /** * Get gesture pinch delta * * @return {Vector2} The resulting Vector2. */ function GetGesturePinchVector () { return r.BindGetGesturePinchVector() } raylib.GetGesturePinchVector = GetGesturePinchVector /** * Get gesture pinch angle * * @return {number} The resulting float. */ function GetGesturePinchAngle () { return r.BindGetGesturePinchAngle() } raylib.GetGesturePinchAngle = GetGesturePinchAngle /** * Update camera movement/rotation * * @param {number} camera * @param {Vector3} movement * @param {Vector3} rotation * @param {number} zoom * * @return {undefined} */ function UpdateCameraPro (camera, movement, rotation, zoom) { return r.BindUpdateCameraPro( camera, movement.x, movement.y, movement.z, rotation.x, rotation.y, rotation.z, zoom ) } raylib.UpdateCameraPro = UpdateCameraPro /** * Set texture and rectangle to be used on shapes drawing * * @param {Texture2D} texture * @param {Rectangle} source * * @return {undefined} */ function SetShapesTexture (texture, source) { return r.BindSetShapesTexture( texture.id, texture.width, texture.height, texture.mipmaps, texture.format, source.x, source.y, source.width, source.height ) } raylib.SetShapesTexture = SetShapesTexture /** * Draw a pixel * * @param {number} posX * @param {number} posY * @param {Color} color * * @return {undefined} */ function DrawPixel (posX, posY, color) { return r.BindDrawPixel( posX, posY, color.r, color.g, color.b, color.a ) } raylib.DrawPixel = DrawPixel /** * Draw a pixel (Vector version) * * @param {Vector2} position * @param {Color} color * * @return {undefined} */ function DrawPixelV (position, color) { return r.BindDrawPixelV( position.x, position.y, color.r, color.g, color.b, color.a ) } raylib.DrawPixelV = DrawPixelV /** * Draw a line * * @param {number} startPosX * @param {number} startPosY * @param {number} endPosX * @param {number} endPosY * @param {Color} color * * @return {undefined} */ function DrawLine (startPosX, startPosY, endPosX, endPosY, color) { return r.BindDrawLine( startPosX, startPosY, endPosX, endPosY, color.r, color.g, color.b, color.a ) } raylib.DrawLine = DrawLine /** * Draw a line (Vector version) * * @param {Vector2} startPos * @param {Vector2} endPos * @param {Color} color * * @return {undefined} */ function DrawLineV (startPos, endPos, color) { return r.BindDrawLineV( startPos.x, startPos.y, endPos.x, endPos.y, color.r, color.g, color.b, color.a ) } raylib.DrawLineV = DrawLineV /** * Draw a line defining thickness * * @param {Vector2} startPos * @param {Vector2} endPos * @param {number} thick * @param {Color} color * * @return {undefined} */ function DrawLineEx (startPos, endPos, thick, color) { return r.BindDrawLineEx( startPos.x, startPos.y, endPos.x, endPos.y, thick, color.r, color.g, color.b, color.a ) } raylib.DrawLineEx = DrawLineEx /** * Draw a line using cubic-bezier curves in-out * * @param {Vector2} startPos * @param {Vector2} endPos * @param {number} thick * @param {Color} color * * @return {undefined} */ function DrawLineBezier (startPos, endPos, thick, color) { return r.BindDrawLineBezier( startPos.x, startPos.y, endPos.x, endPos.y, thick, color.r, color.g, color.b, color.a ) } raylib.DrawLineBezier = DrawLineBezier /** * Draw line using quadratic bezier curves with a control point * * @param {Vector2} startPos * @param {Vector2} endPos * @param {Vector2} controlPos * @param {number} thick * @param {Color} color * * @return {undefined} */ function DrawLineBezierQuad (startPos, endPos, controlPos, thick, color) { return r.BindDrawLineBezierQuad( startPos.x, startPos.y, endPos.x, endPos.y, controlPos.x, controlPos.y, thick, color.r, color.g, color.b, color.a ) } raylib.DrawLineBezierQuad = DrawLineBezierQuad /** * Draw line using cubic bezier curves with 2 control points * * @param {Vector2} startPos * @param {Vector2} endPos * @param {Vector2} startControlPos * @param {Vector2} endControlPos * @param {number} thick * @param {Color} color * * @return {undefined} */ function DrawLineBezierCubic (startPos, endPos, startControlPos, endControlPos, thick, color) { return r.BindDrawLineBezierCubic( startPos.x, startPos.y, endPos.x, endPos.y, startControlPos.x, startControlPos.y, endControlPos.x, endControlPos.y, thick, color.r, color.g, color.b, color.a ) } raylib.DrawLineBezierCubic = DrawLineBezierCubic /** * Draw lines sequence * * @param {number} points * @param {number} pointCount * @param {Color} color * * @return {undefined} */ function DrawLineStrip (points, pointCount, color) { return r.BindDrawLineStrip( points, pointCount, color.r, color.g, color.b, color.a ) } raylib.DrawLineStrip = DrawLineStrip /** * Draw a color-filled circle * * @param {number} centerX * @param {number} centerY * @param {number} radius * @param {Color} color * * @return {undefined} */ function DrawCircle (centerX, centerY, radius, color) { return r.