mirror of
https://github.com/csd4ni3l/shatterstack.git
synced 2026-01-01 12:33:48 +01:00
Add controller support
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user