steed/doc/modules/theme.txt
p.kosyh@gmail.com 63ce58f510 theme doc fix
2011-04-29 18:19:29 +00:00

70 lines
2.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

====== Модуль Theme ======
^ Подключение | require "theme" |
^ Тип | игровой |
^ Зависимости | нет |
===== Описание =====
Начиная с версии 1.3.0, модуль theme позволяет модифицировать параметры темы на лету.
Для этого, используются следующие функции:
<code lua>
-- настройка окна вывода
theme.win.geom(x, y, w, h)
theme.win.color(fg, link, alink)
theme.win.font(name, size, height)
theme.win.gfx.up(pic, x, y)
theme.win.gfx.down(pic, x, y)
-- настройка инвентаря
theme.inv.geom(x, y, w, h)
theme.inv.color(fg, link, alink)
theme.inv.font(name, size, height)
theme.inv.gfx.up(pic, x, y)
theme.inv.gfx.down(pic, x, y)
theme.inv.mode(mode)
-- настройка меню
theme.menu.bw(w)
theme.menu.color(fg, link, alink)
theme.menu.font(name, size, height)
theme.menu.gfx.button(pic, x, y)
-- настройка графики
theme.gfx.cursor(norm, use, x, y)
theme.gfx.mode(mode)
theme.gfx.pad(pad)
theme.gfx.bg(bg)
-- настройка звука
theme.snd.click(name);
</code>
Если необходимо изменить только часть параметров, в качестве неизменяемых параметров можно указывать значение nil. Например:
<code lua>
theme.win.font(nil, 64);
</code>
Существует возможность чтения текущих параметров тем:
<code lua>
theme.get 'имя переменной темы';
</code>
Начиная с версии INSTEAD 1.4.0 вы можете сбросить значение параметра темы на то, которое было установлено во встроенной теме игры:
<code lua>
theme.reset 'имя переменной';
theme.win.reset();
-- ...
</code>
===== Примеры использования =====
<code lua>
theme.gfx.bg "dramatic_bg.png";
theme.win.geom (0,0, theme.get 'scr.w', theme.get 'scr.h');
theme.inv.mode 'disabled'
</code>