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

tset

git-svn-id: http://svn.net-core.org/repos/t-engine4@4101 51575b47-30f0-44d4-a5cc-537603b46e54
parent f027900b
No related branches found
No related tags found
No related merge requests found
......@@ -233,8 +233,8 @@ end
--- Make a module loadscreen
function _M:loadScreen(mod)
core.display.forceRedraw()
core.wait.enable(50000, function()
local i, max, dir, togg = 0, 20, 1, 0
core.wait.enable(10000, function()
local i, max, dir = 0, 20, 1
local bkgs = core.display.loadImage("/data/gfx/background/"..mod.short_name..".png") or core.display.loadImage("/data/gfx/background/tome.png")
local sw, sh = core.display.size()
......@@ -268,14 +268,15 @@ function _M:loadScreen(mod)
-- Progressbar
local x
i = i + dir
if dir > 0 and i >= max then dir = -1 togg = util.boundWrap(togg + 1, 0, 3)
elseif dir < 0 and i <= 0 then dir = 1 togg = util.boundWrap(togg + 1, 0, 3)
if dir > 0 and i >= max then dir = -1
elseif dir < 0 and i <= -max then dir = 1
end
local w, h = dw * (i / max), dh
if togg <= 1 then x = 0
else x = dw - w
end
local x = dw * (i / max)
local x2 = x + dw
x = util.bound(x, 0, dw)
x2 = util.bound(x2, 0, dw)
local w, h = x2 - x, dh
bar[1]:toScreenFull(dx + x, dy, w, h, w * bar[4], h * bar[5])
end
......
......@@ -45,21 +45,24 @@ function _M:simpleWaiter(title, text, width, count)
core.display.forceRedraw()
core.wait.enable(count, function()
local dx, dy, dw, dh = d.ui_by_ui[wait].x + d.display_x, d.ui_by_ui[wait].y + d.display_y, wait.w, wait.h
local i, max, dir, togg = 0, 20, 1, 0
local i, max, dir = 0, 20, 1
local bar = {core.display.loadImage("/data/gfx/waiter/waiter_bar.png"):glTexture()}
return function()
-- Background
core.wait.drawLastFrame()
-- Progressbar
local x
i = i + dir
if dir > 0 and i >= max then dir = -1 togg = util.boundWrap(togg + 1, 0, 3)
elseif dir < 0 and i <= 0 then dir = 1 togg = util.boundWrap(togg + 1, 0, 3)
if dir > 0 and i >= max then dir = -1
elseif dir < 0 and i <= -max then dir = 1
end
core.wait.drawLastFrame()
local w, h = dw * (i / max), dh
if togg <= 1 then x = 0
else x = dw - w
end
local x = dw * (i / max)
local x2 = x + dw
x = util.bound(x, 0, dw)
x2 = util.bound(x2, 0, dw)
local w, h = x2 - x, dh
bar[1]:toScreenFull(dx + x, dy, w, h, w * bar[4], h * bar[5])
end
......
......@@ -85,6 +85,7 @@ extern void on_redraw();
static void hook_wait_display(lua_State *L, lua_Debug *ar)
{
waited_count++;
SDL_PumpEvents();
on_redraw();
}
......
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