Add controller support

This commit is contained in:
csd4ni3l
2025-06-25 11:00:35 +02:00
parent 227d5416e0
commit d294ef3ebd
7 changed files with 61 additions and 46 deletions

View File

@@ -1,13 +1,15 @@
import arcade, arcade.gui, asyncio, pypresence, time, copy, json
from utils.preload import button_texture, button_hovered_texture
from utils.constants import button_style, discord_presence_id
from utils.utils import FakePyPresence
from arcade.gui.experimental.focus import UIFocusGroup
class Main(arcade.gui.UIView):
def __init__(self, pypresence_client=None):
super().__init__()
self.anchor = self.add_widget(arcade.gui.UIAnchorLayout())
self.anchor = self.add_widget(UIFocusGroup(size_hint=(1, 1)))
self.box = self.anchor.add(arcade.gui.UIBoxLayout(space_between=10), anchor_x='center', anchor_y='center')
self.pypresence_client = pypresence_client
@@ -57,6 +59,8 @@ class Main(arcade.gui.UIView):
self.settings_button = self.box.add(arcade.gui.UITextureButton(text="Settings", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=150, style=button_style))
self.settings_button.on_click = lambda event: self.settings()
self.anchor.detect_focusable_widgets()
def play(self):
from game.play import Game
self.window.show_view(Game(self.pypresence_client))