rendered paste bodyfunction widget:GetInfo() return { name = "XPicons", desc = "blabla", author = "q", date = "today", license = "GNU GPL, v2 or later", layer = 5, enabled = false -- loaded by default? }end----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------local pos = {} -- unit positionlocal rect = {} -- rectanglefor i = 1,4 do --rectangle points rect[i] = {}end----------------------------------------------------------------------------------------------------------------------------------------------------------------------------Speed-upslocal gl = gllocal IsUnitVisible = Spring.IsUnitVisiblelocal GetUnitTeam = Spring.GetUnitTeamlocal GetUnitPosition = Spring.GetUnitPositionlocal GetUnitDefID = Spring.GetUnitDefIDlocal GetUnitDefDimensions = Spring.GetUnitDefDimensionslocal GetCameraVectors = Spring.GetCameraVectors---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local A = { 0, 1, 0}-- local B = { 1, 1, 0}-- local C = { 1, 0, 0}-- local D = { 0, 0, 0}-- up = { 0, 1, 0}-- right = { 1, 0, 0}----------------------------------------------------------------------------------------------------------------------------------------------------------------------------function widget:DrawWorld() local allUnits = Spring.GetAllUnits() for _,unitID in ipairs(allUnits) do if (IsUnitVisible(unitID)) then local teamID = GetUnitTeam(unitID) if (teamID) then local cam = Spring.GetCameraVectors() --local unitDefID = GetUnitDefID(unitID) --local h = GetUnitDefDimensions(unitDefID).height pos[1], pos[2], pos[3] = GetUnitPosition(unitID) --pos[2] = pos[2] + h + 10 gl.MatrixMode(GL.MODELVIEW) gl.PushMatrix() gl.Scale(100, 100, 100) for i = 1, 3 do --set up the rectangle coordinates rect[1][i] = pos[i] + cam.up[i] rect[2][i] = pos[i] + cam.up[i] + cam.right[i] rect[3][i] = pos[i] + cam.right[i] rect[4][i] = pos[i] + 0 end gl.BeginEnd(GL.QUADS, function() gl.Color(1, 0, 0, 1) for i = 1, 4 do -- draw rectangle gl.Vertex(rect[i][1], rect[i][2], rect[i][3]) --Spring.Echo("rect"..rect[i][1].." "..rect[i][2].." "..rect[i][3]) end --Spring.Echo("pos "..pos[1].." "..pos[2].." "..pos[3]) end ) gl.PopMatrix() end end endend