manups4e / ScaleformUI

ScaleformUI is a GTA menu styled API made with custom Scaleforms to be lighter, faster and visually better
Other
139 stars 49 forks source link

fix: bug in position and scale #183

Closed Local9 closed 11 months ago

Local9 commented 11 months ago
local splashText = ScaleformUI.Scaleforms.SplashText;

splashText:Load():next(function()
    splashText:SetLabel("Hello World!", SColor.Violet, true);
  end,
  function(error)
    print("Error loading splash text: " .. error);
  end);

local count = 0;
local counter = 0;

math.randomseed(GetGameTimer())

CreateThread(function()
  while true do
    Wait(0);
    HideHudComponentThisFrame(14);
    SetScriptGfxDrawOrder(1);

    splashText:Draw();

    if count > 300 then
      splashText:SetTextLabel("Hello World! " .. tostring(counter), SColor.Violet);
      splashText:TransitionIn(300);
      count = 0
      counter = counter + 1;

      splashText:SetPosition(math.random(0, 100) / 100 + 0.0, math.random(0, 100) / 100 + 0.0);
      splashText:SetScale(math.random(0, 100) / 100 + 0.0, math.random(0, 100) / 100 + 0.0);
    end

    count = count + 1;

    if IsControlJustPressed(0, 38) then
      splashText:TransitionIn();
    end

    if IsControlJustPressed(0, 23) then
      splashText:TransitionOut(300);
    end
  end
end)