Skip to content

Commit 2a0e788

Browse files
Connect4: move controls to the bottom
1 parent dac9648 commit 2a0e788

File tree

1 file changed

+8
-8
lines changed
  • internal_filesystem/apps/com.micropythonos.connect4/assets

1 file changed

+8
-8
lines changed

internal_filesystem/apps/com.micropythonos.connect4/assets/connect4.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,31 +69,31 @@ def onCreate(self):
6969
self.SCREEN_HEIGHT = d.get_vertical_resolution()
7070

7171
# Calculate scaling based on available space
72-
available_height = self.SCREEN_HEIGHT - 40 # Leave space for top bar only
72+
available_height = self.SCREEN_HEIGHT - 40 # Leave space for bottom bar only
7373
max_cell_size = min(available_height // self.ROWS, (self.SCREEN_WIDTH - 20) // self.COLS)
7474
self.CELL_SIZE = max_cell_size
7575
self.PIECE_RADIUS = int(self.CELL_SIZE * 0.4)
76-
self.BOARD_TOP = 35
76+
self.BOARD_TOP = 5
7777

78-
# Status label (top left)
78+
# Status label (bottom left)
7979
self.status_label = lv.label(self.screen)
8080
self.status_label.set_text("Your turn!")
81-
self.status_label.set_pos(5, 10)
81+
self.status_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -8)
8282

83-
# Difficulty button (top center)
83+
# Difficulty button (bottom center)
8484
difficulty_btn = lv.button(self.screen)
8585
difficulty_btn.set_size(70, 26)
86-
difficulty_btn.align(lv.ALIGN.TOP_MID, 0, 5)
86+
difficulty_btn.align(lv.ALIGN.BOTTOM_MID, 0, -5)
8787
difficulty_btn.add_event_cb(self.cycle_difficulty, lv.EVENT.CLICKED, None)
8888

8989
self.difficulty_label = lv.label(difficulty_btn)
9090
self.difficulty_label.set_text("Easy")
9191
self.difficulty_label.center()
9292

93-
# New Game button (top right)
93+
# New Game button (bottom right)
9494
new_game_btn = lv.button(self.screen)
9595
new_game_btn.set_size(70, 26)
96-
new_game_btn.align(lv.ALIGN.TOP_RIGHT, -5, 5)
96+
new_game_btn.align(lv.ALIGN.BOTTOM_RIGHT, -5, -5)
9797
new_game_btn.add_event_cb(lambda e: self.new_game(), lv.EVENT.CLICKED, None)
9898
new_game_label = lv.label(new_game_btn)
9999
new_game_label.set_text("New")

0 commit comments

Comments
 (0)