diff --git a/resources/huawen.TTF b/resources/huawen.TTF new file mode 100644 index 0000000..94dc60a Binary files /dev/null and b/resources/huawen.TTF differ diff --git a/source/component/menubar.py b/source/component/menubar.py index b06e8d2..265d5d4 100644 --- a/source/component/menubar.py +++ b/source/component/menubar.py @@ -1,3 +1,4 @@ +import os import random import pygame as pg from .. import tool @@ -25,7 +26,9 @@ plant_frozen_time_list = [7500, 7500, 7500, 30000, 50000, 7500, 7500, 7500, 7500 all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] def getSunValueImage(sun_value): - font = pg.font.SysFont(None, 22) + # for pack, must use other ttf + fontPath = os.path.join('resources', 'huawen.TTF') + font = pg.font.Font(fontPath, 14) width = 32 msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW) msg_rect = msg_image.get_rect() diff --git a/source/tool.py b/source/tool.py index 52b179a..6fff94a 100644 --- a/source/tool.py +++ b/source/tool.py @@ -4,11 +4,12 @@ from abc import abstractmethod import pygame as pg from . import constants as c +# an abstract class, one state of automata class State(): def __init__(self): self.start_time = 0.0 self.current_time = 0.0 - self.done = False + self.done = False # is it finished self.next = None self.persist = {} @@ -24,6 +25,7 @@ class State(): def update(self, surface, keys, current_time): '''abstract method''' +# control this game. do event loops class Control(): def __init__(self): self.screen = pg.display.get_surface() @@ -73,6 +75,8 @@ class Control(): self.mouse_pos = pg.mouse.get_pos() self.mouse_click[0], _, self.mouse_click[1] = pg.mouse.get_pressed() print('pos:', self.mouse_pos, ' mouse:', self.mouse_click) + else: + print(pg.event.event_name(event.type)) def main(self):