def dot(x, y, size=(1, 1), outline_color=Color.RED, outline_thickness=1): d = RectangleShape() d.size = size d.outline_color = outline_color d.outline_thickness = outline_thickness d.x = x d.y = y return d
def dot(x, y, size=(1,1), outline_color = Color.RED, outline_thickness = 1): d = RectangleShape() d.size = size d.outline_color = outline_color d.outline_thickness = outline_thickness d.x = x d.y = y return d
def line(size=(1,1), outline_color = Color.BLACK, x=0, y=0, rotate = 0, outline_thickness = 1): l = RectangleShape() l.size = size l.outline_color = outline_color l.outline_thickness = outline_thickness l.x = x l.y = y if rotate != 0: l.rotate(rotate) return l
def draw(self, view): if Options.NGUI_FOCUS_DEBUG: if self._mouseWithin == True: r = RectangleShape() r.outline_color = Color.RED r.outline_thickness = 3 r.fill_color = Color.TRANSPARENT r.position = (self._ax, self._ay) r.size = (self._w, self._h) view.drawSprite(r) if self._mouseFocus: view.drawLine(Color.RED, (self._ax, self._ay), (self._ax + self._w, self._ay + self._h)) view.drawLine(Color.RED, (self._ax + self._w, self._ay), (self._ax, self._ay + self._h))
def line(size=(1, 1), outline_color=Color.BLACK, x=0, y=0, rotate=0, outline_thickness=1): l = RectangleShape() l.size = size l.outline_color = outline_color l.outline_thickness = outline_thickness l.x = x l.y = y if rotate != 0: l.rotate(rotate) return l
def drawButton(self, view, bacgroundColour, outlineColour, style): r = RectangleShape() r.outline_color = outlineColour r.outline_thickness = 1 r.fill_color = bacgroundColour r.position = (self._ax, self._ay) r.size = (self._w, self._h) view.drawSprite(r) textSprite = TextManager.renderText(self.text, style) rect = textSprite.local_bounds # Needs rect.left and stuff because text local bounds are apparently non-0. # Something to do with text alignment, perhaps? :) textSprite.position = (self._ax + self._w // 2 - (rect.width // 2) - rect.left, self._ay + self._h // 2 - (rect.height // 2) - rect.top) view.drawSprite(textSprite)