def __init__(self, stage, section): self.stage = stage #The rockmeter self.engine = stage.engine #Game Engine self.config = stage.config #the rockmeter.ini self.section = section #the section of the rockmeter.ini involving this layer self.xposexpr = self.getexpr("xpos", "0.0") self.yposexpr = self.getexpr("ypos", "0.0") self.position = [0.0, 0.0] #where on the screen to draw the layer self.angleexpr = self.getexpr("angle", "0.0") self.angle = 0.0 #angle to rotate the layer (in degrees) self.xscaleexpr = self.getexpr("xscale", "1.0") self.yscaleexpr = self.getexpr("yscale", "1.0") self.scale = [1.0, 1.0] #how much to scale it by (width, height from 0.0 - 1.0) self.color = list(self.engine.theme.hexToColor(self.get("color", str, "#FFFFFF"))) #color of the image (#FFFFFF is white on text, on images it is full color) self.condition = True #when should the image be shown (by default it will always be shown) self.alignment = halign(self.get("alignment", str, "center")) #alignment of the image (horizontal) self.valignment = valign(self.get("valignment", str, "middle")) #alignment of the image (vertical) self.inPixels = self.get("inPixels", str, "").split("|") #makes sure to properly scale/position the images in pixels instead of percent self.effects = [] #various effects associated with the layer
def __init__(self, stage, section, font): super(FontLayer, self).__init__(stage, section) self.font = self.engine.data.fontDict[font] self.text = "" self.textexpr = self.getexpr("text", "''") self.replace = "" self.alignment = halign(self.get("alignment", str, "LEFT"), 'left') self.useComma = self.get("useComma", bool, False) self.shadow = self.get("shadow", bool, False) self.outline = self.get("outline", bool, False)
def updateLayer(self, playerNum): self.position = [float(eval(self.xposexpr)), float(eval(self.yposexpr))] self.angle = float(eval(self.angleexpr)) self.scale = [float(eval(self.xscaleexpr)), float(eval(self.yscaleexpr))] self.color = [float(eval(self.r)), float(eval(self.g)), float(eval(self.b)), float(eval(self.a))] self.alignment = halign(self.alignExpr) self.valignment = valign(self.valignExpr) #makes sure color has an alpha value to consider if len(self.color) == 3: self.color.append(1.0)
def __init__(self, stage, section, font): super(FontLayer, self).__init__(stage, section) self.font = self.engine.data.fontDict[font] #the font to use self.text = "" #the text that will be rendered to screen self.textexpr = self.getexpr("text", "''") #the text from the ini that will be evalutated self.replace = [r.strip() for r in self.get("replace", str, "_").split("_")[:2]] #replace character a character in the string with this self.alignment = halign(self.get("alignment", str, "LEFT"), 'left') #alignment of the text self.useComma = self.get("useComma", bool, False) #use commas when drawing numbers self.shadow = self.get("shadow", bool, False) #show a shadow on the text self.outline = self.get("outline", bool, False) #give the text an outline self.shadowOpacity = self.get("shadowOpacity", float, 1.0) #the opacity of the shadow on the text
def __init__(self, stage, section, font): super(FontLayer, self).__init__(stage, section) self.font = self.engine.data.fontDict[font] #the font to use self.text = "" #the text that will be rendered to screen self.textexpr = self.getexpr( "text", "''") #the text from the ini that will be evalutated self.replace = [ r.strip() for r in self.get("replace", str, "_").split("_")[:2] ] #replace character a character in the string with this self.alignment = halign(self.get("alignment", str, "LEFT"), 'left') #alignment of the text self.useComma = self.get("useComma", bool, False) #use commas when drawing numbers self.shadow = self.get("shadow", bool, False) #show a shadow on the text self.outline = self.get("outline", bool, False) #give the text an outline self.shadowOpacity = self.get( "shadowOpacity", float, 1.0) #the opacity of the shadow on the text
def updateLayer(self, playerNum): self.position = [ float(eval(self.xposexpr)), float(eval(self.yposexpr)) ] self.angle = float(eval(self.angleexpr)) self.scale = [ float(eval(self.xscaleexpr)), float(eval(self.yscaleexpr)) ] self.color = [ float(eval(self.r)), float(eval(self.g)), float(eval(self.b)), float(eval(self.a)) ] self.alignment = halign(self.alignExpr) self.valignment = valign(self.valignExpr) #makes sure color has an alpha value to consider if len(self.color) == 3: self.color.append(1.0)