Skip to content
Snippets Groups Projects
Commit 53a3cd6d authored by dg's avatar dg
Browse files

Limit gamma setting

add tstring:extractLines()


git-svn-id: http://svn.net-core.org/repos/t-engine4@3645 51575b47-30f0-44d4-a5cc-537603b46e54
parent 2394dd6c
No related branches found
No related tags found
No related merge requests found
......@@ -136,12 +136,13 @@ function _M:generateList()
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Gamma correction#WHITE##{normal}#", status=function(item)
return tostring(config.settings.gamma_correction)
end, fct=function(item)
game:registerDialog(GetQuantity.new("Gamma correction", "From 1 to 300", config.settings.gamma_correction, 300, function(qty)
game:registerDialog(GetQuantity.new("Gamma correction", "From 50 to 300", config.settings.gamma_correction, 300, function(qty)
qty = util.bound(qty, 50, 300)
game:saveSettings("gamma_correction", ("gamma_correction = %d\n"):format(qty))
config.settings.gamma_correction = qty
core.display.setGamma(config.settings.gamma_correction / 100)
self.c_list:drawItem(item)
end), 1)
end), 50)
end,}
self.list = list
......
......@@ -707,6 +707,24 @@ function tstring:tokenize(tokens)
return ret
end
function tstring:extractLines()
local rets = {}
local ret = tstring{}
local v, tv
for i = 1, #self do
v = self[i]
tv = type(v)
if tv == true then
rets[#rets+1] = ret
ret = tstring{}
else
ret[#ret+1] = v
end
end
rets[#rets+1] = ret
return rets
end
function tstring:makeLineTextures(max_width, font, no_split, r, g, b)
local list = no_split and self or self:splitLines(max_width, font)
local fh = font:lineSkip()
......
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