es ist nicht ganze die antwort auf deine frage, aber man kann koordinaten automatisch für das fenster umwandeln. dazu das folgende script:
("maus_atelier" durch den namen deines projektes ersetzen)
Code:
$getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')

class Mouse_Coordinates

  attr_reader :x
  attr_reader :y

  def initialize
    @scr2cli = Win32API.new("user32", "ScreenToClient", "lp", "i")
    @findwindow = Win32API.new("user32", "FindWindowA", "pp", "l")
    @x,@y = screen_to_client(get_pos)
  end

  def update
    @x,@y = screen_to_client(get_pos)
  end

  def get_pos
    lpPoint = " " * 8 # store two LONGs
    $getCursorPos.Call(lpPoint)
    return lpPoint.unpack("LL") # get the actual values
  end
  
  def screen_to_client(pos)
    pos = pos.pack('ll')
    if @scr2cli.call(hwnd, pos) != 0
      return pos.unpack('ll')
    else
      return [-1,-1]
    end
  end
  
  def hwnd
    return @findwindow.call("RGSS Player","maus_atelier")
  end
end