def __init__(self, left, top, width, height, _color, text): """Initialisierung eines Buttons""" self.rect = pyRect(left, top, width, height) self.color = _color self.textObj = drawer.createTextObject( drawer.createFont(height), text) self.textX = self.rect.left + int(self.rect.width/2) - int(self.textObj.get_rect().width/2) self.textY = self.rect.top - int( self.textObj.get_rect().height * 0.05 )
def __init__(self, imgPath, name, damageMult, healthMult, player): self.player = player self.name = name self.nameTextObj = drawer.createTextObject( drawer.createFont(int(drawer.DISPLAY_HEIGHT*0.095)), self.name ) self.nameX = int(drawer.DISPLAY_WIDTH / 2 - self.nameTextObj.get_rect().width/2) self.nameY = int(drawer.DISPLAY_HEIGHT * -0.01) self.IMG_stand = loadIMG(imgPath + 'stand.png') self.IMG_ausholen = loadIMG(imgPath + 'ausholen.png') self.IMG_attack = loadIMG(imgPath + 'attack.png') self.centerPos = (drawer.CENTER[0] - int(self.IMG_stand.get_rect().width/2), int(drawer.CENTER[1]*0.35) ) self.attackPos = ( self.centerPos[0], int(self.centerPos[1]*2.1) ) self.curIMG = self.IMG_stand self.curPos = self.centerPos self.posMode = 0 self.clock = 0 self.ausholDuration = 0.5 self.attackDuration = 0.3 self.standDuration = 2 self.damageMult = damageMult self.damage = 10 self.healthMult = healthMult self.maxHealth = 100 self.health = self.maxHealth self.healthbar = Healthbar(self.maxHealth, \ int(drawer.DISPLAY_WIDTH / 2), int(self.centerPos[1] * 0.5 ), \ int(drawer.DISPLAY_WIDTH * 0.7), int(drawer.DISPLAY_HEIGHT*0.05) )
def __init__(self, x, y, width, height, color, value=0): """Erstellt ein Nummernfeld Object""" self.value = str(value) self.selected = False self.rectangle = pyrect(x, y, width, height) self.color = color self.textObj = drawer.createTextObject( drawer.createFont(self.rectangle.height), str(self.value)) self.updateTextObj()
def __init__(self, x, y, text, path): if text.endswith('.pcl'): # Typ Datei self.type = 0 self.childrenOffset = 0 self.children = [] self.text = text[:-4] else: # Typ Ordner self.text = '> ' + text self.type = 1 self.open = False self.path = path + '/' self.textObj = drawer.createTextObject( drawer.createFont(int(drawer.DISPLAY_HEIGHT * 0.05)), self.text) self.x = x self.y = y self.rect = self.textObj.get_rect()
def __init__(self, textList): self.creditObjs = [] self.xs = [] self.ys = [] c = 0 for text in textList: self.creditObjs.append( drawer.createTextObject( drawer.createFont(int(drawer.DISPLAY_HEIGHT / 30)), text)) self.xs.append(drawer.CENTER[0] - int(self.creditObjs[c].get_rect().width / 2)) self.ys.append( int(drawer.DISPLAY_HEIGHT * 0.98) - int(self.creditObjs[c].get_rect().height * (len(textList) - c))) c += 1 pass
def __init__(self, y, numfWidth, numfHeight, description): """Erstelle die Auflösungsoptionen""" self.descriptionObj = drawer.createTextObject( drawer.createFont(numfHeight), description) self.width = int(self.descriptionObj.get_rect().width + numfWidth * 2.1) self.descriptionX = drawer.CENTER[0] - int(self.width / 2) self.widthField = Numfield( self.descriptionX + self.descriptionObj.get_rect().width + int(numfWidth * 0.05), y, numfWidth, numfHeight, (240, 240, 240), drawer.DISPLAY_WIDTH) self.heightField = Numfield( self.descriptionX + self.descriptionObj.get_rect().width + int(numfWidth * 1.1), y, numfWidth, numfHeight, (240, 240, 240), drawer.DISPLAY_HEIGHT) self.rect = pyrect( self.descriptionX, y, self.descriptionObj.get_rect().width + int(numfWidth * 2.1), numfHeight) self.widthField.updateTextObj() self.heightField.updateTextObj()
def updateText(self): """Text des Links updaten""" self.textObj = drawer.createTextObject( drawer.createFont(int(drawer.DISPLAY_HEIGHT * 0.05)), self.text)
def updateTextObj(self): tempTxt = self.value if self.selected: tempTxt += '|' self.textObj = drawer.createTextObject( drawer.createFont(self.rectangle.height), tempTxt)