def checkConstants(gameWin): x1,y1,x2,y2 = findColorArea(gameWin, constants['healthbarColor'], 1) if constants['healthbar'] != (x1,y1,x2,y2): print "healthbar wrong" x1,y1,x2,y2 = findColorArea(gameWin, constants['manabarColor'], 1) if constants['manabar'] != (x1,y1,x2,y2): print "manabar wrong"
def findGameArea(win): print "searching area" # favicons often have the same color, but are smaller in size # so ignore this line startX=0 x1=0 x2=0 while abs(x1-x2) < 200: x1, y1, x2, y2 = findColorArea(win, 0x333333, 1, startX) if x1 == -1: return None startX=x1+5 return SubWindow(win, x1, y1, abs(y1-y2), abs(x1-x2))
def findWindow(self, window, color): x1,y1,x2,y2 = findColorArea(window, color, 1) return (x1,y1,x2,y2)