Example #1
0
 def __init__(self,
              digits,
              can_grow=False,
              limit=100,
              left_top=(0, 0),
              color=Color.BLACK,
              digit_color=Color.RED):
     self.color = color
     self.digit_color = digit_color
     self.limit = limit
     self.can_grow = can_grow
     self.digits = digits
     self.post_update = False
     self.div = 10 * int('{}{}'.format(
         1, ''.join(['0' for i in range(self.digits - 1)])))
     self.counter = 0
     self.padding = 4
     self.is_visible = True
     self.box = go.Rect(left_top, (0, 0), color=color)
     self.font_info = go.FontInfo(font_size=30, font_color=digit_color)
     self.display_text = go.RenderText(self.get_display_str(),
                                       font_info=self.font_info)
     super().__init__(left_top,
                      default_size=tuple(x + self.padding
                                         for x in self.display_text.size))
Example #2
0
	def __init__(self, name, exclude_list=[], text_color=color.FOREST_GREEN, back_color=color.NAVY_BLUE):
		self.max_width = 0
		self.total_height = 0
		self.max_render_order = 0
		self.map_id_to_object = {}
		self.back_color = back_color
		self.exclude_list = exclude_list
		self.font_info = go.FontInfo('lucidaconsole', 20, text_color)
		self.back_panel = go.Rect(self, (0, 0), (0, 0), self.back_color)
		go.GameObject.__init__(self, name, (0, 0), (0, 0), [self.back_panel], (0, 0), 0)
Example #3
0
 def __init__(self, lbl_str, on_checked=None, left_top=(0, 0)):
     super().__init__()
     self.is_active = False
     self.is_checked = False
     self.on_checked = on_checked
     self.font_style = self.get_style('default_text')
     self.lbl_text = go.RenderText(lbl_str, self.font_style)
     self.check_box = go.BorderedRect(left_top, (10, 10))
     self.fill_box = go.Rect(left_top, (10, 10))
     self.set_size(tuple(x + 10 for x in self.lbl_text.size))
     self.set_position(left_top)
     self.wire_events()
Example #4
0
 def __init__(self, left_top, size, index, is_visible=True, border=2):
     self.cards = []
     self.index = index
     self.border = border
     self.rect = go.Rect(left_top,
                         size,
                         width=self.border,
                         color=Color.BLACK,
                         is_visible=is_visible)
     self.text = go.RenderText(str(self.index))
     self.set_size(size)
     self.set_position(left_top)
Example #5
0
 def __init__(self, controls=[], window_side=WindowSide.LEFT):
     super().__init__()
     self.is_expanded = True
     self.controls = controls
     self.window_side = window_side
     self.sidebar_bck = go.Rect((0, 0), (0, 0))
     self.btn_expand = Button(self.get_btn_txt(),
                              on_click=self.toggle_expand)
     self.min_w, self.min_h = self.min_size = self.btn_expand.size
     self.set_size(self.assay_size())
     self.set_position(self.assay_position())
     self.wire_events()
Example #6
0
 def __init__(self,
              lbl_str,
              left_top=(0, 0),
              on_checked=None,
              is_checked=False,
              color=Color.BLACK,
              checked_color=Color.BLACK):
     self.is_checked = is_checked
     self.color = color
     self.checked_color = checked_color
     self.is_active = False
     self.is_enabled = True
     self.is_visible = True
     self.on_checked = on_checked
     self.font_info = go.FontInfo(font_size=10, font_color=Color.BLACK)
     self.lbl_text = go.RenderText(lbl_str, self.font_info)
     self.check_box = go.Rect(left_top, (10, 10), color=color, width=1)
     self.fill_box = go.Rect(left_top, (10, 10), color=checked_color)
     super().__init__(left_top,
                      default_size=tuple(x + 10
                                         for x in self.lbl_text.size))
     self.wire_events()
Example #7
0
 def __init__(self, window_size, side, controls=[], color=Color.SEA_GREEN):
     self.color = color
     self.is_showing = True
     self.window_side = side
     self.window_width, self.window_height = self.window_size = window_size
     self.btn_show = Button('', on_click=self.on_click_toggle_bar)
     controls.insert(0, self.btn_show)
     self.rect = go.Rect((0, 0), (0, 0), color=self.color)
     self.set_btn_text()
     super().__init__((0, 0),
                      controls=controls,
                      default_size=self.btn_show.size,
                      window_or=self.get_windows_or())
     self.wire_events()
