init
This commit is contained in:
60
autoexec.lua
60
autoexec.lua
@@ -34,63 +34,3 @@ menu.create_thread(function()
|
|||||||
end
|
end
|
||||||
--end)
|
--end)
|
||||||
end, nil)
|
end, nil)
|
||||||
|
|
||||||
--[[
|
|
||||||
|
|
||||||
# v2 to coords
|
|
||||||
local x, y, width, height, x_px, y_px, width_px, height_px, x_left, x_right, y_top, y_bottom
|
|
||||||
|
|
||||||
x = .5
|
|
||||||
y = 0
|
|
||||||
width = 1
|
|
||||||
height = 1
|
|
||||||
|
|
||||||
x_px = x * simulated_resolution.x / 2 + simulated_resolution.x / 2
|
|
||||||
y_px = y * simulated_resolution.y / 2 + simulated_resolution.y / 2
|
|
||||||
width_px = width * simulated_resolution.x / 4 + simulated_resolution.x / 4
|
|
||||||
height_px = height * simulated_resolution.y / 4 + simulated_resolution.y / 4
|
|
||||||
|
|
||||||
x_left = x_px - width_px / 2
|
|
||||||
x_right = x_px + width_px / 2
|
|
||||||
y_top = y_px - height_px / 2
|
|
||||||
y_bottom = y_px + height_px / 2
|
|
||||||
|
|
||||||
print(x_left) -- 960
|
|
||||||
print(x_right) -- 1920
|
|
||||||
print(y_top) -- 270
|
|
||||||
print(y_bottom) -- 810
|
|
||||||
|
|
||||||
# coords to v2
|
|
||||||
|
|
||||||
local coord1, coord2, x_left, x_right, y_top, y_bottom, width_px, height_px, x_px, y_px, x, y, width, height
|
|
||||||
|
|
||||||
#x_left = 960
|
|
||||||
#x_right = 1920
|
|
||||||
#y_top = 270
|
|
||||||
#y_bottom = 810
|
|
||||||
|
|
||||||
coord1 = v2(1920, 270)
|
|
||||||
coord2 = v2(960, 810)
|
|
||||||
|
|
||||||
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 / 4) / simulated_resolution.x * 4
|
|
||||||
height = (height_px - simulated_resolution.y / 4 ) / simulated_resolution.y * 4
|
|
||||||
|
|
||||||
print(x)
|
|
||||||
print(y)
|
|
||||||
print(width)
|
|
||||||
print(height)
|
|
||||||
|
|
||||||
]]
|
|
||||||
Reference in New Issue
Block a user