moved zoom into base templates, fixed performance and memory issues
This commit is contained in:
+1
-1
Submodule gui updated: 79ad2b839b...c4cf5cbc9e
+18
-67
@@ -19,30 +19,10 @@ local playerList = {}
|
|||||||
local playerStaticList = {}
|
local playerStaticList = {}
|
||||||
local scoreboard = {}
|
local scoreboard = {}
|
||||||
|
|
||||||
-- Create a table to manage GUI elements
|
|
||||||
local manage = {}
|
|
||||||
|
|
||||||
local boardLog = log:child("board")
|
local boardLog = log:child("board")
|
||||||
|
|
||||||
-- Function to resize fonts for all managed elements
|
-- Function to resize fonts for all managed elements
|
||||||
boardLog:debug("Creating resize fonts handler")
|
boardLog:debug("Creating resize fonts handler")
|
||||||
local function resizeFonts()
|
|
||||||
-- Use multi-threading to improve performance
|
|
||||||
thread.skip(2)
|
|
||||||
-- Iterate over each element in the 'manage' table
|
|
||||||
for i = 1, #manage do
|
|
||||||
local elem = manage[i]
|
|
||||||
|
|
||||||
-- Check if the current element has a centerFont property
|
|
||||||
if elem.centerFont then
|
|
||||||
-- Adjust font size and re-center the text
|
|
||||||
elem:fitFont(nil, nil, {scale = 2/3})
|
|
||||||
elem:centerFont()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
gui.Events.OnResized(resizeFonts)
|
|
||||||
|
|
||||||
local completed_questions = 0
|
local completed_questions = 0
|
||||||
local min_questions = 0
|
local min_questions = 0
|
||||||
@@ -236,12 +216,8 @@ function Menu(frame, path)
|
|||||||
label.color = color.bg
|
label.color = color.bg
|
||||||
label.textColor = color.status_font
|
label.textColor = color.status_font
|
||||||
label:setRoundness(20,20,60)
|
label:setRoundness(20,20,60)
|
||||||
local updateLabel = function()
|
label:scaleFont(2/3)
|
||||||
label:fitFont(nil, nil, {scale = 2/3})
|
label:centerFont()
|
||||||
label:centerFont()
|
|
||||||
end
|
|
||||||
boardUpdater:newThread(updateLabel)
|
|
||||||
gui.Events.OnResized(updateLabel)
|
|
||||||
|
|
||||||
local data = loader:new(path)
|
local data = loader:new(path)
|
||||||
board, question, dailydouble = qframe:newFrame(), qframe:newFrame(), qframe:newImageLabel("assets/images/double.jpg")
|
board, question, dailydouble = qframe:newFrame(), qframe:newFrame(), qframe:newImageLabel("assets/images/double.jpg")
|
||||||
@@ -315,7 +291,8 @@ function Menu(frame, path)
|
|||||||
img:fullFrame()
|
img:fullFrame()
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(manage,c)
|
c:scaleFont(.25)
|
||||||
|
c:centerFont()
|
||||||
|
|
||||||
for tier = 1,tiers do
|
for tier = 1,tiers do
|
||||||
local t = board:newTextButton("$" .. start + inc*(tier-1),0,0,0,0,(1/#index.categories)*(cat-1),1/(tiers+1)*tier,(1/#index.categories),1/(tiers+1))
|
local t = board:newTextButton("$" .. start + inc*(tier-1),0,0,0,0,(1/#index.categories)*(cat-1),1/(tiers+1)*tier,(1/#index.categories),1/(tiers+1))
|
||||||
@@ -407,13 +384,10 @@ function Menu(frame, path)
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end))
|
end))
|
||||||
table.insert(manage,t)
|
t:centerFont()
|
||||||
|
t:scaleFont(.5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resizeFonts()
|
|
||||||
resizeFonts()
|
|
||||||
|
|
||||||
return background
|
return background
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -514,28 +488,14 @@ function ScoreBoard(frame, x, y, w, h, sx, sy, sw, sh)
|
|||||||
textColor = C_TEXT_MUTED,
|
textColor = C_TEXT_MUTED,
|
||||||
}, headernum, headerplayer, headerscore)
|
}, headernum, headerplayer, headerscore)
|
||||||
|
|
||||||
local updateList = {header, headernum, headerplayer, headerscore}
|
local updateList = {headernum, headerplayer, headerscore}
|
||||||
|
|
||||||
local function ScoreResize()
|
header:centerFont()
|
||||||
scoreUpdater:newThread(function()
|
header:scaleFont(2/3)
|
||||||
thread.skip(2)
|
|
||||||
|
|
||||||
for _,object in pairs(updateList) do
|
for _,object in pairs(updateList) do
|
||||||
object:fitFont(nil, nil, {scale = 5/6})
|
object:fitFont(nil, nil, {scale = 5/6})
|
||||||
object:centerFont()
|
object:centerFont()
|
||||||
end
|
|
||||||
|
|
||||||
for _,object in pairs(playerList) do
|
|
||||||
if type(object) == "table" and object.Ref then
|
|
||||||
for i, player in pairs(object.Ref) do
|
|
||||||
if player:hasType(gui.TYPE_TEXT) then
|
|
||||||
player:fitFont(nil, nil, {scale = 5/6})
|
|
||||||
player:centerFont()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scoreboard:AddPlayer(name, score, icon)
|
function scoreboard:AddPlayer(name, score, icon)
|
||||||
@@ -553,13 +513,11 @@ function ScoreBoard(frame, x, y, w, h, sx, sy, sw, sh)
|
|||||||
return tonumber(a.Score) > tonumber(b.Score)
|
return tonumber(a.Score) > tonumber(b.Score)
|
||||||
end)
|
end)
|
||||||
scoreboard:RenderPlayer(playerList)
|
scoreboard:RenderPlayer(playerList)
|
||||||
ScoreResize()
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
table.insert(playerList, player)
|
table.insert(playerList, player)
|
||||||
table.insert(playerStaticList, player)
|
table.insert(playerStaticList, player)
|
||||||
scoreboard:RenderPlayer(playerList)
|
scoreboard:RenderPlayer(playerList)
|
||||||
ScoreResize()
|
|
||||||
return player
|
return player
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -578,13 +536,7 @@ function ScoreBoard(frame, x, y, w, h, sx, sy, sw, sh)
|
|||||||
remove_player:setFont(20)
|
remove_player:setFont(20)
|
||||||
remove_player.align = gui.ALIGN_CENTER
|
remove_player.align = gui.ALIGN_CENTER
|
||||||
local embededWatch = {remove_player}
|
local embededWatch = {remove_player}
|
||||||
|
remove_player:centerFont()
|
||||||
gui.Events.OnMousePressed(boardUpdater:newFunction(function()
|
|
||||||
for i,v in pairs(embededWatch) do
|
|
||||||
v:centerFont()
|
|
||||||
v:centerFont()
|
|
||||||
end
|
|
||||||
end))
|
|
||||||
|
|
||||||
local function embedTextEdit(reference, default, but_text, callback)
|
local function embedTextEdit(reference, default, but_text, callback)
|
||||||
reference.color = C_BORDER_NRM
|
reference.color = C_BORDER_NRM
|
||||||
@@ -604,10 +556,9 @@ function ScoreBoard(frame, x, y, w, h, sx, sy, sw, sh)
|
|||||||
end)
|
end)
|
||||||
gui.apply({
|
gui.apply({
|
||||||
setFont = {20},
|
setFont = {20},
|
||||||
align = gui.ALIGN_CENTER
|
align = gui.ALIGN_CENTER,
|
||||||
|
centerFont = {},
|
||||||
},textbox,button,reference)
|
},textbox,button,reference)
|
||||||
table.insert(embededWatch,textbox)
|
|
||||||
table.insert(embededWatch,button)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
remove_player.color = color.new("#a13a3a")
|
remove_player.color = color.new("#a13a3a")
|
||||||
@@ -709,7 +660,9 @@ function ScoreBoard(frame, x, y, w, h, sx, sy, sw, sh)
|
|||||||
gui.apply({
|
gui.apply({
|
||||||
visibility = 0,
|
visibility = 0,
|
||||||
drawBorder = false,
|
drawBorder = false,
|
||||||
textColor = MapColor(index)
|
textColor = MapColor(index),
|
||||||
|
scaleFont = {5/6},
|
||||||
|
centerFont = {}
|
||||||
},playernum, playerName, playerScore, playerIcon, playerLine)
|
},playernum, playerName, playerScore, playerIcon, playerLine)
|
||||||
|
|
||||||
player.Ref = {playerName, playerScore, playernum, playerIcon, playerLine, Frame = playerFrame}
|
player.Ref = {playerName, playerScore, playernum, playerIcon, playerLine, Frame = playerFrame}
|
||||||
@@ -717,8 +670,6 @@ function ScoreBoard(frame, x, y, w, h, sx, sy, sw, sh)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
gui.Events.OnResized(ScoreResize)
|
|
||||||
ScoreResize()
|
|
||||||
return scoreboard
|
return scoreboard
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+5
-16
@@ -25,17 +25,9 @@ function Menu(frame)
|
|||||||
title.visibility = 0
|
title.visibility = 0
|
||||||
title.textColor = color.title_font
|
title.textColor = color.title_font
|
||||||
title.drawBorder = false
|
title.drawBorder = false
|
||||||
|
title:centerFont()
|
||||||
|
|
||||||
titleLog:debug("Creating font thread")
|
titleLog:debug("Creating font thread")
|
||||||
proc:newThread(function()
|
|
||||||
local function enabled()
|
|
||||||
return background.visible
|
|
||||||
end
|
|
||||||
while true do
|
|
||||||
thread.hold(enabled)
|
|
||||||
title:centerFont()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
local items = 0
|
local items = 0
|
||||||
local MenuOption = function(str)
|
local MenuOption = function(str)
|
||||||
@@ -43,13 +35,10 @@ function Menu(frame)
|
|||||||
local text = item:newTextLabel(str)
|
local text = item:newTextLabel(str)
|
||||||
text:fullFrame()
|
text:fullFrame()
|
||||||
text.align = gui.ALIGN_CENTER
|
text.align = gui.ALIGN_CENTER
|
||||||
thread:newThread(function()
|
text:scaleFont(.4)
|
||||||
thread.skip(2)
|
text:centerFont()
|
||||||
text:fitFont(nil,nil,{scale = 1/2})
|
text.visibility = 0
|
||||||
text:centerFont()
|
text.textColor = color.new("#24269a")
|
||||||
text.visibility = 0
|
|
||||||
text.textColor = color.new("#24269a")
|
|
||||||
end)
|
|
||||||
items = items + 1
|
items = items + 1
|
||||||
return item, text
|
return item, text
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ local function index(window, q, callback)
|
|||||||
label.textColor = color.white
|
label.textColor = color.white
|
||||||
label.color = color.new("#363ac8")
|
label.color = color.new("#363ac8")
|
||||||
label.borderColor = color.new("#363ac8")
|
label.borderColor = color.new("#363ac8")
|
||||||
|
label:scaleFont(.075)
|
||||||
|
|
||||||
if not q.imageA or q.imageA == "" then
|
if not q.imageA or q.imageA == "" then
|
||||||
error("Missing 'imageA' field for question!")
|
error("Missing 'imageA' field for question!")
|
||||||
@@ -49,7 +50,8 @@ local function index(window, q, callback)
|
|||||||
}, imageHolder, plusLabel, imageHolder2)
|
}, imageHolder, plusLabel, imageHolder2)
|
||||||
|
|
||||||
window.apply({
|
window.apply({
|
||||||
fitFont={},
|
scaleFont={.7},
|
||||||
|
centerFont={},
|
||||||
align=window.ALIGN_CENTER,
|
align=window.ALIGN_CENTER,
|
||||||
OnReleased=function(self)
|
OnReleased=function(self)
|
||||||
if self.text == "Skip" then
|
if self.text == "Skip" then
|
||||||
@@ -62,7 +64,7 @@ local function index(window, q, callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function update(dt)
|
local function update(dt)
|
||||||
label:fitFont()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ local function index(window, q, callback)
|
|||||||
label.textColor = color.white
|
label.textColor = color.white
|
||||||
label.color = color.new("#363ac8")
|
label.color = color.new("#363ac8")
|
||||||
label:setFont(50)
|
label:setFont(50)
|
||||||
choices = window:newFrame(noOf(0,.3,1,.7))
|
label:centerFont()
|
||||||
|
label:scaleFont(2/3)
|
||||||
|
|
||||||
|
local choices = window:newFrame(noOf(0,.3,1,.7))
|
||||||
choices.color = color.new("#363ac8")
|
choices.color = color.new("#363ac8")
|
||||||
|
|
||||||
function choices:newChoice(choice, i)
|
function choices:newChoice(choice, i)
|
||||||
@@ -52,9 +55,8 @@ local function index(window, q, callback)
|
|||||||
choiceText.textColor = color.white
|
choiceText.textColor = color.white
|
||||||
-- choiceText.align = window.ALIGN_CENTER
|
-- choiceText.align = window.ALIGN_CENTER
|
||||||
choiceText:setFont(40)
|
choiceText:setFont(40)
|
||||||
table.insert(choiceList,choiceText)
|
choiceText:centerFont()
|
||||||
table.insert(allBoxes,box)
|
table.insert(allBoxes,box)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for i,choice in pairs(q.choices) do
|
for i,choice in pairs(q.choices) do
|
||||||
@@ -84,16 +86,7 @@ local function index(window, q, callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function update(dt) -- time in seconds that has passed since
|
local function update(dt) -- time in seconds that has passed since
|
||||||
-- label:fitFont()
|
|
||||||
label:centerFont()
|
|
||||||
for _, obj in pairs(choiceList) do
|
|
||||||
obj:centerFont()
|
|
||||||
-- obj:fitFont(nil, nil, {scale = 2/3})
|
|
||||||
end
|
|
||||||
confirm:fitFont(nil, nil, {scale = 2/3})
|
|
||||||
confirm:centerFont()
|
|
||||||
-- print(box.parent:getAbsolutes())
|
|
||||||
-- print(box:getAbsolutes())
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ local function index(window, q, callback)
|
|||||||
label.align = ALIGN_CENTER
|
label.align = ALIGN_CENTER
|
||||||
label.textColor = color.white
|
label.textColor = color.white
|
||||||
label.color = color.new("#363ac8")
|
label.color = color.new("#363ac8")
|
||||||
|
label:scaleFont(.5)
|
||||||
|
label:centerFont()
|
||||||
if not q.image or q.image == "" then
|
if not q.image or q.image == "" then
|
||||||
error("Missing 'image' field for question!")
|
error("Missing 'image' field for question!")
|
||||||
end
|
end
|
||||||
@@ -31,7 +33,8 @@ local function index(window, q, callback)
|
|||||||
local skip = window:newTextButton("Skip",0,-100,0,100,.25,1,.5)
|
local skip = window:newTextButton("Skip",0,-100,0,100,.25,1,.5)
|
||||||
skip.color = color.new("#5d5d5d")
|
skip.color = color.new("#5d5d5d")
|
||||||
window.apply({
|
window.apply({
|
||||||
fitFont={},
|
scaleFont={.7},
|
||||||
|
centerFont={},
|
||||||
align=window.ALIGN_CENTER,
|
align=window.ALIGN_CENTER,
|
||||||
OnReleased=function(self)
|
OnReleased=function(self)
|
||||||
if self.text == "Skip" then
|
if self.text == "Skip" then
|
||||||
@@ -47,7 +50,6 @@ local function update(dt) -- time in seconds that has passed since
|
|||||||
_,_,w,h = imageHolder.parent:getAbsolutes()
|
_,_,w,h = imageHolder.parent:getAbsolutes()
|
||||||
local x,y,w,h = imageHolder:GetSizeAdjustedToAspectRatio(w,h)
|
local x,y,w,h = imageHolder:GetSizeAdjustedToAspectRatio(w,h)
|
||||||
imageHolder:setDualDim(w,h,x,y)
|
imageHolder:setDualDim(w,h,x,y)
|
||||||
label:fitFont()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ local function index(window, q, callback)
|
|||||||
label:fullFrame()
|
label:fullFrame()
|
||||||
label.textColor = color.white
|
label.textColor = color.white
|
||||||
label.color = color.new("#363ac8")
|
label.color = color.new("#363ac8")
|
||||||
|
label:centerFont()
|
||||||
|
label:scaleFont(.075)
|
||||||
local correct = window:newTextButton("Correct",0,-200,0,100,0,1,.5)
|
local correct = window:newTextButton("Correct",0,-200,0,100,0,1,.5)
|
||||||
correct.color = color.new("#52b11b")
|
correct.color = color.new("#52b11b")
|
||||||
local wrong = window:newTextButton("Wrong",0,-200,0,100,.5,1,.5)
|
local wrong = window:newTextButton("Wrong",0,-200,0,100,.5,1,.5)
|
||||||
@@ -21,7 +23,8 @@ local function index(window, q, callback)
|
|||||||
local skip = window:newTextButton("Skip",0,-100,0,100,.25,1,.5)
|
local skip = window:newTextButton("Skip",0,-100,0,100,.25,1,.5)
|
||||||
skip.color = color.new("#5d5d5d")
|
skip.color = color.new("#5d5d5d")
|
||||||
gui.apply({
|
gui.apply({
|
||||||
fitFont={},
|
scaleFont={.7},
|
||||||
|
centerFont={},
|
||||||
align=gui.ALIGN_CENTER,
|
align=gui.ALIGN_CENTER,
|
||||||
OnReleased=function(self)
|
OnReleased=function(self)
|
||||||
if self.text == "Skip" then
|
if self.text == "Skip" then
|
||||||
@@ -31,8 +34,6 @@ local function index(window, q, callback)
|
|||||||
callback(self.text == "Correct")
|
callback(self.text == "Correct")
|
||||||
end,
|
end,
|
||||||
},correct,wrong,skip)
|
},correct,wrong,skip)
|
||||||
label:setFont(60)
|
|
||||||
-- label:centerFont()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function update(dt) -- time in seconds that has passed since
|
local function update(dt) -- time in seconds that has passed since
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ local function index(window, q, callback)
|
|||||||
label.align = ALIGN_CENTER
|
label.align = ALIGN_CENTER
|
||||||
label.textColor = color.white
|
label.textColor = color.white
|
||||||
label.color = color.new("#363ac8")
|
label.color = color.new("#363ac8")
|
||||||
|
label:centerFont()
|
||||||
|
label:scaleFont(.5)
|
||||||
local holder = frame:newFrame(-300, -200, 600, 400, .5, .5)
|
local holder = frame:newFrame(-300, -200, 600, 400, .5, .5)
|
||||||
holder:centerX(true)
|
holder:centerX(true)
|
||||||
holder:centerY(true)
|
holder:centerY(true)
|
||||||
@@ -38,7 +40,8 @@ local function index(window, q, callback)
|
|||||||
local skip = window:newTextButton("Skip",0,-100,0,100,.25,1,.5)
|
local skip = window:newTextButton("Skip",0,-100,0,100,.25,1,.5)
|
||||||
skip.color = color.new("#5d5d5d")
|
skip.color = color.new("#5d5d5d")
|
||||||
window.apply({
|
window.apply({
|
||||||
fitFont={},
|
scaleFont={.7},
|
||||||
|
centerFont={},
|
||||||
align=window.ALIGN_CENTER,
|
align=window.ALIGN_CENTER,
|
||||||
OnReleased=function(self)
|
OnReleased=function(self)
|
||||||
video:stop()
|
video:stop()
|
||||||
@@ -52,8 +55,7 @@ local function index(window, q, callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function update(dt) -- time in seconds that has passed since
|
local function update(dt) -- time in seconds that has passed since
|
||||||
label:fitFont()
|
|
||||||
label:centerFont()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
--[[ Constants
|
||||||
|
* (all lua builtins that don't allow io/executing code)
|
||||||
|
color (interface)
|
||||||
|
gui (interface)
|
||||||
|
multi (interface bound to a processor) no thread module
|
||||||
|
|
||||||
|
callback true/false correct/wrong
|
||||||
|
]]
|
||||||
|
local label
|
||||||
|
local imageHolder
|
||||||
|
|
||||||
|
local function index(window, q, callback)
|
||||||
|
frame = window:newFrame(0,0,0,-200,0,.2,1,.8)
|
||||||
|
frame.visibility = 0
|
||||||
|
label = window:newTextLabel(" " ..q.title.. " ",0,0,0,0,0,0,1,.2)
|
||||||
|
label.align = ALIGN_CENTER
|
||||||
|
label.textColor = color.white
|
||||||
|
label.color = color.new("#363ac8")
|
||||||
|
label:scaleFont(.5)
|
||||||
|
label:centerFont()
|
||||||
|
local errors = {}
|
||||||
|
|
||||||
|
if type(q.zoom) ~= "string" and q.zoom ~= "" then
|
||||||
|
table.insert(errors, "Missing 'zoom' fiels for queston! Should be a path to an image.")
|
||||||
|
end
|
||||||
|
|
||||||
|
if type(q.minzoom) ~= "string" and q.minzoom ~= "" then
|
||||||
|
table.insert(errors, "Missing 'minzoom' field for question! Should be a path to an image.")
|
||||||
|
end
|
||||||
|
|
||||||
|
if type(q.fullimage) ~= "string" and q.fullimage ~= "" then
|
||||||
|
table.insert(errors, "Missing 'fullimage' field for question! Should be a path to an image.")
|
||||||
|
end
|
||||||
|
|
||||||
|
local zooms = {q.zoom, q.minzoom, q.fullimage}
|
||||||
|
print(q.fullimage)
|
||||||
|
local index = 1
|
||||||
|
local mul = 1
|
||||||
|
|
||||||
|
imageHolder = frame:newImageLabel(q.zoom)
|
||||||
|
imageHolder:setAspectSize(imageHolder.imageWidth,imageHolder.imageHeight)
|
||||||
|
imageHolder:centerX(true)
|
||||||
|
imageHolder:centerY(true)
|
||||||
|
imageHolder:setDualDim(0,0,imageHolder.imageWidth,imageHolder.imageHeight)
|
||||||
|
|
||||||
|
imageHolder:OnEnter(function(self)
|
||||||
|
self:setShader(gui.SHADERS.glow)
|
||||||
|
end)
|
||||||
|
|
||||||
|
imageHolder:OnExit(function(self)
|
||||||
|
self:setShader()
|
||||||
|
end)
|
||||||
|
|
||||||
|
imageHolder:shaderTime(true)
|
||||||
|
|
||||||
|
imageHolder:OnReleased(function()
|
||||||
|
index = index + 1
|
||||||
|
print(index)
|
||||||
|
if index == 2 then
|
||||||
|
mul = .5
|
||||||
|
elseif index == 3 then
|
||||||
|
mul = .25
|
||||||
|
else
|
||||||
|
index = 3
|
||||||
|
end
|
||||||
|
imageHolder:setImage(zooms[index])
|
||||||
|
end)
|
||||||
|
|
||||||
|
local correct = window:newTextButton("Correct",0,-200,0,100,0,1,.5)
|
||||||
|
correct.color = color.new("#52b11b")
|
||||||
|
local wrong = window:newTextButton("Wrong",0,-200,0,100,.5,1,.5)
|
||||||
|
wrong.color = color.new("#bd2626")
|
||||||
|
local skip = window:newTextButton("Skip",0,-100,0,100,.25,1,.5)
|
||||||
|
skip.color = color.new("#5d5d5d")
|
||||||
|
window.apply({
|
||||||
|
scaleFont={.7},
|
||||||
|
centerFont={},
|
||||||
|
align=window.ALIGN_CENTER,
|
||||||
|
OnReleased=function(self)
|
||||||
|
if self.text == "Skip" then
|
||||||
|
callback()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
callback(self.text == "Correct", mul)
|
||||||
|
end,
|
||||||
|
},correct,wrong,skip)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update(dt) -- time in seconds that has passed since
|
||||||
|
_,_,w,h = imageHolder.parent:getAbsolutes()
|
||||||
|
local x,y,w,h = imageHolder:GetSizeAdjustedToAspectRatio(w,h)
|
||||||
|
imageHolder:setDualDim(w,h,x,y)
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
index = index,
|
||||||
|
update = update
|
||||||
|
}
|
||||||
+2
-2
@@ -37,6 +37,8 @@ local function startTimer(opt)
|
|||||||
tlabel.align = gui.ALIGN_CENTER
|
tlabel.align = gui.ALIGN_CENTER
|
||||||
tlabel:fullFrame()
|
tlabel:fullFrame()
|
||||||
tlabel.visibility = 0
|
tlabel.visibility = 0
|
||||||
|
tlabel:centerFont()
|
||||||
|
tlabel:scaleFont(.5)
|
||||||
tpie.color = opt.startColor
|
tpie.color = opt.startColor
|
||||||
tpie.visibility = opt.visibility
|
tpie.visibility = opt.visibility
|
||||||
|
|
||||||
@@ -82,8 +84,6 @@ local function startTimer(opt)
|
|||||||
|
|
||||||
if opt.autoText then
|
if opt.autoText then
|
||||||
tlabel.text = num
|
tlabel.text = num
|
||||||
tlabel:fitFont(nil, nil, {scale=1/2})
|
|
||||||
tlabel:centerFont()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if opt.finegrained then
|
if opt.finegrained then
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.0.2
|
1.0.3
|
||||||
Reference in New Issue
Block a user