reparar uso de fonte de letras em alguns sistemas
This commit is contained in:
@ -12,6 +12,8 @@ import modules.interaccoes as ModInteraccoes
|
||||
# pg.FULLSCREEN para fullscreen mode
|
||||
flags = 0 # pg.FULLSCREEN
|
||||
sep_janelas: int = 10
|
||||
# fonte a ser usada
|
||||
caminho_fonte = pg.font.match_font("roboto")
|
||||
|
||||
|
||||
# classe Frame para gerir diferentes frames dentro da janela principal
|
||||
@ -138,29 +140,16 @@ def prepararEstatistica(mapa: Mapa | None) -> dict[str, int]:
|
||||
return {}
|
||||
|
||||
|
||||
def mostrarMapa(mapa: Mapa | None) -> None:
|
||||
# verificacao
|
||||
if isinstance(mapa, NoneType):
|
||||
raise TypeError("objecto passado do tipo None")
|
||||
# mostrar mapa com pontuação em cada posição
|
||||
for pos_y in range(0, mapa.dimensao[0]):
|
||||
for pos_x in range(0, mapa.dimensao[1]):
|
||||
tmp_agente: Agente | None = mapa.posicao((pos_x, pos_y))
|
||||
if not isinstance(tmp_agente, NoneType):
|
||||
print(f"{tmp_agente.estrategia[0]:2}", end="")
|
||||
print("")
|
||||
|
||||
|
||||
def actualizarEstatisticas(janela: pg.Surface, frame: Frame, mapa: Mapa) -> None:
|
||||
frame.desenhar(janela, 5, 10)
|
||||
font = pg.font.Font(None, 20)
|
||||
font = pg.font.Font(caminho_fonte, 20)
|
||||
strats: dict[str, int] = prepararEstatistica(mapa)
|
||||
n_linhas = 0
|
||||
for strat in strats:
|
||||
strat_label = font.render(
|
||||
f"{strat}: {(strats[strat] / mapa.dimensao[0] ** 2) * 100:3.2f}",
|
||||
False,
|
||||
pg.Color(255, 255, 255, 0),
|
||||
True,
|
||||
pg.Color(255, 255, 255),
|
||||
)
|
||||
janela.blit(
|
||||
strat_label,
|
||||
@ -178,11 +167,11 @@ def actualizarInfoPos(
|
||||
# limpar frame_info_mapa
|
||||
frame.desenhar(janela, 5, 10)
|
||||
# mostrar informação sobre posicao seleccionada
|
||||
font = pg.font.Font(None, 20)
|
||||
font = pg.font.Font(caminho_fonte, 20)
|
||||
info_posicao = font.render(
|
||||
f"{mapa.posicao(pos).estrategia}@{pos}",
|
||||
False,
|
||||
pg.Color(255, 255, 255, 0),
|
||||
True,
|
||||
pg.Color(255, 255, 255),
|
||||
)
|
||||
janela.blit(
|
||||
info_posicao,
|
||||
|
||||
Reference in New Issue
Block a user