Compare with Previous |
Blame |
View Log
--[[
Align
*****
Creates a grid used to visually align elements
]]--
import "Turbine.UI"
import "Turbine.UI.Lotro"
shellCommand = Turbine.ShellCommand()
function shellCommand:Execute(command,args)
local size
if args=="Decimal" or args=="d" then size=20 else size=32 end
if align~=nil then
--delete grid
align:SetVisible(false)
align=nil
alignlr:SetVisible(false)
alignlr=nil
alignud:SetVisible(false)
alignud=nil
else
--Calculate grid with so it centers on screen
local width = Turbine.UI.Display.GetWidth()
local height = Turbine.UI.Display.GetHeight()
local wtemp=(math.ceil(width/size))*size
local htemp=(math.ceil(height/size))*size
--create grid
align= Turbine.UI.Window()
align:SetPosition( (width-wtemp)/2,(height-htemp)/2)
align:SetSize( wtemp,htemp )
align:SetOpacity(1)
align:SetMouseVisible ( false)
align:SetVisible(true)
if size==32 then align :SetBackground ("JackdawPlugins/align/align.tga") else align :SetBackground ("JackdawPlugins/align/decimal align.tga") end
--cross hair
alignlr= Turbine.UI.Window()
alignlr:SetPosition( math.floor((width-1)/2),0)
alignlr:SetSize( 1,height )
alignlr:SetOpacity(1)
alignlr:SetMouseVisible ( false)
alignlr:SetBackColor(Turbine.UI.Color(1,1,0,0))
alignlr:SetVisible(true)
alignud= Turbine.UI.Window()
alignud:SetPosition(0, math.floor((height-1)/2))
alignud:SetSize( width,1)
alignud:SetOpacity(1)
alignud:SetMouseVisible ( false)
alignud:SetBackColor(Turbine.UI.Color(1,1,0,0))
alignud:SetVisible(true)
Turbine.Shell.WriteLine(size)
end
end
Turbine.Shell.AddCommand('Align', shellCommand)
Compare with Previous |
Blame
All times are GMT -5. The time now is 01:52 AM.