-
Автор темы
- #1

Не придумал лучшего варианта.. но мне кажется что это уже лучше чем такой вариант.

Код:
math.calc_count = function(string, search)
local count = 0
for i = 1, #string do
if string:sub(i, i) == search then
count = count + 1
end
end
return count
end
Render.MultiColorText = function(string, x, y, font_size)
local old_text_size = 0
for i = 1, math.calc_count(string, "{") do
local start_prefix = string:find('{')
local end_prefix = string:find('}')
local string_color = string:sub(start_prefix, end_prefix)
local load_color = loadstring('return ' .. string_color)()
local next_string = string:sub(end_prefix + 1)
local next_prefix_start = next_string:find('{')
local new_string = next_prefix_start and next_string:sub(1, next_prefix_start - 1) or next_string
string = next_string
local color = Color.new(unpack(load_color))
Render.Text(new_string, Vector2.new(x + old_text_size, y), color, font_size)
old_text_size = old_text_size + Render.CalcTextSize(new_string, font_size).x
end
end
Cheat.RegisterCallback('draw', function()
Render.MultiColorText('{1, 1, 1, 1}version: {0.2, 0.5, 0.6, 1}release', 100, 100, 15)
end)
Вложения
-
5.1 KB Просмотры: 128