预加入中文显示支持

This commit is contained in:
wszqkzqk 2022-07-27 23:17:19 +08:00
parent d227a28452
commit 14326d8194
4 changed files with 7 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View File

@ -7,8 +7,8 @@ from .. import constants as c
def getSunValueImage(sun_value): def getSunValueImage(sun_value):
# for pack, must include ttf # 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(c.FONT_PATH, 14)
font = pg.font.Font(fontPath, 14) font.bold = True
width = 35 width = 35
msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW) msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW)
msg_rect = msg_image.get_rect() msg_rect = msg_image.get_rect()
@ -188,7 +188,7 @@ class MenuBar():
self.value_image = getSunValueImage(self.sun_value) self.value_image = getSunValueImage(self.sun_value)
self.value_rect = self.value_image.get_rect() self.value_rect = self.value_image.get_rect()
self.value_rect.x = 21 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) self.image.blit(self.value_image, self.value_rect)
@ -228,7 +228,7 @@ class Panel():
self.value_image = getSunValueImage(sun_value) self.value_image = getSunValueImage(sun_value)
self.value_rect = self.value_image.get_rect() self.value_rect = self.value_image.get_rect()
self.value_rect.x = 21 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_image = self.loadFrame(c.START_BUTTON)
self.button_rect = self.button_image.get_rect() self.button_rect = self.button_image.get_rect()

View File

@ -22,6 +22,9 @@ SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600 SCREEN_HEIGHT = 600
SCREEN_SIZE = (SCREEN_WIDTH, SCREEN_HEIGHT) 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格 CARD_MAX_NUM = 10 # 这里以后可以增加解锁功能从最初的6格逐渐解锁到10格