lotrointerface.com
Search Downloads

LoTROInterface SVN SequenceBars

[/] [trunk/] [Thurallor/] [Common/] [UI/] [Zoomer_2.lua] - Rev 203

Compare with Previous | Blame | View Log

Zoomer = class(Turbine.UI.Window)

function Zoomer:Constructor(fromCtl, toCtl, speed)
    Turbine.UI.Window.Constructor(self);
    self.fromLeft, self.fromTop = fromCtl:PointToScreen(0, 0);
    self.fromWidth, self.fromHeight = fromCtl:GetSize();
    self.toLeft, self.toTop = toCtl:PointToScreen(0, 0);
    self.toWidth, self.toHeight = toCtl:GetSize();
    self.startTime = Turbine.Engine.GetGameTime();
    self.speed = speed or 2;

    self:SetMouseVisible(false);
    self:SetVisible(true);
    self:SetBackColor(Turbine.UI.Color(0.8, 1, 1, 1));
    self.innerCtl = Turbine.UI.Control();
    self.innerCtl:SetBackColor(Turbine.UI.Color(0, 0, 0 ,0));
    self.innerCtl:SetParent(self);
    self.innerCtl:SetPosition(2, 2);

    self:SetPosition(self.fromLeft, self.fromTop);
    self:SetSize(self.fromWidth, self.fromHeight);
    self:SetZOrder(2147483647);
    self:SetWantsUpdates(true);
end

function Zoomer:SetSize(width, height)
    Turbine.UI.Window.SetSize(self, width, height);
    self.innerCtl:SetWidth(width - 4);
    self.innerCtl:SetHeight(height - 4);
end

function Zoomer:Update()
    local progress = (Turbine.Engine.GetGameTime() - self.startTime) * self.speed;
    local param = progress^3;
    if (progress >= 1) then
        self:SetVisible(false);
        self:SetWantsUpdates(false);
        DoCallbacks(self, "ZoomComplete");
        self:Close();
    else
        local left = math.floor(self.fromLeft + param * (self.toLeft - self.fromLeft) + 0.5);
        local top = math.floor(self.fromTop + param * (self.toTop - self.fromTop) + 0.5);
        self:SetPosition(left, top);
        local width = math.floor(self.fromWidth + param * (self.toWidth - self.fromWidth) + 0.5);
        local height = math.floor(self.fromHeight + param * (self.toHeight - self.fromHeight) + 0.5);
        self:SetSize(width, height);
    end
end

Thurallor = Thurallor or {};
Thurallor.UI = Thurallor.UI or {};
Thurallor.UI.Zoomer = Zoomer;

Compare with Previous | Blame


All times are GMT -5. The time now is 09:39 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui