def __init__(self, stage, section): """ :param stage: the rockmeter stage :param section: the section of rockmeter.ini involving this layer """ super(Layer, self).__init__() # init vars self.stage = stage # the rockmeter self.engine = stage.engine # the 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) # init color vars if self.config.has_option(section, "color"): # color of the image (#FFFFFF is white on text, on images it is full color) self.color = list(hexToColor(self.get("color", str, "#FFFFFF"))) if len(self.color) == 3: self.color.append(1.0) self.r, self.g, self.b, self.a = [str(c) for c in self.color] else: self.r = self.getexpr("r", "1.0") self.g = self.getexpr("g", "1.0") self.b = self.getexpr("b", "1.0") self.a = self.getexpr("a", "1.0") self.color = [1.0, 1.0, 1.0, 1.0] self.shared = False # determines if the element is shared between players in multiplayer modes self.condition = True # when should the image be shown (by default it will always be shown) # alignment of the image (horizontal) self.alignExpr = self.get("alignment", str, "center") self.alignment = CENTER # alignment of the image (vertical) self.valignExpr = self.get("valignment", str, "middle") self.valignment = MIDDLE # makes sure to properly scale/position the images in pixels instead of percent self.inPixels = self.get("inPixels", str, "").split("|") self.effects = [] # various effects associated with the layer
def __init__(self, layer, section): super(Fade, self).__init__(layer, section) #starting color color = list(hexToColor(self.get("color", str, "#FFFFFF"))) self.start = list(color) if len(self.start) == 3: self.start.append(1.0) #the color to fade to self.end = list(hexToColor(self.get("fadeTo", str, "#FFFFFF"))) #makes sure alpha is added if len(self.end) == 3: color.append(1.0) #the current color of the image self.current = self.start[:] self.transitionTime = self.get("transitionTime", float, 512.0) self.transitionTimeOut = self.get("transitionTimeOut", float, self.transitionTime) self.condition = self.getexpr("condition", "True") self.reverse = bool(eval(self.getexpr("reverse", "True")))
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) if self.config.has_option(section, "color"): #color of the image (#FFFFFF is white on text, on images it is full color) self.color = list(hexToColor(self.get("color", str, "#FFFFFF"))) if len(self.color) == 3: self.color.append(1.0) self.r, self.g, self.b, self.a = [str(c) for c in self.color] else: self.r = self.getexpr("r", "1.0") self.g = self.getexpr("g", "1.0") self.b = self.getexpr("b", "1.0") self.a = self.getexpr("a", "1.0") self.color = [1.0,1.0,1.0,1.0] self.shared = False #determines if the element is shared between players in multiplayer modes self.condition = True #when should the image be shown (by default it will always be shown) self.alignExpr = self.get("alignment", str, "center") self.alignment = CENTER #alignment of the image (horizontal) self.valignExpr = self.get("valignment", str, "middle") self.valignment = 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