Here's my simple rewrite for a basic crosshair in the center of the screen that you can size.
This is drycoded (not tested) should you get any issues, I'm sure Treeston could help:
https://dl.dropboxusercontent.com/u/...nterScreen.zip
Simply type /crosshair 'thickness' and you'll create a crosshair of your desired thickness in the center of the screen.
Code:
local crosshair
local thickness = 4
function crosshair_Show()
if not crosshair then
crosshair_Create()
elseif crosshair.thickness ~= thickness then
crosshair:Hide()
crosshair_Create()
else
crosshair:Show()
end
end
function crosshair_Hide()
if crosshair then
crosshair:Hide()
end
end
local isCrossing = false
SLASH_TOGGLECROSSHAIR1 = "/crosshair"
SlashCmdList["TOGGLECROSSHAIR"] = function(arg)
if isCrossing then
crosshair_Hide()
isCrossing = false
else
thickness = tonumber(arg)
crosshair_Show()
isCrossing = true
end
end
function crosshair_Create()
crosshair = CreateFrame('Frame', nil, UIParent)
crosshair.thickness = thickness
crosshair:SetAllPoints(UIParent)
local scale = UIParent:GetEffectiveScale()
local width = GetScreenWidth()*scale
local height = GetScreenHeight()*scale
local centerX = width/2
local centerY = height/2
local v = crosshair:CreateTexture(nil, 'BACKGROUND')
v:SetTexture(1,0,0,0.5)
v:SetPoint("TOPLEFT", crosshair, "TOPLEFT", (centerX-(thickness/2)), 0)
v:SetPoint('BOTTOMRIGHT', crosshair, 'BOTTOMLEFT', (centerX+(thickness/2)), 0)
local h = crosshair:CreateTexture(nil, 'BACKGROUND')
h:SetTexture(1,0,0,0.5)
h:SetPoint("TOPLEFT", crosshair, "TOPLEFT", 0,(centerY+(thickness/2)))
h:SetPoint('BOTTOMRIGHT', crosshair, 'TOPRIGHT', 0, (centerY-(thickness/2)))
end