mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
update workflow
This commit is contained in:
17
.github/workflows/python-app.yml
vendored
17
.github/workflows/python-app.yml
vendored
@@ -41,7 +41,16 @@ jobs:
|
|||||||
script-name: main.py
|
script-name: main.py
|
||||||
mode: app
|
mode: app
|
||||||
include-module: raylib,moviepy,numpy,scipy,sounddevice
|
include-module: raylib,moviepy,numpy,scipy,sounddevice
|
||||||
output-filename: PyTaiko
|
options: >-
|
||||||
|
--enable-plugin=numpy
|
||||||
|
--follow-imports
|
||||||
|
--assume-yes-for-downloads
|
||||||
|
--disable-console
|
||||||
|
--include-package=imageio_ffmpeg
|
||||||
|
--include-data-files=./**/*.dll=.
|
||||||
|
--include-data-dir=${pythonLocation}/lib/python*/site-packages/imageio_ffmpeg/binaries=imageio_ffmpeg/binaries
|
||||||
|
--prefer-source-code
|
||||||
|
--skip-module=cffi.model
|
||||||
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -51,6 +60,6 @@ jobs:
|
|||||||
Graphics/*
|
Graphics/*
|
||||||
Sounds/*
|
Sounds/*
|
||||||
Videos/*
|
Videos/*
|
||||||
build/*.exe
|
*.exe
|
||||||
build/*.bin
|
*.bin
|
||||||
build/*.app/**/*
|
*.app/**/*
|
||||||
|
|||||||
107
main.py
107
main.py
@@ -1,107 +0,0 @@
|
|||||||
import pyray as ray
|
|
||||||
|
|
||||||
from libs.audio import audio
|
|
||||||
from libs.utils import get_config
|
|
||||||
from scenes.entry import EntryScreen
|
|
||||||
from scenes.game import GameScreen
|
|
||||||
from scenes.result import ResultScreen
|
|
||||||
from scenes.song_select import SongSelectScreen
|
|
||||||
from scenes.title import TitleScreen
|
|
||||||
|
|
||||||
|
|
||||||
class Screens:
|
|
||||||
TITLE = "TITLE"
|
|
||||||
ENTRY = "ENTRY"
|
|
||||||
SONG_SELECT = "SONG_SELECT"
|
|
||||||
GAME = "GAME"
|
|
||||||
RESULT = "RESULT"
|
|
||||||
|
|
||||||
def main():
|
|
||||||
screen_width: int = get_config()["video"]["screen_width"]
|
|
||||||
screen_height: int = get_config()["video"]["screen_height"]
|
|
||||||
render_width, render_height = ray.get_render_width(), ray.get_render_height()
|
|
||||||
dpi_scale = ray.get_window_scale_dpi()
|
|
||||||
if dpi_scale.x == 0:
|
|
||||||
dpi_scale = (ray.get_render_width(), ray.get_render_height())
|
|
||||||
dpi_scale = screen_width, screen_height
|
|
||||||
else:
|
|
||||||
dpi_scale = int(render_width/dpi_scale.x), int(render_height/dpi_scale.y)
|
|
||||||
|
|
||||||
if get_config()["video"]["vsync"]:
|
|
||||||
ray.set_config_flags(ray.ConfigFlags.FLAG_VSYNC_HINT)
|
|
||||||
ray.set_config_flags(ray.ConfigFlags.FLAG_MSAA_4X_HINT)
|
|
||||||
|
|
||||||
ray.set_window_max_size(screen_width, screen_height)
|
|
||||||
ray.set_window_min_size(screen_width, screen_height)
|
|
||||||
ray.init_window(screen_width, screen_height, "PyTaiko")
|
|
||||||
if get_config()["video"]["borderless"]:
|
|
||||||
ray.toggle_borderless_windowed()
|
|
||||||
ray.clear_window_state(ray.ConfigFlags.FLAG_WINDOW_TOPMOST)
|
|
||||||
if get_config()["video"]["fullscreen"]:
|
|
||||||
ray.maximize_window()
|
|
||||||
|
|
||||||
current_screen = Screens.TITLE
|
|
||||||
_frames_counter = 0
|
|
||||||
|
|
||||||
audio.init_audio_device()
|
|
||||||
|
|
||||||
title_screen = TitleScreen(screen_width, screen_height)
|
|
||||||
entry_screen = EntryScreen(screen_width, screen_height)
|
|
||||||
song_select_screen = SongSelectScreen(screen_width, screen_height)
|
|
||||||
game_screen = GameScreen(screen_width, screen_height)
|
|
||||||
result_screen = ResultScreen(screen_width, screen_height)
|
|
||||||
|
|
||||||
screen_mapping = {
|
|
||||||
Screens.ENTRY: entry_screen,
|
|
||||||
Screens.TITLE: title_screen,
|
|
||||||
Screens.SONG_SELECT: song_select_screen,
|
|
||||||
Screens.GAME: game_screen,
|
|
||||||
Screens.RESULT: result_screen
|
|
||||||
}
|
|
||||||
target = ray.load_render_texture(screen_width, screen_height)
|
|
||||||
ray.set_texture_filter(target.texture, ray.TextureFilter.TEXTURE_FILTER_TRILINEAR)
|
|
||||||
ray.gen_texture_mipmaps(target.texture)
|
|
||||||
#lmaooooooooooooo
|
|
||||||
#rl_set_blend_factors_separate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE_MINUS_SRC_ALPHA, RL_FUNC_ADD, RL_FUNC_ADD)
|
|
||||||
ray.rl_set_blend_factors_separate(0x302, 0x303, 1, 0x303, 0x8006, 0x8006)
|
|
||||||
ray.set_exit_key(ray.KeyboardKey.KEY_A)
|
|
||||||
while not ray.window_should_close():
|
|
||||||
|
|
||||||
ray.begin_texture_mode(target)
|
|
||||||
ray.begin_blend_mode(ray.BlendMode.BLEND_CUSTOM_SEPARATE)
|
|
||||||
screen = screen_mapping[current_screen]
|
|
||||||
|
|
||||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_F11):
|
|
||||||
ray.toggle_fullscreen()
|
|
||||||
|
|
||||||
next_screen = screen.update()
|
|
||||||
screen.draw()
|
|
||||||
if screen == title_screen:
|
|
||||||
ray.clear_background(ray.BLACK)
|
|
||||||
else:
|
|
||||||
ray.clear_background(ray.WHITE)
|
|
||||||
|
|
||||||
if next_screen is not None:
|
|
||||||
current_screen = next_screen
|
|
||||||
|
|
||||||
if get_config()["general"]["fps_counter"]:
|
|
||||||
ray.draw_fps(20, 20)
|
|
||||||
ray.end_blend_mode()
|
|
||||||
ray.end_texture_mode()
|
|
||||||
ray.begin_drawing()
|
|
||||||
ray.clear_background(ray.WHITE)
|
|
||||||
#Thanks to rnoiz proper render height
|
|
||||||
ray.draw_texture_pro(
|
|
||||||
target.texture,
|
|
||||||
ray.Rectangle(0, 0, target.texture.width, -target.texture.height),
|
|
||||||
ray.Rectangle(0, 0, dpi_scale[0], dpi_scale[1]),
|
|
||||||
ray.Vector2(0,0),
|
|
||||||
0,
|
|
||||||
ray.WHITE
|
|
||||||
)
|
|
||||||
ray.end_drawing()
|
|
||||||
ray.close_window()
|
|
||||||
audio.close_audio_device()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -30,6 +30,7 @@ class GameScreen:
|
|||||||
self.result_transition = None
|
self.result_transition = None
|
||||||
self.song_info = None
|
self.song_info = None
|
||||||
self.screen_init = False
|
self.screen_init = False
|
||||||
|
self.movie = None
|
||||||
|
|
||||||
def load_textures(self):
|
def load_textures(self):
|
||||||
self.textures = load_all_textures_from_zip(Path('Graphics/lumendata/enso_system/common.zip'))
|
self.textures = load_all_textures_from_zip(Path('Graphics/lumendata/enso_system/common.zip'))
|
||||||
@@ -101,6 +102,7 @@ class GameScreen:
|
|||||||
self.tja = TJAParser(song)
|
self.tja = TJAParser(song)
|
||||||
metadata = self.tja.get_metadata()
|
metadata = self.tja.get_metadata()
|
||||||
if hasattr(self.tja, 'bg_movie'):
|
if hasattr(self.tja, 'bg_movie'):
|
||||||
|
if Path(self.tja.bg_movie).exists():
|
||||||
self.movie = VideoPlayer(str(Path(self.tja.bg_movie)))
|
self.movie = VideoPlayer(str(Path(self.tja.bg_movie)))
|
||||||
self.movie.set_volume(0.0)
|
self.movie.set_volume(0.0)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user