Files
Basalt/docs/objects/VisualObject/addPostDraw.md
Robert Jelic bb1b1beb79 Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview)
- Pluginsystem to add/remove functionality
- Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject
- Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox
- Removed the Animation Object, and added a animation plugin instead
- Removed the Graphic Object and merged it's functionality with the image object
- Updated currently existing objects
2023-04-30 17:05:34 +02:00

33 lines
1.1 KiB
Markdown

## addPostDraw
### Description
Adds a custom drawing function to the object's postDrawQueue. Functions in the postDrawQueue are executed after the main drawing functions. This allows users to create custom graphical representations that will be drawn in front of the main elements.
### Parameters
1. `string` Name (ID) - must be unique
2. `function` The function to be executed, containing the custom drawing code
3. `number` Optional - Position, determines the order or priority of the drawing
4. `boolean` Optional - Whether the drawing should be rendered immediately or not, default is `true`
### Returns
1. `object` The object in use
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local function customPostDrawing()
-- Custom drawing code goes here
end
mainFrame:addPreDraw("uniqueID", customPostDrawing)
```
In this example, a custom drawing function is added to the main frame's postDrawQueue. The custom drawing code should be placed inside the `customPostDrawing` function. The drawing is given a unique ID, a position of 1, and rendered immediately.