mirror of
https://github.com/csd4ni3l/notifplayground.git
synced 2026-01-01 04:23:47 +01:00
Add demo GIF, Hot Air Baloon, add a way to customize notification timeout, rows and columns, make main menu buttons smaller, fix tetris not updating info label after restart
This commit is contained in:
@@ -52,28 +52,31 @@ class Main(arcade.gui.UIView):
|
||||
|
||||
self.title_label = self.box.add(arcade.gui.UILabel(text="NotifPlayground", font_name="Roboto", font_size=48))
|
||||
|
||||
self.snake_button = self.box.add(arcade.gui.UITextureButton(text="Snake", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 12, style=big_button_style))
|
||||
self.snake_button = self.box.add(arcade.gui.UITextureButton(text="Snake", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 14, style=big_button_style))
|
||||
self.snake_button.on_click = lambda event: self.snake()
|
||||
|
||||
self.flappy_bird_button = self.box.add(arcade.gui.UITextureButton(text="Flappy Bird", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 12, style=big_button_style))
|
||||
self.flappy_bird_button = self.box.add(arcade.gui.UITextureButton(text="Flappy Bird", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 14, style=big_button_style))
|
||||
self.flappy_bird_button.on_click = lambda event: self.flappy_bird()
|
||||
|
||||
self.pong_button = self.box.add(arcade.gui.UITextureButton(text="Pong", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 12, style=big_button_style))
|
||||
self.pong_button = self.box.add(arcade.gui.UITextureButton(text="Pong", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 14, style=big_button_style))
|
||||
self.pong_button.on_click = lambda event: self.pong()
|
||||
|
||||
self.space_invaders_button = self.box.add(arcade.gui.UITextureButton(text="Space Invaders", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 12, style=big_button_style))
|
||||
self.space_invaders_button = self.box.add(arcade.gui.UITextureButton(text="Space Invaders", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 14, style=big_button_style))
|
||||
self.space_invaders_button.on_click = lambda event: self.space_invaders()
|
||||
|
||||
self.wps_test_button = self.box.add(arcade.gui.UITextureButton(text="WPS Test", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 12, style=big_button_style))
|
||||
self.wps_test_button = self.box.add(arcade.gui.UITextureButton(text="WPS Test", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 14, style=big_button_style))
|
||||
self.wps_test_button.on_click = lambda event: self.wps_test()
|
||||
|
||||
self.maze_button = self.box.add(arcade.gui.UITextureButton(text="Maze", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 12, style=big_button_style))
|
||||
self.maze_button = self.box.add(arcade.gui.UITextureButton(text="Maze", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 14, style=big_button_style))
|
||||
self.maze_button.on_click = lambda event: self.maze()
|
||||
|
||||
self.tetris_button = self.box.add(arcade.gui.UITextureButton(text="Tetris", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 12, style=big_button_style))
|
||||
self.tetris_button = self.box.add(arcade.gui.UITextureButton(text="Tetris", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 14, style=big_button_style))
|
||||
self.tetris_button.on_click = lambda event: self.tetris()
|
||||
|
||||
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=self.window.height / 12, style=big_button_style))
|
||||
self.hot_air_baloon_button = self.box.add(arcade.gui.UITextureButton(text="Hot Air Baloon", texture=button_texture, texture_hovered=button_hovered_texture, width=self.window.width / 2, height=self.window.height / 14, style=big_button_style))
|
||||
self.hot_air_baloon_button.on_click = lambda event: self.hot_air_baloon()
|
||||
|
||||
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=self.window.height / 14, style=big_button_style))
|
||||
self.settings_button.on_click = lambda event: self.settings()
|
||||
|
||||
def pong(self):
|
||||
@@ -104,6 +107,10 @@ class Main(arcade.gui.UIView):
|
||||
from game.tetris import Game
|
||||
self.window.show_view(Game(self.pypresence_client))
|
||||
|
||||
def hot_air_baloon(self):
|
||||
from game.hot_air_baloon import Game
|
||||
self.window.show_view(Game(self.pypresence_client))
|
||||
|
||||
def settings(self):
|
||||
from menus.settings import Settings
|
||||
self.window.show_view(Settings(self.pypresence_client))
|
||||
|
||||
@@ -120,14 +120,15 @@ class Settings(arcade.gui.UIView):
|
||||
else:
|
||||
label_text = f"FPS Limit: {self.settings_dict.get(setting_dict['config_key'], setting_dict['default'])}"
|
||||
else:
|
||||
label_text = f"{setting}: {int(self.settings_dict.get(setting_dict['config_key'], setting_dict['default']))}"
|
||||
label_text = f"{setting}: {int(self.settings_dict.get(setting_dict['config_key'], setting_dict['default'])) if setting_dict.get('step', 1) >= 1 else self.settings_dict.get(setting_dict['config_key'], setting_dict['default'])}"
|
||||
|
||||
label.text = label_text
|
||||
|
||||
self.slider_labels[setting] = label
|
||||
|
||||
slider = arcade.gui.UISlider(width=400, height=50, value=self.settings_dict.get(setting_dict["config_key"], setting_dict["default"]), min_value=setting_dict['min'], max_value=setting_dict['max'], style=slider_style)
|
||||
slider = arcade.gui.UISlider(width=400, height=50, step=setting_dict.get("step", 1), value=self.settings_dict.get(setting_dict["config_key"], setting_dict["default"]), min_value=setting_dict['min'], max_value=setting_dict['max'], style=slider_style)
|
||||
slider.on_change = lambda _, setting=setting, slider=slider: self.update(setting, slider.value, "slider")
|
||||
slider._render_steps = lambda surface: None
|
||||
|
||||
self.sliders[setting] = slider
|
||||
self.value_layout.add(slider)
|
||||
@@ -205,7 +206,6 @@ class Settings(arcade.gui.UIView):
|
||||
file.write(json.dumps(self.settings_dict, indent=4))
|
||||
|
||||
def update(self, setting=None, button_state=None, setting_type="bool"):
|
||||
setting_dict = settings[self.current_category][setting]
|
||||
config_key = settings[self.current_category][setting]["config_key"]
|
||||
|
||||
if setting_type == "option":
|
||||
@@ -222,7 +222,7 @@ class Settings(arcade.gui.UIView):
|
||||
self.set_normal_style(self.on_radiobuttons[setting])
|
||||
|
||||
elif setting_type == "slider":
|
||||
new_value = int(button_state)
|
||||
new_value = int(button_state) if settings[self.current_category][setting].get("step", 1) >= 1 else button_state
|
||||
|
||||
self.modified_settings[config_key] = new_value
|
||||
self.sliders[setting].value = new_value
|
||||
|
||||
Reference in New Issue
Block a user