local function translate(window, x, y) local winX, winY = window.getPosition() return x-winX+1, y-winY+1 end local function contains(window, x, y) local winX, winY = window.getPosition() local width, height = window.getSize() return x >= winX and y >= winY and x-winX < width and y-winY < height end return { translate=translate, contains=contains, }