Skip to content
Snippets Groups Projects
Commit 48d5c9a4 authored by DarkGod's avatar DarkGod
Browse files

Disabled the animated background on the main menu, it was always lagging...

Disabled the animated background on the main menu, it was always lagging behind in terms of prettiness
New FontPackages engine class, lets easily define and switch "themes" of fonts
Switched to a new default font, the previous one is still available in the GameOptions as the "web" one
parent 5873991a
No related branches found
No related tags found
No related merge requests found
Showing
with 208 additions and 53 deletions
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009 - 2014 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
newPackage{ id = "basic", name = "Basic", weight = 1,
small = {font="/data/font/Vera.ttf", normal=12, small=10, big=14},
default = {font="/data/font/Vera.ttf", normal=12, small=10, big=14},
bold = {font="/data/font/VeraBd.ttf", normal=12, small=10, big=14},
mono = {font="/data/font/VeraMono.ttf", normal=12, small=10, big=14},
flyer = {font="/data/font/INSULA__.ttf", normal=14, small=12, big=16},
bignews = {font="/data/font/VeraMono.ttf", normal=30},
resources_normal = {font="/data/font/Vera.ttf", bold=true, normal=12},
resources_small = {font="/data/font/Vera.ttf", bold=true, normal=10},
}
newPackage{ id = "web", name = "Web", weight = 10,
small = {font="/data/font/DroidSans.ttf", normal=12, small=10, big=14},
default = {font="/data/font/DroidSans.ttf", normal=16, small=12, big=18},
bold = {font="/data/font/DroidSans.ttf", bold=true, normal=16, small=12, big=18},
mono = {font="/data/font/DroidSansMono.ttf", normal=16, small=12, big=18},
mono_small = {font="/data/font/DroidSansMono.ttf", normal=14, small=10, big=16},
flyer = {font="/data/font/INSULA__.ttf", normal=14, small=12, big=16},
bignews = {font="/data/font/DroidSansMono.ttf", normal=30},
resources_normal = {font="/data/font/DroidSans.ttf", bold=true, normal=12},
resources_small = {font="/data/font/DroidSans.ttf", bold=true, normal=10},
}
newPackage{ id = "fantasy", name = "Fantasy", weight = 100,
small = {font="/data/font/Salsa-Regular.ttf", normal=12, small=10, big=14},
default = {font="/data/font/Salsa-Regular.ttf", normal=16, small=12, big=18},
bold = {font="/data/font/Salsa-Regular.ttf", normal=16, small=12, big=18},
mono = {font="/data/font/Salsa-Mono.ttf", normal=16, small=12, big=18},
mono_small = {font="/data/font/Salsa-Mono.ttf", normal=14, small=10, big=16},
flyer = {font="/data/font/Salsa-Regular.ttf", normal=14, small=12, big=16},
bignews = {font="/data/font/Salsa-Regular.ttf", normal=30},
resources_normal = {font="/data/font/Salsa-Regular.ttf", normal=14},
resources_small = {font="/data/font/Salsa-Regular.ttf", normal=12},
}
-- TE4 - T-Engine 4
-- Copyright (C) 2009 - 2014 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
--- Configure sets of fonts
module(..., package.seeall, class.make)
local packages = {}
--- Loads lore
function _M:loadDefinition(file, env)
local f, err = loadfile(file)
if not f and err then error(err) end
setfenv(f, setmetatable(env or {
newPackage = function(t) self.new(t) end,
load = function(f) self:loadDefinition(f, getfenv(2)) end
}, {__index=_G}))
f()
end
local cur_size = "normal"
function _M:setDefaultSize(size)
cur_size = size
end
local cur_id = "default"
function _M:setDefaultId(id)
if not packages[id] then id = "basic" end
cur_id = id
end
function _M:resolveFont(name, orname)
local font = packages[cur_id]
local size = cur_size
if not font[name] then name = orname end
if not font[name] then name = "default" end
if not font[name][size] then size = "normal" end
return font[name], size
end
function _M:getFont(name, orname)
local font, size = self:resolveFont(name, orname)
return font.font, font[size]
end
function _M:get(name, force)
local name, size = self:getFont(name, size)
local font, size = self:resolveFont(name, orname)
local f = core.display.newFont(font.font, font[size], font.bold or force)
if font.bold then f:setStyle("bold") end
return f
end
function _M:list()
local list = {}
for _, f in pairs(packages) do list[#list+1] = f end
table.sort(list, function(a, b) return a.weight > b.weight end)
return list
end
function _M:init(t)
assert(t.id, "no font package id")
assert(t.default, "no font package default")
for k, e in pairs(t) do self[k] = e end
packages[t.id] = self
end
......@@ -21,6 +21,7 @@
require "engine.class"
local Savefile = require "engine.Savefile"
local UIBase = require "engine.ui.Base"
local FontPackage = require "engine.FontPackage"
require "engine.PlayerProfile"
--- Handles dialog windows
......@@ -55,7 +56,6 @@ function _M:listModules(incompatible, moddir_filter)
end
table.sort(ms, function(a, b)
print(a.short_name,b.short_name)
if a.short_name == "tome" then return 1
elseif b.short_name == "tome" then return nil
else return a.name < b.name
......@@ -652,8 +652,8 @@ function _M:loadScreen(mod)
local middle = {core.display.loadImage("/data/gfx/metal-ui/waiter/middle.png"):glTexture()}
local bar = {core.display.loadImage("/data/gfx/metal-ui/waiter/bar.png"):glTexture()}
local font = core.display.newFont("/data/font/DroidSans.ttf", 12)
local bfont = core.display.newFont("/data/font/DroidSans.ttf", 16)
local font = FontPackage:get("small")
local bfont = FontPackage:get("default")
local dw, dh = math.floor(sw / 2), left[7]
local dx, dy = math.floor((sw - dw) / 2), sh - dh
......@@ -827,6 +827,12 @@ function _M:instanciate(mod, name, new_game, no_reboot, extra_module_info)
fs.mount(engine.homepath, "/")
mod.load("setup")
-- Load font packages
FontPackage:loadDefinition("/data/font/packages/default.lua")
if mod.font_packages_definitions then FontPackage:loadDefinition(mod.font_packages_definitions) end
FontPackage:setDefaultId(util.getval(mod.font_package_id))
FontPackage:setDefaultSize(util.getval(mod.font_package_size))
-- Check the savefile if possible, to add to the progress bar size
local savesize = 0
local save = Savefile.new("")
......
......@@ -35,6 +35,7 @@ local Map = require "engine.Map"
local Level = require "engine.Level"
local LogDisplay = require "engine.LogDisplay"
local FlyingText = require "engine.FlyingText"
local FontPackage = require "engine.FontPackage"
local NicerTiles = require "mod.class.NicerTiles"
local Grid = require "mod.class.Grid"
......@@ -51,7 +52,7 @@ function _M:init()
engine.interface.GameMusic.init(self)
engine.interface.GameSound.init(self)
engine.GameEnergyBased.init(self, engine.KeyBind.new(), 100, 100)
self.profile_font = core.display.newFont("/data/font/DroidSerif-Italic.ttf", 14)
self.profile_font = FontPackage:get("default")
local background_name
if not config.settings.censor_boot then background_name = {"tome","tome2","tome3"}
......@@ -72,7 +73,8 @@ function _M:init()
-- self.refuse_threads = true
self.normal_key = self.key
self.stopped = config.settings.boot_menu_background
-- self.stopped = config.settings.boot_menu_background
self.stopped = true
if core.display.safeMode() then self.stopped = true end
if self.stopped then
core.game.setRealtime(0)
......
......@@ -20,12 +20,13 @@
require "engine.class"
local Dialog = require "engine.ui.Dialog"
local Shader = require "engine.Shader"
local FontPackage = require "engine.FontPackage"
module(..., package.seeall, class.inherit(Dialog))
__show_only = true
local title_font = core.display.newFont("/data/font/DroidSans-Bold.ttf", 32)
local title_font = core.display.newFont(FontPackage:getFont("default"), 32)
local aura = {
Shader.new("awesomeaura", {flameScale=0.6, time_factor=8000}),
Shader.new("awesomeaura", {flameScale=0.6, time_factor=8000}),
......@@ -42,7 +43,7 @@ local fallback_colors = {
local outline = Shader.new("textoutline", {})
local credits = {
{img="/data/gfx/background/tome-logo.png"},
{img="/data/gfx/background/tome-logo.png", offset_x=30},
{"by"},
{img="/data/gfx/background/netcore-logo.png"},
false,
......@@ -170,6 +171,7 @@ local credits = {
{"Font: SVBasicManual: http://www.dafont.com/fr/johan-winge.d757"},
{"Font FSEX300: http://www.fixedsysexcelsior.com/"},
{"Font: square: http://strlen.com/square"},
{"Font: Salsa: http://www.google.com/fonts/specimen/Salsa"},
}
function _M:init()
......@@ -182,17 +184,20 @@ function _M:init()
EXIT = function() game:unregisterDialog(self) end,
}
self:triggerHook{"Boot:credits", credits=credits}
self.list = { self:makeEntry(credits[1]) }
self.list[1].y = self.list[1].y - self.list[1].h
self.next_credit = 2
end
function _M:makeLogo(img)
function _M:makeLogo(img, offx)
local txt = {y=game.h}
local i, w, h = core.display.loadImage(img)
txt._tex, txt._tex_w, txt._tex_h = i:glTexture()
txt.w, txt.h = w, h
txt.step_h = h
txt.offset_x = offx
txt.offset_y = 0
txt.img = true
return txt
......@@ -201,7 +206,7 @@ end
function _M:makeEntry(credit)
if not credit then return {none=true, y=game.h, h=32, step_h=32, offset_y=0} end
if credit.img then return self:makeLogo(credit.img) end
if credit.img then return self:makeLogo(credit.img, credit.offset_x) end
local txt
if credit.title then
......@@ -216,7 +221,7 @@ function _M:makeEntry(credit)
txt.step_h = txt.h
txt.offset_y = 0
else
local w, h = title_font:size(credit[1]) + 20, 36
local w, h = title_font:size(credit[1]) + 20, 42
local s = core.display.newSurface(w, h)
s:alpha(0)
s:drawStringBlended(title_font, credit[1], 10, 0, 255, 255, 255, false)
......@@ -239,28 +244,28 @@ function _M:displayCredit(txt, x, y)
aura[txt.title].shad:use(true)
if aura[txt.title].shad.uniQuadSize then aura[txt.title].shad:uniQuadSize(txt.w/txt._tex_w, txt.h/txt._tex_h) end
if aura[txt.title].shad.uniTexSize then aura[txt.title].shad:uniTexSize(txt._tex_w, txt._tex_h) end
txt._texf:toScreenPrecise(x, y, txt.w, txt.h, 0, txt.w/txt._tex_w, 0, txt.h/txt._tex_h)
txt._texf:toScreenPrecise(x + (txt.offset_x or 0), y, txt.w, txt.h, 0, txt.w/txt._tex_w, 0, txt.h/txt._tex_h)
aura[txt.title].shad:use(false)
outline.shad:use(true)
outline.shad:uniOutlineSize(0.7, 0.7)
outline.shad:uniTextSize(txt._tex_w, txt._tex_h)
txt._tex:toScreenFull(x, y, txt.w, txt.h, txt._tex_w, txt._tex_h)
txt._tex:toScreenFull(x + (txt.offset_x or 0), y, txt.w, txt.h, txt._tex_w, txt._tex_h)
outline.shad:use(false)
else
outline.shad:use(true)
outline.shad:uniOutlineSize(0.7, 0.7)
outline.shad:uniTextSize(txt._tex_w, txt._tex_h)
txt._tex:toScreenFull(x, y, txt.w, txt.h, txt._tex_w, txt._tex_h)
txt._tex:toScreenFull(x + (txt.offset_x or 0), y, txt.w, txt.h, txt._tex_w, txt._tex_h)
outline.shad:use(false)
end
else
if not txt.img then txt._tex:toScreenFull(x + 3, y + 3, txt.w, txt.h, txt._tex_w, txt._tex_h, 0, 0, 0, 1) end
if not txt.img then txt._tex:toScreenFull(x + 3 + (txt.offset_x or 0), y + 3, txt.w, txt.h, txt._tex_w, txt._tex_h, 0, 0, 0, 1) end
if txt.title and not txt.img then
local c = fallback_colors[txt.title]
txt._tex:toScreenFull(x, y, txt.w, txt.h, txt._tex_w, txt._tex_h, c.r/255, c.g/255, c.b/255, 1)
txt._tex:toScreenFull(x + (txt.offset_x or 0), y, txt.w, txt.h, txt._tex_w, txt._tex_h, c.r/255, c.g/255, c.b/255, 1)
else
txt._tex:toScreenFull(x, y, txt.w, txt.h, txt._tex_w, txt._tex_h)
txt._tex:toScreenFull(x + (txt.offset_x or 0), y, txt.w, txt.h, txt._tex_w, txt._tex_h)
end
end
end
......@@ -270,7 +275,7 @@ function _M:innerDisplay(x, y, nb_keyframes)
local txt = self.list[i]
self:displayCredit(txt, x, y)
txt.y = txt.y - nb_keyframes * 1.5
txt.y = txt.y - nb_keyframes * 15
if i == #self.list and txt.y < game.h then
if credits[self.next_credit] ~= nil then
local t = self:makeEntry(credits[self.next_credit])
......
......@@ -26,6 +26,7 @@ local Textzone = require "engine.ui.Textzone"
local Textbox = require "engine.ui.Textbox"
local Separator = require "engine.ui.Separator"
local KeyBind = require "engine.KeyBind"
local FontPackage = require "engine.FontPackage"
module(..., package.seeall, class.inherit(Dialog))
......@@ -62,9 +63,9 @@ function _M:init()
-- if config.settings.cheat then l[#l+1] = {name="webtest", fct=function() util.browserOpenUrl("asset://te4/html/test.html") end} end
self.c_background = Button.new{text=game.stopped and "Enable background" or "Disable background", fct=function() self:switchBackground() end}
self.c_version = Textzone.new{font={"/data/font/DroidSansMono.ttf", 10}, auto_width=true, auto_height=true, text=("#{bold}##B9E100#T-Engine4 version: %d.%d.%d"):format(engine.version[1], engine.version[2], engine.version[3])}
self.c_version = Textzone.new{font={FontPackage:getFont("default"), 10}, auto_width=true, auto_height=true, text=("#{bold}##B9E100#T-Engine4 version: %d.%d.%d"):format(engine.version[1], engine.version[2], engine.version[3])}
self.c_list = List.new{width=self.iw, nb_items=#self.list, list=self.list, fct=function(item) end, font={"/data/font/DroidSans-Bold.ttf", 16}}
self.c_list = List.new{width=self.iw, nb_items=#self.list, list=self.list, fct=function(item) end, font={FontPackage:getFont("default")}}
self.c_facebook = ButtonImage.new{no_decoration=true, alpha_unfocus=0.5, file="facebook.png", fct=function() util.browserOpenUrl("https://www.facebook.com/tales.of.maj.eyal") end}
self.c_twitter = ButtonImage.new{no_decoration=true, alpha_unfocus=0.5, file="twitter.png", fct=function() util.browserOpenUrl("https://twitter.com/darkgodone") end}
......@@ -72,7 +73,7 @@ function _M:init()
self.base_uis = {
{left=0, top=0, ui=self.c_list},
{left=0, bottom=0, absolute=true, ui=self.c_background},
-- {left=0, bottom=0, absolute=true, ui=self.c_background},
{right=self.c_facebook.w, bottom=0, absolute=true, ui=self.c_version},
{right=0, bottom=self.c_facebook.h+self.c_twitter.h, absolute=true, ui=self.c_forums},
{right=0, bottom=self.c_twitter.h, absolute=true, ui=self.c_facebook},
......
......@@ -36,3 +36,6 @@ allow_userchat = {"mainmenu"} -- We can talk to the online community but not joi
if not config.settings.censor_boot then background_name = {"tome","tome2","tome3"}
else background_name = {"tome3"}
end
font_package_id = function() config.settings.tome = config.settings.tome or {} if not config.settings.tome.fonts then config.settings.tome.fonts = {type="fantasy", size="normal"} end return config.settings.tome.fonts.type end
font_package_size = function() config.settings.tome = config.settings.tome or {} if not config.settings.tome.fonts then config.settings.tome.fonts = {type="fantasy", size="normal"} end return config.settings.tome.fonts.size end
......@@ -31,11 +31,12 @@ local ActorLevel = require "engine.interface.ActorLevel"
local ActorTemporaryEffects = require "engine.interface.ActorTemporaryEffects"
local Birther = require "engine.Birther"
local UIBase = require "engine.ui.Base"
local FontPackage = require "engine.FontPackage"
UIBase.font = core.display.newFont("/data/font/DroidSans.ttf", 16)
UIBase.font_bold = core.display.newFont("/data/font/DroidSans.ttf", 16)
UIBase.font_mono = core.display.newFont("/data/font/DroidSansMono.ttf", 16)
UIBase.font_bold:setStyle("bold")
-- Dialogs fonts
UIBase.font = FontPackage:get("default")
UIBase.font_bold = FontPackage:get("bold")
UIBase.font_mono = FontPackage:get("mono")
UIBase.font_h = UIBase.font:lineSkip()
UIBase.font_bold_h = UIBase.font_bold:lineSkip()
UIBase.font_mono_w = UIBase.font_mono:size(" ")
......
......@@ -34,6 +34,7 @@ local Astar = require "engine.Astar"
local DirectPath = require "engine.DirectPath"
local Shader = require "engine.Shader"
local HighScores = require "engine.HighScores"
local FontPackage = require "engine.FontPackage"
local NicerTiles = require "mod.class.NicerTiles"
local GameState = require "mod.class.GameState"
......@@ -100,14 +101,14 @@ function _M:runReal()
self.uiset:activate()
local flysize = ({normal=14, small=12, big=16})[config.settings.tome.fonts.size]
local flyfont, flysize = FontPackage:getFont("flyer")
self.tooltip = Tooltip.new(self.uiset.init_font_mono, self.uiset.init_size_mono, {255,255,255}, {30,30,30,230})
self.tooltip2 = Tooltip.new(self.uiset.init_font_mono, self.uiset.init_size_mono, {255,255,255}, {30,30,30,230})
self.flyers = FlyingText.new("/data/font/INSULA__.ttf", flysize, "/data/font/INSULA__.ttf", flysize + 3)
self.flyers = FlyingText.new(flyfont, flysize, flyfont, flysize + 3)
self.flyers:enableShadow(0.6)
game:setFlyingText(self.flyers)
self.bignews = BigNews.new("/data/font/DroidSansMono.ttf", 30)
self.bignews = BigNews.new(FontPackage:getFont("bignews"))
self.nicer_tiles = NicerTiles.new()
......@@ -148,14 +149,14 @@ function _M:runReal()
end)
-- Create the map scroll text overlay
local lfont = core.display.newFont("/data/font/DroidSans.ttf", 30)
local lfont = FontPackage:get("bignews", true)
lfont:setStyle("bold")
local s = core.display.drawStringBlendedNewSurface(lfont, "<Scroll mode, press keys to scroll, caps lock to exit>", unpack(colors.simple(colors.GOLD)))
lfont:setStyle("normal")
self.caps_scroll = {s:glTexture()}
self.caps_scroll.w, self.caps_scroll.h = s:getSize()
self.zone_font = core.display.newFont("/data/font/DroidSans.ttf", 12)
self.zone_font = FontPackage:get("normal")
self.inited = true
......
......@@ -33,6 +33,7 @@ local Tooltip = require "mod.class.Tooltip"
local TooltipsData = require "mod.class.interface.TooltipsData"
local Dialog = require "engine.ui.Dialog"
local Map = require "engine.Map"
local FontPackage = require "engine.FontPackage"
module(..., package.seeall, class.inherit(UISet, TooltipsData))
......@@ -130,10 +131,8 @@ ammo_shot = {core.display.loadImage("/data/gfx/ui/resources/ammo_shot.png"):glTe
_M['ammo_shadow_alchemist-gem'] = {core.display.loadImage("/data/gfx/ui/resources/ammo_shadow_alchemist-gem.png"):glTexture()}
_M['ammo_alchemist-gem'] = {core.display.loadImage("/data/gfx/ui/resources/ammo_alchemist-gem.png"):glTexture()}
font_sha = core.display.newFont("/data/font/DroidSans.ttf", 14, true)
font_sha:setStyle("bold")
sfont_sha = core.display.newFont("/data/font/DroidSans.ttf", 12, true)
sfont_sha:setStyle("bold")
font_sha = FontPackage:get("resources_normal", true)
sfont_sha = FontPackage:get("resources_small", true)
icon_green = { core.display.loadImage("/data/gfx/ui/talent_frame_ok.png"):glTexture() }
icon_yellow = { core.display.loadImage("/data/gfx/ui/talent_frame_sustain.png"):glTexture() }
......@@ -343,18 +342,10 @@ end
function _M:activate()
Shader:setDefault("textoutline", "textoutline")
local size, size_mono, font, font_mono, font_mono_h, font_h
if config.settings.tome.fonts.type == "fantasy" then
size = ({normal=16, small=14, big=18})[config.settings.tome.fonts.size]
size_mono = ({normal=14, small=10, big=16})[config.settings.tome.fonts.size]
font = "/data/font/DroidSans.ttf"
font_mono = "/data/font/DroidSansMono.ttf"
else
size = ({normal=12, small=10, big=14})[config.settings.tome.fonts.size]
size_mono = ({normal=12, small=10, big=14})[config.settings.tome.fonts.size]
font = "/data/font/Vera.ttf"
font_mono = "/data/font/VeraMono.ttf"
end
local font, size = FontPackage:getFont("default")
local font_mono, size_mono = FontPackage:getFont("mono_small", "mono")
local font_mono_h, font_h
local f = core.display.newFont(font, size)
font_h = f:lineSkip()
f = core.display.newFont(font_mono, size_mono)
......
......@@ -25,7 +25,8 @@ local energycount = function(self)
local tex, nblines, wline = nil
local lastenergy = nil
local shader = require("engine.Shader").default.textoutline and require("engine.Shader").default.textoutline.shad
local font = core.display.newFont("/data/font/DroidSansMono.ttf", 16)
local FontPackage = require "engine.FontPackage"
local font = FontPackage:get("mono")
local UIBase = require "engine.ui.Base"
local MyUI = require("engine.class").inherit(UIBase){}
MyUI.ui = "metal"
......@@ -264,7 +265,8 @@ local dcb = function(self)
local tex, nblines, wline = nil
local DamageType = require "engine.DamageType"
local shader = require("engine.Shader").default.textoutline and require("engine.Shader").default.textoutline.shad
local font = core.display.newFont("/data/font/DroidSansMono.ttf", 16)
local FontPackage = require "engine.FontPackage"
local font = FontPackage:get("mono")
local UIBase = require "engine.ui.Base"
local MyUI = require("engine.class").inherit(UIBase){}
MyUI.ui = "metal"
......
......@@ -28,6 +28,7 @@ local SurfaceZone = require "engine.ui.SurfaceZone"
local Separator = require "engine.ui.Separator"
local Stats = require "engine.interface.ActorStats"
local Textzone = require "engine.ui.Textzone"
local FontPackage = require "engine.FontPackage"
module(..., package.seeall, class.inherit(Dialog, mod.class.interface.TooltipsData))
......@@ -39,7 +40,7 @@ function _M:init(actor)
self.actor = actor
Dialog.init(self, "Character Sheet: "..self.actor.name, math.max(game.w * 0.7, 950), 500)
self.font = core.display.newFont("/data/font/DroidSansMono.ttf", 12)
self.font = core.display.newFont(FontPackage:getFont("mono_small", "mono"))
self.font_h = self.font:lineSkip()
self.talent_sorting = config.settings.tome.charsheet_talent_sorting or 1
......
......@@ -25,6 +25,7 @@ local Separator = require "engine.ui.Separator"
local GetQuantity = require "engine.dialogs.GetQuantity"
local Tabs = require "engine.ui.Tabs"
local GraphicMode = require("mod.dialogs.GraphicMode")
local FontPackage = require "engine.FontPackage"
module(..., package.seeall, class.inherit(Dialog))
......@@ -158,10 +159,11 @@ function _M:generateListUi()
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Font Style#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.fonts.type):capitalize()
end, fct=function(item)
Dialog:listPopup("Font style", "Select font", {{name="Fantasy", type="fantasy"}, {name="Basic", type="basic"}}, 300, 200, function(sel)
local list = FontPackage:list()
Dialog:listPopup("Font style", "Select font", list, 300, 200, function(sel)
if not sel or not sel.type then return end
game:saveSettings("tome.fonts", ("tome.fonts = { type = %q, size = %q }\n"):format(sel.type, config.settings.tome.fonts.size))
config.settings.tome.fonts.type = sel.type
game:saveSettings("tome.fonts", ("tome.fonts = { type = %q, size = %q }\n"):format(sel.id, config.settings.tome.fonts.size))
config.settings.tome.fonts.type = sel.id
self.c_list:drawItem(item)
end)
end,}
......
......@@ -28,6 +28,7 @@ local UIContainer = require "engine.ui.UIContainer"
local TalentTrees = require "mod.dialogs.elements.TalentTrees"
local Separator = require "engine.ui.Separator"
local DamageType = require "engine.DamageType"
local FontPackage = require "engine.FontPackage"
module(..., package.seeall, class.inherit(Dialog, mod.class.interface.TooltipsData))
......@@ -65,7 +66,7 @@ function _M:init(actor, on_finish, on_birth)
self.talent_types_learned = {}
self.stats_increased = {}
self.font = core.display.newFont("/data/font/DroidSansMono.ttf", 12)
self.font = core.display.newFont(FontPackage:getFont("mono_small", "mono"))
self.font_h = self.font:lineSkip()
self.actor.__hidden_talent_types = self.actor.__hidden_talent_types or {}
......
......@@ -27,6 +27,7 @@ local TextzoneList = require "engine.ui.TextzoneList"
local TalentGrid = require "mod.dialogs.elements.TalentGrid"
local Separator = require "engine.ui.Separator"
local DamageType = require "engine.DamageType"
local FontPackage = require "engine.FontPackage"
module(..., package.seeall, class.inherit(Dialog, mod.class.interface.TooltipsData))
......@@ -34,7 +35,7 @@ function _M:init(actor, levelup_end_prodigies)
self.actor = actor
self.levelup_end_prodigies = levelup_end_prodigies
self.font = core.display.newFont("/data/font/DroidSansMono.ttf", 12)
self.font = core.display.newFont(FontPackage:getFont("mono_small", "mono"))
self.font_h = self.font:lineSkip()
self.actor_dup = actor:clone()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment