diff --git a/resources/DroidSansFallback.ttf b/resources/DroidSansFallback.ttf new file mode 100644 index 0000000..cfbc66a Binary files /dev/null and b/resources/DroidSansFallback.ttf differ diff --git a/resources/freesansbold.ttf b/resources/freesansbold.ttf deleted file mode 100644 index a98562f..0000000 Binary files a/resources/freesansbold.ttf and /dev/null differ diff --git a/source/component/menubar.py b/source/component/menubar.py index 60cd064..61fffd4 100755 --- a/source/component/menubar.py +++ b/source/component/menubar.py @@ -7,8 +7,8 @@ from .. import constants as c def getSunValueImage(sun_value): # for pack, must include ttf - fontPath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),'resources', 'freesansbold.ttf') - font = pg.font.Font(fontPath, 14) + font = pg.font.Font(c.FONT_PATH, 14) + font.bold = True width = 35 msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW) msg_rect = msg_image.get_rect() @@ -188,7 +188,7 @@ class MenuBar(): self.value_image = getSunValueImage(self.sun_value) self.value_rect = self.value_image.get_rect() self.value_rect.x = 21 - self.value_rect.y = self.rect.bottom - 21 + self.value_rect.y = self.rect.bottom - 24 self.image.blit(self.value_image, self.value_rect) @@ -228,7 +228,7 @@ class Panel(): self.value_image = getSunValueImage(sun_value) self.value_rect = self.value_image.get_rect() self.value_rect.x = 21 - self.value_rect.y = self.menu_rect.bottom - 21 + self.value_rect.y = self.menu_rect.bottom - 24 self.button_image = self.loadFrame(c.START_BUTTON) self.button_rect = self.button_image.get_rect() diff --git a/source/constants.py b/source/constants.py index 081db46..77deab2 100755 --- a/source/constants.py +++ b/source/constants.py @@ -22,6 +22,9 @@ SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 SCREEN_SIZE = (SCREEN_WIDTH, SCREEN_HEIGHT) +# 字体路径 +FONT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)),'resources', 'DroidSansFallback.ttf') + # 选卡数量 # 最大数量 CARD_MAX_NUM = 10 # 这里以后可以增加解锁功能,从最初的6格逐渐解锁到10格