Add screenshots and a README to display them.
This commit is contained in:
parent
ce6cb893bf
commit
48ffa74bfd
12 changed files with 229 additions and 168 deletions
|
|
@ -35,7 +35,11 @@ return function(state)
|
|||
imfs.row(0.15, 0.05, "100% - 0.3", "100% - 0.13")
|
||||
local show_type = state.show_type()
|
||||
imfs.button(0, 0, "1x", "100%", "All")
|
||||
:style(show_type == "all" and style_borderless_alt or style_borderless)
|
||||
:style(
|
||||
show_type == "all"
|
||||
and style_borderless_alt
|
||||
or style_borderless
|
||||
)
|
||||
:style("hovered", style_borderless_hovered)
|
||||
:style("pressed", style_borderless_hovered)
|
||||
:onclick(function()
|
||||
|
|
@ -52,7 +56,11 @@ return function(state)
|
|||
end)
|
||||
imfs.box(0, 0, 0.1, "100%", theme.styles.container.border_color)
|
||||
imfs.button(0, 0, "1x", "100%", "Games")
|
||||
:style(show_type == "games" and style_borderless_alt or style_borderless)
|
||||
:style(
|
||||
show_type == "games"
|
||||
and style_borderless_alt
|
||||
or style_borderless
|
||||
)
|
||||
:style("hovered", style_borderless_hovered)
|
||||
:style("pressed", style_borderless_hovered)
|
||||
:onclick(function()
|
||||
|
|
@ -69,7 +77,11 @@ return function(state)
|
|||
end)
|
||||
imfs.box(0, 0, 0.1, "100%", theme.styles.container.border_color)
|
||||
imfs.button(0, 0, "1x", "100%", "Mods")
|
||||
:style(show_type == "mods" and style_borderless_alt or style_borderless)
|
||||
:style(
|
||||
show_type == "mods"
|
||||
and style_borderless_alt
|
||||
or style_borderless
|
||||
)
|
||||
:style("hovered", style_borderless_hovered)
|
||||
:style("pressed", style_borderless_hovered)
|
||||
:onclick(function()
|
||||
|
|
@ -86,7 +98,11 @@ return function(state)
|
|||
end)
|
||||
imfs.box(0, 0, 0.1, "100%", theme.styles.container.border_color)
|
||||
imfs.button(0, 0, "1x", "100%", "Texture Packs")
|
||||
:style(show_type == "texturepacks" and style_borderless_alt or style_borderless)
|
||||
:style(
|
||||
show_type == "texturepacks"
|
||||
and style_borderless_alt
|
||||
or style_borderless
|
||||
)
|
||||
:style("hovered", style_borderless_hovered)
|
||||
:style("pressed", style_borderless_hovered)
|
||||
:onclick(function()
|
||||
|
|
@ -157,75 +173,83 @@ return function(state)
|
|||
return imfs.end_()
|
||||
end
|
||||
|
||||
local content = state.content_shown()
|
||||
local num_per_page = math.floor((size.x + 0.5) / 5.5) * math.floor((size.y - 1.05) / 3.5)
|
||||
local excess_x = (size.x + 0.5) % 5.5
|
||||
local excess_y = (size.y - 1.05) % 3.5
|
||||
imfs.scroll_container(0, 1.05, "100%", "100% - 1.55", "horizontal", 0, "")
|
||||
:scrollbar(function()
|
||||
imfs.scrollbar(0, size.y - 0.5, size.x, 0.5, "horizontal", state.page())
|
||||
:options({
|
||||
min = 1,
|
||||
max = math.ceil(state.num_content / num_per_page),
|
||||
smallstep = 1
|
||||
})
|
||||
:onchange(function(action, value)
|
||||
if action == "CHG" then
|
||||
state.page(value)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
local x = 0
|
||||
local y = 0
|
||||
local start = (state.page() - 1) * num_per_page
|
||||
local i = start
|
||||
local idx = start
|
||||
while idx < start + num_per_page do
|
||||
i = i + 1
|
||||
local pkg = content[i]
|
||||
if not pkg then break end
|
||||
if state.detail() then
|
||||
imfs.button(1, 2, 3, 0.75, "Back")
|
||||
:onclick(function()
|
||||
state.detail(false)
|
||||
end)
|
||||
else
|
||||
local content = state.content_shown()
|
||||
local num_per_page =
|
||||
math.floor((size.x + 0.5) / 5.5) * math.floor((size.y - 1.05) / 3.5)
|
||||
local excess_x = (size.x + 0.5) % 5.5
|
||||
local excess_y = (size.y - 1.05) % 3.5
|
||||
imfs.scroll_container(0, 1.05, "100%", "100% - 1.55", "horizontal", 0, "")
|
||||
:scrollbar(function()
|
||||
imfs.scrollbar(0, size.y - 0.5, size.x, 0.5, "horizontal", state.page())
|
||||
:options({
|
||||
min = 1,
|
||||
max = math.ceil(state.num_content / num_per_page),
|
||||
smallstep = 1
|
||||
})
|
||||
:onchange(function(action, value)
|
||||
if action == "CHG" then
|
||||
state.page(value)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
if not package.is_installed(pkg.type, pkg.name) then
|
||||
idx = idx + 1
|
||||
local x = 0
|
||||
local y = 0
|
||||
local start = (state.page() - 1) * num_per_page
|
||||
local i = start
|
||||
local idx = start
|
||||
while idx < start + num_per_page do
|
||||
i = i + 1
|
||||
local pkg = content[i]
|
||||
if not pkg then break end
|
||||
|
||||
imfs.group(x + excess_x / 2, y + excess_y / 2, 5, 3)
|
||||
imfs.image(0, 0, "100%", "100%", package.screenshot(pkg))
|
||||
imfs.box(0, 0, "100%", "100%", "#000a")
|
||||
imfs.hypertext(0.1, 0.1, "100% - 0.2", "100% - 0.2", string.format(
|
||||
[[<global color=#fff><style size=24><b>%s</b></style>
|
||||
<b> by %s</b>
|
||||
%s]],
|
||||
core.hypertext_escape(pkg.title or pkg.name),
|
||||
pkg.author,
|
||||
pkg.short_description
|
||||
))
|
||||
:style(".scrollbar", {
|
||||
size = "0"
|
||||
})
|
||||
imfs.button(0, 0, "100%", "100%")
|
||||
:styles(styles_no_background)
|
||||
:style("hovered", {
|
||||
bgimg = "[fill:1x1:0,0:#fff",
|
||||
bgcolor = "#0004"
|
||||
})
|
||||
:style("pressed", {
|
||||
bgimg = "[fill:1x1:0,0:#fff",
|
||||
bgcolor = "#0004"
|
||||
})
|
||||
:onclick(function()
|
||||
|
||||
end)
|
||||
imfs.group_end()
|
||||
x = x + 5.5
|
||||
if x + 5 > size.x then
|
||||
x = 0
|
||||
y = y + 3.5
|
||||
if not package.is_installed(pkg.type, pkg.name) then
|
||||
idx = idx + 1
|
||||
|
||||
imfs.group(x + excess_x / 2, y + excess_y / 2, 5, 3)
|
||||
imfs.image(0, 0, "100%", "100%", package.screenshot(pkg))
|
||||
imfs.box(0, 0, "100%", "100%", "#000a")
|
||||
imfs.hypertext(0.1, 0.1, "100% - 0.2", "100% - 0.2", string.format(
|
||||
[[<global color=#fff><style size=24><b>%s</b></style>
|
||||
<b> by %s</b>
|
||||
%s]],
|
||||
core.hypertext_escape(pkg.title or pkg.name),
|
||||
pkg.author,
|
||||
pkg.short_description
|
||||
))
|
||||
:style(".scrollbar", {
|
||||
size = "0"
|
||||
})
|
||||
imfs.button(0, 0, "100%", "100%")
|
||||
:styles(styles_no_background)
|
||||
:style("hovered", {
|
||||
bgimg = "[fill:1x1:0,0:#fff",
|
||||
bgcolor = "#0004"
|
||||
})
|
||||
:style("pressed", {
|
||||
bgimg = "[fill:1x1:0,0:#fff",
|
||||
bgcolor = "#0004"
|
||||
})
|
||||
:onclick(function()
|
||||
state.detail(pkg)
|
||||
end)
|
||||
imfs.group_end()
|
||||
x = x + 5.5
|
||||
if x + 5 > size.x then
|
||||
x = 0
|
||||
y = y + 3.5
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
imfs.scroll_container_end()
|
||||
|
||||
imfs.scroll_container_end()
|
||||
end
|
||||
|
||||
return imfs.end_()
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue