From 7ba390d4859cb3e70a97789baa65a311713191e5 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Wed, 23 Dec 2020 13:23:50 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=BE=D0=B4=D0=BD=D1=83=20=D1=82=D0=B5=D0=BC?= =?UTF-8?q?=D1=83,=20=D1=81=D0=B0=D0=BC=D1=83=D1=8E=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=83=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotheme.lua | 86 -------------------- main3.lua | 2 - theme.ini | 29 +++++++ themes/common/LiberationSerif-Bold.ttf | 3 - themes/common/LiberationSerif-BoldItalic.ttf | 3 - themes/common/LiberationSerif-Italic.ttf | 3 - themes/common/LiberationSerif-Regular.ttf | 3 - themes/common/menu.png | 3 - themes/fullhd/theme.ini | 32 -------- themes/tablet/theme.ini | 35 -------- 10 files changed, 29 insertions(+), 170 deletions(-) delete mode 100644 autotheme.lua create mode 100644 theme.ini delete mode 100644 themes/common/LiberationSerif-Bold.ttf delete mode 100644 themes/common/LiberationSerif-BoldItalic.ttf delete mode 100644 themes/common/LiberationSerif-Italic.ttf delete mode 100644 themes/common/LiberationSerif-Regular.ttf delete mode 100644 themes/common/menu.png delete mode 100644 themes/fullhd/theme.ini delete mode 100644 themes/tablet/theme.ini diff --git a/autotheme.lua b/autotheme.lua deleted file mode 100644 index 6899a6b..0000000 --- a/autotheme.lua +++ /dev/null @@ -1,86 +0,0 @@ -local msg = dprint or print - -local function autodetect_theme() - if not instead.screen_size then - return - end - local f = io.open(instead.savepath().."/config.ini", "r") - if f then - msg("Найден конфиг темы."); - f:close() - return - end - - local themes = {} - for d in std.readdir(instead.gamepath().."/themes") do - if d ~= '.' and d ~= '..' then - local p = instead.gamepath().."/themes/" .. d - local f = io.open(p.."/theme.ini", "r") - if f then - local w, h - for l in f:lines() do - if l:find("scr%.w[ \t]*=[ \t]*[0-9]+") then - w = l:gsub("scr%.w[ \t]*=[ \t]*([0-9]+)", "%1") - elseif l:find("scr%.h[ \t]*=[ \t]*[0-9]+") then - h = l:gsub("scr%.h[ \t]*=[ \t]*([0-9]+)", "%1") - end - if w and h then break end - end - if w and h then - w = tonumber(w) - h = tonumber(h) - local r = w / h - if r < 1 then r = 1 / r end - table.insert(themes, { - nam = d, - w = w, - h = h, - vertical = w < h, - ratio = r - }) - end - f:close() - end - end - end - - if #themes == 1 then - return - end - local w, h = instead.screen_size() - local ratio = w / h - local mobile = PLATFORM == "ANDROID" or PLATFORM == "IOS" or PLATFORM == "S60" or PLATFORM == "WINRT" or PLATFORM == "WINCE" - local vertical = w < h - local d = 1000 - local t = false - for _, v in ipairs(themes) do - local dd = math.abs(v.ratio - ratio) - if dd < d then - if mobile and (not vertical or v.vertical) then - d = dd - t = v - elseif not mobile and not v.vertical then - d = dd - t = v - end - end - end - if not t or t.nam == 'default' then - return - end - local name = instead.savepath().."/config.ini" - local name_tmp = name .. '.tmp' - local f = io.open(name_tmp, "w") - if f then - dprint("Autodetect theme: ", t.nam) - f:write("theme = "..t.nam.."\n") - f:close() - std.os.remove(name) - std.os.rename(name_tmp, name); - instead.restart() - end -end - -std.mod_start(function() - autodetect_theme() -end, -100) diff --git a/main3.lua b/main3.lua index 20ee526..cd18b33 100644 --- a/main3.lua +++ b/main3.lua @@ -10,7 +10,6 @@ if instead.tiny then end if not instead.tiny then - require "autotheme" require "theme" end @@ -34,7 +33,6 @@ global { } game.dsc = '' player.description = "Здесь нет зеркал. Но хотя бы ноги выглядят прекрасно."; -set_pic('wall.jpg') pl.plural = false pl.pronouns = 'fem' diff --git a/theme.ini b/theme.ini new file mode 100644 index 0000000..20ec3bb --- /dev/null +++ b/theme.ini @@ -0,0 +1,29 @@ +;$Name:Парсер (микро) +scr.w = 500 +scr.h = 600 + +scr.gfx.bg = bgr/wall.jpg +scr.col.bg = white + +win.x = 20 +win.y = 20 +win.w = 460 +win.h = 500 + +inv.x = 20 +inv.y = 520 +inv.w = 460 +inv.h = 40 + +inv.col.link = #666666 +inv.col.fg = #000000 +menu.button.x = 474 +menu.button.y = 868 +inv.mode = horizontal-left +snd.click = +win.align = left +scr.gfx.x = 0 +scr.gfx.y = 0 +scr.gfx.w = 0 +scr.gfx.h = 0 +scr.gfx.mode = float-middle-center diff --git a/themes/common/LiberationSerif-Bold.ttf b/themes/common/LiberationSerif-Bold.ttf deleted file mode 100644 index 8946cd0..0000000 --- a/themes/common/LiberationSerif-Bold.ttf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:99e68d1d7a6f3b5af90e6159993a8d4c1bfbaef9a6f1c98023f5b5d97689b4a5 -size 147132 diff --git a/themes/common/LiberationSerif-BoldItalic.ttf b/themes/common/LiberationSerif-BoldItalic.ttf deleted file mode 100644 index 7f43e24..0000000 --- a/themes/common/LiberationSerif-BoldItalic.ttf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1c8ef143f105412f5da71e6d22bd38dbd3d4241e0811e941228c68ee8fa1ae53 -size 151452 diff --git a/themes/common/LiberationSerif-Italic.ttf b/themes/common/LiberationSerif-Italic.ttf deleted file mode 100644 index 947a5ce..0000000 --- a/themes/common/LiberationSerif-Italic.ttf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f0166733d032462f7952e35c6bbe75ea63ca56873fe8c43fff5f21ee9c6c3dc5 -size 145028 diff --git a/themes/common/LiberationSerif-Regular.ttf b/themes/common/LiberationSerif-Regular.ttf deleted file mode 100644 index 031a447..0000000 --- a/themes/common/LiberationSerif-Regular.ttf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b6e1ef240a81e679f058c760c85468a4eaa92eb561b73d5aeac7a3ceeaebbdc0 -size 152408 diff --git a/themes/common/menu.png b/themes/common/menu.png deleted file mode 100644 index a418b44..0000000 --- a/themes/common/menu.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a90caa8c49540fa9eebdd3bb16d167064160ac09e8780dbaad1d3e50ad25a9cb -size 355 diff --git a/themes/fullhd/theme.ini b/themes/fullhd/theme.ini deleted file mode 100644 index 8f81816..0000000 --- a/themes/fullhd/theme.ini +++ /dev/null @@ -1,32 +0,0 @@ -;$Name:FullHD -include = arctic -scr.w = 1920 -scr.h = 1080 -win.x = 20 -win.y = 20 -win.w = 964 -win.h = 420 -menu.button.x = 1000 -menu.button.y = 552 -inv.x = 20 -inv.y = 460 -inv.w = 964 -inv.h = 100 -inv.mode = horizontal-left -snd.click = - -scr.gfx.x = 650 -scr.gfx.y = 10 -scr.gfx.w = 144 -scr.gfx.h = 448 - -win.fnt.name = ../common/{LiberationSerif-Regular,LiberationSerif-Bold,LiberationSerif-Italic,LiberationSerif-BoldItalic}.ttf -win.fnt.size = 24 - -inv.fnt.name = ../common/{LiberationSerif-Regular,LiberationSerif-Bold,LiberationSerif-Italic,LiberationSerif-BoldItalic}.ttf -inv.fnt.size = 24 - -menu.gfx.button = ../common/menu.png - -inv.col.link = #666666 -inv.col.fg = #222222 diff --git a/themes/tablet/theme.ini b/themes/tablet/theme.ini deleted file mode 100644 index b09c94b..0000000 --- a/themes/tablet/theme.ini +++ /dev/null @@ -1,35 +0,0 @@ -;$Name:Tablet -include = arctic -scr.w = 800 -scr.h = 600 -scr.gfx.bg = ;bg.png -scr.col.bg = white -win.x = 20 -win.y = 20 -win.w = 964 -win.h = 420 -inv.col.link = #666666 -inv.col.fg = #222222 - -menu.button.x = 1000 -menu.button.y = 552 -inv.x = 10 -inv.y = 460 -inv.w = 964 -inv.h = 100 -inv.mode = horizontal-left -snd.click = - -scr.gfx.x = 650 -scr.gfx.y = 10 -scr.gfx.w = 144 -scr.gfx.h = 448 -scr.gfx.mode = embedded - -win.fnt.name = ../common/{LiberationSerif-Regular,LiberationSerif-Bold,LiberationSerif-Italic,LiberationSerif-BoldItalic}.ttf -win.fnt.size = 18 - -inv.fnt.name = ../common/{LiberationSerif-Regular,LiberationSerif-Bold,LiberationSerif-Italic,LiberationSerif-BoldItalic}.ttf -inv.fnt.size = 18 - -menu.gfx.button = ../common/menu.png