This commit is contained in:
wcb_dell 2020-11-24 18:48:47 +08:00
commit 5a829a288a
3 changed files with 9 additions and 2 deletions

BIN
resources/huawen.TTF Normal file

Binary file not shown.

View File

@ -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()

View File

@ -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):