Astrath:createShape: Difference between revisions
Jump to navigation
Jump to search
(Created page with "= DxShape:new = {{Client function}} {{FuncDef|element DxShape:new ( float posX, float posY, float width, float height, element parent, boolean relative, table color )}} '''Description:''' Creates a new DX-based shape element. Shapes can have custom colors, hover effects, and rounded corners. Each shape instance is automatically registered in the DX library. '''Parameters:''' * posX, posY (float) – Position on screen. * width, height (float) – Size of the shape. *...") |
(No difference)
|
Latest revision as of 20:17, 22 October 2025
DxShape:new
Description: Creates a new DX-based shape element. Shapes can have custom colors, hover effects, and rounded corners. Each shape instance is automatically registered in the DX library.
Parameters:
- posX, posY (float) – Position on screen.
- width, height (float) – Size of the shape.
- parent (element) – Parent DX element to attach this shape to (optional).
- relative (boolean) – Position relative to parent (optional).
- color (table / tocolor) – Main color of the shape (optional, default: grey).
Returns:
- Returns the newly created DxShape element.
Methods:
Method | Description |
---|---|
Ath:destroy() | Destroys the shape and all its child elements. |
Ath:setVisible(boolean) | Shows or hides the shape. |
Ath:setEnabled(boolean) | Enables or disables the shape for interaction. |
Ath:setHoverable(boolean) | Enables or disables hover effect. |
Ath:setColor(r, g, b, a, type) | Sets main or hover color of the shape. |
Example:
local myShape = DxShape:new(100, 100, 200, 150) myShape:setVisible(true) myShape:setHoverable(true) myShape:setColor(150, 150, 150, 255, "mainColor") myShape:draw()
See also:
- Astrath – Main library page
- DxWindow:new – Page for window element reference
- DxLabel:new – Page for label element reference
- onClientRender – Event used to render DX elements