Files
2take1-scripts/autoexec.lua
2021-06-21 21:34:57 -05:00

36 lines
1.1 KiB
Lua

simulated_resolution = v2(1920, 1080)
function coords_to_screenwriter(coord1, coord2)
x_left = math.min(coord1.x, coord2.x)
x_right = math.max(coord1.x, coord2.x)
y_top = math.min(coord1.y, coord2.y)
y_bottom = math.max(coord1.y, coord2.y)
width_px = x_right - x_left
height_px = y_bottom - y_top
x_px = x_left + width_px / 2
y_px = y_top + height_px / 2
x = (x_px - simulated_resolution.x / 2) / simulated_resolution.x * 2
y = (y_px - simulated_resolution.y / 2) / simulated_resolution.y * 2
width = (width_px - simulated_resolution.x / 2) / simulated_resolution.x * 2
height = (height_px - simulated_resolution.y / 2) / simulated_resolution.y * 2
return v2(x, y), v2(width, height)
end
--menu.add_feature("player coords", "toggle", 0, function(f)
menu.create_thread(function()
local scale = -2
--while f.on do
while true do
local pos, scale = coords_to_screenwriter(v2(1920, 0), v2(1728, 108))
scriptdraw.draw_rect(pos, scale, 0xFF000000)
--scriptdraw.draw_text(scale, v2(0, 0), v2(1, 1), 1, 0XFFFFFFFF, 0)
system.wait(0)
end
--end)
end, nil)