Skip to content

Commit 306fc9c

Browse files
committed
menu
1 parent 151c8c3 commit 306fc9c

40 files changed

Lines changed: 62 additions & 95 deletions

tuxemon/menu/theme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def get_theme(scaling: ScalingStrategy) -> Theme:
8080
if _theme is not None:
8181
return _theme
8282

83-
scale_factor = max(scaling.scale, 1)
83+
scale_factor = max(scaling.scale_int(1), 1)
8484
tuxemon_border = BaseImage(
8585
image_path=transform_resource_filename(CONFIG.menu_border),
8686
).scale(scale_factor, scale_factor, smooth=False)

tuxemon/prepare.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class DisplayContext:
4545
)
4646

4747

48-
SCREEN_SIZE = CONFIG.resolution
4948
DEV_TOOLS = CONFIG.dev_tools
5049

5150

tuxemon/states/calendar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from tuxemon.menu.menu import PygameMenuState
1212
from tuxemon.platform.const.graphics import BG_MISSIONS
1313
from tuxemon.platform.const.sizes import MONTH_KEYS
14-
from tuxemon.prepare import SCREEN_SIZE
1514
from tuxemon.session import Session
1615

1716
if TYPE_CHECKING:
@@ -30,7 +29,7 @@ def __init__(
3029
) -> None:
3130
self.session = session
3231

33-
width, height = SCREEN_SIZE
32+
width, height = self.client.context.resolution
3433

3534
width = int(width * 0.8)
3635
height = int(height * 0.8)

tuxemon/states/celestial.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from tuxemon.locale.locale import T
1212
from tuxemon.menu.menu import PygameMenuState
1313
from tuxemon.platform.const.graphics import BG_MISSIONS
14-
from tuxemon.prepare import SCREEN_SIZE
1514
from tuxemon.session import Session
1615

1716
if TYPE_CHECKING:
@@ -31,7 +30,7 @@ def __init__(
3130
self.session = session
3231
self.celestial = session.celestial
3332

34-
width, height = SCREEN_SIZE
33+
width, height = self.client.context.resolution
3534

3635
width = int(width * 0.8)
3736
height = int(height * 0.8)

tuxemon/states/character.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from tuxemon.platform.const import buttons
2020
from tuxemon.platform.const.graphics import BG_PLAYER1, BG_PLAYER2
2121
from tuxemon.platform.const.sizes import U_KM, U_MI
22-
from tuxemon.prepare import SCREEN_SIZE
2322
from tuxemon.tools import fix_measure, format_playtime
2423
from tuxemon.tuxepedia.reporter import TuxepediaReporter
2524

@@ -211,7 +210,7 @@ def __init__(
211210
if not lookup_cache:
212211
_lookup_monsters()
213212

214-
width, height = SCREEN_SIZE
213+
width, height = self.client.context.resolution
215214
self.char = character
216215

217216
bg = (

tuxemon/states/choice_item.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from tuxemon.db import ItemModel
1414
from tuxemon.menu.menu import PygameMenuState
1515
from tuxemon.menu.theme import get_theme
16-
from tuxemon.prepare import SCREEN_SIZE
1716
from tuxemon.tools import fix_measure
1817
from tuxemon.ui.menu_options import MenuOptions
1918

@@ -71,7 +70,7 @@ def __init__(
7170
def calculate_window_size(
7271
self, menu: MenuOptions
7372
) -> tuple[int, int, float]:
74-
_width, _height = SCREEN_SIZE
73+
_width, _height = self.client.context.resolution
7574

7675
if len(menu.options) >= self.config.max_elements:
7776
height = _height * self.config.max_height_percentage

tuxemon/states/choice_monster.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from tuxemon.menu.menu import PygameMenuState
1818
from tuxemon.menu.theme import get_theme
1919
from tuxemon.monster.sprite import MonsterSpriteHandler, SpriteLoader
20-
from tuxemon.prepare import SCREEN_SIZE
2120
from tuxemon.session import local_session
2221
from tuxemon.ui.menu_options import MenuOptions
2322

@@ -139,7 +138,7 @@ def open_journal(self, monster: MonsterModel) -> None:
139138
action.execute_action("clear_tuxepedia", [monster.slug], True)
140139

141140
def update_animation_size(self) -> None:
142-
width, height = SCREEN_SIZE
141+
width, height = self.client.context.resolution
143142
widgets_size = self.menu.get_size(widget=True)
144143

145144
_width = widgets_size[0]

tuxemon/states/choice_npc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from tuxemon.graphics import scale_surface
1818
from tuxemon.menu.menu import PygameMenuState
1919
from tuxemon.menu.theme import get_theme
20-
from tuxemon.prepare import SCREEN_SIZE
2120
from tuxemon.ui.menu_options import MenuOptions
2221

2322
if TYPE_CHECKING:
@@ -106,7 +105,7 @@ def add_npc_menu_item(
106105
self.menu.add.vertical_fill(self.config.vertical_fill)
107106

108107
def update_animation_size(self) -> None:
109-
width, height = SCREEN_SIZE
108+
width, height = self.client.context.resolution
110109
widgets_size = self.menu.get_size(widget=True)
111110

112111
_width = widgets_size[0]

tuxemon/states/choice_state.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from tuxemon.animation import Animation, ScheduleType
1111
from tuxemon.menu.menu import PygameMenuState
1212
from tuxemon.menu.theme import get_theme
13-
from tuxemon.prepare import SCREEN_SIZE
1413
from tuxemon.ui.menu_options import MenuOptions
1514

1615
if TYPE_CHECKING:
@@ -69,7 +68,7 @@ def __init__(
6968

7069
def update_animation_size(self) -> None:
7170
widgets_size = self.menu.get_size(widget=True)
72-
width, height = SCREEN_SIZE
71+
width, height = self.client.context.resolution
7372

7473
_width = widgets_size[0]
7574
_height = widgets_size[1]

tuxemon/states/color_state.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from tuxemon.graphics import string_to_colorlike
88
from tuxemon.menu.menu import PygameMenuState
99
from tuxemon.menu.theme import get_theme
10-
from tuxemon.prepare import SCREEN_SIZE
1110

1211
if TYPE_CHECKING:
1312
from tuxemon.base_client import BaseClient
@@ -26,7 +25,7 @@ def process_event(self, event: PlayerInput) -> PlayerInput | None:
2625
return None
2726

2827
def __init__(self, client: BaseClient, color: str, **kwargs: Any) -> None:
29-
width, height = SCREEN_SIZE
28+
width, height = self.client.context.resolution
3029
_color = string_to_colorlike(color)
3130

3231
super().__init__(client=client, height=height, width=width, **kwargs)

0 commit comments

Comments
 (0)