added 'button_genetic_algorithm' button

This commit is contained in:
Jakub R 2021-06-16 13:57:15 +02:00
parent bec9e14c93
commit 39dbd5a5aa

25
game.py
View File

@ -44,6 +44,7 @@ class Game:
self.input_box_row = InputBox((0, 0), (0, 0))
self.input_box_column = InputBox((0, 0), (0, 0))
self.button_auto = Button((0, 0), (0, 0))
self.button_genetic_algorithm = Button((0, 0), (0, 0))
self.button_random = Button((0, 0), (0, 0))
self.button_ok = Button((0, 0), (0, 0))
@ -217,7 +218,7 @@ class Game:
gui_width = const.V_SIDE_MENU_WIDTH
ib_height, bt_height = const.V_INPUT_BOX_HEIGHT, const.V_BUTTON_HEIGHT
gui_x = const.V_TILE_AREA_WIDTH + 2 * const.V_SCREEN_PADDING + const.V_NUMBER_PADDING
gui_y = const.SCREEN.get_height() / 2 - (2 * ib_height + 2 * bt_height + 30) / 2
gui_y = const.SCREEN.get_height() / 2 - (2 * ib_height + 3 * bt_height + 50) / 2
# creating in game gui components
self.input_box_row = InputBox(
@ -257,9 +258,18 @@ class Game:
outline_additional_pixel=True
)
self.button_random = Button(
self.button_genetic_algorithm = Button(
position=(gui_x, gui_y + 2 * ib_height + bt_height + 30),
dimensions=(gui_width, bt_height),
text="genetic",
box_color=(100, 200, 100),
outline_color=(80, 180, 80),
outline_additional_pixel=True
)
self.button_random = Button(
position=(gui_x, gui_y + 2 * ib_height + 2 * bt_height + 40),
dimensions=(gui_width, bt_height),
text="random",
box_color=(100, 200, 100),
outline_color=(80, 180, 80),
@ -267,7 +277,7 @@ class Game:
)
self.button_ok = Button(
position=(gui_x, gui_y + 2 * ib_height + 2 * bt_height + 40),
position=(gui_x, gui_y + 2 * ib_height + 3 * bt_height + 50),
dimensions=(gui_width, bt_height),
text="ok",
box_color=(100, 200, 100),
@ -275,7 +285,14 @@ class Game:
outline_additional_pixel=True
)
gui_list = [self.input_box_row, self.input_box_column, self.button_auto, self.button_random, self.button_ok]
gui_list = [
self.input_box_row,
self.input_box_column,
self.button_auto,
self.button_genetic_algorithm,
self.button_random,
self.button_ok
]
self.in_game_gui_components_manager = UiComponentsManager(gui_list)
# creating game over gui components