Ejemplo n.º 1
0
    def _create_Lines(self):

        self._columns = []
        for x in range(self.tile_w + 1):
            r = RectangleShape((1, self.h))
            r.fill_color = self.color
            r.position = self.x + (TILE * x), self.y
            self._columns.append(r)

        self._rows = []
        for y in range(self.tile_h + 1):
            r = RectangleShape((self.w, 1))
            r.fill_color = self.color
            r.position = self.x, self.y + (TILE * y)
            self._rows.append(r)
Ejemplo n.º 2
0
	def _create_Lines(self):
		
		self._columns = []
		for x in range(self.tile_w+1):
			r = RectangleShape((1,self.h))
			r.fill_color = self.color
			r.position = self.x+(TILE*x), self.y
			self._columns.append(r)

		self._rows = []
		for y in range(self.tile_h+1):
			r = RectangleShape((self.w,1))
			r.fill_color = self.color
			r.position = self.x, self.y+(TILE*y)
			self._rows.append(r)
Ejemplo n.º 3
0
		def _create_highlight(self): #init, controls
			
			#Find the position of the current box.
			char = self().character

			x, y = 0,0
			if char in Text_Ref.characters.upper():
				x =Text_Ref.characters.upper().index(char)
				y = 0
			if char in Text_Ref.characters:
				x = Text_Ref.characters.index(char)
				y = 1
			if char in Text_Ref.grammar:
				x = Text_Ref.grammar.index(char)
				y = 2
			if char in Text_Ref.numbers:
				x = Text_Ref.numbers.index(char)
				y = 3

			#Highlight it
			w,h = 8,12
			highlight = RectangleShape((w,h))
			highlight.position = w*x, h*y
			highlight.fill_color = Color(100,100,100,100)
			self.highlight = highlight
Ejemplo n.º 4
0
		def render(self): #draw
			box = RectangleShape(self.size)
			box.position = self.position
			box.outline_thickness = 1
			box.outline_color = Color(255,0,0,100)
			box.fill_color = Color(0,0,0,10)
			self.box = box
Ejemplo n.º 5
0
 def render(self):  #draw
     box = RectangleShape(self.size)
     box.position = self.position
     box.outline_thickness = 1
     box.outline_color = Color(255, 0, 0, 100)
     box.fill_color = Color(0, 0, 0, 10)
     self.box = box
Ejemplo n.º 6
0
        def _create_highlight(self):  #init, controls

            #Find the position of the current box.
            char = self().character

            x, y = 0, 0
            if char in Text_Ref.characters.upper():
                x = Text_Ref.characters.upper().index(char)
                y = 0
            if char in Text_Ref.characters:
                x = Text_Ref.characters.index(char)
                y = 1
            if char in Text_Ref.grammar:
                x = Text_Ref.grammar.index(char)
                y = 2
            if char in Text_Ref.numbers:
                x = Text_Ref.numbers.index(char)
                y = 3

            #Highlight it
            w, h = 8, 12
            highlight = RectangleShape((w, h))
            highlight.position = w * x, h * y
            highlight.fill_color = Color(100, 100, 100, 100)
            self.highlight = highlight
Ejemplo n.º 7
0
 def box(self):  #draw
     size = self.w, self.h + self.rise
     b = RectangleShape(size)
     b.position = self.x, self.y - self.rise_offset
     b.outline_thickness = 1
     b.outline_color = self.box_outline
     b.fill_color = self.box_fill
     return b
Ejemplo n.º 8
0
	def box(self): #draw
		size = self.w, self.h+self.rise
		b = RectangleShape(size)
		b.position = self.x, self.y-self.rise_offset
		b.outline_thickness = 1
		b.outline_color = self.box_outline
		b.fill_color = self.box_fill
		return b
Ejemplo n.º 9
0
 def draw(self, view):
   if self.dragRect == None:
     return
   sprite = RectangleShape(self.dragRect.size)
   sprite.position = self.dragRect.position
   sprite.fill_color = Color.TRANSPARENT
   sprite.outline_color = Color.RED
   sprite.outline_thickness = 0.1
   view.drawList[SelectionController.DRAG_RECT_LAYER].append(sprite)
Ejemplo n.º 10
0
 def _create_box_shading(self):  #_create_box
     w = self.w
     x, y = self.x, self.y2 - 2
     #
     Box_shading = RectangleShape((w, 2))
     Box_shading.fill_color = Color(150, 150, 150)
     Box_shading.position = x, y
     #
     self.Box_shading = Box_shading
Ejemplo n.º 11
0
    def _create_Lines(self):  #init

        self._columns = []
        for x in range(self.tile_w + 1):
            w = 1
            if x == 0 or x == self.tile_w: w = 5
            r = RectangleShape((w, self.h))
            r.fill_color = self.color
            r.position = self.x + (TILE * x) - (w / 2), self.y
            self._columns.append(r)

        self._rows = []
        for y in range(self.tile_h + 1):
            h = 1
            if y == 0 or y == self.tile_h: h = 5
            r = RectangleShape((self.w, h))
            r.fill_color = self.color
            r.position = self.x, self.y + (TILE * y) - (h / 2)
            self._rows.append(r)
Ejemplo n.º 12
0
	def _create_Lines(self): #init
		
		self._columns = []
		for x in range(self.tile_w+1):
			w = 1
			if x == 0 or x == self.tile_w: w = 5
			r = RectangleShape((w,self.h))
			r.fill_color = self.color
			r.position = self.x+(TILE*x)-(w/2), self.y
			self._columns.append(r)

		self._rows = []
		for y in range(self.tile_h+1):
			h = 1
			if y == 0 or y == self.tile_h: h = 5
			r = RectangleShape((self.w,h))
			r.fill_color = self.color
			r.position = self.x, self.y+(TILE*y)-(h/2)
			self._rows.append(r)
Ejemplo n.º 13
0
 def _create_box(self):  #draw
     size = self.size
     position = self.position
     #
     Box = RectangleShape(size)
     Box.position = position
     Box.fill_color = Color(255, 255, 255)
     Box.outline_color = Color(0, 0, 0)
     Box.outline_thickness = 1
     #
     self.Box = Box
     #
     self._create_box_shading()
Ejemplo n.º 14
0
 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))
Ejemplo n.º 15
0
  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)
Ejemplo n.º 16
0
 def shadow(self):  #draw
     w, h = self.size
     b = RectangleShape((w, self.rise))
     b.position = self.x, self.y2
     b.fill_color = Color(0, 0, 0, 255)
     return b
Ejemplo n.º 17
0
	def shadow(self): #draw
		w,h = self.size
		b = RectangleShape((w,self.rise))
		b.position = self.x, self.y2
		b.fill_color = Color(0,0,0,255)
		return b