added tooltips
This commit is contained in:
@@ -10,6 +10,7 @@ class MapDisplay:
|
||||
PATH_WIDTH = 5
|
||||
SEGMENT_SIZE = 20
|
||||
MIN_SEGMENT_LENGTH = 5
|
||||
APP_NAME = "Train Journey - Map Display"
|
||||
|
||||
def __init__(self,
|
||||
surf: pygame.Surface,
|
||||
@@ -25,7 +26,8 @@ class MapDisplay:
|
||||
self.max_lat: float = max_lat
|
||||
self.cities: list[tuple[Vec2, str, str]] = cities
|
||||
|
||||
self.font = pygame.font.SysFont("ubuntu", 20)
|
||||
self.font: pygame.font.Font = pygame.font.SysFont("ubuntu", 20)
|
||||
self._tooltip_surf: Optional[pygame.Surface] = None
|
||||
|
||||
def real_to_screen(self, lon: float, lat: float) -> tuple[float, float]:
|
||||
x = (lon - self.min_lon) / (self.max_lon - self.min_lon)
|
||||
@@ -116,12 +118,13 @@ class MapDisplay:
|
||||
pygame.image.save(self.surf, path)
|
||||
print(f"Saved as {path}")
|
||||
|
||||
pygame.display.set_caption(f"{self.APP_NAME} - {clock.get_fps():.2f}fps")
|
||||
self.render()
|
||||
pygame.display.flip()
|
||||
clock.tick(30)
|
||||
|
||||
def init_interactive(self) -> None:
|
||||
pass
|
||||
self._tooltip_surf = pygame.Surface(self.surf.get_size(), pygame.SRCALPHA)
|
||||
|
||||
def render(self) -> None:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user