Обновить Lua API
47
Lua-API.md
47
Lua-API.md
@@ -209,4 +209,49 @@ tab = fatal.menu_tab("My Script 3")
|
|||||||
|
|
||||||
How it looks in game:
|
How it looks in game:
|
||||||
<br/>
|
<br/>
|
||||||

|

|
||||||
|
|
||||||
|
### ``fatal.draw.line(x1, y1, x2, y2, r, g, b, a, [thickness])``
|
||||||
|
### ``fatal.draw.rect(x, y, w, h, r, g, b, a)``
|
||||||
|
### ``fatal.draw.rect_filled(x, y, w, h, r, g, b, a)``
|
||||||
|
### ``fatal.draw.circle(cx, cy, radius, r, g, b, a, [thickness])``
|
||||||
|
### ``fatal.draw.circle_filled(cx, cy, radius, r, g, b, a)``
|
||||||
|
### ``fatal.draw.text(x, y, text, r, g, b, a)``
|
||||||
|
### ``fatal.draw.clear()``
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```lua
|
||||||
|
hook.Remove("Think", "fatal_demo_draw")
|
||||||
|
hook.Add("Think", "fatal_demo_draw", function()
|
||||||
|
local t = RealTime()
|
||||||
|
|
||||||
|
-- Line: x1, y1, x2, y2, r, g, b, a [, thickness]
|
||||||
|
fatal.draw.line(100, 100, 500, 300, 1, 0, 0, 1, 2)
|
||||||
|
|
||||||
|
-- Running line
|
||||||
|
local x = 100 + (t * 60 % 400)
|
||||||
|
fatal.draw.line(x, 180, x + 80, 180, 0, 1, 0, 0.8, 1)
|
||||||
|
|
||||||
|
-- Rect outline: x, y, w, h, r, g, b, a
|
||||||
|
fatal.draw.rect(200, 220, 150, 80, 1, 1, 1, 1)
|
||||||
|
|
||||||
|
-- Rect fill
|
||||||
|
fatal.draw.rect_filled(420, 60, 90, 30, 0.2, 0.6, 1, 0.5)
|
||||||
|
|
||||||
|
-- Circle outline: cx, cy, radius, r, g, b, a [, thickness]
|
||||||
|
fatal.draw.circle(650, 300, 40, 1, 1, 0, 1, 2)
|
||||||
|
|
||||||
|
-- Circle fill
|
||||||
|
fatal.draw.circle_filled(720, 200, 15, 0, 1, 0, 0.6)
|
||||||
|
|
||||||
|
-- Text: x, y, text, r, g, b, a
|
||||||
|
fatal.draw.text(100, 260, "fatal.draw works", 1, 1, 1, 1)
|
||||||
|
|
||||||
|
-- Manually clear buffer (not necessary - it clears by itself)
|
||||||
|
-- fatal.draw.clear()
|
||||||
|
end)
|
||||||
|
```
|
||||||
|
|
||||||
|
How it looks in game (it's unscreengrabable because draws in overlay):
|
||||||
|
<br/>
|
||||||
|

|
||||||
Reference in New Issue
Block a user