diff --git a/UI.py b/UI.py index 7a779d8..a19811d 100644 --- a/UI.py +++ b/UI.py @@ -34,8 +34,9 @@ class GenericUI: if event.type == pygame.MOUSEBUTTONDOWN: mouse_pos = pygame.mouse.get_pos() if self.hold_function and self.collide_at(mouse_pos): - self.hold_function(mouse_pos) - draw_update = True + if event.button == 1: + self.hold_function(mouse_pos) + draw_update = True if event.type == pygame.MOUSEBUTTONUP: mouse_pos = pygame.mouse.get_pos() @@ -273,7 +274,7 @@ class ScrollList(GenericUI): text_rect.width = self.width self.text_rects.append(text_rect) current_y += text_rect.height - self.max_offset = max(0, current_y - self.height - self.outline_thickness) + self.max_offset = max(0, current_y - self.height) self.redraw() self.draw_update.emit() @@ -290,33 +291,29 @@ class CallPanel(GenericUI): self.text_size = 20 margins = 5 - ui_width = 75 + ui_width = 80 ui_height = 25 - width_spacings = (width - 3 * ui_width - 2 * margins) / 4 + width_spacings = (width - 2.5 * ui_width - 2 * margins) / 4 height_spacings = (height - 2 * margins - 3 * ui_height) / 4 self.output_text = ['', ''] - #self.label1 = TextBox(margins+width_spacings, margins, - # ui_width, ui_height, text='List1', text_size=self.text_size) self.list1 = ScrollList(margins+width_spacings, margins, - ui_width, height - 2*margins, - texts=[str(i) for i in range(4)], text_size=self.text_size) + ui_width/2, height - 2*margins, + texts=[str(i) for i in range(20)], text_size=self.text_size) self.list1.list_selected.connect(lambda text, **z: self.print_list_selection(text, 0)) - #self.label2 = TextBox(margins+width_spacings*2+ui_width, margins, - # ui_width, ui_height, text='List2', text_size=self.text_size) - self.list2 = ScrollList(margins+width_spacings*2+ui_width, margins, + self.list2 = ScrollList(margins+width_spacings*2+ui_width/2, margins, ui_width, height - 2*margins, texts=['a', 'b', 'c', 'd'], text_size=self.text_size) self.list2.list_selected.connect(lambda text, **z: self.print_list_selection(text, 1)) - self.output_box = TextBox(margins+width_spacings*3+ui_width*2, margins+height_spacings, + self.output_box = TextBox(margins+width_spacings*3+ui_width*1.5, margins+height_spacings, ui_width, ui_height, text='-', text_size=self.text_size) - self.confirm_button = Button(margins+width_spacings*3+ui_width*2, margins+height_spacings*2+ui_height, + self.confirm_button = Button(margins+width_spacings*3+ui_width*1.5, margins+height_spacings*2+ui_height, ui_width, ui_height, text='Call', text_size=self.text_size) self.confirm_button.clicked.connect(self.emit_output) - self.cancel_button = Button(margins + width_spacings * 3 + ui_width * 2, + self.cancel_button = Button(margins + width_spacings * 3 + ui_width * 1.5, margins + height_spacings * 3 + ui_height * 2, ui_width, ui_height, text='Pass', text_size=self.text_size) diff --git a/main.py b/main.py index 1cc1e00..b26a545 100644 --- a/main.py +++ b/main.py @@ -105,7 +105,7 @@ if __name__ == '__main__': # rng_state = pickle.load(f) #random.setstate(rng_state) - main_view = GameScreen(900, 600, clear_colour=(255, 0, 0), + main_view = GameScreen(800, 600, clear_colour=(255, 0, 0), autoplay=AUTOPLAY, view_all_cards=VIEW_ALL_CARDS) main_view.run() \ No newline at end of file diff --git a/table.py b/table.py index d9bf10b..9c717c2 100644 --- a/table.py +++ b/table.py @@ -85,8 +85,8 @@ class Table: # Prepare the card with dimensions w_deck = min(self.height, self.width) * 0.18 l_deck = min(self.width, self.height) * 0.7 - # This is not a deck as it will never be drawn - self.discard_deck = cards.prepare_playing_cards(int(w_deck*0.7), int(w_deck*0.8)) + # This is not a deck as it will never be draw + self.discard_deck = cards.prepare_playing_cards(int(w_deck*0.6), int(w_deck*0.6 *97/71)) game_margins = 5 # Players' deck positioning @@ -194,7 +194,7 @@ class Table: self.require_player_input = False self.calling_panel = UI.CallPanel(playdeckx[0]+w_deck+5,playdecky[0]+w_deck-100, - 250, 100) + 220, 100) self.calling_panel.parent = self self.calling_panel.visible = False self.parent = None @@ -502,10 +502,14 @@ class Table: self.write_message(msg, line=1, update_now=False) msg = 'Bid Leader: Player {0:d}'.format(self.current_player) self.write_message(msg, line=2, update_now=True) + if self.first_player: self.first_player = False + if player_bid: + self.update_player_bid(self.current_player, player_bid, update_now=False) else: self.update_player_bid(self.current_player, player_bid, update_now=False) + if self.table_status["bid"] < 75: self.current_player += 1 self.current_player %= NUM_OF_PLAYERS