[#] Вопросы и ответы
RSS-bot(tavern,2) — All
2019-04-17 08:50:59


peter: Хорошо бы ещё кэш прикрутить. Но как демонстрация -- норм. pad = сколько откусить от краёв. ``` require "sprite" require "theme" require "fmt" fmt.para = true local fnt = sprite.fnt('1.ttf', (theme.get 'win.fnt.size'+70)); obj { nam = '$letter'; act = function(s, t) local sp = fnt:text(t, '#B22222') -- спрайт local w, h = sp:size() -- размер local pad = 16 local nsp = sprite.new(w - pad * 2, h - pad * 2) -- мЕньший спрайт sp:copy(pad, pad, w - pad * 2, h - pad * 2, nsp); -- копируем в него return fmt.imgl(nsp) -- вернули то, что вышло end; } room { nam = "main"; dsc = "_{$letter|B}уковка."; } ```

Ссылка: http://instead-games.ru/forum/index.php?p=/discussion/comment/13111/#Comment_13111