local screen = EngineClient.GetScreenSize()
local item = {0, 0, 0}
local imgs = {
{ size = Vector2.new(100,100),
obj = Render.LoadImageFromFile("johv_otsosi.png", self.size) },
{ size = Vector2.new(200, 200),
obj = Render.LoadImageFromFile("jestempijanymturysta.png", self.size) }
}
local elems = {
combo = Menu.Combo("Fakemenu", "Cheat menu", {"otsosi", "jestempijanymturysta"}, 1)
bind = Menu.Switch("Fakemenu", "Open menu", false),
x = Menu.SliderInt("Fakemenu", "X", 10, 1, screen.x),
y = Menu.SliderInt("Fakemenu", "Y", 10, 1, screen.y)
}
local function drag(x, y, width, height, xmenu, ymenu, item)
local cursor = Cheat.GetMousePos()
if (cursor.x >= x) and (cursor.x <= x + width) and (cursor.y >= y) and (cursor.y <= y + height) then
if Cheat.IsKeyDown(1) and item[1] == 0 then
item[1] = 1
item[2] = x - cursor.x
item[3] = y - cursor.y
end
end
if not Cheat.IsKeyDown(1) then item[1] = 0 end
if item[1] == 1 and Cheat.IsMenuVisible() then
xmenu:Set(cursor.x + item[2])
ymenu:Set(cursor.y + item[3])
end
end
local function render_img(array, pos)
Render.Image(array.obj, pos, array.size)
end
local function renderer()
local x, y = elems.x:GetInt(), elems.y:GetInt()
local img = elems.combo:Get()
local size = imgs[img].size
if elems.bind:Get() then
render_img(imgs[elems.combo:Get()], Vector2.new(x, y))
drag(x, y, size.x, size.y, elems.x, elems.y, item)
end
end
Cheat.RegisterCallback("draw", renderer)