Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local str = "abcdefg\noaskdoikas dsd\n hrllo"
- local tbl = {}
- local length = #str
- for i = 1, length do
- table.insert(tbl, {char = str:sub(i, i), color = HSVToColor((i / #str) * 360, 1, 1)})
- end
- surface.CreateFont("LOL", {
- font = "Arial",
- size = 800,
- })
- hook.Add("HUDPaint", "test", function()
- surface.SetFont("LOL")
- local w, h = ScrW(), ScrH()
- local last_w, last_h = 0, 0
- for i, data in pairs(tbl) do
- surface.SetTextPos(w/2 + last_w, h/2 + last_h)
- surface.SetTextColor(data.color)
- surface.DrawText(data.char)
- local w, h = surface.GetTextSize(data.char)
- last_w = last_w + w
- if data.char == "\n" then
- last_h = last_h + h / 2
- last_w = 0
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement