import{_ as a,a as e,b as s,ag as t}from"./chunks/framework.BcrMLAmg.js";const u=JSON.parse('{"title":"Frequently Asked Questions","description":"","frontmatter":{},"headers":[],"relativePath":"guides/faq.md","filePath":"guides/faq.md","lastUpdated":1740313499000}'),l={name:"guides/faq.md"};function n(h,i,o,r,d,p){return s(),e("div",null,i[0]||(i[0]=[t(`
Basalt is a UI framework for CC:Tweaked that helps you create user interfaces easily and efficiently. It provides pre-built components, event handling, and advanced features like animations and themes.
Why should I use Basalt instead of direct terminal manipulation?
Basalt handles many complex aspects automatically:
Use dynamic positioning with strings, or use functions:
lua
element:setPosition("{parent.width - 5}", 5) -- 5 from right edgeelement:setSize("{parent.width - 10}", 5) -- 5 padding on each sideelement:setPosition(function(self) -- Another example, but as function call return self:getParent() - 5end, 5)
The render loop only runs when something visually changed (color, position, size,..) which means it only runs once, even if Basalt gets spammed with events (timer events or mouse events).
The event system is highly optimized:
Events are only registered for elements that actually use them
Events bubble up through the element hierarchy efficiently
Event handlers are stored in a flat structure for quick access
Events are automatically cleaned up when elements are removed
Parent containers only receive events their children actually use
Additional tips for optimization:
Group elements in Frames to reduce render calls
Use setVisible(false) instead of removing elements you'll need again
In case you need a LOT of elements you can use addDelayed{Element}, for example addDelayedButton instead of addButton
`,35)]))}const c=a(l,[["render",n]]);export{u as __pageData,c as default};