clone and modify arcade to stop text scale and speed up text display
This commit is contained in:
8
arcade/examples/pyinstaller/build-exe.bat
Normal file
8
arcade/examples/pyinstaller/build-exe.bat
Normal file
@ -0,0 +1,8 @@
|
||||
rem @echo off
|
||||
for /f %%i in ('python -c "import site; print(site.getsitepackages()[0])"') do set PYTHON_ROOT="%%i"
|
||||
rem copy %PYTHON_ROOT%\Lib\site-packages\arcade\Win64\avbin.dll .
|
||||
rem copy avbin.dll avbin64.dll
|
||||
rem pyinstaller --exclude-module tkinter --add-data resources;resources --add-data ./avbin64.dll;. --add-data ./avbin.dll;Win64 --onefile --noconsole sample.py
|
||||
rem del avbin.dll
|
||||
rem del avbin64.dll
|
||||
rem pause
|
||||
16
arcade/examples/pyinstaller/build-exe.py
Normal file
16
arcade/examples/pyinstaller/build-exe.py
Normal file
@ -0,0 +1,16 @@
|
||||
import site
|
||||
import shutil
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
python_root = site.getsitepackages()[0]
|
||||
|
||||
shutil.copyfile(f"{python_root}/Lib/site-packages/arcade/Win64/avbin.dll", "avbin.dll")
|
||||
shutil.copyfile(f"avbin.dll", "avbin64.dll")
|
||||
sp = subprocess.run(["pyinstaller", "--exclude-module", "tkinter", "--add-data", "resources;resources", "--add-data", "./avbin64.dll;.", "--add-data", "./avbin.dll;Win64", "--onefile", "--noconsole", "sample.py"], stdout=subprocess.PIPE)
|
||||
# rem pyinstaller --exclude-module tkinter --add-data resources;resources --add-data ./avbin64.dll;. --add-data ./avbin.dll;Win64 --onefile --noconsole sample.py
|
||||
# print(sp.stdout)
|
||||
os.unlink("avbin.dll")
|
||||
os.unlink("avbin64.dll")
|
||||
|
||||
BIN
arcade/examples/pyinstaller/resources/cat-meow.wav
Normal file
BIN
arcade/examples/pyinstaller/resources/cat-meow.wav
Normal file
Binary file not shown.
BIN
arcade/examples/pyinstaller/resources/character.png
Normal file
BIN
arcade/examples/pyinstaller/resources/character.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
36
arcade/examples/pyinstaller/sample.py
Normal file
36
arcade/examples/pyinstaller/sample.py
Normal file
@ -0,0 +1,36 @@
|
||||
import arcade
|
||||
import pyglet
|
||||
import time
|
||||
import sys
|
||||
|
||||
SCREEN_WIDTH = 800
|
||||
SCREEN_HEIGHT = 500
|
||||
TITLE = 'Arcade cx_Freeze Sample'
|
||||
BACKGROUND_COLOR = arcade.color.WHITE
|
||||
|
||||
|
||||
def resource_path(file):
|
||||
path = 'resources/' + file
|
||||
# are we in a frozen environment (e.g. pyInstaller)?
|
||||
if getattr(sys, 'frozen', False):
|
||||
path = sys._MEIPASS.replace('\\', '/') + '/' + path
|
||||
return path
|
||||
|
||||
|
||||
def main():
|
||||
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, TITLE)
|
||||
arcade.set_background_color(BACKGROUND_COLOR)
|
||||
arcade.start_render()
|
||||
arcade.draw_circle_filled(400, 250, 100, arcade.color.BLACK)
|
||||
# load image
|
||||
image = arcade.load_texture(resource_path('character.png'))
|
||||
arcade.draw_texture_rectangle(200, 250, image.width, image.height, image)
|
||||
# load sound
|
||||
sound = arcade.sound.load_sound(resource_path('cat-meow.wav'))
|
||||
arcade.sound.play_sound(sound)
|
||||
arcade.finish_render()
|
||||
arcade.run()
|
||||
return
|
||||
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user