Skip to content

Commit

Permalink
settings menu reworked
Browse files Browse the repository at this point in the history
  • Loading branch information
karastoyanov committed Jul 25, 2023
1 parent 7660585 commit ee0266d
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 74 deletions.
7 changes: 6 additions & 1 deletion gui/main_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def __init__(self):
self.setMaximumHeight(500)

"""BACKGROUND PICTURE"""

bg_image_groupbox = QGroupBox()
bg_image_groupbox.setProperty("class", "background")

"""ADD CUSTOM FONTS"""
font = QFontDatabase.addApplicationFont(r'../fonts/American Captain.ttf')
Expand Down Expand Up @@ -118,14 +119,18 @@ def __init__(self):


main_layout = QVBoxLayout()



main_layout.addStretch(2)
main_layout.addSpacing(10)
main_layout.addLayout(gold_layout)
main_layout.addLayout(rank_layout)
main_layout.addLayout(main_buttons_layout)
main_layout.setProperty("class", "main_menu")
bg_image_groupbox.setLayout(main_layout)
self.setLayout(main_layout)

self.show()

def start_game_button_func(self):
Expand Down
35 changes: 19 additions & 16 deletions gui/main_menu.qss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
QPushButton{
background-color: #004d1a;

.planes {
background-color: #56ba77;
color: #bfbfbf;
border-radius: 4px;
border-radius: 10px;
border: 1px solid #bfbfbf;
border-bottom: 4px solid #000000;
border-right: 4px solid #000000;
Expand All @@ -10,15 +11,19 @@ QPushButton{
outline: 0px;
}

QPushButton:hover{
background-color: #017227;
color: #000000;
.planes:hover {
background-color: #7fd49b;

}

}.planes{
background-color: #56ba77;
.background {
background-image: url(../images/menu/main_menu_background2.jpg);
}

QPushButton {
background-color: #004d1a;
color: #bfbfbf;
border-radius: 10px;
border-radius: 4px;
border: 1px solid #bfbfbf;
border-bottom: 4px solid #000000;
border-right: 4px solid #000000;
Expand All @@ -27,12 +32,13 @@ QPushButton:hover{
outline: 0px;
}

.planes:hover{
background-color: #7fd49b;

QPushButton:hover {
background-color: #017227;
color: #000000;
}

QGroupBox{

QGroupBox {
color: #004d1a;
border: 2px solid #000000;
border-radius: 4px;
Expand All @@ -49,6 +55,3 @@ QGroupBox::title {
color: #000000;
}

/* QWidget {
background-image: url(../images/menu/main_menu_background2.jpg);
} */
107 changes: 51 additions & 56 deletions gui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,87 +38,82 @@ def __init__(self):
print('Error loading fonts!')
fonts = QFontDatabase.applicationFontFamilies(font)

"""FPS CONTROLS"""
fps_layout = QHBoxLayout()
fps_layout.addStretch()
fps_layout.addSpacing(10)
fps_layout.setSpacing(150)
"""MAIN HORIZONTAL LAYOUT"""
main_horizontal_layout = QHBoxLayout()
main_horizontal_layout.addStretch()
main_horizontal_layout.addSpacing(-250)
# main_horizontal_layout.setAlignment(Qt.AlignCenter)

"""LEFT VERTICAL LAYOUT"""
left_vertrical_layout = QVBoxLayout()
left_vertrical_layout.setAlignment(Qt.AlignCenter)

fps_label = QLabel()
fps_label.setText('FPS')
fps_label.setFont(QFont(fonts[0], 20))
# fps_label.setAlignment(Qt.AlignRight)
fps_label.setAlignment(Qt.AlignCenter)

music_vol_label = QLabel()
music_vol_label.setText("Music Volume")
music_vol_label.setFont(QFont(fonts[0], 20))
music_vol_label.setAlignment(Qt.AlignCenter)

effects_vol_label = QLabel()
effects_vol_label.setText("Effects Volume")
effects_vol_label.setFont(QFont(fonts[0], 20))
effects_vol_label.setAlignment(Qt.AlignCenter)

user_name_label = QLabel()
user_name_label.setAlignment(Qt.AlignCenter)
user_name_label.setText("Username")
user_name_label.setFont(QFont(fonts[0], 20))

left_vertrical_layout.addWidget(fps_label)
left_vertrical_layout.addWidget(music_vol_label)
left_vertrical_layout.addWidget(effects_vol_label)
left_vertrical_layout.addWidget(user_name_label)

"""RIGHT VERTICAL LAYOUT"""
right_vertrical_layout = QVBoxLayout()
right_vertrical_layout.setAlignment(Qt.AlignCenter)

fps_menu = QComboBox()
fps_menu.addItems(["45", "60", "75"])
fps_menu.setFont(QFont(fonts[0], 20))
fps_menu.setFixedSize(70, 40)

fps_layout.addWidget(fps_label)
fps_layout.addWidget(fps_menu)
# fps_layout.setAlignment(Qt.AlignCenter)
fps_layout.addStretch()
fps_layout.addSpacing(10)
fps_layout.setSpacing(150)

"""MUSIC VOLUME CONTROLS"""
music_vol_layout = QHBoxLayout()
music_vol_layout.addStretch()
music_vol_layout.addSpacing(20)
music_vol_layout.setSpacing(97)
fps_menu.setFixedSize(70, 30)

music_vol_label = QLabel()
music_vol_label.setText("Music Volume")
music_vol_label.setFont(QFont(fonts[0], 20))
music_vol_label.setAlignment(Qt.AlignCenter)

music_vol_slider = QSlider(Qt.Horizontal)
music_vol_slider.setTickInterval(20)
music_vol_slider.setFocusPolicy(Qt.StrongFocus)
music_vol_slider.setTickPosition(QSlider.TicksBothSides)
music_vol_slider.setSingleStep(1)
music_vol_slider.setFixedWidth(200)

music_vol_layout.addWidget(music_vol_label)
music_vol_layout.addWidget(music_vol_slider)
music_vol_layout.setAlignment(Qt.AlignCenter)
music_vol_layout.addStretch()
music_vol_layout.addSpacing(20)
music_vol_layout.setSpacing(97)

"""EFFECTS VOLUME CONTROLS"""
effects_vol_layout = QHBoxLayout()
effects_vol_layout.addStretch()
effects_vol_layout.addSpacing(20)
effects_vol_layout.setSpacing(80)

effects_vol_label = QLabel()
effects_vol_label.setText("Effects Volume")
effects_vol_label.setFont(QFont(fonts[0], 20))
effects_vol_label.setAlignment(Qt.AlignCenter)


effects_vol_slider = QSlider(Qt.Horizontal)
effects_vol_slider.setTickInterval(20)
effects_vol_slider.setFocusPolicy(Qt.StrongFocus)
effects_vol_slider.setTickPosition(QSlider.TicksBothSides)
effects_vol_slider.setSingleStep(1)
effects_vol_slider.setFixedWidth(200)

user_name_textbox = QLineEdit()
user_name_textbox.setFont(QFont(fonts[0], 20))
user_name_textbox.setFixedSize(200, 40)
user_name_textbox.setAlignment(Qt.AlignCenter)

right_vertrical_layout.addWidget(fps_menu)
right_vertrical_layout.addWidget(music_vol_slider)
right_vertrical_layout.addWidget(effects_vol_slider)
right_vertrical_layout.addWidget(user_name_textbox)

effects_vol_layout.addWidget(effects_vol_label)
effects_vol_layout.addWidget(effects_vol_slider)
effects_vol_layout.setAlignment(Qt.AlignCenter)
effects_vol_layout.addStretch()
effects_vol_layout.addSpacing(20)

main_horizontal_layout.addLayout(left_vertrical_layout)
main_horizontal_layout.addLayout(right_vertrical_layout)


main_layout = QVBoxLayout()
main_layout.addStretch(0)
main_layout.addSpacing(100)
main_layout.addLayout(fps_layout)
main_layout.addLayout(music_vol_layout)
main_layout.addLayout(effects_vol_layout)
main_layout.addStretch(0)
main_layout.addSpacing(100)
# main_layout.setAlignment(Qt.AlignCenter)
main_layout.addLayout(main_horizontal_layout)
self.setLayout(main_layout)
self.show()

Expand Down
Binary file modified images/user_plane_images/user_plane_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/user_plane_images/user_plane_template.pixil

Large diffs are not rendered by default.

0 comments on commit ee0266d

Please sign in to comment.