Beispiel #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))
Beispiel #2
0
 def creat_suit_emblem(self):
     for suit in SUITS:
         font_info = go.FontInfo(font_size=self.font_size,
                                 font_color=SUIT_TO_COLOR[suit],
                                 font_name=Card.SUIT_FONT)
         self.foundation_suit_texts.append(
             go.RenderText(SUIT_TO_CHAR[suit], font_info=font_info))
Beispiel #3
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)
Beispiel #4
0
 def __init__(self, *args, **kargs):
     self.foundation_suit_texts = []
     super().__init__(*args, **kargs)
     self.first_card = None
     self.font_size = 30
     font_info = go.FontInfo(font_size=self.font_size,
                             font_name=Card.SUIT_FONT,
                             font_color=Color.BLACK)
     self.card_value_text_top = go.RenderText('',
                                              is_visible=False,
                                              font_info=font_info)
     self.card_value_text_bottom = go.RenderText('',
                                                 is_visible=False,
                                                 font_info=font_info)
     self.creat_suit_emblem()
     self.wire_events()
Beispiel #5
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()
Beispiel #6
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())
Beispiel #7
0
 def __init__(self):
     pygame.init()
     self.w, self.h = self.size = imp.IMP().screen.size
     self.elapsed = 1
     self.is_win = False
     self.previous = None
     self.is_paused = True
     self.SEC_PER_FRAME = 1 / 60
     self.center = tuple(x // 2 for x in self.size)
     self.title = imp.IMP().config.try_get('GAME_NAME', 'Default Name')
     self.card_table = cards.CardTable(
         (0, 0),
         self.size,
         margins=imp.IMP().config.try_get('CARD_TABLE_MARGINS', (0, 0)))
     self.pause_text = go.RenderText('Paused!',
                                     font_info=go.FontInfo(60, Color.BLUE),
                                     is_visible=False)
     self.pause_text.center_on(self.center)
     self.create_side_bars()
     self.wire_events()
     self.set_title()
Beispiel #8
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()
Beispiel #9
0
	def __init__(self, name, text_str='', center=(0,0), velocity=(0, 0), color=color.WHITE, render_order=0):
		object = go.RenderText(self, text_str, go.FontInfo('lucidaconsole', 20, color), velocity)
		go.GameObject.__init__(self, name, center, object.get_bounds(), [object], velocity, render_order)