ball class checks window bounds