Compare commits
No commits in common. "af00e8abd46f7399d7ac5743c55d91b84c36231c" and "9ce9b85dfa81f90abacccac902ff933b0720544c" have entirely different histories.
af00e8abd4
...
9ce9b85dfa
@ -1,91 +0,0 @@
|
|||||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
||||||
This license is copied below, and is also available with a FAQ at:
|
|
||||||
https://openfontlicense.org
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------
|
|
||||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
||||||
-----------------------------------------------------------
|
|
||||||
|
|
||||||
PREAMBLE
|
|
||||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
||||||
development of collaborative font projects, to support the font creation
|
|
||||||
efforts of academic and linguistic communities, and to provide a free and
|
|
||||||
open framework in which fonts may be shared and improved in partnership
|
|
||||||
with others.
|
|
||||||
|
|
||||||
The OFL allows the licensed fonts to be used, studied, modified and
|
|
||||||
redistributed freely as long as they are not sold by themselves. The
|
|
||||||
fonts, including any derivative works, can be bundled, embedded,
|
|
||||||
redistributed and/or sold with any software provided that any reserved
|
|
||||||
names are not used by derivative works. The fonts and derivatives,
|
|
||||||
however, cannot be released under any other type of license. The
|
|
||||||
requirement for fonts to remain under this license does not apply
|
|
||||||
to any document created using the fonts or their derivatives.
|
|
||||||
|
|
||||||
DEFINITIONS
|
|
||||||
"Font Software" refers to the set of files released by the Copyright
|
|
||||||
Holder(s) under this license and clearly marked as such. This may
|
|
||||||
include source files, build scripts and documentation.
|
|
||||||
|
|
||||||
"Reserved Font Name" refers to any names specified as such after the
|
|
||||||
copyright statement(s).
|
|
||||||
|
|
||||||
"Original Version" refers to the collection of Font Software components as
|
|
||||||
distributed by the Copyright Holder(s).
|
|
||||||
|
|
||||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
||||||
or substituting -- in part or in whole -- any of the components of the
|
|
||||||
Original Version, by changing formats or by porting the Font Software to a
|
|
||||||
new environment.
|
|
||||||
|
|
||||||
"Author" refers to any designer, engineer, programmer, technical
|
|
||||||
writer or other person who contributed to the Font Software.
|
|
||||||
|
|
||||||
PERMISSION & CONDITIONS
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
||||||
redistribute, and sell modified and unmodified copies of the Font
|
|
||||||
Software, subject to the following conditions:
|
|
||||||
|
|
||||||
1) Neither the Font Software nor any of its individual components,
|
|
||||||
in Original or Modified Versions, may be sold by itself.
|
|
||||||
|
|
||||||
2) Original or Modified Versions of the Font Software may be bundled,
|
|
||||||
redistributed and/or sold with any software, provided that each copy
|
|
||||||
contains the above copyright notice and this license. These can be
|
|
||||||
included either as stand-alone text files, human-readable headers or
|
|
||||||
in the appropriate machine-readable metadata fields within text or
|
|
||||||
binary files as long as those fields can be easily viewed by the user.
|
|
||||||
|
|
||||||
3) No Modified Version of the Font Software may use the Reserved Font
|
|
||||||
Name(s) unless explicit written permission is granted by the corresponding
|
|
||||||
Copyright Holder. This restriction only applies to the primary font name as
|
|
||||||
presented to the users.
|
|
||||||
|
|
||||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
||||||
Software shall not be used to promote, endorse or advertise any
|
|
||||||
Modified Version, except to acknowledge the contribution(s) of the
|
|
||||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
5) The Font Software, modified or unmodified, in part or in whole,
|
|
||||||
must be distributed entirely under this license, and must not be
|
|
||||||
distributed under any other license. The requirement for fonts to
|
|
||||||
remain under this license does not apply to any document created
|
|
||||||
using the Font Software.
|
|
||||||
|
|
||||||
TERMINATION
|
|
||||||
This license becomes null and void if any of the above conditions are
|
|
||||||
not met.
|
|
||||||
|
|
||||||
DISCLAIMER
|
|
||||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
||||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
||||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
||||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
||||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
||||||
Binary file not shown.
@ -1,94 +0,0 @@
|
|||||||
Copyright 2025 The WDXL Lubrifont Project Authors (https://github.com/NightFurySL2001/WD-XL-font)
|
|
||||||
Copyright 2018-2020 The ZCOOL QingKe HuangYou Project Authors (https://www.github.com/googlefonts/zcool-qingke-huangyou)
|
|
||||||
|
|
||||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
||||||
This license is copied below, and is also available with a FAQ at:
|
|
||||||
https://openfontlicense.org
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------
|
|
||||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
||||||
-----------------------------------------------------------
|
|
||||||
|
|
||||||
PREAMBLE
|
|
||||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
||||||
development of collaborative font projects, to support the font creation
|
|
||||||
efforts of academic and linguistic communities, and to provide a free and
|
|
||||||
open framework in which fonts may be shared and improved in partnership
|
|
||||||
with others.
|
|
||||||
|
|
||||||
The OFL allows the licensed fonts to be used, studied, modified and
|
|
||||||
redistributed freely as long as they are not sold by themselves. The
|
|
||||||
fonts, including any derivative works, can be bundled, embedded,
|
|
||||||
redistributed and/or sold with any software provided that any reserved
|
|
||||||
names are not used by derivative works. The fonts and derivatives,
|
|
||||||
however, cannot be released under any other type of license. The
|
|
||||||
requirement for fonts to remain under this license does not apply
|
|
||||||
to any document created using the fonts or their derivatives.
|
|
||||||
|
|
||||||
DEFINITIONS
|
|
||||||
"Font Software" refers to the set of files released by the Copyright
|
|
||||||
Holder(s) under this license and clearly marked as such. This may
|
|
||||||
include source files, build scripts and documentation.
|
|
||||||
|
|
||||||
"Reserved Font Name" refers to any names specified as such after the
|
|
||||||
copyright statement(s).
|
|
||||||
|
|
||||||
"Original Version" refers to the collection of Font Software components as
|
|
||||||
distributed by the Copyright Holder(s).
|
|
||||||
|
|
||||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
||||||
or substituting -- in part or in whole -- any of the components of the
|
|
||||||
Original Version, by changing formats or by porting the Font Software to a
|
|
||||||
new environment.
|
|
||||||
|
|
||||||
"Author" refers to any designer, engineer, programmer, technical
|
|
||||||
writer or other person who contributed to the Font Software.
|
|
||||||
|
|
||||||
PERMISSION & CONDITIONS
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
||||||
redistribute, and sell modified and unmodified copies of the Font
|
|
||||||
Software, subject to the following conditions:
|
|
||||||
|
|
||||||
1) Neither the Font Software nor any of its individual components,
|
|
||||||
in Original or Modified Versions, may be sold by itself.
|
|
||||||
|
|
||||||
2) Original or Modified Versions of the Font Software may be bundled,
|
|
||||||
redistributed and/or sold with any software, provided that each copy
|
|
||||||
contains the above copyright notice and this license. These can be
|
|
||||||
included either as stand-alone text files, human-readable headers or
|
|
||||||
in the appropriate machine-readable metadata fields within text or
|
|
||||||
binary files as long as those fields can be easily viewed by the user.
|
|
||||||
|
|
||||||
3) No Modified Version of the Font Software may use the Reserved Font
|
|
||||||
Name(s) unless explicit written permission is granted by the corresponding
|
|
||||||
Copyright Holder. This restriction only applies to the primary font name as
|
|
||||||
presented to the users.
|
|
||||||
|
|
||||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
||||||
Software shall not be used to promote, endorse or advertise any
|
|
||||||
Modified Version, except to acknowledge the contribution(s) of the
|
|
||||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
5) The Font Software, modified or unmodified, in part or in whole,
|
|
||||||
must be distributed entirely under this license, and must not be
|
|
||||||
distributed under any other license. The requirement for fonts to
|
|
||||||
remain under this license does not apply to any document created
|
|
||||||
using the Font Software.
|
|
||||||
|
|
||||||
TERMINATION
|
|
||||||
This license becomes null and void if any of the above conditions are
|
|
||||||
not met.
|
|
||||||
|
|
||||||
DISCLAIMER
|
|
||||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
||||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
||||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
||||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
||||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
||||||
Binary file not shown.
@ -57,8 +57,6 @@ function barElement:draw()
|
|||||||
love.graphics.setColor(1, 1, 1)
|
love.graphics.setColor(1, 1, 1)
|
||||||
--- текст поверх
|
--- текст поверх
|
||||||
if self.drawText then
|
if self.drawText then
|
||||||
local font = Tree.fonts:getDefaultTheme():getVariant("small")
|
|
||||||
love.graphics.setFont(font)
|
|
||||||
love.graphics.printf(tostring(self.value) .. "/" .. tostring(self.maxValue), self.bounds.x,
|
love.graphics.printf(tostring(self.value) .. "/" .. tostring(self.maxValue), self.bounds.x,
|
||||||
self.bounds.y, self.bounds.width, "center")
|
self.bounds.y, self.bounds.width, "center")
|
||||||
end
|
end
|
||||||
|
|||||||
@ -22,8 +22,8 @@ function endTurnButton:update(dt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function endTurnButton:layout()
|
function endTurnButton:layout()
|
||||||
local font = Tree.fonts:getDefaultTheme():getVariant("headline")
|
local font = love.graphics.newFont(16)
|
||||||
self.text = love.graphics.newText(font, "Завершить ход")
|
self.text = love.graphics.newText(font, "end_turn")
|
||||||
self.bounds.width = self.text:getWidth() + 32
|
self.bounds.width = self.text:getWidth() + 32
|
||||||
self.bounds.height = self.text:getHeight() + 16
|
self.bounds.height = self.text:getHeight() + 16
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
Tree = {
|
Tree = {
|
||||||
assets = (require "lib.utils.asset_bundle"):load()
|
assets = (require "lib.utils.asset_bundle"):load()
|
||||||
}
|
}
|
||||||
Tree.fonts = (require "lib.utils.font_manager"):load("WDXL_Lubrifont_TC"):loadTheme("Roboto_Mono") -- дефолтный шрифт
|
|
||||||
Tree.panning = require "lib/panning"
|
Tree.panning = require "lib/panning"
|
||||||
Tree.controls = require "lib.controls"
|
Tree.controls = require "lib.controls"
|
||||||
Tree.level = (require "lib.level.level").new("procedural", "flower_plains") -- для теста у нас только один уровень, который сразу же загружен
|
Tree.level = (require "lib.level.level").new("procedural", "flower_plains") -- для теста у нас только один уровень, который сразу же загружен
|
||||||
|
|||||||
@ -51,7 +51,7 @@ function AssetBundle.loadFile(path)
|
|||||||
elseif (ext == "lua") then
|
elseif (ext == "lua") then
|
||||||
return require(string.gsub(path, ".lua", ""))
|
return require(string.gsub(path, ".lua", ""))
|
||||||
end
|
end
|
||||||
return filedata
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function AssetBundle.cutExtension(filename)
|
function AssetBundle.cutExtension(filename)
|
||||||
|
|||||||
@ -1,94 +0,0 @@
|
|||||||
--- @alias FontVariant "smallest" | "small" | "medium" | "large" | "headline"
|
|
||||||
|
|
||||||
--- @class TextTheme
|
|
||||||
--- @field private _sizes {[FontVariant]: integer}
|
|
||||||
local theme = {
|
|
||||||
_sizes = {
|
|
||||||
smallest = 10,
|
|
||||||
small = 12,
|
|
||||||
medium = 14,
|
|
||||||
large = 16,
|
|
||||||
headline = 20,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
theme.__index = theme
|
|
||||||
|
|
||||||
--- @param loader fun(size: integer): love.Font?
|
|
||||||
function theme.new(loader)
|
|
||||||
local t = {}
|
|
||||||
for tag, size in pairs(theme._sizes) do
|
|
||||||
local f = loader(size)
|
|
||||||
if not f then return nil end
|
|
||||||
t[tag] = f
|
|
||||||
end
|
|
||||||
|
|
||||||
return setmetatable(t, theme)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- @param variant FontVariant
|
|
||||||
--- @return love.Font
|
|
||||||
function theme:getVariant(variant)
|
|
||||||
return self[variant]
|
|
||||||
end
|
|
||||||
|
|
||||||
----------------------------------------------------------
|
|
||||||
|
|
||||||
--- A singleton to handle fonts
|
|
||||||
--- @class FontManager
|
|
||||||
--- @field private _themes table
|
|
||||||
--- @field defaultTheme string?
|
|
||||||
local FontManager = {
|
|
||||||
_themes = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
--- @param name string
|
|
||||||
--- @param size integer
|
|
||||||
function FontManager.newFont(name, size)
|
|
||||||
local err = function()
|
|
||||||
print("[FontManager]: font " .. name .. " not found!")
|
|
||||||
end
|
|
||||||
local fontDir = Tree.assets.files.fonts[name]
|
|
||||||
if not fontDir then return err() end
|
|
||||||
local font = fontDir.font
|
|
||||||
if not font then return err() end
|
|
||||||
return love.graphics.newFont(font, size)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- @param name string
|
|
||||||
--- @return FontManager
|
|
||||||
function FontManager:loadTheme(name)
|
|
||||||
self._themes[name] = theme.new(
|
|
||||||
function(size)
|
|
||||||
return self.newFont(name, size)
|
|
||||||
end
|
|
||||||
)
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- @param name string
|
|
||||||
--- @return TextTheme?
|
|
||||||
function FontManager:getTheme(name)
|
|
||||||
return self._themes[name]
|
|
||||||
end
|
|
||||||
|
|
||||||
--- @return TextTheme
|
|
||||||
function FontManager:getDefaultTheme()
|
|
||||||
return self._themes[self.defaultTheme]
|
|
||||||
end
|
|
||||||
|
|
||||||
--- initial setup
|
|
||||||
--- @param defaultFontName string
|
|
||||||
function FontManager:load(defaultFontName)
|
|
||||||
local t = self:loadTheme(defaultFontName):getTheme(defaultFontName)
|
|
||||||
if not t then
|
|
||||||
print("[FontManager]: default font " .. defaultFontName .. " is missing")
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
self.defaultTheme = defaultFontName
|
|
||||||
|
|
||||||
local f = t:getVariant("medium")
|
|
||||||
love.graphics.setFont(f)
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
return FontManager
|
|
||||||
1
main.lua
1
main.lua
@ -64,7 +64,6 @@ function love.draw()
|
|||||||
testLayout:draw()
|
testLayout:draw()
|
||||||
love.graphics.setColor(1, 1, 1)
|
love.graphics.setColor(1, 1, 1)
|
||||||
|
|
||||||
love.graphics.setFont(Tree.fonts:getTheme("Roboto_Mono"):getVariant("medium"))
|
|
||||||
local stats = "fps: " ..
|
local stats = "fps: " ..
|
||||||
love.timer.getFPS() ..
|
love.timer.getFPS() ..
|
||||||
" lt: " .. lt .. " dt: " .. dt .. " mem: " .. string.format("%.2f MB", collectgarbage("count") / 1000)
|
" lt: " .. lt .. " dt: " .. dt .. " mem: " .. string.format("%.2f MB", collectgarbage("count") / 1000)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user