mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
rewrote outlined text
This commit is contained in:
32
scenes/devtest.py
Normal file
32
scenes/devtest.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import pyray as ray
|
||||
|
||||
from libs.utils import OutlinedText, get_current_ms
|
||||
|
||||
|
||||
class DevScreen:
|
||||
def __init__(self, width: int, height: int):
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.screen_init = False
|
||||
|
||||
self.time_now = get_current_ms()
|
||||
self.test = OutlinedText('Triple Helix', 40, ray.Color(255, 255, 255, 255), ray.Color(101, 0, 82, 255), outline_thickness=4, vertical=True)
|
||||
|
||||
def on_screen_start(self):
|
||||
if not self.screen_init:
|
||||
self.screen_init = True
|
||||
|
||||
def on_screen_end(self, next_screen: str):
|
||||
self.screen_init = False
|
||||
return next_screen
|
||||
|
||||
def update(self):
|
||||
self.on_screen_start()
|
||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_ENTER):
|
||||
return self.on_screen_end('TITLE')
|
||||
|
||||
def draw(self):
|
||||
ray.draw_rectangle(0, 0, self.width, self.height, ray.WHITE)
|
||||
src = ray.Rectangle(0, 0, self.test.texture.width, self.test.texture.height)
|
||||
dest = ray.Rectangle(self.width//2 - self.test.texture.width//2, self.height//2 - self.test.texture.height//2, self.test.texture.width, self.test.texture.height)
|
||||
self.test.draw(src, dest, ray.Vector2(0, 0), 0, ray.WHITE)
|
||||
@@ -279,12 +279,12 @@ class EntryScreen:
|
||||
|
||||
box_title = self.box_titles[i][1]
|
||||
src = ray.Rectangle(0, 0, box_title.texture.width, box_title.texture.height)
|
||||
dest = ray.Rectangle(final_x + 12, y + 20, box_title.texture.width, box_title.texture.height)
|
||||
dest = ray.Rectangle(final_x + 25, y + 20, box_title.texture.width, box_title.texture.height)
|
||||
box_title.draw(src, dest, ray.Vector2(0, 0), 0, color)
|
||||
else:
|
||||
box_title = self.box_titles[i][0]
|
||||
src = ray.Rectangle(0, 0, box_title.texture.width, box_title.texture.height)
|
||||
dest = ray.Rectangle(final_x + 9, y + 20, box_title.texture.width, box_title.texture.height)
|
||||
dest = ray.Rectangle(final_x + 20, y + 20, box_title.texture.width, box_title.texture.height)
|
||||
box_title.draw(src, dest, ray.Vector2(0, 0), 0, color)
|
||||
|
||||
def draw(self):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import pyray as ray
|
||||
import sounddevice as sd
|
||||
|
||||
from libs.audio import audio
|
||||
from libs.utils import (
|
||||
global_data,
|
||||
is_l_don_pressed,
|
||||
@@ -34,6 +35,9 @@ class SettingsScreen:
|
||||
self.screen_init = False
|
||||
save_config(self.config)
|
||||
global_data.config = self.config
|
||||
audio.close_audio_device()
|
||||
audio.type = global_data.config["audio"]["device_type"]
|
||||
audio.init_audio_device()
|
||||
return "ENTRY"
|
||||
|
||||
def get_current_settings(self):
|
||||
|
||||
@@ -400,7 +400,7 @@ class SongBox:
|
||||
self.tja_count = tja_count
|
||||
self.tja_count_text = None
|
||||
if self.tja_count is not None and self.tja_count != 0:
|
||||
self.tja_count_text = OutlinedText(str(self.tja_count), 35, ray.Color(255, 255, 255, 255), ray.Color(0, 0, 0, 255), outline_thickness=5, horizontal_spacing=1.2)
|
||||
self.tja_count_text = OutlinedText(str(self.tja_count), 35, ray.Color(255, 255, 255, 255), ray.Color(0, 0, 0, 255), outline_thickness=5)#, horizontal_spacing=1.2)
|
||||
self.tja = tja
|
||||
self.hash = dict()
|
||||
self.update(False)
|
||||
@@ -1007,6 +1007,8 @@ class SongFile(FileSystemItem):
|
||||
def __init__(self, path: Path, name: str, texture_index: int, tja=None, name_texture_index: Optional[int]=None):
|
||||
super().__init__(path, name)
|
||||
self.is_recent = (datetime.now() - datetime.fromtimestamp(path.stat().st_mtime)) <= timedelta(days=7)
|
||||
if self.is_recent:
|
||||
print(name, (datetime.now() - datetime.fromtimestamp(path.stat().st_mtime)))
|
||||
self.tja = tja or TJAParser(path)
|
||||
if self.is_recent:
|
||||
self.tja.ex_data.new = True
|
||||
|
||||
Reference in New Issue
Block a user