diff --git a/docs/lua_api/background.lua b/docs/lua_api/bg.lua similarity index 65% rename from docs/lua_api/background.lua rename to docs/lua_api/bg.lua index b4443bd..f671032 100644 --- a/docs/lua_api/background.lua +++ b/docs/lua_api/bg.lua @@ -1,60 +1,53 @@ --- bg 'background' table +---bg `background` table +---@class background +background = { +} -- Draws the background shader and invokes `gfx.ForceRender` -DrawShader = function() end +background.DrawShader = function() end -- Gets the clear state value, `0` for fail state, `1` for clear state ---@return integer -GetClearTransition = function() end +background.GetClearTransition = function() end -- Retrieves the path to the background folder -GetPath = function() end +background.GetPath = function() end -- Gets the pixel coordinates for a point just above the end of the track ---@return number x ---@return number y -GetScreenCenter = function() end +background.GetScreenCenter = function() end -- Gets tilt values, `< 0` for clockwise, `> 0` for counter-clockwise ---@return number laserTilt # Tilt induced by lasers ---@return number spinTilt # Tilt induced by spinEvents -GetTilt = function() end +background.GetTilt = function() end -- Gets timing data of the chart ---@return number bartime # Value that goes from `0` to `1` over the duration of each beat ---@return number offsync # Value that goes from `0` to `1` over the duration `BPM * multiplier` ---@return number time # Current time in the chart -GetTiming = function() end +background.GetTiming = function() end -- Loads a texture which will be available in the fragment shader under the given `shaderName` ---@param shaderName string ---@param fileName string -LoadTexture = function(shaderName, fileName) end +background.LoadTexture = function(shaderName, fileName) end -- Set a float value to a uniform variable in the shader ---@param uniformName string ---@param val number -SetParamf = function(uniformName, val) end +background.SetParamf = function(uniformName, val) end -- Set an integer value to a uniform variable in the shader ---@param uniformName string ---@param val integer -SetParami = function(uniformName, val) end +background.SetParami = function(uniformName, val) end -- Sets the speed multiplier for the `offsync` timer returned by `GetTiming` ---@param speed number -SetSpeedMulti = function(speed) end +background.SetSpeedMulti = function(speed) end ----@class background -background = { - DrawShader = DrawShader, - GetClearTransition = GetClearTransition, - GetPath = GetPath, - GetScreenCenter = GetScreenCenter, - GetTilt = GetTilt, - GetTiming = GetTiming, - LoadTexture = LoadTexture, - SetParamf = SetParamf, - SetParami = SetParami, - SetSpeedMulti = SetSpeedMulti, -}; \ No newline at end of file +---Render background +---@param deltaTime number +function render_bg(deltaTime) end diff --git a/docs/lua_api/downloadscreen.lua b/docs/lua_api/downloadscreen.lua index 9ea6fce..2065e42 100644 --- a/docs/lua_api/downloadscreen.lua +++ b/docs/lua_api/downloadscreen.lua @@ -1,28 +1,23 @@ --- downloadscreen `dlScreen` table +-- Global downloadscreen `dlScreen` table +---@class dlScreen +dlScreen = { +} -- Download the selected song ---@param uri string # Encoded URI ---@param header table ---@param id string # Song ID ---@param cb function # Archive callback -DownloadArchive = function(uri, header, id, cb) end +dlScreen.DownloadArchive = function(uri, header, id, cb) end -- Exit the download screen -Exit = function() end +dlScreen.Exit = function() end -- Gets the path to the song folder -GetSongsPath = function() end +dlScreen.GetSongsPath = function() end -- Play the chart preview ---@param uri string # Encoded URI ---@param header table ---@param id string # Song ID -PlayPreview = function(uri, header, id) end - ----@class dlScreen -dlScreen = { - DownloadArchive = DownloadArchive, - Exit = Exit, - GetSongsPath = GetSongsPath, - PlayPreview = PlayPreview, -}; \ No newline at end of file +dlScreen.PlayPreview = function(uri, header, id) end diff --git a/docs/lua_api/foreground.lua b/docs/lua_api/fg.lua similarity index 67% rename from docs/lua_api/foreground.lua rename to docs/lua_api/fg.lua index c0e3aeb..e42179b 100644 --- a/docs/lua_api/foreground.lua +++ b/docs/lua_api/fg.lua @@ -1,60 +1,53 @@ -- fg 'foreground' table +---@class foreground +foreground = { +} -- Draws the foreground shader and invokes `gfx.ForceRender` -DrawShader = function() end +foreground.DrawShader = function() end -- Gets the clear state value, `0` for fail state, `1` for clear state ---@return integer -GetClearTransition = function() end +foreground.GetClearTransition = function() end -- Retrieves the path to the background folder -GetPath = function() end +foreground.GetPath = function() end -- Gets the pixel coordinates for a point just above the end of the track ---@return number x ---@return number y -GetScreenCenter = function() end +foreground.GetScreenCenter = function() end -- Gets tilt values, `< 0` for clockwise, `> 0` for counter-clockwise ---@return number laserTilt # Tilt induced by lasers ---@return number spinTilt # Tilt induced by spinEvents -GetTilt = function() end +foreground.GetTilt = function() end -- Gets timing data of the chart ---@return number bartime # Value that goes from `0` to `1` over the duration of each beat ---@return number offsync # Value that goes from `0` to `1` over the duration `BPM * multiplier` ---@return number time # Current time in the chart -GetTiming = function() end +foreground.GetTiming = function() end -- Loads a texture which will be available in the fragment shader under the given `shaderName` ---@param shaderName string ---@param fileName string -LoadTexture = function(shaderName, fileName) end +foreground.LoadTexture = function(shaderName, fileName) end -- Set a float value to a uniform variable in the shader ---@param uniformName string ---@param val number -SetParamf = function(uniformName, val) end +foreground.SetParamf = function(uniformName, val) end -- Set an integer value to a uniform variable in the shader ---@param uniformName string ---@param val integer -SetParami = function(uniformName, val) end +foreground.SetParami = function(uniformName, val) end -- Sets the speed multiplier for the `offsync` timer returned by `GetTiming` ---@param speed number -SetSpeedMulti = function(speed) end +foreground.SetSpeedMulti = function(speed) end ----@class foreground -foreground = { - DrawShader = DrawShader, - GetClearTransition = GetClearTransition, - GetPath = GetPath, - GetScreenCenter = GetScreenCenter, - GetTilt = GetTilt, - GetTiming = GetTiming, - LoadTexture = LoadTexture, - SetParamf = SetParamf, - SetParami = SetParami, - SetSpeedMulti = SetSpeedMulti, -}; \ No newline at end of file +---Render foreground +---@param deltaTime number +function render_fg(deltaTime) end diff --git a/docs/lua_api/filterwheel.lua b/docs/lua_api/filterwheel.lua index 33d982e..d8b1f41 100644 --- a/docs/lua_api/filterwheel.lua +++ b/docs/lua_api/filterwheel.lua @@ -1,6 +1,5 @@ -- filterwheel `filters` table - ---@class filters ---@field folder string[] # Array of song folders and collections ---@field level string[] # Array of song levels -filters = {}; \ No newline at end of file +filters = {}; diff --git a/docs/lua_api/game.lua b/docs/lua_api/game.lua index d5d68a3..ac05c43 100644 --- a/docs/lua_api/game.lua +++ b/docs/lua_api/game.lua @@ -1,69 +1,5 @@ -- Global `game` table - --- Gets the state of the specified button ----@param button integer # options are under the `game` table prefixed with `BUTTON` ----@return boolean # `true` if it is being pressed -GetButton = function(button) end - --- Gets the absolute rotation of the specified knob ----@param knob integer # `0 = left`, `1 = right` ----@return number angle # in radians, `-2*pi` to `0` (turning CCW) and `0` to `2*pi` (turning CW) -GetKnob = function(knob) end - --- Gets the color of the specified laser ----@param laser integer # `0 = left`, `1 = right` ----@return integer r, integer g, integer b -GetLaserColor = function(laser) end - --- Gets the mouse's position on the game window in pixel coordinates ----@return number, number -GetMousePos = function() end - --- Gets the game window's resolution in pixels ----@return number, number -GetResolution = function() end - --- Gets the name of the current skin ----@return string -GetSkin = function() end - --- Gets the value of the skin setting with the specified key ----@param key string ----@return any -GetSkinSetting = function(key) end - --- Checks whether the named sample is currently playing ----@param name string # name of the loaded sample ----@return boolean|nil # `nil` if the sample is not loaded -IsSamplePlaying = function(name) end - --- Loads an audio sample from the `audio` directory of the current skin folder ----@param name string # `.wav` extension assumed if not provided -LoadSkinSample = function(name) end - --- Logs a message to the game's log file ----@param message string ----@param severity integer # options are under the `game` table prefixed with `LOGGER` -Log = function(message, severity) end - --- Plays a loaded sample ----@param name string # name of the loaded sample ----@param loop? boolean -PlaySample = function(name, loop) end - --- Sets the value of the skin setting with the specified key ----@param key string ----@param value any # type must match the type of the defined skin setting -SetSkinSetting = function(key, value) end - --- Stops a playing sample ----@param name string # name of the loaded sample -StopSample = function(name) end - --- Checks if an update is available ----@return string url, string version # `nil` if there is no update available -UpdateAvailable = function() end - +---@class game game = { LOGGER_INFO = 1, LOGGER_NORMAL = 2, @@ -78,19 +14,68 @@ game = { BUTTON_FXR = 5, BUTTON_STA = 6, BUTTON_BCK = 11, +} - GetButton = GetButton, - GetKnob = GetKnob, - GetLaserColor = GetLaserColor, - GetMousePos = GetMousePos, - GetResolution = GetResolution, - GetSkin = GetSkin, - GetSkinSetting = GetSkinSetting, - IsSamplePlaying = IsSamplePlaying, - LoadSkinSample = LoadSkinSample, - Log = Log, - PlaySample = PlaySample, - SetSkinSetting = SetSkinSetting, - StopSample = StopSample, - UpdateAvailable = UpdateAvailable, -}; \ No newline at end of file +-- Gets the state of the specified button +---@param button integer # options are under the `game` table prefixed with `BUTTON` +---@return boolean # `true` if it is being pressed +game.GetButton = function(button) end + +-- Gets the absolute rotation of the specified knob +---@param knob integer # `0 = left`, `1 = right` +---@return number angle # in radians, `-2*pi` to `0` (turning CCW) and `0` to `2*pi` (turning CW) +game.GetKnob = function(knob) end + +-- Gets the color of the specified laser +---@param laser integer # `0 = left`, `1 = right` +---@return integer r, integer g, integer b +game.GetLaserColor = function(laser) end + +-- Gets the mouse's position on the game window in pixel coordinates +---@return number, number +game.GetMousePos = function() end + +-- Gets the game window's resolution in pixels +---@return number, number +game.GetResolution = function() end + +-- Gets the name of the current skin +---@return string +game.GetSkin = function() end + +-- Gets the value of the skin setting with the specified key +---@param key string +---@return any +game.GetSkinSetting = function(key) end + +-- Checks whether the named sample is currently playing +---@param name string # name of the loaded sample +---@return boolean|nil # `nil` if the sample is not loaded +game.IsSamplePlaying = function(name) end + +-- Loads an audio sample from the `audio` directory of the current skin folder +---@param name string # `.wav` extension assumed if not provided +game.LoadSkinSample = function(name) end + +-- Logs a message to the game's log file +---@param message string +---@param severity integer # options are under the `game` table prefixed with `LOGGER` +game.Log = function(message, severity) end + +-- Plays a loaded sample +---@param name string # name of the loaded sample +---@param loop? boolean +game.PlaySample = function(name, loop) end + +-- Sets the value of the skin setting with the specified key +---@param key string +---@param value any # type must match the type of the defined skin setting +game.SetSkinSetting = function(key, value) end + +-- Stops a playing sample +---@param name string # name of the loaded sample +game.StopSample = function(name) end + +-- Checks if an update is available +---@return string url, string version # `nil` if there is no update available +game.UpdateAvailable = function() end diff --git a/docs/lua_api/gameplay.lua b/docs/lua_api/gameplay.lua index e16cc8b..cfd31cf 100644 --- a/docs/lua_api/gameplay.lua +++ b/docs/lua_api/gameplay.lua @@ -1,36 +1,35 @@ --- gameplay `gameplay` table - ---@class CritLine ---@field cursors LaserCursor[] # ---@field line Line # Line from the left corner of the track to the right corner ---@field rotation number # The rotation of the crit line, in radians ---@field x integer # Screen x-coordinate of the center of the crit line ---@field y integer # Screen y-coordinate of the center of the crit line -CritLine = {}; +CritLine = {} ---@class LaserCursor ---@field alpha number # Alpha channel value, `0.0` to `1.0` ---@field pos number # The x-position relative to the center of the crit line ---@field skew number # The x-skew of the cursor -LaserCursor = {}; +LaserCursor = {} ---@class Gauge ---@field type integer # `0` = Effective, `1` = Excessive, `2` = Permissive, `3` = Blastive ---@field value number # Current gauge percentage, `0.0` to `1.0` -Gauge = {}; +Gauge = {} ---@class Line ---@field x1 number # Starting x-coordinate ---@field y1 number # Starting y-coordinate ---@field x2 number # Ending x-coordinate ---@field y2 number # Ending y-coordinate -Line = {}; +Line = {} ---@class ScoreReplay ---@field currentScore integer # Current score of the replay ---@field maxScore integer # Ending score of the replay -ScoreReplay = {}; +ScoreReplay = {} +-- gameplay `gameplay` table ---@class gameplay ---@field artist string # Chart artist ---@field bpm number # Chart BPM @@ -54,4 +53,4 @@ ScoreReplay = {}; ---@field suddenFade number # Sudden fade value, `0.0` to `1.0` ---@field title string # Chart title ---@field user_id nil|string # Only for multiplayer -gameplay = {}; \ No newline at end of file +gameplay = {} diff --git a/docs/lua_api/gamesettingsdialog.lua b/docs/lua_api/gamesettingsdialog.lua index 5a4f4d5..d9bc239 100644 --- a/docs/lua_api/gamesettingsdialog.lua +++ b/docs/lua_api/gamesettingsdialog.lua @@ -7,12 +7,12 @@ ---@field options? string[] # Array of setting value names, only available if setting `type` is `enum` ---@field type string # Type of the setting value: `button`, `enum`, `float`, `int`, or `toggle` ---@field value? number|boolean # Value of the setting, not available if setting `type` is `button` -SettingsDiagSetting = {}; +SettingsDiagSetting = {} ---@class SettingsDiagTab ---@field name string # Tab name ---@field settings SettingsDiagSetting[] # Array of settings in the tab -SettingsDiagTab = {}; +SettingsDiagTab = {} ---@class SettingsDiag ---@field currentSetting integer # Current setting index for `SettigsDiag[currentTab].settings` @@ -20,4 +20,4 @@ SettingsDiagTab = {}; ---@field posX number # X-Position relative to the entire screen, from `0.0` to `1.0` ---@field posY number # Y-Position relative to the entire screen, from `0.0` to `1.0` ---@field tabs SettingsDiagTab[] -SettingsDiag = {}; +SettingsDiag = {} diff --git a/docs/lua_api/gfx.lua b/docs/lua_api/gfx.lua index ca23c26..ecc5063 100644 --- a/docs/lua_api/gfx.lua +++ b/docs/lua_api/gfx.lua @@ -1,483 +1,4 @@ -- Global `gfx` table - --- Creates a new circle arc shaped sub-path ----@param cx number # center x-coordinate ----@param cy number # center y-coordinate ----@param r number # radius ----@param a0 number # starting angle, in radians ----@param a1 number # ending angle, in radians ----@param dir integer # 1 = counter-clockwise, 2 = clockwise -Arc = function(cx, cy, r, a0, a1, dir) end - --- Adds an arc segment at the corner defined by the previous point and two specified points ----@param x1 number ----@param y1 number ----@param x2 number ----@param y2 number ----@param radius number -ArcTo = function(x1, y1, x2, y2, radius) end - --- Clears currently defined paths to begin drawing a new "shape" -BeginPath = function() end - --- Adds a cubic bezier segment from the previous point to the specified point --- Uses the two control points `(c1x, c1y)` and `(c2x, c2y)` ----@param c1x number ----@param c1y number ----@param c2x number ----@param c2y number ----@param x number ----@param y number -BezierTo = function(c1x, c1y, c2x, c2y, x, y) end - --- Creates a box gradient that can be used by `FillPaint` or `StrokePaint` ----@param x number ----@param y number ----@param w number ----@param h number ----@param r number # radius ----@param f number # feather amount -BoxGradient = function(x, y, w, h, r, f) end - --- Creates a new circle shaped sub-path ----@param cx number ----@param cy number ----@param r number -Circle = function(cx, cy, r) end - --- Closes the current sub-path with a line segment -ClosePath = function() end - --- Loads an image from the specified filename ----@param filename string ----@param flags? integer # options are under the `gfx` table prefixed with `IMAGE` -CreateImage = function(filename, flags) end - --- Creates a cached text that can be drawn by `DrawLabel` ----@param text string ----@param size integer ----@param monospace boolean -CreateLabel = function(text, size, monospace) end - --- Creates a new `ShadedMesh` object ----@param materialName string ----@param path? string # Optional path to the material, loads from the current skin's `shaders` folder otherwise --- `.fs` and `.vs` must exist at either location ----@return ShadedMesh -CreateShadedMesh = function(materialName, path) end - --- Loads an image from `skins//textures/` ----@param path string ----@param flags? integer -CreateSkinImage = function(path, flags) end - --- Draws the loaded gauge --- The game loads the gauge itself, using the textures in `skins//textures/gauges/` ----@param rate number # current gauge percentage ----@param x number ----@param y number ----@param w number ----@param h number ----@param deltaTime number -DrawGauge = function(rate, x, y, w, h, deltaTime) end - --- Draws a created label, resized if `maxWidth > 0` --- Labels are always be drawn on top of other drawn elements ----@param label any # label created by `CreateLabel` ----@param x number ----@param y number ----@param maxWidth? number -DrawLabel = function(label, x, y, maxWidth) end - --- Creates a new ellipse shaped sub-path ----@param cx number ----@param cy number ----@param rx number ----@param ry number -Ellipse = function(cx, cy, rx, ry) end - --- Draws a string at the specified location, but will always be drawn on top of other drawn elements ----@param text string ----@param x number ----@param y number -FastText = function(text, x, y) end - --- Gets the width and height of a given fast text ----@param text string ----@return number w, number h -FastTextSize = function(text) end - --- Fills the current path with the current fill style -Fill = function() end - --- Sets the current fill to a solid color ----@param r integer ----@param g integer ----@param b integer ----@param a? integer # default 255 -FillColor = function(r, g, b, a) end - --- Sets the current fill to a paint ----@param paint any # pattern created by `ImagePattern` or gradient created by `BoxGradient`, `LinearGradient`, or `RadialGradient` -FillPaint = function(paint) end - --- Sets the font face for the current text style ----@param font string -FontFace = function(font) end - --- Sets the font size of the current text style ----@param size number -FontSize = function(size) end - --- Forces the current render queue to be processed --- This causes "fast" elements such as `FastRect`, `FastText` or `labels` to be drawn/processed immediately rather than at the end of the render queue -ForceRender = function() end - --- Gets the shared texture ID generated by `gfx.LoadSharedTexture` under the given `name` ----@param name string ----@return integer ID # Used the same as images generated by `gfx.CreateImage` -GetSharedTexture = function(name) end - --- Sets the global alpha value for all drawings --- Elements that have their alpha set will be adjusted relative to the global value ----@param alpha number -GlobalAlpha = function(alpha) end - --- Sets the composite operation with custom pixel arithmetic --- Options are under the `gfx` table prefixed with `BLEND` ----@param srcFactor integer ----@param desFactor integer -GlobalCompositeBlendFunc = function(srcFactor, desFactor) end - --- Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately --- Options are under the `gfx` table prefixed with `BLEND` ----@param srcRGB integer ----@param desRGB integer ----@param srcAlpha integer ----@param desAlpha integer -GlobalCompositeBlendFuncSeparate = function(srcRGB, desRGB, srcAlpha, desAlpha) end - --- Sets the composite operation --- Options are under the `gfx` table prefixed with `BLEND_OP` ----@param op integer -GlobalCompositeOperation = function(op) end - --- Sets the inner and outer colors for a gradient --- `ri, gi, bi, ai` inner color --- `ro, go, bo, ao` outer color ----@param ri integer ----@param gi integer ----@param bi integer ----@param ai integer ----@param ro integer ----@param go integer ----@param bo integer ----@param ao integer -GradientColors = function(ri, gi, bi, ai, ro, bo, go, ao) end - --- Creates an image pattern that can be used by `FillPaint` or `StrokePaint` --- `(sx, sy)` is the top-left location of the pattern --- `(ix, iy)` is the size of one image ----@param sx number ----@param sy number ----@param ix number ----@param iy number ----@param angle number # in radians ----@param image any # image created by `CreateImage` or `CreateSkinImage` ----@param alpha number # `0.0` to `1.0` -ImagePattern = function(sx, sy, ix, iy, angle, image, alpha) end - --- Draws an image in the specified rect; stretches the image to fit ----@param x number ----@param y number ----@param w number ----@param h number ----@param image any # image created by `CreateImage` or `CreateSkinImage`, or an animation loaded with `LoadSkinAnimation` ----@param alpha number # `0.0` to `1.0` ----@param angle number # in radians -ImageRect = function(x, y, w, h, image, alpha, angle) end - --- Gets the width and height of a given image ----@param image any # image created by `CreateImage` or `CreateSkinImage` ----@return number w, number h -ImageSize = function(image) end - --- Intersects the current scissor rectangle with the specified rectangle ----@param x number ----@param y number ----@param w number ----@param h number -IntersectScissor = function(x, y, w, h) end - --- Gets the width and height of a given label ----@param label any # label created by `CreateLabel` ----@return number w, number h -LabelSize = function(label) end - --- Creates a linear gradient that can be used by `FillPaint` or `StrokePaint` --- `(sx, sy)` -> `(ex, ey)` starting to ending coordinates ----@param sx number ----@param sy number ----@param ex number ----@param ey number -LinearGradient = function(sx, sy, ex, ey) end - --- Sets how the end of the line is drawn --- Options are under the `gfx` table prefixed with `LINE` ----@param cap integer -LineCap = function(cap) end - --- Sets how sharp path corners are drawn --- Options are under the `gfx` table prefixed with `LINE` ----@param join integer -LineJoin = function(join) end - --- Adds a line segment from the previous point to the specified point ----@param x number ----@param y number -LineTo = function(x, y) end - --- Loads all images of the specified folder as frames to be used for an animation --- Returns an `animation` that can be used the same way as an `image` ----@param path string ----@param frameTime number # 1 / fps ----@param loopCount? integer # 0 ----@param compressed boolean # false --- if `compressed`, the animation will be stored in RAM and decoded on-demand; this uses more CPU but much less RAM -LoadAnimation = function(path, frameTime, loopCount, compressed) end - --- Loads a persistent texture from the `path` that can be accessed by the `name` in `gfx.GetSharedTexture` and `ShadedMesh:AddSharedTexture` ----@param name string ----@param path string -LoadSharedTexture = function(name, path) end - --- Loads all images from `skins//textures/` to be used for an animation --- Returns an `animation` that can be used the same way as an `image` ----@param path string ----@param frameTime number # 1 / fps ----@param loopCount? integer # Default `0` ----@param compressed boolean --- If `compressed`, the animation will be stored in RAM and decoded on-demand; this uses more CPU but much less RAM -LoadSkinAnimation = function(path, frameTime, loopCount, compressed) end - --- Loads a persistent texture from `skins//textures/` that can be accessed by the `name` in `gfx.GetSharedTexture` and `ShadedMesh:AddSharedTexture` ----@param name string ----@param path string -LoadSharedSkinTexture = function(name, path) end - --- Loads a font fromt the specified filename --- Sets it as the current font if it is already loaded ----@param name? string ----@param filename string -LoadFont = function(name, filename) end - --- Loads an image outside of the main thread to prevent rendering lock-up --- Image will be loaded at original size unless `w` and `h` are provided ----@param filepath string ----@param placeholder any # image created by `CreateImage` or `CreateSkinImage` ----@param w? number # 0 ----@param h? number # 0 ----@return any # returns `placeholder` until the image is loaded -LoadImageJob = function(filepath, placeholder, w, h) end - --- Loads a font from `skins//textures/` --- Sets it as the current font if it is already loaded ----@param filename string -LoadSkinFont = function(filename) end - --- Loads a font from `skins//textures/` --- Sets it as the current font if it is already loaded ----@param name string ----@param filename string -LoadSkinFont = function(name, filename) end - --- Loads an image outside of the main thread to prevent rendering lock-up --- Image will be loaded at original size unless `w` and `h` are provided ----@param url string # web url of image ----@param placeholder any # image created by `CreateImage` or `CreateSkinImage` ----@param w? number # 0 ----@param h? number # 0 ----@return any # returns `placeholder` until the image is loaded -LoadWebImageJob = function(url, placeholder, w, h) end - --- Sets the miter limit of the stroke style ----@param limit number -MiterLimit = function(limit) end - --- Starts a new sub-path at the specified point ----@param x number ----@param y number -MoveTo = function(x, y) end - --- Adds a quadratic bezier segment from the previous point to the specified point --- Uses the control point `(cx, cy)` ----@param cx number ----@param cy number ----@param x number ----@param y number -QuadTo = function(cx, cy, x, y) end - --- Creates a radial gradient that can be used by `FillPaint` or `StrokePaint` ----@param cx number ----@param cy number ----@param inr number # inner radius ----@param outr number # outer radius -RadialGradient = function(cx, cy, inr, outr) end - --- Creates a new rectangle shaped sub-path ----@param x number ----@param y number ----@param w number ----@param h number -Rect = function(x, y, w, h) end - --- Resets the current render state to default values --- This does not affect the render state stack -Reset = function() end - --- Resets and disables scissoring -ResetScissor = function() end - --- Resets all transforms done by `Rotate`, `Scale`, or `Translate`, etc. -ResetTransform = function() end - --- Pops/restores the current render state from the state stack --- The render state is pushed/saved to the stack using `Save` -Restore = function() end - --- Rotates the current coordinates ----@param angle number # in radians -Rotate = function(angle) end - --- Creates a rounded rectangle shaped sub-path ----@param x number ----@param y number ----@param w number ----@param h number ----@param r number -RoundedRect = function(x, y, w, h, r) end - --- Creates a rounded rectangle shaped sub-path with varying radii for each corner --- `r1` is the top-left corner and continues clockwise ----@param x number ----@param y number ----@param w number ----@param h number ----@param r1 number ----@param r2 number ----@param r3 number ----@param r4 number -RoundedRectVarying = function(x, y, w, h, r1, r2, r3, r4) end - --- Pushes/saves the current render state into a state stack --- The render state can be popped/restored from the stack using `Restore` -Save = function() end - --- Scales the current coordinates by the given factors ----@param x number ----@param y number -Scale = function(x, y) end - --- Sets the current scissor rectangle --- Scissoring allows you to clip any rendering into a rectangle (affected by the current transform) ----@param x number ----@param y number ----@param w number ----@param h number -Scissor = function(x, y, w, h) end - --- Sets the gauge color for the specified `index` ----@param index integer # --- ``` --- 0 = Normal gauge fail (<70%) --- 1 = Normal gauge clear (>=70%) --- 2 = Hard gauge fail (<30%) --- 3 = Hard gauge fail (>=30%) --- ``` ----@param r integer ----@param g integer ----@param b integer -SetGaugeColor = function(index, r, g, b) end - --- Multiplies the color given with all incoming drawn image colors ----@param r integer ----@param g integer ----@param b integer -SetImageTint = function(r, g, b) end - --- Skews the current coordinates along the x-axis ----@param angle number # in radians -SkewX = function(angle) end - --- Skews the current coordinates along the y-axis ----@param angle number # in radians -SkewY = function(angle) end - --- Strokes the current path with the current stroke style -Stroke = function() end - --- Sets the current stroke style to a solid color ----@param r integer ----@param g integer ----@param b integer ----@param a? integer # 255 -StrokeColor = function(r, g, b, a) end - --- Sets the current stroke style to a paint ----@param paint any # pattern created by `ImagePattern` or gradient created by `BoxGradient`, `LinearGradient`, or `RadialGradient` -StrokePaint = function(paint) end - --- Sets the stroke width of the stroke style ----@param size number -StrokeWidth = function(size) end - --- Draws a string at the specified location ----@param text string ----@param x number ----@param y number -Text = function(text, x, y) end - --- Sets the text align of the current text style --- Options are under the `gfx` table prefixed with `TEXT_ALIGN` ----@param align integer -TextAlign = function(align) end - --- Gets the bounding rectangle coordinates of a given text ----@param x number ----@param y number ----@param text string ----@return number x1, number y1, number x2, number y2 -TextBounds = function(x, y, text); end - --- Progresses the given animation ----@param animation any # animation created by `LoadAnimation` or `LoadSkinAnimation` ----@param deltaTime number -TickAnimation = function(animation, deltaTime) end - --- Translates the current coordinates by `x` and `y` ----@param x number ----@param y number -Translate = function(x, y) end - --- Updates the properties of a created pattern --- `(sx, sy)` is the top-left location of the pattern --- `(ix, iy)` is the size of one image ----@param pattern any # pattern created by `ImagePattern` ----@param sx number ----@param sy number ----@param ix number ----@param iy number ----@param angle number # in radians ----@param alpha number # `0.0` to `1.0` -UpdateImagePattern = function(pattern, sx, sy, ix, iy, angle, alpha) end - --- Updates the properties of a created label ----@param label any # label created by `CreateLabel` ----@param text? string ----@param size? integer -UpdateLabel = function(label, text, size) end - ----@type table gfx = { BLEND_ZERO = 1, BLEND_ONE = 2, @@ -525,79 +46,481 @@ gfx = { TEXT_ALIGN_BOTTOM = 32, TEXT_ALIGN_BASELINE = 64, - Arc = Arc, - ArcTo = ArcTo, - BeginPath = BeginPath, - BezierTo = BezierTo, - BoxGradient = BoxGradient, - Circle = Circle, - ClosePath = ClosePath, - CreateImage = CreateImage, - CreateLabel = CreateLabel, - CreateShadedMesh = CreateShadedMesh, - CreateSkinImage = CreateSkinImage, - DrawGauge = DrawGauge, - DrawLabel = DrawLabel, - Ellipse = Ellipse, - FastText = FastText, - FastTextSize = FastTextSize, - Fill = Fill, - FillColor = FillColor, - FillPaint = FillPaint, - FontFace = FontFace, - FontSize = FontSize, - ForceRender = ForceRender, - GetSharedTexture = GetSharedTexture, - GlobalAlpha = GlobalAlpha, - GlobalCompositeBlendFunc = GlobalCompositeBlendFunc, - GlobalCompositeBlendFuncSeparate = GlobalCompositeBlendFuncSeparate, - GlobalCompositeOperation = GlobalCompositeOperation, - GradientColors = GradientColors, - ImagePattern = ImagePattern, - ImageRect = ImageRect, - ImageSize = ImageSize, - IntersectScissor = IntersectScissor, - LabelSize = LabelSize, - LinearGradient = LinearGradient, - LineCap = LineCap, - LineJoin = LineJoin, - LineTo = LineTo, - LoadAnimation = LoadAnimation, - LoadSharedTexture = LoadSharedTexture, - LoadSkinAnimation = LoadSkinAnimation, - LoadSharedSkinTexture = LoadSharedSkinTexture, - LoadFont = LoadFont, - LoadImageJob = LoadImageJob, - LoadSkinFont = LoadSkinFont, - LoadWebImageJob = LoadWebImageJob, - MiterLimit = MiterLimit, - MoveTo = MoveTo, - QuadTo = QuadTo, - RadialGradient = RadialGradient, - Rect = Rect, - Reset = Reset, - ResetScissor = ResetScissor, - ResetTransform = ResetTransform, - Restore = Restore, - Rotate = Rotate, - RoundedRect = RoundedRect, - RoundedRectVarying = RoundedRectVarying, - Save = Save, - Scale = Scale, - Scissor = Scissor, - SetGaugeColor = SetGaugeColor, - SetImageTint = SetImageTint, - SkewX = SkewX, - SkewY = SkewY, - Stroke = Stroke, - StrokeColor = StrokeColor, - StrokePaint = StrokePaint, - StrokeWidth = StrokeWidth, - Text = Text, - TextAlign = TextAlign, - TextBounds = TextBounds, - TickAnimation = TickAnimation, - Translate = Translate, - UpdateImagePattern = UpdateImagePattern, - UpdateLabel = UpdateLabel, -}; +} + +-- Creates a new circle arc shaped sub-path +---@param cx number # center x-coordinate +---@param cy number # center y-coordinate +---@param r number # radius +---@param a0 number # starting angle, in radians +---@param a1 number # ending angle, in radians +---@param dir integer # 1 = counter-clockwise, 2 = clockwise +gfx.Arc = function(cx, cy, r, a0, a1, dir) end + +-- Adds an arc segment at the corner defined by the previous point and two specified points +---@param x1 number +---@param y1 number +---@param x2 number +---@param y2 number +---@param radius number +gfx.ArcTo = function(x1, y1, x2, y2, radius) end + +-- Clears currently defined paths to begin drawing a new "shape" +gfx.BeginPath = function() end + +-- Adds a cubic bezier segment from the previous point to the specified point +-- Uses the two control points `(c1x, c1y)` and `(c2x, c2y)` +---@param c1x number +---@param c1y number +---@param c2x number +---@param c2y number +---@param x number +---@param y number +gfx.BezierTo = function(c1x, c1y, c2x, c2y, x, y) end + +-- Creates a box gradient that can be used by `FillPaint` or `StrokePaint` +---@param x number +---@param y number +---@param w number +---@param h number +---@param r number # radius +---@param f number # feather amount +gfx.BoxGradient = function(x, y, w, h, r, f) end + +-- Creates a new circle shaped sub-path +---@param cx number +---@param cy number +---@param r number +gfx.Circle = function(cx, cy, r) end + +-- Closes the current sub-path with a line segment +gfx.ClosePath = function() end + +-- Loads an image from the specified filename +---@param filename string +---@param flags? integer # options are under the `gfx` table prefixed with `IMAGE` +gfx.CreateImage = function(filename, flags) end + +-- Creates a cached text that can be drawn by `DrawLabel` +---@param text string +---@param size integer +---@param monospace boolean +gfx.CreateLabel = function(text, size, monospace) end + +-- Creates a new `ShadedMesh` object +---@param materialName string +---@param path? string # Optional path to the material, loads from the current skin's `shaders` folder otherwise +-- `.fs` and `.vs` must exist at either location +---@return ShadedMesh +gfx.CreateShadedMesh = function(materialName, path) end + +-- Loads an image from `skins//textures/` +---@param path string +---@param flags? integer +gfx.CreateSkinImage = function(path, flags) end + +-- Draws the loaded gauge +-- The game loads the gauge itself, using the textures in `skins//textures/gauges/` +---@param rate number # current gauge percentage +---@param x number +---@param y number +---@param w number +---@param h number +---@param deltaTime number +gfx.DrawGauge = function(rate, x, y, w, h, deltaTime) end + +-- Draws a created label, resized if `maxWidth > 0` +-- Labels are always be drawn on top of other drawn elements +---@param label any # label created by `CreateLabel` +---@param x number +---@param y number +---@param maxWidth? number +gfx.DrawLabel = function(label, x, y, maxWidth) end + +-- Creates a new ellipse shaped sub-path +---@param cx number +---@param cy number +---@param rx number +---@param ry number +gfx.Ellipse = function(cx, cy, rx, ry) end + +-- Draws a string at the specified location, but will always be drawn on top of other drawn elements +---@param text string +---@param x number +---@param y number +gfx.FastText = function(text, x, y) end + +-- Gets the width and height of a given fast text +---@param text string +---@return number w, number h +gfx.FastTextSize = function(text) end + +-- Fills the current path with the current fill style +gfx.Fill = function() end + +-- Sets the current fill to a solid color +---@param r integer +---@param g integer +---@param b integer +---@param a? integer # default 255 +gfx.FillColor = function(r, g, b, a) end + +-- Sets the current fill to a paint +---@param paint any # pattern created by `ImagePattern` or gradient created by `BoxGradient`, `LinearGradient`, or `RadialGradient` +gfx.FillPaint = function(paint) end + +-- Sets the font face for the current text style +---@param font string +gfx.FontFace = function(font) end + +-- Sets the font size of the current text style +---@param size number +gfx.FontSize = function(size) end + +-- Forces the current render queue to be processed +-- This causes "fast" elements such as `FastRect`, `FastText` or `labels` to be drawn/processed immediately rather than at the end of the render queue +gfx.ForceRender = function() end + +-- Gets the shared texture ID generated by `gfx.LoadSharedTexture` under the given `name` +---@param name string +---@return integer ID # Used the same as images generated by `gfx.CreateImage` +gfx.GetSharedTexture = function(name) end + +-- Sets the global alpha value for all drawings +-- Elements that have their alpha set will be adjusted relative to the global value +---@param alpha number +gfx.GlobalAlpha = function(alpha) end + +-- Sets the composite operation with custom pixel arithmetic +-- Options are under the `gfx` table prefixed with `BLEND` +---@param srcFactor integer +---@param desFactor integer +gfx.GlobalCompositeBlendFunc = function(srcFactor, desFactor) end + +-- Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately +-- Options are under the `gfx` table prefixed with `BLEND` +---@param srcRGB integer +---@param desRGB integer +---@param srcAlpha integer +---@param desAlpha integer +gfx.GlobalCompositeBlendFuncSeparate = function(srcRGB, desRGB, srcAlpha, desAlpha) end + +-- Sets the composite operation +-- Options are under the `gfx` table prefixed with `BLEND_OP` +---@param op integer +gfx.GlobalCompositeOperation = function(op) end + +-- Sets the inner and outer colors for a gradient +-- `ri, gi, bi, ai` inner color +-- `ro, go, bo, ao` outer color +---@param ri integer +---@param gi integer +---@param bi integer +---@param ai integer +---@param ro integer +---@param go integer +---@param bo integer +---@param ao integer +gfx.GradientColors = function(ri, gi, bi, ai, ro, bo, go, ao) end + +-- Creates an image pattern that can be used by `FillPaint` or `StrokePaint` +-- `(sx, sy)` is the top-left location of the pattern +-- `(ix, iy)` is the size of one image +---@param sx number +---@param sy number +---@param ix number +---@param iy number +---@param angle number # in radians +---@param image any # image created by `CreateImage` or `CreateSkinImage` +---@param alpha number # `0.0` to `1.0` +gfx.ImagePattern = function(sx, sy, ix, iy, angle, image, alpha) end + +-- Draws an image in the specified rect; stretches the image to fit +---@param x number +---@param y number +---@param w number +---@param h number +---@param image any # image created by `CreateImage` or `CreateSkinImage`, or an animation loaded with `LoadSkinAnimation` +---@param alpha number # `0.0` to `1.0` +---@param angle number # in radians +gfx.ImageRect = function(x, y, w, h, image, alpha, angle) end + +-- Gets the width and height of a given image +---@param image any # image created by `CreateImage` or `CreateSkinImage` +---@return number w, number h +gfx.ImageSize = function(image) end + +-- Intersects the current scissor rectangle with the specified rectangle +---@param x number +---@param y number +---@param w number +---@param h number +gfx.IntersectScissor = function(x, y, w, h) end + +-- Gets the width and height of a given label +---@param label any # label created by `CreateLabel` +---@return number w, number h +gfx.LabelSize = function(label) end + +-- Creates a linear gradient that can be used by `FillPaint` or `StrokePaint` +-- `(sx, sy)` -> `(ex, ey)` starting to ending coordinates +---@param sx number +---@param sy number +---@param ex number +---@param ey number +gfx.LinearGradient = function(sx, sy, ex, ey) end + +-- Sets how the end of the line is drawn +-- Options are under the `gfx` table prefixed with `LINE` +---@param cap integer +gfx.LineCap = function(cap) end + +-- Sets how sharp path corners are drawn +-- Options are under the `gfx` table prefixed with `LINE` +---@param join integer +gfx.LineJoin = function(join) end + +-- Adds a line segment from the previous point to the specified point +---@param x number +---@param y number +gfx.LineTo = function(x, y) end + +-- Loads all images of the specified folder as frames to be used for an animation +-- Returns an `animation` that can be used the same way as an `image` +---@param path string +---@param frameTime number # 1 / fps +---@param loopCount? integer # 0 +---@param compressed boolean # false +-- if `compressed`, the animation will be stored in RAM and decoded on-demand; this uses more CPU but much less RAM +gfx.LoadAnimation = function(path, frameTime, loopCount, compressed) end + +-- Loads a persistent texture from the `path` that can be accessed by the `name` in `gfx.GetSharedTexture` and `ShadedMesh:AddSharedTexture` +---@param name string +---@param path string +gfx.LoadSharedTexture = function(name, path) end + +-- Loads all images from `skins//textures/` to be used for an animation +-- Returns an `animation` that can be used the same way as an `image` +---@param path string +---@param frameTime number # 1 / fps +---@param loopCount? integer # Default `0` +---@param compressed boolean +-- If `compressed`, the animation will be stored in RAM and decoded on-demand; this uses more CPU but much less RAM +gfx.LoadSkinAnimation = function(path, frameTime, loopCount, compressed) end + +-- Loads a persistent texture from `skins//textures/` that can be accessed by the `name` in `gfx.GetSharedTexture` and `ShadedMesh:AddSharedTexture` +---@param name string +---@param path string +gfx.LoadSharedSkinTexture = function(name, path) end + +-- Loads a font fromt the specified filename +-- Sets it as the current font if it is already loaded +---@param name? string +---@param filename string +gfx.LoadFont = function(name, filename) end + +-- Loads an image outside of the main thread to prevent rendering lock-up +-- Image will be loaded at original size unless `w` and `h` are provided +---@param filepath string +---@param placeholder any # image created by `CreateImage` or `CreateSkinImage` +---@param w? number # 0 +---@param h? number # 0 +---@return any # returns `placeholder` until the image is loaded +gfx.LoadImageJob = function(filepath, placeholder, w, h) end + +-- Loads a font from `skins//textures/` +-- Sets it as the current font if it is already loaded +---@param filename string +gfx.LoadSkinFont = function(filename) end + +-- Loads a font from `skins//textures/` +-- Sets it as the current font if it is already loaded +---@param name string +---@param filename string +gfx.LoadSkinFont = function(name, filename) end + +-- Loads an image outside of the main thread to prevent rendering lock-up +-- Image will be loaded at original size unless `w` and `h` are provided +---@param url string # web url of image +---@param placeholder any # image created by `CreateImage` or `CreateSkinImage` +---@param w? number # 0 +---@param h? number # 0 +---@return any # returns `placeholder` until the image is loaded +gfx.LoadWebImageJob = function(url, placeholder, w, h) end + +-- Sets the miter limit of the stroke style +---@param limit number +gfx.MiterLimit = function(limit) end + +-- Starts a new sub-path at the specified point +---@param x number +---@param y number +gfx.MoveTo = function(x, y) end + +-- Adds a quadratic bezier segment from the previous point to the specified point +-- Uses the control point `(cx, cy)` +---@param cx number +---@param cy number +---@param x number +---@param y number +gfx.QuadTo = function(cx, cy, x, y) end + +-- Creates a radial gradient that can be used by `FillPaint` or `StrokePaint` +---@param cx number +---@param cy number +---@param inr number # inner radius +---@param outr number # outer radius +gfx.RadialGradient = function(cx, cy, inr, outr) end + +-- Creates a new rectangle shaped sub-path +---@param x number +---@param y number +---@param w number +---@param h number +gfx.Rect = function(x, y, w, h) end + +-- Resets the current render state to default values +-- This does not affect the render state stack +gfx.Reset = function() end + +-- Resets and disables scissoring +gfx.ResetScissor = function() end + +-- Resets all transforms done by `Rotate`, `Scale`, or `Translate`, etc. +gfx.ResetTransform = function() end + +-- Pops/restores the current render state from the state stack +-- The render state is pushed/saved to the stack using `Save` +gfx.Restore = function() end + +-- Rotates the current coordinates +---@param angle number # in radians +gfx.Rotate = function(angle) end + +-- Creates a rounded rectangle shaped sub-path +---@param x number +---@param y number +---@param w number +---@param h number +---@param r number +gfx.RoundedRect = function(x, y, w, h, r) end + +-- Creates a rounded rectangle shaped sub-path with varying radii for each corner +-- `r1` is the top-left corner and continues clockwise +---@param x number +---@param y number +---@param w number +---@param h number +---@param r1 number +---@param r2 number +---@param r3 number +---@param r4 number +gfx.RoundedRectVarying = function(x, y, w, h, r1, r2, r3, r4) end + +-- Pushes/saves the current render state into a state stack +-- The render state can be popped/restored from the stack using `Restore` +gfx.Save = function() end + +-- Scales the current coordinates by the given factors +---@param x number +---@param y number +gfx.Scale = function(x, y) end + +-- Sets the current scissor rectangle +-- Scissoring allows you to clip any rendering into a rectangle (affected by the current transform) +---@param x number +---@param y number +---@param w number +---@param h number +gfx.Scissor = function(x, y, w, h) end + +-- Sets the gauge color for the specified `index` +---@param index integer # +-- ``` +-- 0 = Normal gauge fail (<70%) +-- 1 = Normal gauge clear (>=70%) +-- 2 = Hard gauge fail (<30%) +-- 3 = Hard gauge fail (>=30%) +-- ``` +---@param r integer +---@param g integer +---@param b integer +gfx.SetGaugeColor = function(index, r, g, b) end + +-- Multiplies the color given with all incoming drawn image colors +---@param r integer +---@param g integer +---@param b integer +gfx.SetImageTint = function(r, g, b) end + +-- Skews the current coordinates along the x-axis +---@param angle number # in radians +gfx.SkewX = function(angle) end + +-- Skews the current coordinates along the y-axis +---@param angle number # in radians +gfx.SkewY = function(angle) end + +-- Strokes the current path with the current stroke style +gfx.Stroke = function() end + +-- Sets the current stroke style to a solid color +---@param r integer +---@param g integer +---@param b integer +---@param a? integer # 255 +gfx.StrokeColor = function(r, g, b, a) end + +-- Sets the current stroke style to a paint +---@param paint any # pattern created by `ImagePattern` or gradient created by `BoxGradient`, `LinearGradient`, or `RadialGradient` +gfx.StrokePaint = function(paint) end + +-- Sets the stroke width of the stroke style +---@param size number +gfx.StrokeWidth = function(size) end + +-- Draws a string at the specified location +---@param text string +---@param x number +---@param y number +gfx.Text = function(text, x, y) end + +-- Sets the text align of the current text style +-- Options are under the `gfx` table prefixed with `TEXT_ALIGN` +---@param align integer +gfx.TextAlign = function(align) end + +-- Gets the bounding rectangle coordinates of a given text +---@param x number +---@param y number +---@param text string +---@return number x1, number y1, number x2, number y2 +gfx.TextBounds = function(x, y, text) end + +-- Progresses the given animation +---@param animation any # animation created by `LoadAnimation` or `LoadSkinAnimation` +---@param deltaTime number +gfx.TickAnimation = function(animation, deltaTime) end + +-- Translates the current coordinates by `x` and `y` +---@param x number +---@param y number +gfx.Translate = function(x, y) end + +-- Updates the properties of a created pattern +-- `(sx, sy)` is the top-left location of the pattern +-- `(ix, iy)` is the size of one image +---@param pattern any # pattern created by `ImagePattern` +---@param sx number +---@param sy number +---@param ix number +---@param iy number +---@param angle number # in radians +---@param alpha number # `0.0` to `1.0` +gfx.UpdateImagePattern = function(pattern, sx, sy, ix, iy, angle, alpha) end + +-- Updates the properties of a created label +---@param label any # label created by `CreateLabel` +---@param text? string +---@param size? integer +gfx.UpdateLabel = function(label, text, size) end diff --git a/docs/lua_api/http.lua b/docs/lua_api/http.lua index d540c31..45ef0e9 100644 --- a/docs/lua_api/http.lua +++ b/docs/lua_api/http.lua @@ -1,29 +1,7 @@ -- Global `Http` table - --- Executes a blocking `GET` request ----@param url string ----@param header table ----@return HttpResponse -Get = function(url, header) end - --- Executes a `GET` request and calls `callback` with `HttpResponse` as a parameter ----@param url string ----@param header table ----@param callback function -GetAsync = function(url, header, callback) end - --- Executes a blocking `POST` request ----@param url string ----@param content string ----@param header table ----@return HttpResponse -Post = function(url, content, header) end - --- Executes a `POST` request and calls `callback` with `HttpResponse` as a parameter ----@param url string ----@param header table ----@param callback function -PostAsync = function(url, header, callback) end +---@class Http +Http = { +} ---@class HttpResponse ---@field cookies string @@ -33,12 +11,29 @@ PostAsync = function(url, header, callback) end ---@field error string ---@field text string ---@field url string -HttpResponse = {}; +HttpResponse = {} ----@class Http -Http = { - Get = Get, - GetAsync = GetAsync, - Post = Post, - PostAsync = PostAsync, -}; \ No newline at end of file +-- Executes a blocking `GET` request +---@param url string +---@param header table +---@return HttpResponse +Http.Get = function(url, header) end + +-- Executes a `GET` request and calls `callback` with `HttpResponse` as a parameter +---@param url string +---@param header table +---@param callback function +Http.GetAsync = function(url, header, callback) end + +-- Executes a blocking `POST` request +---@param url string +---@param content string +---@param header table +---@return HttpResponse +Http.Post = function(url, content, header) end + +-- Executes a `POST` request and calls `callback` with `HttpResponse` as a parameter +---@param url string +---@param header table +---@param callback function +Http.PostAsync = function(url, header, callback) end diff --git a/docs/lua_api/result.lua b/docs/lua_api/result.lua index aa17fb9..d72ee06 100644 --- a/docs/lua_api/result.lua +++ b/docs/lua_api/result.lua @@ -7,7 +7,7 @@ ---@field delta integer -- Delta value of the hit from 0 ---@field hold integer -- `0` for chip/laser, otherwise `# Ticks` of hold ---@field rating integer -- `0 = Miss`, `1 = Near`, `2 = Crit` -HitStat = {}; +HitStat = {} ---@class HitWindow ---@field good integer # Near window, default `92` @@ -16,7 +16,7 @@ HitStat = {}; ---@field perfect integer -- Critical window, default `46` ---@field slam integer -- Slam window, default `84` ---@field type integer -- `1 = Normal` default, `2 = Hard` default values halved -HitWindow = {}; +HitWindow = {} ---@class Score ---@field auto_flags integer # Autoplay flag @@ -34,12 +34,12 @@ HitWindow = {}; ---@field score integer # Result score ---@field timestamp integer # Unix timestamp of the score ---@field uid nil|string # Only for multiplayer results, UID of the player -Score = {}; +Score = {} ---@class ChartResult : result ---@field passed boolean # Whether or not challenge requirements were met for this chart ---@field failReason string # Fail reason if a challenge requirement was not met -ChartResult = {}; +ChartResult = {} ---@class ServerScoreOptions ---@field gaugeType integer # An enum value representing the gauge type used. 0 = normal, 1 = hard. Further values are not currently specified. @@ -129,4 +129,4 @@ ServerScore = {} ---@field speedModValue number # Only for singleplayer, `HiSpeed` for `XMOD`, `ModSpeed` otherwise ---@field title string # Chart (with player name in multiplayer) or challenge title ---@field uid nil|string # Only for multiplayer, UID of the player -result = {}; +result = {} diff --git a/docs/lua_api/shadedmesh.lua b/docs/lua_api/shadedmesh.lua index a6a4855..5a2dd0a 100644 --- a/docs/lua_api/shadedmesh.lua +++ b/docs/lua_api/shadedmesh.lua @@ -1,118 +1,5 @@ --- Adds a texture that was loaded with `gfx.LoadSharedTexture` to the material that can be used in the shader code ----@param uniformName string ----@param textureName string -AddSharedTexture = function(uniformName, textureName) end - --- Adds a texture to the material that can be used in the shader code ----@param uniformName string ----@param path string # prepended with `skins//textures/` -AddSkinTexture = function(uniformName, path) end - --- Adds a texture to the material that can be used in the shader code ----@param uniformName string ----@param path string -AddTexture = function(uniformName, path) end - --- Gets the translation of the mesh ----@return number x, number y, number z -GetPosition = function() end - --- Gets the rotation (in degrees) of the mesh ----@return number roll, number yaw, number pitch -GetRotation = function() end - --- Gets the scale of the mesh ----@return number x, number y, number z -GetScale = function() end - --- Sets the blending mode ----@param mode integer # options also available as fields of the object prefixed with `BLEND` --- `Normal` = 0 (default) --- `Additive` = 1 --- `Multiply` = 2 -SetBlendMode = function(mode) end - --- Sets the geometry data ----@param data table # array of vertices in clockwise order starting from the top left e.g. --- ``` --- { --- { { 0, 0 }, { 0, 0 } }, --- { { 50, 0 }, { 1, 0 } }, --- { { 50, 50 }, { 1, 1 } }, --- { { 0, 50 }, { 0, 1 } }, --- } --- ``` -SetData = function(data) end - --- Sets the material is opaque or non-opaque (default) ----@param opaque boolean -SetOpaque = function(opaque) end - --- Sets the value of the specified uniform ----@param uniformName string ----@param value number # `float` -SetParam = function(uniformName, value) end - --- Sets the value of the specified 2d vector uniform ----@param uniformName string ----@param x number # `float` ----@param y number # `float` -SetParamVec2 = function(uniformName, x, y) end - --- Sets the value of the specified 3d vector uniform ----@param uniformName string ----@param x number # `float` ----@param y number # `float` ----@param z number # `float` -SetParamVec3 = function(uniformName, x, y, z) end - --- Sets the value of the specified 4d vector uniform ----@param uniformName string ----@param x number # `float` ----@param y number # `float` ----@param z number # `float` ----@param w number # `float` -SetParamVec4 = function(uniformName, x, y, z, w) end - --- Sets the translation for the mesh --- Relative to the screen for `ShadedMesh` --- Relative to the center of the crit line for `ShadedMeshOnTrack` ----@param x number ----@param y number ----@param z? number # Default `0` -SetPosition = function(x, y, z) end - --- Sets the format for geometry data provided by `SetData` ----@param type integer # options also available as fields of the object prefixed with `PRIM` --- `TriangleList` = 0 (default) --- `TriangleStrip` = 1 --- `TriangleFan` = 2 --- `LineList` = 3 --- `LineStrip` = 4 --- `PointList` = 5 -SetPrimitiveType = function(type) end - --- Sets the rotation (in degrees) of the mesh --- **WARNING:** For `ShadedMesh`, pitch and yaw may clip, rendering portions or the entire mesh invisible ----@param roll number ----@param yaw? number # Default `0` ----@param pitch? number # Default `0` -SetRotation = function(roll, yaw, pitch) end - --- Sets the scale of the mesh ----@param x number ----@param y number ----@param z? number # Default `0` -SetScale = function(x, y, z) end - --- Sets the wireframe mode of the object (does not render texture) --- Useful for debugging models or geometry shaders ----@param useWireframe boolean -SetWireframe = function(useWireframe) end - --- Renders the `ShadedMesh` object -Draw = function() end - +---ShadedMesh is a lua object available that has "low-level" drawing capabilites +---that can be useful for very custom rendering goals. ---@class ShadedMesh ShadedMesh = { BLEND_NORM = 0, @@ -125,57 +12,148 @@ ShadedMesh = { PRIM_LINELIST = 3, PRIM_LINESTRIP = 4, PRIM_POINTLIST = 5, +} - AddSharedTexture = AddSharedTexture, - AddSkinTexture = AddSkinTexture, - AddTexture = AddTexture, - Draw = Draw, - GetPosition = GetPosition, - GetRotation = GetRotation, - GetScale = GetScale, - SetBlendMode = SetBlendMode, - SetData = SetData, - SetOpaque = SetOpaque, - SetParam = SetParam, - SetParamVec2 = SetParamVec2, - SetParamVec3 = SetParamVec3, - SetParamVec4 = SetParamVec4, - SetPosition = SetPosition, - SetPrimitiveType = SetPrimitiveType, - SetRotation = SetRotation, - SetScale = SetScale, - SetWireframe = SetWireframe, -}; +-- Adds a texture that was loaded with `gfx.LoadSharedTexture` to the material that can be used in the shader code +---@param uniformName string +---@param textureName string +ShadedMesh.AddSharedTexture = function(uniformName, textureName) end --- Gets the length of the mesh ----@return number length -GetLength = function() end +-- Adds a texture to the material that can be used in the shader code +---@param uniformName string +---@param path string # prepended with `skins//textures/` +ShadedMesh.AddSkinTexture = function(uniformName, path) end --- Sets the y-scale of the mesh based on its length --- Useful for creating fake buttons which may have variable length based on duration ----@param length number -ScaleToLength = function(length) end +-- Adds a texture to the material that can be used in the shader code +---@param uniformName string +---@param path string +ShadedMesh.AddTexture = function(uniformName, path) end --- Stops meshes beyond the track from being rendered if `doClip` ----@param doClip boolean -SetClipWithTrack = function(doClip) end +-- Gets the translation of the mesh +---@return number x, number y, number z +ShadedMesh.GetPosition = function() end --- Sets the length (in the y-direction relative to the track) of the mesh ----@param length number # Optional constants: `BUTTON_TEXTURE_LENGTH`, `FXBUTTON_TEXTURE_LENGTH`, and `TRACK_LENGTH` -SetLength = function(length) end +-- Gets the rotation (in degrees) of the mesh +---@return number roll, number yaw, number pitch +ShadedMesh.GetRotation = function() end --- Uses an existing game mesh ----@param meshName string # Options: `'button'`, `'fxbutton'`, and `'track'` -UseGameMesh = function(meshName) end +-- Gets the scale of the mesh +---@return number x, number y, number z +ShadedMesh.GetScale = function() end +-- Sets the blending mode +---@param mode integer # options also available as fields of the object prefixed with `BLEND` +-- `Normal` = 0 (default) +-- `Additive` = 1 +-- `Multiply` = 2 +ShadedMesh.SetBlendMode = function(mode) end + +-- Sets the geometry data +---@param data table # array of vertices in clockwise order starting from the top left e.g. +-- ``` +-- { +-- { { 0, 0 }, { 0, 0 } }, +-- { { 50, 0 }, { 1, 0 } }, +-- { { 50, 50 }, { 1, 1 } }, +-- { { 0, 50 }, { 0, 1 } }, +-- } +-- ``` +ShadedMesh.SetData = function(data) end + +-- Sets the material is opaque or non-opaque (default) +---@param opaque boolean +ShadedMesh.SetOpaque = function(opaque) end + +-- Sets the value of the specified uniform +---@param uniformName string +---@param value number # `float` +ShadedMesh.SetParam = function(uniformName, value) end + +-- Sets the value of the specified 2d vector uniform +---@param uniformName string +---@param x number # `float` +---@param y number # `float` +ShadedMesh.SetParamVec2 = function(uniformName, x, y) end + +-- Sets the value of the specified 3d vector uniform +---@param uniformName string +---@param x number # `float` +---@param y number # `float` +---@param z number # `float` +ShadedMesh.SetParamVec3 = function(uniformName, x, y, z) end + +-- Sets the value of the specified 4d vector uniform +---@param uniformName string +---@param x number # `float` +---@param y number # `float` +---@param z number # `float` +---@param w number # `float` +ShadedMesh.SetParamVec4 = function(uniformName, x, y, z, w) end + +-- Sets the translation for the mesh +-- Relative to the screen for `ShadedMesh` +-- Relative to the center of the crit line for `ShadedMeshOnTrack` +---@param x number +---@param y number +---@param z? number # Default `0` +ShadedMesh.SetPosition = function(x, y, z) end + +-- Sets the format for geometry data provided by `SetData` +---@param type integer # options also available as fields of the object prefixed with `PRIM` +-- `TriangleList` = 0 (default) +-- `TriangleStrip` = 1 +-- `TriangleFan` = 2 +-- `LineList` = 3 +-- `LineStrip` = 4 +-- `PointList` = 5 +ShadedMesh.SetPrimitiveType = function(type) end + +-- Sets the rotation (in degrees) of the mesh +-- **WARNING:** For `ShadedMesh`, pitch and yaw may clip, rendering portions or the entire mesh invisible +---@param roll number +---@param yaw? number # Default `0` +---@param pitch? number # Default `0` +ShadedMesh.SetRotation = function(roll, yaw, pitch) end + +-- Sets the scale of the mesh +---@param x number +---@param y number +---@param z? number # Default `0` +ShadedMesh.SetScale = function(x, y, z) end + +-- Sets the wireframe mode of the object (does not render texture) +-- Useful for debugging models or geometry shaders +---@param useWireframe boolean +ShadedMesh.SetWireframe = function(useWireframe) end + +-- Renders the `ShadedMesh` object +ShadedMesh.Draw = function() end + +---ShadedMeshOnTrack is a ShadedMesh that renders with the track camera instead of the screen. ---@class ShadedMeshOnTrack : ShadedMesh ---@field BUTTON_TEXTURE_LENGTH number ---@field FXBUTTON_TEXTURE_LENGTH number ---@field TRACK_LENGTH number ShadedMeshOnTrack = { - GetLength = GetLength, - UseGameMesh = UseGameMesh, - ScaleToLength = ScaleToLength, - SetClipWithTrack = SetClipWithTrack, - SetLength = SetLength, -}; \ No newline at end of file +} +-- Gets the length of the mesh +---@return number length +ShadedMeshOnTrack.GetLength = function() end + +-- Sets the y-scale of the mesh based on its length +-- Useful for creating fake buttons which may have variable length based on duration +---@param length number +ShadedMeshOnTrack.ScaleToLength = function(length) end + +-- Stops meshes beyond the track from being rendered if `doClip` +---@param doClip boolean +ShadedMeshOnTrack.SetClipWithTrack = function(doClip) end + +-- Sets the length (in the y-direction relative to the track) of the mesh +---@param length number # Optional constants: `BUTTON_TEXTURE_LENGTH`, `FXBUTTON_TEXTURE_LENGTH`, and `TRACK_LENGTH` +ShadedMeshOnTrack.SetLength = function(length) end + +-- Uses an existing game mesh +---@param meshName string # Options: `'button'`, `'fxbutton'`, and `'track'` +ShadedMeshOnTrack.UseGameMesh = function(meshName) end + diff --git a/docs/lua_api/songwheel.lua b/docs/lua_api/songwheel.lua index 2c57b26..42e609a 100644 --- a/docs/lua_api/songwheel.lua +++ b/docs/lua_api/songwheel.lua @@ -9,7 +9,7 @@ ---@field level integer # Difficulty level ---@field scores Score[] # Scores for the current difficulty ---@field topBadge integer # `0 = Never Played`, `1 = Played`, `2 = Cleared`, `3 = Hard Cleared`, `4 = Full Chain`, `5 = Perfect Chain` -Difficulty = {}; +Difficulty = {} ---@class Song ---@field artist string # Chart artist @@ -18,7 +18,7 @@ Difficulty = {}; ---@field id integer # Song id, unique static identifier ---@field path string # Full filepath to the chart folder on the disk ---@field title string # Chart title -Song = {}; +Song = {} ---@class songwheel ---@field allSongs Song[] # Array of all available songs @@ -26,4 +26,16 @@ Song = {}; ---@field searchStatus string # Current song database status ---@field searchText string # Search input text ---@field songs Song[] # Array of songs with the current filters/sorting applied -songwheel = {}; \ No newline at end of file +songwheel = {} + +---Set difficulty index +---@param diff integer diff index +function set_diff(diff) end + +---Function called by the game when ``songs`` or ``allSongs`` (if withAll == true) is changed. +---@param allSongs boolean +function songs_changed(allSongs) end + +---Function called by the game to get how much to scroll when page up or page down are pressed. +---Needs to be defined for the game to work properly. +function get_page_size() end diff --git a/docs/lua_api/sortwheel.lua b/docs/lua_api/sortwheel.lua index 018e801..dc6edda 100644 --- a/docs/lua_api/sortwheel.lua +++ b/docs/lua_api/sortwheel.lua @@ -1,4 +1,17 @@ -- sortwheel `sorts` table ---@type string[] # Array of song sorts -sorts = {}; \ No newline at end of file +sorts = { + "Title ^", + "Title v", + "Score ^", + "Score v", + "Date ^", + "Date v", + "Badge ^", + "Badge v", + "Artist ^", + "Artist v", + "Effector ^", + "Effector v", +} diff --git a/docs/lua_api/titlescreen.lua b/docs/lua_api/titlescreen.lua index 749eb74..f7c0ec1 100644 --- a/docs/lua_api/titlescreen.lua +++ b/docs/lua_api/titlescreen.lua @@ -1,27 +1,30 @@ -local function Exit() end - -local function Settings() end - -local function Start() end - -local function DLScreen() end - -local function Update() end - -local function Multiplayer() end - -local function Challenges() end - +--- Global `Menu` table +---@class Menu Menu = { - Exit = Exit, - Settings = Settings, - Start = Start, - DLScreen = DLScreen, - Update = Update, - Multiplayer = Multiplayer, - Challenges = Challenges } +--- Exit application +Menu.Exit = function() end + +--- Open settings screen +Menu.Settings = function() end + +--- Open songwheel screen +Menu.Start = function() end + +--- Open nautica screen +Menu.DLScreen = function() end + +--- Update the application +Menu.Update = function() end + +--- Open multiplayer screen +Menu.Multiplayer = function() end + +--- Open challenge course screen +Menu.Challenges = function() end + + --- Render frame for titlescreen ---@param deltaTime number Elapsed frametime since last frame function render(deltaTime) end @@ -32,4 +35,4 @@ function button_pressed(buttonCode) end --- Mouse event handler for titlescreen ---@param button integer -function mouse_pressed(button) end \ No newline at end of file +function mouse_pressed(button) end diff --git a/docs/lua_api/track.lua b/docs/lua_api/track.lua index 7603515..59a50d7 100644 --- a/docs/lua_api/track.lua +++ b/docs/lua_api/track.lua @@ -1,39 +1,34 @@ --- `track` table --- Only exists in `gameplay.lua` and background/foreground scripts +---`track` table +--- +---Only exists in `gameplay.lua` and background/foreground scripts +---@class track +track = { +} -- Creates a new `ShadedMeshOnTrack` object ---@param materialName string # Default `'guiTex'`, loaded from the current skin's `shaders` folder -- `.fs` and `.vs` must exist at this location ---@return ShadedMeshOnTrack -CreateShadedMeshOnTrack = function(materialName) end +track.CreateShadedMeshOnTrack = function(materialName) end -- Gets the x-value for the left side of the given `lane` ---@param lane integer # `1` = A, `2` = B, `3` = C, `4` = D, `5` = L, `6` = R ---@return number x -GetCurrentLaneXPos = function(lane) end +track.GetCurrentLaneXPos = function(lane) end -- Gets the y-length of a long note from `start` for `duration`, adjusted for the current track speed ---@param start integer # In miliseconds ---@param duration integer # In miliseconds ---@return number y -GetLengthForDuration = function(start, duration) end +track.GetLengthForDuration = function(start, duration) end -- Gets the y-position for an object at the given `time`, adjusted for the current track speed ---@param time integer # In miliseconds ---@return number y -GetYPosForTime = function(time) end +track.GetYPosForTime = function(time) end -- Hides an object in the given `lane` at the given `time` -- If no object is found, hides the closest object after the given `time` ---@param time integer # In miliseconds ---@param lane integer # `1` = A, `2` = B, `3` = C, `4` = D, `5` = L, `6` = R -HideObject = function(time, lane) end - ----@class track -track = { - CreateShadedMeshOnTrack = CreateShadedMeshOnTrack, - GetCurrentLaneXPos = GetCurrentLaneXPos, - GetLengthForDuration = GetLengthForDuration, - GetYPosForTime = GetYPosForTime, - HideObject = HideObject, -}; \ No newline at end of file +track.HideObject = function(time, lane) end