Skip to content

Commit

Permalink
start to use ImageWithText in game.kv
Browse files Browse the repository at this point in the history
  • Loading branch information
LupaDevStudio committed Sep 11, 2023
1 parent 68a77d7 commit 7f613c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 35 deletions.
40 changes: 9 additions & 31 deletions screens/game.kv
Original file line number Diff line number Diff line change
Expand Up @@ -242,49 +242,27 @@
text_color: TEXT_FONT_COLOR

# Decree left
# ImageWithText:
# id: decree_left
# source: PATH_IMAGES + "decree_choice_background.png"
# size_hint: side_img_width, side_img_height
# pos_hint: {"center_x": side_img_center_x, "center_y":side_img_center_y}
# allow_stretch: True
# keep_ratio:False
# text: root.decree_center_text
Image:
id: decree_left_background
ImageWithText:
id: decree_left
source: PATH_IMAGES + "decree_choice_background.png"
size_hint: side_img_width, side_img_height
pos_hint: {"center_x": side_img_center_x, "center_y":side_img_center_y}
allow_stretch: True
keep_ratio:False
Label:
id: decree_left_label
text: root.decree_left_text
size_hint: side_img_width, side_img_height
pos_hint: {"center_x": side_img_center_x, "center_y":side_img_center_y}
font_size: 15*root.font_ratio
font_name: root.font
color: TEXT_FONT_COLOR
shorten: False
text_size: (self.width*text_filling_ratio,None)
text_font: root.font
text_color: TEXT_FONT_COLOR

# Decree right
Image:
id: decree_right_background
ImageWithText:
id: decree_right
source: PATH_IMAGES + "decree_choice_background.png"
size_hint: side_img_width, side_img_height
pos_hint: {"center_x": 1- side_img_center_x, "center_y": side_img_center_y}
pos_hint: {"center_x": 1-side_img_center_x, "center_y":side_img_center_y}
allow_stretch: True
keep_ratio:False
Label:
id: decree_right_label
text: root.decree_right_text
size_hint: side_img_width, side_img_height
pos_hint: {"center_x": 1- side_img_center_x, "center_y": side_img_center_y}
font_size: 15*root.font_ratio
font_name: root.font
color: TEXT_FONT_COLOR
shorten: False
text_size: (self.width*text_filling_ratio,None)
text_font: root.font
text_color: TEXT_FONT_COLOR


3 changes: 0 additions & 3 deletions screens/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,11 @@ class GameScreen(ImprovedScreen):
decree_right_text = StringProperty()
decree_left_text = StringProperty()

font = StringProperty(PATH_TEXT_FONT)

def __init__(self, **kw):
super().__init__(
back_image_path=PATH_IMAGES + "day_camp.png",
font=PATH_TEXT_FONT,
** kw)
self.font = PATH_TEXT_FONT

def on_pre_enter(self, *args):

Expand Down
2 changes: 1 addition & 1 deletion tools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ def change_language(self, language):
### Colors ###
BACKGROUND_COLOR = (0, 0, 0, 1)
TITLE_FONT_COLOR = (0, 0, 0, 1)
TEXT_FONT_COLOR = (50 / 255, 50 / 255, 255 / 255, 1)
TEXT_FONT_COLOR = (50 / 255, 50 / 255, 50 / 255, 1)

0 comments on commit 7f613c7

Please sign in to comment.