Example #1
0
    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)
Example #2
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
Example #3
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
Example #4
0
    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)