Files
Basalt2/docs/.vitepress/dist/assets/references_render.md.CbkFjoxm.js
2025-09-16 17:41:40 +02:00

2 lines
19 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as r,a as t,b as a,ag as d}from"./chunks/framework.BcrMLAmg.js";const b=JSON.parse('{"title":"Render","description":"","frontmatter":{},"headers":[],"relativePath":"references/render.md","filePath":"references/render.md","lastUpdated":1757840145000}'),o={name:"references/render.md"};function i(n,e,l,h,c,s){return a(),t("div",null,e[0]||(e[0]=[d('<h1 id="render" tabindex="-1">Render <a class="header-anchor" href="#render" aria-label="Permalink to &quot;Render&quot;"></a></h1><p>_This is the render module for Basalt. It tries to mimic the functionality of the <code>term</code> API. but with additional _ <em>functionality. It also has a buffer system to reduce the number of calls</em></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;"></a></h2><table tabindex="0"><thead><tr><th>Method</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><a href="#render-new-terminal">Render.new</a></td><td>Render</td><td>Creates a new Render object</td></tr><tr><td><a href="#render-adddirtyrect-x-y-width-height">Render:addDirtyRect</a></td><td>Render</td><td>Adds a dirty rectangle to the buffer</td></tr><tr><td><a href="#render-blit-x-y-text-fg-bg">Render:blit</a></td><td>Render</td><td>Blits text to the screen</td></tr><tr><td><a href="#render-multiblit-x-y-width-height-text-fg-bg">Render:multiBlit</a></td><td>Render</td><td>Blits text to the screen with multiple lines</td></tr><tr><td><a href="#render-textfg-x-y-text-fg">Render:textFg</a></td><td>Render</td><td>Blits text to the screen with a foreground color</td></tr><tr><td><a href="#render-textbg-x-y-text-bg">Render:textBg</a></td><td>Render</td><td>Blits text to the screen with a background color</td></tr><tr><td><a href="#render-text-x-y-text">Render:text</a></td><td>Render</td><td>Renders the text to the screen</td></tr><tr><td><a href="#render-fg-x-y-fg">Render:fg</a></td><td>Render</td><td>Blits a foreground color to the screen</td></tr><tr><td><a href="#render-bg-x-y-bg">Render:bg</a></td><td>Render</td><td>Blits a background color to the screen</td></tr><tr><td><a href="#render-text-x-y-text">Render:text</a></td><td>Render</td><td>Blits text to the screen</td></tr><tr><td><a href="#render-fg-x-y-fg">Render:fg</a></td><td>Render</td><td>Blits a foreground color to the screen</td></tr><tr><td><a href="#render-bg-x-y-bg">Render:bg</a></td><td>Render</td><td>Blits a background color to the screen</td></tr><tr><td><a href="#render-clear-bg">Render:clear</a></td><td>Render</td><td>Clears the screen</td></tr><tr><td><a href="#render-render">Render:render</a></td><td>Render</td><td>Renders the buffer to the screen</td></tr><tr><td><a href="#render-rectoverlaps-r1-r2">Render:rectOverlaps</a></td><td>boolean</td><td>Checks if two rectangles overlap</td></tr><tr><td><a href="#render-mergerects-target-source">Render:mergeRects</a></td><td>Render</td><td>Merges two rectangles</td></tr><tr><td><a href="#render-setcursor-x-y-blink">Render:setCursor</a></td><td>Render</td><td>Sets the cursor position</td></tr><tr><td><a href="#render-cleararea-x-y-width-height-bg">Render:clearArea</a></td><td>Render</td><td>Clears an area of the screen</td></tr><tr><td><a href="#render-getsize">Render:getSize</a></td><td>number</td><td>Gets the size of the render</td></tr><tr><td><a href="#render-setsize-width-height">Render:setSize</a></td><td>Render</td><td>Sets the size of the render</td></tr></tbody></table><h2 id="render-new-terminal" tabindex="-1">Render.new(terminal) <a class="header-anchor" href="#render-new-terminal" aria-label="Permalink to &quot;Render.new(terminal)&quot;"></a></h2><p>Creates a new Render object</p><h3 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>terminal</code> <code>table</code> The terminal object to render to</li></ul><h3 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-adddirtyrect-x-y-width-height" tabindex="-1">Render:addDirtyRect(x, y, width, height) <a class="header-anchor" href="#render-adddirtyrect-x-y-width-height" aria-label="Permalink to &quot;Render:addDirtyRect(x, y, width, height)&quot;"></a></h2><p>Adds a dirty rectangle to the buffer</p><h3 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position of the rectangle</li><li><code>y</code> <code>number</code> The y position of the rectangle</li><li><code>width</code> <code>number</code> The width of the rectangle</li><li><code>height</code> <code>number</code> The height of the rectangle</li></ul><h3 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-blit-x-y-text-fg-bg" tabindex="-1">Render:blit(x, y, text, fg, bg) <a class="header-anchor" href="#render-blit-x-y-text-fg-bg" aria-label="Permalink to &quot;Render:blit(x, y, text, fg, bg)&quot;"></a></h2><p>Blits text to the screen</p><h3 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position to blit to</li><li><code>y</code> <code>number</code> The y position to blit to</li><li><code>text</code> <code>string</code> The text to blit</li><li><code>fg</code> <code>string</code> The foreground color of the text</li><li><code>bg</code> <code>string</code> The background color of the text</li></ul><h3 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-multiblit-x-y-width-height-text-fg-bg" tabindex="-1">Render:multiBlit(x, y, width, height, text, fg, bg) <a class="header-anchor" href="#render-multiblit-x-y-width-height-text-fg-bg" aria-label="Permalink to &quot;Render:multiBlit(x, y, width, height, text, fg, bg)&quot;"></a></h2><p>Blits text to the screen with multiple lines</p><h3 id="parameters-3" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-3" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position to blit to</li><li><code>y</code> <code>number</code> The y position to blit to</li><li><code>width</code> <code>number</code> The width of the text</li><li><code>height</code> <code>number</code> The height of the text</li><li><code>text</code> <code>string</code> The text to blit</li><li><code>fg</code> <code>colors</code> The foreground color of the text</li><li><code>bg</code> <code>colors</code> The background color of the text</li></ul><h3 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-textfg-x-y-text-fg" tabindex="-1">Render:textFg(x, y, text, fg) <a class="header-anchor" href="#render-textfg-x-y-text-fg" aria-label="Permalink to &quot;Render:textFg(x, y, text, fg)&quot;"></a></h2><p>Blits text to the screen with a foreground color</p><h3 id="parameters-4" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-4" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position to blit to</li><li><code>y</code> <code>number</code> The y position to blit to</li><li><code>text</code> <code>string</code> The text to blit</li><li><code>fg</code> <code>colors</code> The foreground color of the text</li></ul><h3 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-textbg-x-y-text-bg" tabindex="-1">Render:textBg(x, y, text, bg) <a class="header-anchor" href="#render-textbg-x-y-text-bg" aria-label="Permalink to &quot;Render:textBg(x, y, text, bg)&quot;"></a></h2><p>Blits text to the screen with a background color</p><h3 id="parameters-5" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-5" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position to blit to</li><li><code>y</code> <code>number</code> The y position to blit to</li><li><code>text</code> <code>string</code> The text to blit</li><li><code>bg</code> <code>colors</code> The background color of the text</li></ul><h3 id="returns-5" tabindex="-1">Returns <a class="header-anchor" href="#returns-5" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-text-x-y-text" tabindex="-1">Render:text(x, y, text) <a class="header-anchor" href="#render-text-x-y-text" aria-label="Permalink to &quot;Render:text(x, y, text)&quot;"></a></h2><p>Renders the text to the screen</p><h3 id="parameters-6" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-6" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position to blit to</li><li><code>y</code> <code>number</code> The y position to blit to</li><li><code>text</code> <code>string</code> The text to blit</li></ul><h3 id="returns-6" tabindex="-1">Returns <a class="header-anchor" href="#returns-6" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-fg-x-y-fg" tabindex="-1">Render:fg(x, y, fg) <a class="header-anchor" href="#render-fg-x-y-fg" aria-label="Permalink to &quot;Render:fg(x, y, fg)&quot;"></a></h2><p>Blits a foreground color to the screen</p><h3 id="parameters-7" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-7" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>fg</code> <code>string</code> The foreground color to blit</li></ul><h3 id="returns-7" tabindex="-1">Returns <a class="header-anchor" href="#returns-7" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-bg-x-y-bg" tabindex="-1">Render:bg(x, y, bg) <a class="header-anchor" href="#render-bg-x-y-bg" aria-label="Permalink to &quot;Render:bg(x, y, bg)&quot;"></a></h2><p>Blits a background color to the screen</p><h3 id="parameters-8" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-8" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>bg</code> <code>string</code> The background color to blit</li></ul><h3 id="returns-8" tabindex="-1">Returns <a class="header-anchor" href="#returns-8" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-text-x-y-text-1" tabindex="-1">Render:text(x, y, text) <a class="header-anchor" href="#render-text-x-y-text-1" aria-label="Permalink to &quot;Render:text(x, y, text)&quot;"></a></h2><p>Blits text to the screen</p><h3 id="parameters-9" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-9" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position to blit to</li><li><code>y</code> <code>number</code> The y position to blit to</li><li><code>text</code> <code>string</code> The text to blit</li></ul><h3 id="returns-9" tabindex="-1">Returns <a class="header-anchor" href="#returns-9" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-fg-x-y-fg-1" tabindex="-1">Render:fg(x, y, fg) <a class="header-anchor" href="#render-fg-x-y-fg-1" aria-label="Permalink to &quot;Render:fg(x, y, fg)&quot;"></a></h2><p>Blits a foreground color to the screen</p><h3 id="parameters-10" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-10" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>fg</code> <code>string</code> The foreground color to blit</li></ul><h3 id="returns-10" tabindex="-1">Returns <a class="header-anchor" href="#returns-10" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-bg-x-y-bg-1" tabindex="-1">Render:bg(x, y, bg) <a class="header-anchor" href="#render-bg-x-y-bg-1" aria-label="Permalink to &quot;Render:bg(x, y, bg)&quot;"></a></h2><p>Blits a background color to the screen</p><h3 id="parameters-11" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-11" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>bg</code> <code>string</code> The background color to blit</li></ul><h3 id="returns-11" tabindex="-1">Returns <a class="header-anchor" href="#returns-11" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-clear-bg" tabindex="-1">Render:clear(bg) <a class="header-anchor" href="#render-clear-bg" aria-label="Permalink to &quot;Render:clear(bg)&quot;"></a></h2><p>Clears the screen</p><h3 id="parameters-12" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-12" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>bg</code> <code>colors</code> The background color to clear the screen with</li></ul><h3 id="returns-12" tabindex="-1">Returns <a class="header-anchor" href="#returns-12" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-render" tabindex="-1">Render:render() <a class="header-anchor" href="#render-render" aria-label="Permalink to &quot;Render:render()&quot;"></a></h2><p>Renders the buffer to the screen</p><h3 id="returns-13" tabindex="-1">Returns <a class="header-anchor" href="#returns-13" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-rectoverlaps-r1-r2" tabindex="-1">Render:rectOverlaps(r1, r2) <a class="header-anchor" href="#render-rectoverlaps-r1-r2" aria-label="Permalink to &quot;Render:rectOverlaps(r1, r2)&quot;"></a></h2><p>Checks if two rectangles overlap</p><h3 id="parameters-13" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-13" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>r1</code> <code>table</code> The first rectangle</li><li><code>r2</code> <code>table</code> The second rectangle</li></ul><h3 id="returns-14" tabindex="-1">Returns <a class="header-anchor" href="#returns-14" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>boolean</code></li></ul><h2 id="render-mergerects-target-source" tabindex="-1">Render:mergeRects(target, source) <a class="header-anchor" href="#render-mergerects-target-source" aria-label="Permalink to &quot;Render:mergeRects(target, source)&quot;"></a></h2><p>Merges two rectangles</p><h3 id="parameters-14" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-14" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>target</code> <code>table</code> The target rectangle</li><li><code>source</code> <code>table</code> The source rectangle</li></ul><h3 id="returns-15" tabindex="-1">Returns <a class="header-anchor" href="#returns-15" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-setcursor-x-y-blink" tabindex="-1">Render:setCursor(x, y, blink) <a class="header-anchor" href="#render-setcursor-x-y-blink" aria-label="Permalink to &quot;Render:setCursor(x, y, blink)&quot;"></a></h2><p>Sets the cursor position</p><h3 id="parameters-15" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-15" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position of the cursor</li><li><code>y</code> <code>number</code> The y position of the cursor</li><li><code>blink</code> <code>boolean</code> Whether the cursor should blink</li></ul><h3 id="returns-16" tabindex="-1">Returns <a class="header-anchor" href="#returns-16" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-cleararea-x-y-width-height-bg" tabindex="-1">Render:clearArea(x, y, width, height, bg) <a class="header-anchor" href="#render-cleararea-x-y-width-height-bg" aria-label="Permalink to &quot;Render:clearArea(x, y, width, height, bg)&quot;"></a></h2><p>Clears an area of the screen</p><h3 id="parameters-16" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-16" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>x</code> <code>number</code> The x position of the area</li><li><code>y</code> <code>number</code> The y position of the area</li><li><code>width</code> <code>number</code> The width of the area</li><li><code>height</code> <code>number</code> The height of the area</li><li><code>bg</code> <code>colors</code> The background color to clear the area with</li></ul><h3 id="returns-17" tabindex="-1">Returns <a class="header-anchor" href="#returns-17" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul><h2 id="render-getsize" tabindex="-1">Render:getSize() <a class="header-anchor" href="#render-getsize" aria-label="Permalink to &quot;Render:getSize()&quot;"></a></h2><p>Gets the size of the render</p><h3 id="returns-18" tabindex="-1">Returns <a class="header-anchor" href="#returns-18" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>number</code></li></ul><h2 id="render-setsize-width-height" tabindex="-1">Render:setSize(width, height) <a class="header-anchor" href="#render-setsize-width-height" aria-label="Permalink to &quot;Render:setSize(width, height)&quot;"></a></h2><p>Sets the size of the render</p><h3 id="parameters-17" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-17" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><ul><li><code>width</code> <code>number</code> The width of the render</li><li><code>height</code> <code>number</code> The height of the render</li></ul><h3 id="returns-19" tabindex="-1">Returns <a class="header-anchor" href="#returns-19" aria-label="Permalink to &quot;Returns&quot;"></a></h3><ul><li><code>Render</code></li></ul>',120)]))}const x=r(o,[["render",i]]);export{b as __pageData,x as default};