Example #8
0
 def __init__(self,
              title,
              left_top,
              size,
              color=Color.LIGHT_GREY,
              header_color=Color.DEEP_SKY_BLUE):
     super().__init__()
     self.title = title
     self.dragging = False
     self.mouse_pos = (0, 0)
     self.controls = []
     self.fixed_positions = []
     self.title_height = 20
     self.window_border = go.Rect(left_top,
                                  tuple(x + 2 for x in size),
                                  width=1)
     self.window = go.Rect(left_top, size)
     self.lbl_text = go.RenderText(self.title,
                                   self.get_style('default_text'))
     self.header = go.Rect(left_top, size)
     self.line = go.HorizontalLine((0, 0), 0)
     self.set_size(size)
     self.set_position(left_top)
     self.wire_events()
Example #9
0
 def __init__(self,
              btn_str,
              on_click=None,
              left_top=(0, 0),
              color=Color.ALICE_BLUE,
              active_color=Color.RED):
     self.color = color
     self.is_active = False
     self.is_enabled = True
     self.is_visible = True
     self.on_click = on_click
     self.active_color = active_color
     self.btn_font = go.FontInfo(font_size=10, font_color=Color.BLACK)
     self.btn_text = go.RenderText(btn_str, self.btn_font)
     self.rect = go.Rect(left_top, (0, 0), color=self.color)
     super().__init__(left_top, default_size=self.btn_text.size)
     self.wire_events()
Example #10
0
 def __init__(self, card_val, suit, tile_index, is_showing=False):
     self.mouse_pos = (0, 0)
     self.is_selected = False
     self.mw, self.mh = (0, 0)
     self.suit = suit
     self.value = card_val
     self.tile_index = tile_index
     self.is_showing = is_showing
     self.card_str = CARD_VAL_TO_STR[self.value]
     self.suit_char = SUIT_TO_CHAR[suit]
     self.suit_str = SUIT_TO_STR[suit]
     self.suit_color = SUIT_TO_COLOR[suit]
     self.rect = go.Rect((0, 0), (0, 0), is_visible=False)
     self.card_back = pygame.image.load('{0}/{1}'.format(
         Card.SOURCE_FOLDER, Card.CARD_BACK_IMAGE_FILE)).convert()
     self.card_front = pygame.image.load('{0}/card{1}{2}.png'.format(
         Card.SOURCE_FOLDER, self.suit_str, self.card_str)).convert()
     self.wire_events()
Example #11
0
 def __init__(self,
              left_top=(0, 0),
              color=Color.BLACK,
              digit_color=Color.RED):
     self.color = color
     self.digit_color = digit_color
     self.is_visible = True
     self.time = 0
     self.prv_time = 0
     self.padding = 4
     self.is_running = False
     self.font_info = go.FontInfo(font_size=20, font_color=digit_color)
     self.seperator_txt = go.RenderText(':', self.font_info)
     self.seconds_txt = go.RenderText(self.display_format(0),
                                      self.font_info)
     self.minutes_txt = go.RenderText(self.display_format(0),
                                      self.font_info)
     self.hours_txt = go.RenderText(self.display_format(0), self.font_info)
     self.box = go.Rect(left_top, (0, 0), color=color)
     super().__init__(left_top, default_size=self.get_clock_size())
Example #12
0
	def __init__(self, name, center, velocity=(0, 0), block_size=20, color=color.RED, render_order=0):
		object = go.Rect(self, (block_size, block_size), velocity, color)
		go.GameObject.__init__(self, name, center, object.get_bounds(), [object], velocity, render_order)
Example #13
0
	def __init__(self, name, center, velocity=(0, 0), block_size=20, color=color.GREEN, render_order=0):
		object1 = go.Rect(self, (block_size, block_size), velocity, color, 0, (lambda x, y : (x - block_size // 2, y - block_size // 2)))
		object2 = go.Rect(self, (block_size, block_size), velocity, color, 0, (lambda x, y : (x + block_size // 2, y - block_size // 2)))
		object3 = go.Rect(self, (block_size, block_size), velocity, color, 0, (lambda x, y : (x, y + block_size // 2)))
		go.GameObject.__init__(self, name, center, (2 * block_size, 2 * block_size), [object1, object2, object3], velocity, render_order)