diff options
Diffstat (limited to 'meta/3rd/love2d/library/love/window.lua')
-rw-r--r-- | meta/3rd/love2d/library/love/window.lua | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/meta/3rd/love2d/library/love/window.lua b/meta/3rd/love2d/library/love/window.lua index 9722af3b..bbf87533 100644 --- a/meta/3rd/love2d/library/love/window.lua +++ b/meta/3rd/love2d/library/love/window.lua @@ -3,12 +3,18 @@ --- ---Provides an interface for modifying and retrieving information about the program's window. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window) +--- ---@class love.window love.window = {} --- ---Closes the window. It can be reopened with love.window.setMode. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.close) +--- function love.window.close() end --- @@ -20,6 +26,9 @@ function love.window.close() end --- ---Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.fromPixels) +--- ---@overload fun(px: number, py: number):number, number ---@param pixelvalue number # A number in pixels to convert to density-independent units. ---@return number value # The converted number, in density-independent units. @@ -34,12 +43,18 @@ function love.window.fromPixels(pixelvalue) end --- ---The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getDPIScale) +--- ---@return number scale # The pixel scale factor associated with the window. function love.window.getDPIScale() end --- ---Gets the width and height of the desktop. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getDesktopDimensions) +--- ---@param displayindex? number # The index of the display, if multiple monitors are available. ---@return string width # The width of the desktop. ---@return string height # The height of the desktop. @@ -48,12 +63,18 @@ function love.window.getDesktopDimensions(displayindex) end --- ---Gets the number of connected monitors. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayCount) +--- ---@return number count # The number of currently connected displays. function love.window.getDisplayCount() end --- ---Gets the name of a display. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayName) +--- ---@param displayindex? number # The index of the display to get the name of. ---@return string name # The name of the specified display. function love.window.getDisplayName(displayindex) end @@ -61,6 +82,9 @@ function love.window.getDisplayName(displayindex) end --- ---Gets current device display orientation. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayOrientation) +--- ---@param displayindex? number # Display index to get its display orientation, or nil for default display index. ---@return love.DisplayOrientation orientation # Current device display orientation. function love.window.getDisplayOrientation(displayindex) end @@ -68,6 +92,9 @@ function love.window.getDisplayOrientation(displayindex) end --- ---Gets whether the window is fullscreen. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getFullscreen) +--- ---@return boolean fullscreen # True if the window is fullscreen, false otherwise. ---@return love.FullscreenType fstype # The type of fullscreen mode used. function love.window.getFullscreen() end @@ -75,6 +102,9 @@ function love.window.getFullscreen() end --- ---Gets a list of supported fullscreen modes. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getFullscreenModes) +--- ---@param displayindex? number # The index of the display, if multiple monitors are available. ---@return table modes # A table of width/height pairs. (Note that this may not be in order.) function love.window.getFullscreenModes(displayindex) end @@ -82,12 +112,18 @@ function love.window.getFullscreenModes(displayindex) end --- ---Gets the window icon. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getIcon) +--- ---@return love.ImageData imagedata # The window icon imagedata, or nil if no icon has been set with love.window.setIcon. function love.window.getIcon() end --- ---Gets the display mode and properties of the window. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getMode) +--- ---@return number width # Window width. ---@return number height # Window height. ---@return {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, refreshrate: number, x: number, y: number, srgb: boolean} flags # Table with the window properties: @@ -98,6 +134,9 @@ function love.window.getMode() end --- ---The window position is in the coordinate space of the display it is currently in. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getPosition) +--- ---@return number x # The x-coordinate of the window's position. ---@return number y # The y-coordinate of the window's position. ---@return number displayindex # The index of the display that the window is in. @@ -106,6 +145,9 @@ function love.window.getPosition() end --- ---Gets area inside the window which is known to be unobstructed by a system title bar, the iPhone X notch, etc. Useful for making sure UI elements can be seen by the user. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getSafeArea) +--- ---@return number x # Starting position of safe area (x-axis). ---@return number y # Starting position of safe area (y-axis). ---@return number w # Width of safe area. @@ -115,24 +157,36 @@ function love.window.getSafeArea() end --- ---Gets the window title. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getTitle) +--- ---@return string title # The current window title. function love.window.getTitle() end --- ---Gets current vertical synchronization (vsync). --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.getVSync) +--- ---@return number vsync # Current vsync status. 1 if enabled, 0 if disabled, and -1 for adaptive vsync. function love.window.getVSync() end --- ---Checks if the game window has keyboard focus. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.hasFocus) +--- ---@return boolean focus # True if the window has the focus or false if not. function love.window.hasFocus() end --- ---Checks if the game window has mouse focus. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.hasMouseFocus) +--- ---@return boolean focus # True if the window has mouse focus or false if not. function love.window.hasMouseFocus() end @@ -141,6 +195,9 @@ function love.window.hasMouseFocus() end --- ---Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.isDisplaySleepEnabled) +--- ---@return boolean enabled # True if system display sleep is enabled / allowed, false otherwise. function love.window.isDisplaySleepEnabled() end @@ -149,18 +206,27 @@ function love.window.isDisplaySleepEnabled() end --- ---The window can be maximized if it is not fullscreen and is resizable, and either the user has pressed the window's Maximize button or love.window.maximize has been called. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.isMaximized) +--- ---@return boolean maximized # True if the window is currently maximized in windowed mode, false otherwise. function love.window.isMaximized() end --- ---Gets whether the Window is currently minimized. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.isMinimized) +--- ---@return boolean minimized # True if the window is currently minimized, false otherwise. function love.window.isMinimized() end --- ---Checks if the window is open. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.isOpen) +--- ---@return boolean open # True if the window is open, false otherwise. function love.window.isOpen() end @@ -169,6 +235,9 @@ function love.window.isOpen() end --- ---The window is considered visible if it's not minimized and the program isn't hidden. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.isVisible) +--- ---@return boolean visible # True if the window is visible or false if not. function love.window.isVisible() end @@ -177,11 +246,17 @@ function love.window.isVisible() end --- ---This function has no effect if the window isn't resizable, since it essentially programmatically presses the window's 'maximize' button. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.maximize) +--- function love.window.maximize() end --- ---Minimizes the window to the system's task bar / dock. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.minimize) +--- function love.window.minimize() end --- @@ -189,12 +264,18 @@ function love.window.minimize() end --- ---In Windows the taskbar icon will flash, and in OS X the dock icon will bounce. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.requestAttention) +--- ---@param continuous? boolean # Whether to continuously request attention until the window becomes active, or to do it only once. function love.window.requestAttention(continuous) end --- ---Restores the size and position of the window if it was minimized or maximized. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.restore) +--- function love.window.restore() end --- @@ -202,12 +283,18 @@ function love.window.restore() end --- ---Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.setDisplaySleepEnabled) +--- ---@param enable boolean # True to enable system display sleep, false to disable it. function love.window.setDisplaySleepEnabled(enable) end --- ---Enters or exits fullscreen. The display to use when entering fullscreen is chosen based on which display the window is currently in, if multiple monitors are connected. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.setFullscreen) +--- ---@overload fun(fullscreen: boolean, fstype: love.FullscreenType):boolean ---@param fullscreen boolean # Whether to enter or exit fullscreen mode. ---@return boolean success # True if an attempt to enter fullscreen was successful, false otherwise. @@ -216,6 +303,9 @@ function love.window.setFullscreen(fullscreen) end --- ---Sets the window icon until the game is quit. Not all operating systems support very large icon images. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.setIcon) +--- ---@param imagedata love.ImageData # The window icon image. ---@return boolean success # Whether the icon has been set successfully. function love.window.setIcon(imagedata) end @@ -227,6 +317,9 @@ function love.window.setIcon(imagedata) end --- ---Changing the display mode may have side effects: for example, canvases will be cleared and values sent to shaders with canvases beforehand or re-draw to them afterward if you need to. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.setMode) +--- ---@param width number # Display width. ---@param height number # Display height. ---@param flags? {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, stencil: boolean, depth: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number, usedpiscale: boolean, srgb: boolean} # The flags table with the options: @@ -238,6 +331,9 @@ function love.window.setMode(width, height, flags) end --- ---The window position is in the coordinate space of the specified display. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.setPosition) +--- ---@param x number # The x-coordinate of the window's position. ---@param y number # The y-coordinate of the window's position. ---@param displayindex? number # The index of the display that the new window position is relative to. @@ -246,18 +342,27 @@ function love.window.setPosition(x, y, displayindex) end --- ---Sets the window title. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.setTitle) +--- ---@param title string # The new window title. function love.window.setTitle(title) end --- ---Sets vertical synchronization mode. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.setVSync) +--- ---@param vsync number # VSync number: 1 to enable, 0 to disable, and -1 for adaptive vsync. function love.window.setVSync(vsync) end --- ---Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.showMessageBox) +--- ---@overload fun(title: string, message: string, buttonlist: table, type?: love.MessageBoxType, attachtowindow?: boolean):number ---@param title string # The title of the message box. ---@param message string # The text inside the message box. @@ -275,6 +380,9 @@ function love.window.showMessageBox(title, message, type, attachtowindow) end --- ---Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.toPixels) +--- ---@overload fun(x: number, y: number):number, number ---@param value number # A number in density-independent units to convert to pixels. ---@return number pixelvalue # The converted number, in pixels. @@ -287,6 +395,9 @@ function love.window.toPixels(value) end --- ---Changing the display mode may have side effects: for example, canvases will be cleared. Make sure to save the contents of canvases beforehand or re-draw to them afterward if you need to. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.window.updateMode) +--- ---@param width number # Window width. ---@param height number # Window height. ---@param settings {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number} # The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode. @@ -296,6 +407,9 @@ function love.window.updateMode(width, height, settings) end --- ---Types of device display orientation. --- +--- +---[Open in Browser](https://love2d.org/wiki/DisplayOrientation) +--- ---@alias love.DisplayOrientation --- ---Orientation cannot be determined. @@ -321,6 +435,9 @@ function love.window.updateMode(width, height, settings) end --- ---Types of fullscreen modes. --- +--- +---[Open in Browser](https://love2d.org/wiki/FullscreenType) +--- ---@alias love.FullscreenType --- ---Sometimes known as borderless fullscreen windowed mode. A borderless screen-sized window is created which sits on top of all desktop UI elements. The window is automatically resized to match the dimensions of the desktop, and its size cannot be changed. @@ -338,6 +455,9 @@ function love.window.updateMode(width, height, settings) end --- ---Types of message box dialogs. Different types may have slightly different looks. --- +--- +---[Open in Browser](https://love2d.org/wiki/MessageBoxType) +--- ---@alias love.MessageBoxType --- ---Informational dialog. |