From c9c015e15b28521cc2203633c1aba499c90e5fd6 Mon Sep 17 00:00:00 2001 From: Luis Rodrigues Date: Fri, 3 Apr 2026 00:33:05 +0100 Subject: [PATCH] =?UTF-8?q?corrigir=20apresenta=C3=A7=C3=A3o=20do=20mapa?= =?UTF-8?q?=20quando=20=C3=A9=20usado=20outros=20tamanhos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gui.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/gui.py b/modules/gui.py index 0d21f0c..4266c0d 100644 --- a/modules/gui.py +++ b/modules/gui.py @@ -40,11 +40,11 @@ class Frame: def criarFrames(janela_app: pg.Surface) -> tuple[Frame, Frame, Frame, Frame]: frm_mapa = Frame( ( - janela_app.get_size()[1] - (sep_janelas) * 2, + janela_app.get_size()[1] - (sep_janelas * 2), janela_app.get_size()[1] - (sep_janelas * 2), ), (sep_janelas, sep_janelas), - pg.Color(0, 0, 0, 0), + pg.Color(0, 0, 0), ) frm_info_mapa = Frame( ( @@ -52,7 +52,7 @@ def criarFrames(janela_app: pg.Surface) -> tuple[Frame, Frame, Frame, Frame]: (janela_app.get_size()[1] - (sep_janelas * 2)) // 2, ), (frm_mapa.tamanho[0] + (sep_janelas * 2), sep_janelas), - pg.Color(255, 255, 255, 0), + pg.Color(255, 255, 255), ) frm_info_pos = Frame( ( @@ -63,7 +63,7 @@ def criarFrames(janela_app: pg.Surface) -> tuple[Frame, Frame, Frame, Frame]: frm_mapa.tamanho[0] + (sep_janelas * 2), frm_info_mapa.tamanho[1] + (sep_janelas * 2), ), - pg.Color(255, 255, 255, 0), + pg.Color(255, 255, 255), ) frm_accoes = Frame( ( @@ -77,7 +77,7 @@ def criarFrames(janela_app: pg.Surface) -> tuple[Frame, Frame, Frame, Frame]: frm_mapa.tamanho[0] + 20, frm_info_mapa.tamanho[1] + frm_info_pos.tamanho[1] + 30, ), - pg.Color(255, 255, 255, 0), + pg.Color(255, 255, 255), ) return (frm_mapa, frm_info_mapa, frm_info_pos, frm_accoes) @@ -100,7 +100,7 @@ def devolveCor(agente: Agente) -> tuple[int, int, int, int]: def criarMapa(janela_app: pg.Surface, frame: Frame, mapa: Mapa) -> None: - lado: int = (frame.tamanho[1] - (10 * 2)) // mapa.dimensao[0] + lado: int = frame.tamanho[0] // mapa.dimensao[0] for pos_y in range(0, mapa.dimensao[1]): for pos_x in range(0, mapa.dimensao[0]): agente: Agente | None = mapa.posicao((pos_x, pos_y)) @@ -233,7 +233,7 @@ def main(mapa: Mapa | None, tamanho_mapa: tuple[int, int]): # botao 1 do rato clicado, seleccionar ou tirar selecao if pg.mouse.get_pressed(num_buttons=3)[0]: pos_rato: tuple[int, int] = pg.mouse.get_pos() - quadrado = (frm_mapa.tamanho[1] - 20) // mapa.dimensao[0] + quadrado = frm_mapa.tamanho[0] // mapa.dimensao[0] if pos_rato[0] < 10 or pos_rato[1] < 10: continue pos_x = (pos_rato[0] - 10) // quadrado