Add files via upload

This commit is contained in:
bakustarver 2024-05-22 14:24:34 +03:00 committed by GitHub
parent 59c570595d
commit 53b5bdb0ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 167586 additions and 0 deletions

133
nwjs/install.sh Normal file
View file

@ -0,0 +1,133 @@
#!/bin/bash
installpath=$(dirname "$0")
version='1.0.7'
if ! [ -d "$installpath/nwjs" ]; then
echo "Can't find nwjs folder"
exit 1;
fi
echo "Installing rpgmaker-linux v$version"
mainfd="$HOME/desktopapps/nwjs"
localapplicationsfd="$HOME/.local/share/applications"
localbin="$HOME/.local/bin"
compatibilitytoolsfddef="$HOME/.steam/root/compatibilitytools.d/"
compatibilitytoolsfdflatpak="$HOME/.var/app/com.valvesoftware.Steam/data/Steam/compatibilitytools.d/"
arch=$(uname -m)
archcheckmessage=$(echo "$arch" | sed -e 's@x86_64@, x86-64, version@g' -e 's@aarch64@, ARM aarch64,@g' -e 's@i686@, Intel 80386,@g' -e 's@i386@, Intel 80386,@g' -e 's@armv7l@, ARM,@g' -e 's@armhf@, ARM,@g')
rm -rf "$mainfd"
createfd() {
if ! [ -d "$1" ]; then
echo "Missing $1 creating one"
mkdir -p "$1"
if [ "$1" = "$localbin" ]; then
nolocalbin=true
fi
fi;
}
rmfd() {
if [ -d "$1" ]; then
rm -rf "$1"
fi;
}
lnnew() {
if ! [ -f "$1" ]; then
echo "Can't find the $1 file"
fi
if [ -h "$2" ]; then
rm "$2"
fi
ln -s "$1" "$2"
}
checkthebinaryarch() {
if ! [ -f "$1" ]; then
echo "Missing file $1"
fi
steamcompatibilitytoolinstaller() {
createfd "$1"
rmfd "$1/rpgmaker-linux-steam-wrapper"
cp -r "$installpath/nwjs/packagefiles/rpgmaker-linux-steam-wrapper/" "$1"
}
if ! file "$1" | grep -q "$archcheckmessage" ; then
# Use $ wget -qO- installscript.sh | bash
file "$1"
echo "Wrong architecture!!
Download corrent archive with $arch"
exit 1;
fi
}
createfd "$mainfd"
createfd "$localapplicationsfd"
createfd "$localbin"
checkthebinaryarch "$installpath/nwjs/cicpoffs"
cp "$installpath/install.sh" "$mainfd"
cp "$installpath/uninstall.sh" "$mainfd"
cp -r "$installpath/nwjs" "$mainfd"
# echo "Making a desktop file"
echo -e "[Desktop Entry]
Name=RPG Maker MV/MZ (cicpoffs mount)
Exec=env gamef=\"%u\" $mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh --chooselatestnwjs
Type=Application
Categories=Games
StartupNotify=true
MimeType=application/x-ms-dos-executable;application/x-wine-extension-msp;
Icon=$mainfd/nwjs/packagefiles/nwjs128.png
Terminal=true
NoDisplay=true" > "$localapplicationsfd/nwjstest.desktop"
chmod +x "$localapplicationsfd/nwjstest.desktop"
echo -e "[Desktop Entry]
Name=RPG Maker MV/MZ Options
Exec=env gamef=\"%u\" $mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh --gui
Type=Application
Categories=Games
StartupNotify=true
MimeType=application/x-ms-dos-executable;application/x-wine-extension-msp;x-scheme-handler/rpgmakermp
Icon=$mainfd/nwjs/packagefiles/nwjs128.png
Terminal=true
NoDisplay=true" > "$localapplicationsfd/nwjsoptions.desktop"
chmod +x "$localapplicationsfd/nwjsoptions.desktop"
# Exec=bash -c "/home/pasha/desktopapps/nwjs/nwjs/packagefiles/nwjsstart-cicpoffs.sh --latestnwjs --gamepath '$(pwd)'";#
lnnew "$mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh" "$localbin/rpgmaker-linux"
chmod +x "$localbin/rpgmaker-linux"
update-desktop-database -q ~/.local/share/applications
xdg-mime default nwjsoptions.desktop x-scheme-handler/rpgmakermp
echo "Installation Done"
if [ -d "$HOME/.steam/" ]; then
steamcompatibilitytoolinstaller "$compatibilitytoolsfddef"
fi
if [ -d "$HOME/.var/app/com.valvesoftware.Steam/data/Steam" ]; then
steamcompatibilitytoolinstaller "$compatibilitytoolsfdflatpak"
fi
if [ -n "$nolocalbin" ]; then
echo "$localbin folder was created, you might need to restart your computer if you want to use the program in the terminal
Or use
$ export PATH=\$PATH:$localbin"
fi

BIN
nwjs/nwjs/cicpoffs Normal file

Binary file not shown.

137
nwjs/nwjs/dwnwjs.sh Normal file
View file

@ -0,0 +1,137 @@
#!/bin/bash
gitlink="https://github.com/nwjs/nw.js"
# defp="$HOME/desktopapps/nwjs/nwjs"
if [ -z "$defpn" ]; then
defpn=$(dirname "$0")
else
defp="$defpn"
fi
# kdialog --msgbox "$test $depfp"
# defp="$defp0/nwjs"
# echo "defp $defp"
if ! [ -d "$defp" ]; then
mkdir -p "$defp"
fi;
nwjslist=$(ls -p "$defp/nwjs" | grep /)
nwjsfm="$HOME/desktopapps/nwjs/nwjs"
if [ -f "$nwjsfm/packagefiles/usesdk.txt" ]; then
SDKNWJS=true
nwjslist=$(echo "$nwjslist" | grep "sdk")
else
nwjslist=$(echo "$nwjslist" | grep -v "sdk")
fi
echo "$SDKNWJS"
versioninstalledlist=$(ls "$defp")
arch=$(uname -m | sed -e 's@i686@ia32@g' -e 's@x86_64@x64@g' -e 's@armv7l@armhf@g' -e 's@armhf@arm@g' -e 's@aarch64@arm64@g')
downloadversion() {
if [ -n "$SDKNWJS" ]; then
# rm "$defp/nwjs-$version-linux-$arch.tar.gz"
wget -c -P "$defp" https://dl.nwjs.io/$version/nwjs-sdk-$version-linux-$arch.tar.gz
tar -xf "$defp/nwjs-sdk-$version-linux-$arch.tar.gz" -C "$defp/nwjs"
rm "$defp/nwjs-sdk-$version-linux-$arch.tar.gz"
else
# rm "$defp/nwjs-$version-linux-$arch.tar.gz"
wget -c -P "$defp" https://dl.nwjs.io/$version/nwjs-$version-linux-$arch.tar.gz
tar -xf "$defp/nwjs-$version-linux-$arch.tar.gz" -C "$defp/nwjs"
rm "$defp/nwjs-$version-linux-$arch.tar.gz"
fi
}
downloadandextract() {
if [ -n "$nwjslinktar" ]; then
tar -xf "$defp/nwjs-$version-linux-$arch.tar.gz" -C "$defp/nwjs"
rm "$defp/nwjs-$version-linux-$arch.tar.gz"
echo Finished
fi
}
if [ "$arch" = "arm" ]; then
if [ -n "$SDKNWJS" ]; then
echo "No sdk version for your architecture $arch
Use $ rpgmaker-linux --usestandart";
exit
fi
nwjslinktar="https://github.com/bakustarver/rpgmakermlinux-cicpoffs/releases/download/libraries/nwjs-v0.60.1-linux-arm.tar.gz"
downloadandextract
elif [ "$arch" = "arm64" ]; then
if [ -n "$SDKNWJS" ]; then
echo "No sdk version for your architecture $arch
Use $ rpgmaker-linux --usestandart";
exit;
fi
nwjslinktar="https://github.com/bakustarver/rpgmakermlinux-cicpoffs/releases/download/libraries/nwjs-v0.60.1-linux-arm64.tar.gz"
downloadandextract
fi
#get latest nwjs version info
if [ "$arch" = "x64" ] || [ "$arch" = "ia32" ]; then
if [ -z "$@" ]; then
version=$(wget --user-agent 'Mozilla/5.0 (Windows NT 10.0; rv:124.0) Gecko/20100101 Firefox/124.0' -qO- "https://github.com/nwjs/nw.js/tags" | grep 'Link--primary Link' | head -n 1 | sed -e 's@.*">@@g' -e 's@<.*@@g' -e 's@nw-@@g')
echo "latest version is $version"
else
if echo "$@" | grep -q "v[0-1].[0-9][0-9].[0]"; then
version="$@"
elif echo "$@" | grep -q "[0-1].[0-9][0-9].[0]"; then
version="v$@"
else
echo "Incorrect version name - $@"
exit 1;
fi
fi
# kdialog --msgbox "hello 1"
# echo "$latestlocal $version"
if [ -n "$latestlocal" ] && [ "$latestlocal" = "$version" ] && [ -z "$checkversionnwjs" ]; then
echo Your nwjs version is latest
echo Reinstall? y/n
read
if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ]; then
if [ -n "$SDKNWJS" ]; then
rm -rf "$defp/nwjs/nwjs-sdk-$version-linux-x64/"
else
rm -rf "$defp/nwjs/nwjs-$version-linux-x64/"
fi
echo Reinstalling "$latestlocal";
else
exit;
fi
fi
# uname -p
# echo "sdk q$SDKNWJS"
if [ "$skipdownloadifexist" = "true" ]; then
# if "$nwjslist"
if [ -n "$nwjslist" ] && echo "$nwjslist" | grep -q "$version" ; then
# version
echo skiping
else
downloadversion
fi
# echo skipping download;
else
downloadversion
fi
echo Finished
fi
# fi
sleep 1;

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -0,0 +1,847 @@
#!/bin/bash
export LD_LIBRARY_PATH="$HOME/desktopapps/nwjs/nwjs/packagefiles/:$LD_LIBRARY_PATH"
# kdialog --msgbox "$CPATH"
# curdesktop=$(echo "$XDG_CURRENT_DESKTOP")
# defp="$HOME/deskappbin/nwjs/nwjs/"
version='1.0.7'
nwjsfm="$HOME/desktopapps/nwjs/nwjs"
yadp="$nwjsfm/packagefiles/yad"
defp="$nwjsfm/nwjs"
export defpn="$nwjsfm"
nwjslist=$(ls -p "$defp" | grep /)
if [ -z "$nwjslist" ]; then
echo "the nwjs is not installed, please use $ rpgmaker-linux --installnwjs"
fi
nwjsonlylist=$(echo "$nwjslist" | grep -v "sdk")
nwjssdkonlylist=$(echo "$nwjslist" | grep "sdk")
if echo "$nwjslist" | grep -q "\-sdk"; then
# sdkinstalled=true
latestinstallednwjsfd=$(echo "$nwjssdkonlylist" | sort -V | uniq | tail -n 1)
# allversionsnwjs=$(echo "$nwjslist" | sed -e 's@-sdk-@@g' -e 's@nwjs-@@g' -e 's@-linux-.*@@g' | sort -V | uniq)
else
latestinstallednwjsfd=$(echo "$nwjslist" | tail -n 1)
fi
allversionsnwjs=$(echo "$nwjslist" | sed -e 's@sdk-@@g' -e 's@nwjs-@@g' -e 's@-linux-.*@@g' | sort -V | uniq | tac)
# echo "$latestinstallednwjsfd"
# exit
githubscriptwget=$(timeout 7s wget -qO- "https://raw.githubusercontent.com/bakustarver/rpgmakermlinux-cicpoffs/main/installgithub.sh" )
# latestinstallednwjsfd=$(ls -p "$defp" | grep / | sort -V | tail -n 1 )
if [ -n "$githubscriptwget" ]; then
githubversion=$(echo "$githubscriptwget" | sed -n 's/version=//p')
if [ "$version" != "$githubversion" ]; then
if { echo "$version"; echo "$githubversion"; } | sort --version-sort -C; then
echo "A new rpgmaker-linux update has been found, to get the latest version use
$ rpgmaker-linux --fullupdate
"
fi
fi
fi
arch=$(uname -m)
archcheckmessage=$(echo "$arch" | sed -e 's@x86_64@, x86-64, version@g' -e 's@aarch64@, ARM aarch64,@g' -e 's@i686@, Intel 80386,@g' -e 's@i386@, Intel 80386,@g' -e 's@armv7l@, ARM,@g' -e 's@armhf@, ARM,@g')
checkthebinaryarch() {
if ! [ -f "$1" ]; then
echo "Missing file $1"
fi
if ! file "$1" | grep -q "$archcheckmessage" ; then
# Use $ wget -qO- installscript.sh | bash
file "$1"
echo "Wrong architecture!! Use
$ rpgmaker-linux --fullupdate
to get correct version"
exit 1;
fi
}
checkthebinariesarch() {
"$cicpoffs"
# - ask for download?
# - set custom path
"$nwjstestpath/nw"
# cicpoffspath
}
makedesktopfile() {
# $mountpath
geticonpath=$(sed -n 's/.*"icon": "//p' "$nwjstestpath/package.json" | sed -e 's@"@@g')
if [ "$engine" = "mz" ] && [ -z "$PACKAGEJSONPATH" ]; then
geticonpath=$(echo "$geticonpath" | sed -e 's@www/@@g');
fi
bmountpath=$(basename "$mountpath")
if [ "$engine" = "mv" ]; then
ndirname=$(dirname "$mountpath")
# echo 1
else
ndirname="$mountpath"
# echo 2
fi
ndrbasen=$(basename "$ndirname")
iconpath="$ndirname/$geticonpath"
# kdialog --msgbox "$mountpath-$bmountpath\n$ndirname\n$iconpath"
if [ -z "$dsavepath" ]; then
dsavepath="$ndirname"
fi
getgamename="Your game" #$(basename "$mountpath")
# kdialog --msgbox "$iconpath"
if ! [ -f "$dsavepath/$ndrbasen.desktop" ]; then
echo "[Desktop Entry]
Name=$ndrbasen
Exec=env gamef=\"$ndirname\" $nwjsfm/packagefiles/nwjsstart-cicpoffs.sh
Type=Application
Categories=Game
StartupNotify=true
MimeType=application/x-ms-dos-executable;application/x-wine-extension-msp;
Icon=$iconpath
Terminal=true" > "$dsavepath/$ndrbasen.desktop"
chmod +x "$dsavepath/$ndrbasen.desktop"
fi
}
makelocalshortcut() {
dsavepath=""
makedesktopfile
}
makedesktopshortcut() {
dsavepath=$(xdg-user-dir DESKTOP)
makedesktopfile
}
makethemenushortcut() {
dsavepath="$HOME/.local/share/applications/"
makedesktopfile
}
pixi5install() {
echo "Installing pixi5"
newjsfd="$nwjsfm/packagefiles/rpgmaker-mv-pixi5/js"
curjs="$mountpath/js"
if grep "pixi.js - v5." "$curjs/libs/pixi.js"; then
echo "The pixi5 lib is already installed"
else
mv "$curjs" "$mountpath/js-backup"
cp -r "$newjsfd" "$mountpath"
cp -r "$mountpath/js-backup/plugins" "$curjs"
cat "$mountpath/js-backup/plugins.js" > "$curjs/plugins.js"
echo "pixi5 was installed"
fi
#pixi func
}
texthookerplugininstall() {
echo "Installing the text hooker plugin"
texthookerpligin="$nwjsfm/packagefiles/plugins/Clipboard_llule.js"
pluginsfile="$mountpath/js/plugins.js"
if grep -q 'Clipboard_llule","status":true,' "$pluginsfile"; then
echo "The texthooker plugin is already installed"
else
cp "$pluginsfile" "$pluginsfile.bk"
sed -e 's@^\[$@[\n{"name":"Clipboard_llule","status":true,"description":"","parameters":{}},@g' -i "$pluginsfile"
cp "$texthookerpligin" "$mountpath/js/plugins/";
fi
}
texthookerpluginuninstall() {
echo "Uninstalling the text hooker plugin"
pluginsfile="$mountpath/js/plugins.js"
if grep -q 'Clipboard_llule","status":true,' "$pluginsfile"; then
sed -e 's@{"name":"Clipboard_llule".*@@g' -i "$pluginsfile"
else
echo "The text hooker plugin is not installed"
fi
}
sourcelinks() {
echo "Github page
https://github.com/bakustarver/rpgmakermlinux-cicpoffs
Patreon page
https://www.patreon.com/user/about?u=121421184
Buymeacoffe page
https://www.buymeacoffee.com/rpgmakerlinux"
}
incompletefeaturefunc() {
echo "$arg" in development, wait for it on this site.
echo "https://github.com/bakustarver/rpgmakermlinux-cicpoffs"
}
fullupdatereinstall() {
echo "$githubscriptwget" | bash
}
updatenwjs() {
if [ -f "$nwjsfm/packagefiles/usesdk.txt" ]; then
export latestlocal=$(echo "$nwjssdkonlylist" | tail -n 1 | sed -e 's@nwjs-sdk-@@g' -e 's@-linux.*@@g' )
"$nwjsfm/dwnwjs.sh"
else
export latestlocal=$(echo "$latestinstallednwjsfd" | sed -e 's@nwjs-@@g' -e 's@-linux.*@@g')
"$nwjsfm/dwnwjs.sh"
fi
}
nwjsversionfunc() {
export skipdownloadifexist=true
. "$nwjsfm/dwnwjs.sh" "$1"
# nwjsversion=(echo "$nwjsversion"
}
checkifexist() {
if ! [ -f "$1" ]; then
echo "Can't find the file $1"
exit
fi
}
pchange() {
if echo "$1" | grep ".exe"; then
dirname "$1" | sed -e "s@^'@@g"
else
echo "$1"
fi
# echo "Use "$arg' "/path/rpggame/"'
# exit 1
# fi
}
checkgamefilesfd() {
npath=$(echo "$1" | sed -e 's@rpgmakermp:///@@g')
if echo "$npath" | grep ".exe"; then
npath=$(dirname "$npath" | sed -e "s@^'@@g");
else
npath="$npath"
fi
# zenity --title "$gamef" --warning --text="$npath"
if [ -d "$npath/www" ] && [ -e "$npath/package.json" ] && [ -e "$npath/www/js/plugins.js" ]; then
mountpath="$npath/www"
found=true
gamepath=true
engine=mv
elif [ -d "$npath/data" ] && [ -e "$npath/package.json" ] && [ -e "$npath/js/plugins.js" ]; then
mountpath="$npath"
gamepath=true
found=true
engine=mz
else
echo "Can't find game with $npath"
exit 1
fi
}
checkgamepath() {
# path="$1"
echo "$1"
if ! [ -n "$CPATH" ]; then
path=$(pchange "$1")
else
path="$CPATH"
fi
# kdialog --msbox "$path"
checkgamefilesfd "$path"
}
if [ -z "$gamepath" ]; then
if [ -d ./www ] && [ -f ./package.json ]; then
mountpath="$PWD/www"
found=true
engine=mv
elif [ -d ./js ] && [ -f ./package.json ] && [ -d ./data ]; then
mountpath="$PWD"
found=true
engine=mz
fi
fi
#
if [ -z "$found" ] && [ -n "$gamef" ] ; then
kdialog --msgbox "$gamef"
checkgamefilesfd "$gamef"
fi
checknwjspath() {
path="$1"
if [ -d "$path/lib" ] && [ -e "$path/nw" ]; then
NWJSPATH="$path"
else
echo "Can't find NWJS"
exit 1
fi
}
checkcicpoffspath() {
path="$1"
if [ -e "$path" ]; then
cicpoffs="$path"
cicpoffspath="true"
else
echo "Can't find cicpoff"
exit 1
fi
}
packagejsonfunc() {
if [ -n "$PACKAGEJSONPATH" ]; then
packagejson="$PACKAGEJSONPATH"
else
packagejson="$HOME/desktopapps/nwjs/nwjs/packagefiles/package.json"
fi
packagejsoninfo=$(cat "$packagejson")
newpackagejson=$(echo "$packagejsoninfo" | sed -e 's@"name": "",@"name": "RPG Maker MV/MZ (cicpoffs mount)",@g' -e 's@"main": ".*@"main": "www/index.html",@' -e 's@"title": "",@"title": "RPG Maker MV/MZ (cicpoffs mount)",@g')
# echo "$packagejson"
# ln -s "$packagejson" "$nwjstestpath"
if [ -h "$nwjstestpath/package.json" ]; then
rm "$nwjstestpath/package.json"
fi
echo "$newpackagejson" > "$nwjstestpath/package.json"
}
while [ $# -ne 0 ]
do
arg="$1"
arg2="$2"
case "$arg" in
--help)
help=true
info=true
;;
--version)
showversion=true
info=true
;;
--checkreleaseupdates)
info=true
incompletefeaturefunc
;;
--gui)
GUIMENU=true
;;
--usestandart)
# export SDKNWJS=true
if [ -e "$nwjsfm/packagefiles/usesdk.txt" ]; then
rm "$nwjsfm/packagefiles/usesdk.txt"
fi
;;
--pixi5install)
INSTALLPIXI5=true
;;
--installtexthookerplugin)
INSTALLTHPL=true
;;
--uninstalltexthookerplugin)
INSTALLTHPL=false
;;
--usesdk)
# export SDKNWJS=true
touch "$nwjsfm/packagefiles/usesdk.txt"
if [ -z "$nwjssdkonlylist" ]; then
updatenwjs
fi
;;
--checkbetaupdates)
info=true
incompletefeaturefunc
;;
--chooselatestnwjs)
latestnwjs=true
;;
--choosenwjsversion)
nwjsversionfunc "$2"
;;
--clearoldnwjs)
clearoldnwjs=true
incompletefeaturefunc
;;
--updatenwjs)
updatenwjs
;;
--fullupdate)
fullupdatereinstall
;;
--updatescripts)
disableCopperBld=true
incompletefeaturefunc
;;
--makeshortcut)
case "$arg2" in
local)
MAKELOCALSHORTCUT=true
;;
desktop)
MAKEDESKTOPSHORTCUT=true
;;
menu)
ADDTOTHEMENU=true
;;
all)
MAKELOCALSHORTCUT=true
MAKEDESKTOPSHORTCUT=true
ADDTOTHEMENU=true
;;
*)
echo -e "Use --makeshortcut local or desktop or menu all"
info=true
;;
esac
;;
--unmount)
case "$arg2" in
false)
unmount=false
;;
*)
echo -e "Use --unmount false
--unmount true"
info=true
;;
esac
;;
--gamepath)
echo "$@ $2"
checkgamepath "$2"
;;
--useoriginalgamepackagejson)
if [ -f "$path/package.json" ]; then
PACKAGEJSONPATH="$path/package.json"
echo "$path"
elif [ -f "$mountpath/package.json" ]; then
PACKAGEJSONPATH="$mountpath/package.json"
elif [ -f "$PWD/package.json" ]; then
PACKAGEJSONPATH="$PWD/package.json"
else
echo "Can't find the original package.json"
fi
useoriginalgamepackagejson=true
;;
--custompackagejsonpath)
checkifexist "$2"
PACKAGEJSONPATH="$2"
custompackagejsonpath=true
;;
--nwjspath)
checknwjspath $2
;;
--cicpoffspath)
checkcicpoffspath "$2"
;;
--printrpgmakerlibversions)
printrpgmakerlibversions=true
info=true
;;
--forceaarch)
incompletefeaturefunc
case "$arg2" in
x86_64)
forceaarch="x86_64"
;;
i386)
forceaarch="i386"
;;
ia32)
forceaarch="i386"
;;
aarch64)
forceaarch="arm64"
;;
arm64)
forceaarch="arm64"
;;
armhf)
forceaarch="armhf"
;;
*)
# nothing="true"
echo -e "
Available architectures are
x86_64
i386
arm64
armhf"
info=true
;;
esac
;;
--jpnlocale)
export LANG="ja_JP.utf8"
;;
--sourcelinks)
sourcelinks
info=true
;;
*)
nothing="true"
;;
esac
shift
done
# --chooselatestnwjs --choosenwjsversion --nwjspath
#latestnwjs=true $nwjsversion #NWJSPATH
if [ "$latestnwjs" = "true" ] && [ -n "$nwjsversion" ] || [ "$latestnwjs" = "true" ] && [ -n "$NWJSPATH" ] || [ -n "$nwjsversion" ] && [ -n "$NWJSPATH" ]; then
echo "You can't use those arguments together --chooselatestnwjs --choosenwjsversion --nwjspath"
exit 1;
fi
if [ "$useoriginalgamepackagejson" = "true" ] && [ "$custompackagejsonpath" = "true" ] ; then
echo "You can't use those arguments together --useoriginalgamepackagejson --custompackagejsonpath"
exit 1;
fi
if [ "$showversion" = true ]; then
echo -e "$version"
fi
if [ "$help" = true ]; then
echo -e "RPGMaker MV/MZ linux $version
https://github.com/bakustarver/rpgmakermlinux-cicpoffs
--help
--version
--updatenwjs
--chooselatestnwjs
--nwjsversion
--clearoldnwjs
--unmount
--gamepath
--useoriginalgamepackagejson
--custompackagejsonpath
--nwjspath
--cicpoffspath
--printrpgmakerlibversions
--forceaarch
--jpnlocale
--checkreleaseupdates
--checkbetaupdates
--updatescripts
--fullupdate
--sourcelinks
--usesdk
--pixi5install
--installtexthookerplugin
--uninstalltexthookerplugin
--makeshortcut"
fi
yaddata() {
updatenwjsvar=$(echo "$@" | awk '{print $1}')
pixiupdatevar=$(echo "$@" | awk '{print $2}')
localshortcutvar=$(echo "$@" | awk '{print $3}')
nwjsguivar=$(echo "$@" | awk '{print $4}')
jpnlocalevar=$(echo "$@" | awk '{print $5}')
texthookerset=$(echo "$@" | awk '{print $6}')
desktopshortcut=$(echo "$@" | awk '{print $7}')
addtomenuvar=$(echo "$@" | awk '{print $8}')
sdkvar=$(echo "$@" | awk '{print $9}')
# kdialog --msgbox "$updatenwjsvar $pixiupdate $localshortcut $texthookerset dc $desktopshortcut $addtomenuvar $sdkvar $nwjsguivar"
}
if [ "$GUIMENU" = "true" ]; then
configgp="$HOME/desktopapps/rpgmaker-guiconfig.txt"
if [ -f "$configgp" ]; then
configgdata=$(cat "$configgp")
yaddata "$configgdata"
newversionlist=$(echo "$allversionsnwjs" | grep -v "^$nwjsguivar$" | sed "1s/^/$nwjsguivar\n/")
if [ -z "$newversionlist" ]; then
newversionlist="$allversionsnwjs"
fi
# kdialog --msgbox "$nwjsguivar\n--$newversionlist"
guim=$("$yadp" --title "RPG Maker MV/MZ Options" --text="Please choose your options:" --image="$HOME/desktopapps/nwjs/nwjs/packagefiles/nwjs128.png" --columns=5 --field "Update NWJS":chk $updatenwjsvar --form --field "Pixi5 Update":chk "$pixiupdatevar" --field="Shorcut Options::LBL" false --field "Local Shortcut":chk "$localshortcutvar" --form --separator=" " --item-separator="\n" --field="Versions::"CBE "$newversionlist" --field "Japanese Locale":chk "$jpnlocalevar" --field "Texthooker Plugin":chk "$texthookerset" --field=" :LBL" false --field "Desktop Shortcut":chk "$desktopshortcut" --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field "Show in the Menu":chk "$addtomenuvar" --field "Use SDK version":chk "$sdkvar" --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false)
else
guim=$("$yadp" --title "RPG Maker MV/MZ Options" --text="Please choose your options:" --image="$HOME/desktopapps/nwjs/nwjs/packagefiles/nwjs128.png" --columns=5 --field "Update NWJS":chk true --form --field "Pixi5 Update":chk false --field="Shorcut Options::LBL" false --field "Local Shortcut":chk true --form --separator=" " --item-separator="\n" --field="Versions::"CBE "$allversionsnwjs" --field "Japanese Locale":chk false --field "Texthooker Plugin":chk false --field=" :LBL" false --field "Desktop Shortcut":chk false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field "Show in the Menu":chk false --field "Use SDK version":chk false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false --field=" :LBL" false)
fi
if [ -n "$guim" ] ; then
echo "$guim" > "$configgp"
else
exit;
fi
yaddata "$guim"
echo "$guim"
# exit;
if [ "$jpnlocalevar" = "TRUE" ]; then
export LANG="ja_JP.utf8"
fi
if [ "$updatenwjsvar" = "TRUE" ]; then
export skipdownloadifexist=true
export checkversionnwjs=false
updatenwjs
fi
if [ "$texthookerset" = "TRUE" ]; then
INSTALLTHPL=true
elif [ "$texthookerset" = "FALSE" ]; then
INSTALLTHPL=false
fi
if [ "$pixiupdatevar" = "TRUE" ]; then
INSTALLPIXI5=true
fi
if [ "$sdkvar" = "TRUE" ]; then
if ! [ -f "$nwjsfm/packagefiles/usesdk.txt" ]; then
touch "$nwjsfm/packagefiles/usesdk.txt"
fi
elif [ "$sdkvar" = "FALSE" ]; then
if [ -f "$nwjsfm/packagefiles/usesdk.txt" ]; then
rm "$nwjsfm/packagefiles/usesdk.txt"
fi
fi
if [ "$localshortcutvar" = "TRUE" ]; then
MAKELOCALSHORTCUT=true
fi
if [ "$desktopshortcut" = "TRUE" ]; then
MAKEDESKTOPSHORTCUT=true
fi
if [ "$addtomenuvar" = "TRUE" ]; then
ADDTOTHEMENU=true
fi
if [ -n "$nwjsguivar" ]; then
nwjsversion="$nwjsguivar"
export skipdownloadifexist=true
export checkversionnwjs=false
. "$nwjsfm/dwnwjs.sh" "$nwjsguivar"
fi
fi
# exit;
if [ "$printrpgmakerlibversions" = "true" ]; then
if [ "$found" = "true" ]; then
if [ "$gamepath" = "true" ]; then
nwdllpath="$path/nw.dll"
nodedllpath="$path/node.dll"
else
nwdllpath="nw.dll"
nodedllpath="node.dll"
fi
# echo "$mountpath"
rpgmvcorefilepath="$mountpath/js/rpg_core.js"
rpgmzcorefilepath="$mountpath/js/rmmz_core.js"
if [ -f "$rpgmvcorefilepath" ]; then
rpgcorefilepath="$rpgmvcorefilepath"
elif [ -f "$rpgmzcorefilepath" ]; then
rpgcorefilepath="$rpgmzcorefilepath"
fi
nwdlltext=$(strings "$nwdllpath")
rpgcoretext=$(cat "$rpgcorefilepath")
nodeversion=$(strings "$nodedllpath" | grep '/win-.*/node.lib' | sed -e 's@https://nodejs.org/download/release/@@g' -e 's@/win-.*/node.lib@@g')
nwjsversiondll=$(echo "$nwdlltext" | sed -n "s/process.versions\['nw'\] = '//p" | sed -e "s@'.*@@g")
chromiumversion=$(echo "$nwdlltext" | grep -B 4 '::SHGetSpecialFolderPathW' | grep '\.[0-9]\.[0-9]' | sed -e 's@.*\.\$@@g')
rpgmakername=$(echo -e "$rpgcoretext" | sed -n "s/Utils.RPGMAKER_NAME = .//p" | sed -e 's@.;@@g')
rpgmakerversion=$(echo -e "$rpgcoretext" | sed -n 's/Utils.RPGMAKER_VERSION = .//p' | sed -e 's@.;@@g')
echo "NWJS version - $nwjsversiondll
Chromium version - $chromiumversion
Node version - $nodeversion
RPG Maker Name - $rpgmakername
RPG Maker version - $rpgmakerversion
ffmpeg prebuild link
https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt/releases/tag/$nwjsversiondll"
else
echo "Can't find the game path"
fi
fi
if [ "$info" = true ]; then
exit;
fi
# echo "$forceaarch"
if [ -z "$cicpoffspath" ]; then
cicpoffs="$HOME/desktopapps/nwjs/nwjs/cicpoffs"
fi
nwjslist=$(ls -p "$nwjsfm/nwjs/" | grep /)
if [ -f "$nwjsfm/packagefiles/usesdk.txt" ]; then
nwjslistd=$(echo "$nwjslist" | grep "sdk")
# export latestlocal=$(echo "$nwjssdkonlylist" | tail -n 1 | sed -e 's@nwjs-sdk-@@g' -e 's@-linux.*@@g' )
else
nwjslistd=$(echo "$nwjslist" | grep -v "sdk")
fi
if [ "$latestnwjs" = "true" ]; then
nwjsf="$latestinstallednwjsfd"
else
nwjsf=$(ls -tp "$defp" | grep / | head -n 1 | sed -e 's@/$@@g')
fi
if [ -n "$NWJSPATH" ]; then
nwjstestpath="$NWJSPATH"
echo "$NWJSPATH"
else
if [ -n "$nwjsversion" ]; then
searchpath=$(echo "$nwjslistd" | grep "$nwjsversion" )
# nwjstestpath="$defp/nwjs/$nwjsversion"
if [ -n "$searchpath" ]; then
nwjstestpath="$nwjsfm/nwjs/$searchpath"
# kdialog --msgbox "$nwjstestpath"
else
echo no version
fi
else
nwjstestpath="$defp/$nwjsf"
fi
fi
nwjstestpath=$(echo "$nwjstestpath" | sed -e 's@/$@@g')
# wwwsavesymlink.sh "$@"
# echo "$nwjstestpath"
startnw() {
if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then
echo "wayland detected"
"$nwjstestpath/nw" --ozone-platform=wayland
else
echo "wayland not detected, starting in x11"
"$nwjstestpath/nw" --ozone-platform=x11
fi
}
#Unmount folder
checkandunmount() {
if ! [ -d "$nwjstestpath/www" ]; then
mkdir -p "$nwjstestpath/www"
fi;
if [ -z "$unmount" ]; then
testf=$(findmnt "$nwjstestpath/www");
if [ -n "$testf" ]; then
fusermount -u "$nwjstestpath/www"
fi
fi
}
rmsymlinks () {
# rm "$nwjstestpath/package.json";
rm "$nwjstestpath/www"
}
mountwww() {
packagejsonfunc
if ! [ -d "$nwjstestpath/www" ]; then
mkdir -p "$nwjstestpath/www"
fi;
echo "$cicpoffs" "$mountpath" "$nwjstestpath/www"
"$cicpoffs" "$mountpath" "$nwjstestpath/www"
SECONDS=0;
while ! [ -d "$nwjstestpath/www/js" ]; do
sleep 1
echo Mounting the folder: Time passed $SECONDS seconds;
done
echo -e "Mounting done.
Total time: $SECONDS seconds"
}
if [ "$INSTALLPIXI5" = "true" ]; then
pixi5install;
fi
if [ "$INSTALLTHPL" = "true" ]; then
texthookerplugininstall;
elif [ "$INSTALLTHPL" = "false" ]; then
texthookerpluginuninstall
fi
# kdialog --msgbox "ggg $nwjstestpath"
checkandunmount
checkthebinaryarch "$cicpoffs"
checkthebinaryarch "$nwjstestpath/nw"
if [ "$found" = "true" ]; then
# rmsymlinks
mountwww
if [ -n "$MAKELOCALSHORTCUT" ]; then
makelocalshortcut
fi
if [ -n "$MAKEDESKTOPSHORTCUT" ]; then
makedesktopshortcut
fi
if [ -n "$ADDTOTHEMENU" ]; then
makethemenushortcut
fi
startnw
# sleep 60;
checkandunmount
fi

View file

@ -0,0 +1,13 @@
{
"name": "RPG Maker MV/MZ (cicpoffs mount)",
"main": "www/index.html",
"js-flags": "--expose-gc",
"chromium-args": "--enable-webgl --ignore-gpu-blacklist --disable-setuid-sandbox-enable --force-gpu-rasterization --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers --enable-zero-copy --enable-gpu-async-worker-context --disable-password-generation",
"window": {
"title": "RPG Maker MV/MZ (cicpoffs mount)",
"toolbar": false,
"width": 745,
"height": 400,
"icon": "www/icon/icon.png"
}
}

View file

@ -0,0 +1,258 @@
//=============================================================================
// Libellule Text extractor to clipboard plugin
// Clipboard_llule.js
//=============================================================================
/*
* Install and configure with the patcher here :
* https://www.dropbox.com/sh/p83yxde8e8nrz35/AADkJzbz7VuM7HqwiwhhfhHTa?dl=0
* Help : http://www.ulmf.org/bbs/showthread.php?t=29359
*/
//=============================================================================
TimerMil = 200;
WantCmdItemSeparator = true;
CmdItemSeparator = "。\r\n";
ShowCodeColor = false;
ForceNameSeparator = false;
TextSeparatorLeft = String.fromCharCode(12300);
TextSeparatorRight = String.fromCharCode(12301);
NameCodeColor = ["#ffffa0", "#40c0f0", "#ff80ff", "#80ff80", "#66cc40"];
IgnoreRepeatableItem = true;
BloctextSeparator = true;
IgnoreRepeatablebloc = true;
var IgnoreRegExtextbloc = [/^\d\d:\d\d($|.$|。$)/, /(^([,.\d]+)([,.]\d+)?)(\uFF27($|。$)|G($|。$)|$|。$)/, /^(\uFF27($|。$)|G($|。$))/];
ClipLogerOnStart = true;
WantChoiceSeparator = true;
ChoiceSeparator = "。\r\n";
TextWaitingTimeOFF = true;
var ClipLoger = "";
LastItem = "";
ColorEnCour = "";
ActualThis = "";
StarTextNamefound = false;
EndTextNamefound = false;
BlocSeparatorLeft = String.fromCharCode(12300);
BlocSeparatorRight = String.fromCharCode(12301);
LastColor = "";
MemText = "";
LastMemTextSend = "";
ClipTimerOn = false;
SaveOrgDrawText = Bitmap.prototype.drawText;
var gui = require('nw.gui');
var clipboard = gui.Clipboard.get();
var win = gui.Window.get();
var SaveoldInput_onKeyDown = Input._onKeyDown;
var Savewindowonload = window.onload;
var choices_encour = [];
Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
OptionalText = "";
pass = true;
if (text) {
if (text.length == 1 && y >= this.height) {
pass = false;
}
if (IgnoreRepeatableItem && text.length > 1) {
if (text == LastItem) {
pass = false;
}
LastItem = text;
}
if (pass) {
if (ShowCodeColor) {
if (this.textColor != LastColor) {
OptionalText = "<" + this.textColor + ">";
LastColor = this.textColor;
}
}
if (ForceNameSeparator && text.length == 1) {
if (!ClipTimerOn && (NameCodeColor.indexOf(this.textColor) > -1)) {
LastColor = this.textColor;
StarTextNamefound = true;
ColorNameEnCour = this.textColor;
}
if (ClipTimerOn && StarTextNamefound && (this.textColor != ColorNameEnCour)) {
OptionalText = OptionalText + TextSeparatorLeft;
StarTextNamefound = false;
EndTextNamefound = true;
}
}
if (BloctextSeparator) {
if (ActualThis == "") {
ActualThis = this;
OptionalText = OptionalText + BlocSeparatorLeft;
} else {
if (ActualThis != this) {
OptionalText = OptionalText + BlocSeparatorRight + "\r\n" + BlocSeparatorLeft;
ActualThis = this;
}
}
if ($gameMessage != null) {
if ($gameMessage.isChoice() && !choices_encour.length) {
choices_encour = $gameMessage._choices;
}
}
}
if (ClipTimerOn) {
if (text.length > 1 && WantCmdItemSeparator) {
MemText = MemText + OptionalText + text + CmdItemSeparator;
} else {
MemText = MemText + OptionalText + text;
}
} else {
if (text.length > 1 && WantCmdItemSeparator) {
MemText = OptionalText + text + CmdItemSeparator;
} else {
MemText = OptionalText + text;
}
ClipTimerOn = true;
ClipTimer = setTimeout(ClipTimerSend, TimerMil);
}
}
}
SaveOrgDrawText.call(this, text, x, y, maxWidth, lineHeight, align);
};
function ClipTimerSend() {
if (BloctextSeparator) {
MemText = MemText + BlocSeparatorRight;
KickOutDuplicateBloc();
}
if (EndTextNamefound) {
MemText = MemText + TextSeparatorRight;
StarTextNamefound = false;
EndTextNamefound = false;
if (BloctextSeparator) {
KickOutDuplicateBloc();
}
}
if (MemText != "") {
clipboard.set(MemText, 'text');
LastMemTextSend = MemText;
}
ClipTimerOn = false;
ActualThis = "";
LastColor = "";
ColorNameEnCour = "";
};
var LibWindow_Message_prototype_clearFlags = Window_Message.prototype.clearFlags;
Window_Message.prototype.clearFlags = function() {
LibWindow_Message_prototype_clearFlags.call(this);
this._showFast = true;
this._lineShowFast = true;
this._pauseSkip = false;
};
function LaunchCliploger() {
/*Path = process.cwd() + "\\www\\js\\plugins";
var execFile = require('child_process').execFile;
ClipLoger = execFile(Path + "\\ClipLoger.exe", function(error, stdout, stderr) {
ClipLoger = "";
});
if (!ClipLoger.pid) {
alert(Msg1);
return;
}
setTimeout(Focus, 500);*/
};
function Focus() {
if (ClipLoger.pid) {
win.focus();
} else {
setTimeout(Focus, 500);
}
};
Input._onKeyDown = function(event) {
if (event.keyCode == 118) {
clipboard.set(LastMemTextSend, 'text');
}
if (event.keyCode == 117) {
if (ClipLoger.pid) {
ClipLoger.kill();
} else {
LaunchCliploger();
}
}
if (event.keyCode == 116) {
if (ClipLoger.pid) {
ClipLoger.kill();
}
}
SaveoldInput_onKeyDown.call(this, event);
};
window.onload = function() {
if (ClipLogerOnStart) {
LaunchCliploger();
}
Savewindowonload.call(this);
};
function KickOutDuplicateBloc() {
var Bloc = MemText.split("\r\n");
var output = [];
var Deleteone = "";
if (choices_encour.length && WantChoiceSeparator) {
var temps = choices_encour[0].replace(/\\C\[\d+\]/gi, "");
var With = BlocSeparatorLeft + temps;
var Deleteone = With;
for (i = 1; i < choices_encour.length; i++) {
temps = choices_encour[i].replace(/\\C\[\d+\]/gi, "");
With = With + ChoiceSeparator + temps;
Deleteone = Deleteone + temps;
}
With += BlocSeparatorRight;
output.push(With);
Deleteone += BlocSeparatorRight;
choices_encour = [];
}
for (var i = 0; i < Bloc.length; i++) {
if (output.indexOf(Bloc[i]) < 0) {
if (RegEXspeIgnore(Bloc[i]) && Deleteone != Bloc[i]) {
output.push(EraseDoubleSeparator(Bloc[i]));
}
}
}
MemText = output.join("\r\n");
};
function RegEXspeIgnore(Bloc) {
BlocS = Bloc.slice(1, Bloc.length - 1);
if (IgnoreRegExtextbloc.length != 0) {
for (var i = 0; i < IgnoreRegExtextbloc.length; i++) {
if (BlocS.search(IgnoreRegExtextbloc[i]) != -1) {
return false;
}
}
return true;
} else {
return true;
}
};
function EraseDoubleSeparator(Bloc) {
if ((Bloc.split(BlocSeparatorLeft).length) == 3) {
if ((Bloc.split(BlocSeparatorRight).length) == 3) {
return Bloc.slice(1, Bloc.length - 1);
}
}
return Bloc;
};
Msg1 = "ClipLoger.exe not found\r\nReinstal the plugin from the patcher\r\n";
var Save_Window_Message_prototype_updateWait = Window_Message.prototype.updateWait;
Window_Message.prototype.updateWait = function() {
if (ClipTimerOn && TextWaitingTimeOFF) {
this._waitCount = 0;
}
return Save_Window_Message_prototype_updateWait.call(this);
};

View file

@ -0,0 +1,13 @@
"compatibilitytools"
{
"compat_tools"
{
"rpgmaker-linux-cicpoffs" // Internal name of this tool
{
"install_path" "."
"display_name" "RPG Maker MV/MZ (cicpoffs mount) Tool"
"from_oslist" "windows"
"to_oslist" "linux"
}
}
}

View file

@ -0,0 +1,21 @@
#!/bin/bash
if [[ ! -z "${LD_PRELOAD}" ]]; then
echo "LD_PRELOAD found with $LD_PRELOAD"
export ORIGINAL_LD_PRELOAD="$LD_PRELOAD"
export LD_PRELOAD=""
# export PATH=""
fi
#
# DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
if [[ $2 == *"iscriptevaluator.exe"* ]]; then
echo "ignoring iscriptevaluator.exe"
exit 0
fi
export LC_ALL=""
startset=$(echo "$@" | sed -e 's@waitforexitandrun @@g' -e 's@ --in-process-gpu@@g')
export gamef=$(dirname "$startset")
xdg-open "rpgmakermp:///$gamef"

View file

@ -0,0 +1,6 @@
"manifest"
{
"version" "2"
"commandline" "/rpgmaker-linux-cicpoffs-wrapper.sh %verb%"
"use_sessions" "1"
}

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Scott Atkins
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,40 @@
# RPGMaker MV Game Engine 1.6.2.1
This is a set of updates based on RPGMaker MV 1.6.2 to use [PixiJS 5.3.3](https://github.com/pixijs/pixi.js/releases/tag/v5.3.3)
## Features
- Faster rendering
- Case insensitive file loading to better support Linux/Android without having to change your scripts
- With [NW.js v0.45.6](https://dl.nwjs.io/v0.45.6/) plays webm (VP8/VP9) files properly
- Filter change for Pixi-Picture to get it to run properly (Issue submitted waiting for a real fix)
- Added more keys in the keymap for easier use in scripts
- Fixes to documentation, spelling, and javascript syntax
- Added jshint information
## Known Issues
- ShaderTilemap is not working properly falling back on Tilemap
- Doesn't seem to be affecting performance
- Plugins the load files directly or override the functions which load from disk may fail in case sensitive environments
- Wrap the file path with `CS_URL.MapURL()` to ensure it resolves to the correct case sensitive name
- Overrides or calls to `refereshVehicles` will fail
- Use `refreshVehicles` instead
- Overrides or calls to `updateButtonsVisiblity` will fail
- Use `updateButtonsVisibility` instead
## Further Work
- Cleanup of Javascript (using let/const)
- Add updates to plugins
- Investigate if garbage collection needs to run (possibly do this during scene changes)
- Check for any memory leaks
- Submit issue against Pixi-Tilemap for the rendering issue
- Submit issue against NW.js for performance issues starting with v0.46
- Bring in proper filter fix for Pixi-Picture when it is released
## License
- PixiJS is covered by the [MIT License](https://github.com/pixijs/pixi.js/blob/dev/LICENSE)
- Typescript and other libraries, see the file headers
- My Modifications: MIT License

View file

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target":"es6"
},
"files": [
"./rmmv.d.ts",
"./rmmv-pixi.d.ts"
],
"include": [
"./*",
"./plugins_dev/*.js",
"./plugins/*.js"
]
}

View file

@ -0,0 +1,15 @@
/*! FPSMeter 0.3.1 - 9th May 2013 | https://github.com/Darsain/fpsmeter */
(function(m,j){function s(a,e){for(var g in e)try{a.style[g]=e[g]}catch(j){}return a}function H(a){return null==a?String(a):"object"===typeof a||"function"===typeof a?Object.prototype.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase()||"object":typeof a}function R(a,e){if("array"!==H(e))return-1;if(e.indexOf)return e.indexOf(a);for(var g=0,j=e.length;g<j;g++)if(e[g]===a)return g;return-1}function I(){var a=arguments,e;for(e in a[1])if(a[1].hasOwnProperty(e))switch(H(a[1][e])){case "object":a[0][e]=
I({},a[0][e],a[1][e]);break;case "array":a[0][e]=a[1][e].slice(0);break;default:a[0][e]=a[1][e]}return 2<a.length?I.apply(null,[a[0]].concat(Array.prototype.slice.call(a,2))):a[0]}function N(a){a=Math.round(255*a).toString(16);return 1===a.length?"0"+a:a}function S(a,e,g,j){if(a.addEventListener)a[j?"removeEventListener":"addEventListener"](e,g,!1);else if(a.attachEvent)a[j?"detachEvent":"attachEvent"]("on"+e,g)}function D(a,e){function g(a,b,d,c){return y[0|a][Math.round(Math.min((b-d)/(c-d)*J,J))]}
function r(){f.legend.fps!==q&&(f.legend.fps=q,f.legend[T]=q?"FPS":"ms");K=q?b.fps:b.duration;f.count[T]=999<K?"999+":K.toFixed(99<K?0:d.decimals)}function m(){z=A();L<z-d.threshold&&(b.fps-=b.fps/Math.max(1,60*d.smoothing/d.interval),b.duration=1E3/b.fps);for(c=d.history;c--;)E[c]=0===c?b.fps:E[c-1],F[c]=0===c?b.duration:F[c-1];r();if(d.heat){if(w.length)for(c=w.length;c--;)w[c].el.style[h[w[c].name].heatOn]=q?g(h[w[c].name].heatmap,b.fps,0,d.maxFps):g(h[w[c].name].heatmap,b.duration,d.threshold,
0);if(f.graph&&h.column.heatOn)for(c=u.length;c--;)u[c].style[h.column.heatOn]=q?g(h.column.heatmap,E[c],0,d.maxFps):g(h.column.heatmap,F[c],d.threshold,0)}if(f.graph)for(p=0;p<d.history;p++)u[p].style.height=(q?E[p]?Math.round(O/d.maxFps*Math.min(E[p],d.maxFps)):0:F[p]?Math.round(O/d.threshold*Math.min(F[p],d.threshold)):0)+"px"}function k(){20>d.interval?(x=M(k),m()):(x=setTimeout(k,d.interval),P=M(m))}function G(a){a=a||window.event;a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.returnValue=
!1,a.cancelBubble=!0);b.toggle()}function U(){d.toggleOn&&S(f.container,d.toggleOn,G,1);a.removeChild(f.container)}function V(){f.container&&U();h=D.theme[d.theme];y=h.compiledHeatmaps||[];if(!y.length&&h.heatmaps.length){for(p=0;p<h.heatmaps.length;p++){y[p]=[];for(c=0;c<=J;c++){var b=y[p],e=c,g;g=0.33/J*c;var j=h.heatmaps[p].saturation,m=h.heatmaps[p].lightness,n=void 0,k=void 0,l=void 0,t=l=void 0,v=n=k=void 0,v=void 0,l=0.5>=m?m*(1+j):m+j-m*j;0===l?g="#000":(t=2*m-l,k=(l-t)/l,g*=6,n=Math.floor(g),
v=g-n,v*=l*k,0===n||6===n?(n=l,k=t+v,l=t):1===n?(n=l-v,k=l,l=t):2===n?(n=t,k=l,l=t+v):3===n?(n=t,k=l-v):4===n?(n=t+v,k=t):(n=l,k=t,l-=v),g="#"+N(n)+N(k)+N(l));b[e]=g}}h.compiledHeatmaps=y}f.container=s(document.createElement("div"),h.container);f.count=f.container.appendChild(s(document.createElement("div"),h.count));f.legend=f.container.appendChild(s(document.createElement("div"),h.legend));f.graph=d.graph?f.container.appendChild(s(document.createElement("div"),h.graph)):0;w.length=0;for(var q in f)f[q]&&
h[q].heatOn&&w.push({name:q,el:f[q]});u.length=0;if(f.graph){f.graph.style.width=d.history*h.column.width+(d.history-1)*h.column.spacing+"px";for(c=0;c<d.history;c++)u[c]=f.graph.appendChild(s(document.createElement("div"),h.column)),u[c].style.position="absolute",u[c].style.bottom=0,u[c].style.right=c*h.column.width+c*h.column.spacing+"px",u[c].style.width=h.column.width+"px",u[c].style.height="0px"}s(f.container,d);r();a.appendChild(f.container);f.graph&&(O=f.graph.clientHeight);d.toggleOn&&("click"===
d.toggleOn&&(f.container.style.cursor="pointer"),S(f.container,d.toggleOn,G))}"object"===H(a)&&a.nodeType===j&&(e=a,a=document.body);a||(a=document.body);var b=this,d=I({},D.defaults,e||{}),f={},u=[],h,y,J=100,w=[],W=0,B=d.threshold,Q=0,L=A()-B,z,E=[],F=[],x,P,q="fps"===d.show,O,K,c,p;b.options=d;b.fps=0;b.duration=0;b.isPaused=0;b.tickStart=function(){Q=A()};b.tick=function(){z=A();W=z-L;B+=(W-B)/d.smoothing;b.fps=1E3/B;b.duration=Q<L?B:z-Q;L=z};b.pause=function(){x&&(b.isPaused=1,clearTimeout(x),
C(x),C(P),x=P=0);return b};b.resume=function(){x||(b.isPaused=0,k());return b};b.set=function(a,c){d[a]=c;q="fps"===d.show;-1!==R(a,X)&&V();-1!==R(a,Y)&&s(f.container,d);return b};b.showDuration=function(){b.set("show","ms");return b};b.showFps=function(){b.set("show","fps");return b};b.toggle=function(){b.set("show",q?"ms":"fps");return b};b.hide=function(){b.pause();f.container.style.display="none";return b};b.show=function(){b.resume();f.container.style.display="block";return b};b.destroy=function(){b.pause();
U();b.tick=b.tickStart=function(){}};V();k()}var A,r=m.performance;A=r&&(r.now||r.webkitNow)?r[r.now?"now":"webkitNow"].bind(r):function(){return+new Date};for(var C=m.cancelAnimationFrame||m.cancelRequestAnimationFrame,M=m.requestAnimationFrame,r=["moz","webkit","o"],G=0,k=0,Z=r.length;k<Z&&!C;++k)M=(C=m[r[k]+"CancelAnimationFrame"]||m[r[k]+"CancelRequestAnimationFrame"])&&m[r[k]+"RequestAnimationFrame"];C||(M=function(a){var e=A(),g=Math.max(0,16-(e-G));G=e+g;return m.setTimeout(function(){a(e+
g)},g)},C=function(a){clearTimeout(a)});var T="string"===H(document.createElement("div").textContent)?"textContent":"innerText";D.extend=I;window.FPSMeter=D;D.defaults={interval:100,smoothing:10,show:"fps",toggleOn:"click",decimals:1,maxFps:60,threshold:100,position:"absolute",zIndex:10,left:"5px",top:"5px",right:"auto",bottom:"auto",margin:"0 0 0 0",theme:"dark",heat:0,graph:0,history:20};var X=["toggleOn","theme","heat","graph","history"],Y="position zIndex left top right bottom margin".split(" ")})(window);(function(m,j){j.theme={};var s=j.theme.base={heatmaps:[],container:{heatOn:null,heatmap:null,padding:"5px",minWidth:"95px",height:"30px",lineHeight:"30px",textAlign:"right",textShadow:"none"},count:{heatOn:null,heatmap:null,position:"absolute",top:0,right:0,padding:"5px 10px",height:"30px",fontSize:"24px",fontFamily:"Consolas, Andale Mono, monospace",zIndex:2},legend:{heatOn:null,heatmap:null,position:"absolute",top:0,left:0,padding:"5px 10px",height:"30px",fontSize:"12px",lineHeight:"32px",fontFamily:"sans-serif",
textAlign:"left",zIndex:2},graph:{heatOn:null,heatmap:null,position:"relative",boxSizing:"padding-box",MozBoxSizing:"padding-box",height:"100%",zIndex:1},column:{width:4,spacing:1,heatOn:null,heatmap:null}};j.theme.dark=j.extend({},s,{heatmaps:[{saturation:0.8,lightness:0.8}],container:{background:"#222",color:"#fff",border:"1px solid #1a1a1a",textShadow:"1px 1px 0 #222"},count:{heatOn:"color"},column:{background:"#3f3f3f"}});j.theme.light=j.extend({},s,{heatmaps:[{saturation:0.5,lightness:0.5}],
container:{color:"#666",background:"#fff",textShadow:"1px 1px 0 rgba(255,255,255,.5), -1px -1px 0 rgba(255,255,255,.5)",boxShadow:"0 0 0 1px rgba(0,0,0,.1)"},count:{heatOn:"color"},column:{background:"#eaeaea"}});j.theme.colorful=j.extend({},s,{heatmaps:[{saturation:0.5,lightness:0.6}],container:{heatOn:"backgroundColor",background:"#888",color:"#fff",textShadow:"1px 1px 0 rgba(0,0,0,.2)",boxShadow:"0 0 0 1px rgba(0,0,0,.1)"},column:{background:"#777",backgroundColor:"rgba(0,0,0,.2)"}});j.theme.transparent=
j.extend({},s,{heatmaps:[{saturation:0.8,lightness:0.5}],container:{padding:0,color:"#fff",textShadow:"1px 1px 0 rgba(0,0,0,.5)"},count:{padding:"0 5px",height:"40px",lineHeight:"40px"},legend:{padding:"0 5px",height:"40px",lineHeight:"42px"},graph:{height:"40px"},column:{width:5,background:"#999",heatOn:"backgroundColor",opacity:0.5}})})(window,FPSMeter);

View file

@ -0,0 +1,3 @@
/*! npm.im/iphone-inline-video */
var makeVideoPlayableInline=function(){"use strict";/*! npm.im/intervalometer */
function e(e,n,r,i){function t(r){d=n(t,i),e(r-(a||r)),a=r}var d,a;return{start:function(){d||t(0)},stop:function(){r(d),d=null,a=0}}}function n(n){return e(n,requestAnimationFrame,cancelAnimationFrame)}function r(e,n,r,i){function t(n){Boolean(e[r])===Boolean(i)&&n.stopImmediatePropagation(),delete e[r]}return e.addEventListener(n,t,!1),t}function i(e,n,r,i){function t(){return r[n]}function d(e){r[n]=e}i&&d(e[n]),Object.defineProperty(e,n,{get:t,set:d})}function t(e,n,r){r.addEventListener(n,function(){return e.dispatchEvent(new Event(n))})}function d(e,n){Promise.resolve().then(function(){e.dispatchEvent(new Event(n))})}function a(e){var n=new Audio;return t(e,"play",n),t(e,"playing",n),t(e,"pause",n),n.crossOrigin=e.crossOrigin,n.src=e.src||e.currentSrc||"data:",n}function o(e,n,r){(m||0)+200<Date.now()&&(e[g]=!0,m=Date.now()),r||(e.currentTime=n),A[++k%3]=100*n|0}function u(e){return e.driver.currentTime>=e.video.duration}function s(e){var n=this;n.video.readyState>=n.video.HAVE_FUTURE_DATA?(n.hasAudio||(n.driver.currentTime=n.video.currentTime+e*n.video.playbackRate/1e3,n.video.loop&&u(n)&&(n.driver.currentTime=0)),o(n.video,n.driver.currentTime)):n.video.networkState!==n.video.NETWORK_IDLE||n.video.buffered.length||n.video.load(),n.video.ended&&(delete n.video[g],n.video.pause(!0))}function c(){var e=this,n=e[b];return e.webkitDisplayingFullscreen?void e[E]():("data:"!==n.driver.src&&n.driver.src!==e.src&&(o(e,0,!0),n.driver.src=e.src),void(e.paused&&(n.paused=!1,e.buffered.length||e.load(),n.driver.play(),n.updater.start(),n.hasAudio||(d(e,"play"),n.video.readyState>=n.video.HAVE_ENOUGH_DATA&&d(e,"playing")))))}function v(e){var n=this,r=n[b];r.driver.pause(),r.updater.stop(),n.webkitDisplayingFullscreen&&n[T](),r.paused&&!e||(r.paused=!0,r.hasAudio||d(n,"pause"),n.ended&&(n[g]=!0,d(n,"ended")))}function p(e,r){var i=e[b]={};i.paused=!0,i.hasAudio=r,i.video=e,i.updater=n(s.bind(i)),r?i.driver=a(e):(e.addEventListener("canplay",function(){e.paused||d(e,"playing")}),i.driver={src:e.src||e.currentSrc||"data:",muted:!0,paused:!0,pause:function(){i.driver.paused=!0},play:function(){i.driver.paused=!1,u(i)&&o(e,0)},get ended(){return u(i)}}),e.addEventListener("emptied",function(){var n=!i.driver.src||"data:"===i.driver.src;i.driver.src&&i.driver.src!==e.src&&(o(e,0,!0),i.driver.src=e.src,n?i.driver.play():i.updater.stop())},!1),e.addEventListener("webkitbeginfullscreen",function(){e.paused?r&&!i.driver.buffered.length&&i.driver.load():(e.pause(),e[E]())}),r&&(e.addEventListener("webkitendfullscreen",function(){i.driver.currentTime=e.currentTime}),e.addEventListener("seeking",function(){A.indexOf(100*e.currentTime|0)<0&&(i.driver.currentTime=e.currentTime)}))}function l(e){var n=e[b];e[E]=e.play,e[T]=e.pause,e.play=c,e.pause=v,i(e,"paused",n.driver),i(e,"muted",n.driver,!0),i(e,"playbackRate",n.driver,!0),i(e,"ended",n.driver),i(e,"loop",n.driver,!0),r(e,"seeking"),r(e,"seeked"),r(e,"timeupdate",g,!1),r(e,"ended",g,!1)}function f(e,n,r){void 0===n&&(n=!0),void 0===r&&(r=!0),r&&!h||e[b]||(p(e,n),l(e),e.classList.add("IIV"),!n&&e.autoplay&&e.play(),/iPhone|iPod|iPad/.test(navigator.platform)||console.warn("iphone-inline-video is not guaranteed to work in emulated environments"))}var m,y="undefined"==typeof Symbol?function(e){return"@"+(e||"@")+Math.random()}:Symbol,h="object-fit"in document.head.style&&/iPhone|iPod/i.test(navigator.userAgent)&&!matchMedia("(-webkit-video-playable-inline)").matches,b=y(),g=y(),E=y("nativeplay"),T=y("nativepause"),A=[],k=0;return f.isWhitelisted=h,f}();

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,404 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var pixi_picture;
(function (pixi_picture) {
var BackdropFilter = (function (_super) {
__extends(BackdropFilter, _super);
function BackdropFilter() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.backdropUniformName = null;
_this._backdropActive = false;
_this.clearColor = null;
return _this;
}
return BackdropFilter;
}(PIXI.Filter));
pixi_picture.BackdropFilter = BackdropFilter;
var filterFrag = "\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D uBackdrop;\n\n%UNIFORM_CODE%\n\nvoid main(void)\n{\n vec4 b_src = texture2D(uSampler, vTextureCoord);\n vec4 b_dest = texture2D(uBackdrop, vTextureCoord);\n vec4 b_res = b_dest;\n \n %BLEND_CODE%\n\n gl_FragColor = b_res;\n}";
var BlendFilter = (function (_super) {
__extends(BlendFilter, _super);
function BlendFilter(shaderParts) {
var _this = this;
var fragCode = filterFrag;
fragCode = fragCode.replace('%UNIFORM_CODE%', shaderParts.uniformCode || "");
fragCode = fragCode.replace('%BLEND_CODE%', shaderParts.blendCode || "");
_this = _super.call(this, undefined, fragCode, shaderParts.uniforms) || this;
_this.backdropUniformName = 'uBackdrop';
return _this;
}
return BlendFilter;
}(BackdropFilter));
pixi_picture.BlendFilter = BlendFilter;
})(pixi_picture || (pixi_picture = {}));
var pixi_picture;
(function (pixi_picture) {
function containsRect(rectOut, rectIn) {
var r1 = rectIn.x + rectIn.width;
var b1 = rectIn.y + rectIn.height;
var r2 = rectOut.x + rectOut.width;
var b2 = rectOut.y + rectOut.height;
return (rectIn.x >= rectOut.x) &&
(rectIn.x <= r2) &&
(rectIn.y >= rectOut.y) &&
(rectIn.y <= b2) &&
(r1 >= rectOut.x) &&
(r1 <= r2) &&
(b1 >= rectOut.y) &&
(b1 <= b2);
}
PIXI.systems.TextureSystem.prototype.bindForceLocation = function (texture, location) {
if (location === void 0) { location = 0; }
var gl = this.gl;
if (this.currentLocation !== location) {
this.currentLocation = location;
gl.activeTexture(gl.TEXTURE0 + location);
}
this.bind(texture, location);
};
function pushWithCheck(target, filters, checkEmptyBounds) {
if (checkEmptyBounds === void 0) { checkEmptyBounds = true; }
var renderer = this.renderer;
var filterStack = this.defaultFilterStack;
var state = this.statePool.pop() || new PIXI.FilterState();
var resolution = filters[0].resolution;
var padding = filters[0].padding;
var autoFit = filters[0].autoFit;
var legacy = filters[0].legacy;
for (var i = 1; i < filters.length; i++) {
var filter = filters[i];
resolution = Math.min(resolution, filter.resolution);
padding = this.useMaxPadding
? Math.max(padding, filter.padding)
: padding + filter.padding;
autoFit = autoFit || filter.autoFit;
legacy = legacy || filter.legacy;
}
if (filterStack.length === 1) {
this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current;
}
filterStack.push(state);
state.resolution = resolution;
state.legacy = legacy;
state.target = target;
state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));
var canUseBackdrop = true;
state.sourceFrame.pad(padding);
if (autoFit) {
state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame);
}
else {
canUseBackdrop = containsRect(this.renderer.renderTexture.sourceFrame, state.sourceFrame);
}
if (checkEmptyBounds && state.sourceFrame.width <= 1 && state.sourceFrame.height <= 1) {
filterStack.pop();
state.clear();
this.statePool.push(state);
return false;
}
state.sourceFrame.ceil(resolution);
if (canUseBackdrop) {
var backdrop = null;
for (var i = 0; i < filters.length; i++) {
var bName = filters[i].backdropUniformName;
if (bName) {
if (backdrop === null) {
backdrop = this.prepareBackdrop(state.sourceFrame);
}
filters[i].uniforms[bName] = backdrop;
if (backdrop) {
filters[i]._backdropActive = true;
}
}
}
}
state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution);
state.filters = filters;
state.destinationFrame.width = state.renderTexture.width;
state.destinationFrame.height = state.renderTexture.height;
var destinationFrame = this.tempRect;
destinationFrame.width = state.sourceFrame.width;
destinationFrame.height = state.sourceFrame.height;
state.renderTexture.filterFrame = state.sourceFrame;
renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame);
renderer.renderTexture.clear(filters[filters.length - 1].clearColor);
return true;
}
function push(target, filters) {
return this.pushWithCheck(target, filters, false);
}
function pop() {
var filterStack = this.defaultFilterStack;
var state = filterStack.pop();
var filters = state.filters;
this.activeState = state;
var globalUniforms = this.globalUniforms.uniforms;
globalUniforms.outputFrame = state.sourceFrame;
globalUniforms.resolution = state.resolution;
var inputSize = globalUniforms.inputSize;
var inputPixel = globalUniforms.inputPixel;
var inputClamp = globalUniforms.inputClamp;
inputSize[0] = state.destinationFrame.width;
inputSize[1] = state.destinationFrame.height;
inputSize[2] = 1.0 / inputSize[0];
inputSize[3] = 1.0 / inputSize[1];
inputPixel[0] = inputSize[0] * state.resolution;
inputPixel[1] = inputSize[1] * state.resolution;
inputPixel[2] = 1.0 / inputPixel[0];
inputPixel[3] = 1.0 / inputPixel[1];
inputClamp[0] = 0.5 * inputPixel[2];
inputClamp[1] = 0.5 * inputPixel[3];
inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);
inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);
if (state.legacy) {
var filterArea = globalUniforms.filterArea;
filterArea[0] = state.destinationFrame.width;
filterArea[1] = state.destinationFrame.height;
filterArea[2] = state.sourceFrame.x;
filterArea[3] = state.sourceFrame.y;
globalUniforms.filterClamp = globalUniforms.inputClamp;
}
this.globalUniforms.update();
var lastState = filterStack[filterStack.length - 1];
if (state.renderTexture.framebuffer.multisample > 1) {
this.renderer.framebuffer.blit();
}
if (filters.length === 1) {
filters[0].apply(this, state.renderTexture, lastState.renderTexture, PIXI.CLEAR_MODES.BLEND, state);
this.returnFilterTexture(state.renderTexture);
}
else {
var flip = state.renderTexture;
var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution);
flop.filterFrame = flip.filterFrame;
var i = 0;
for (i = 0; i < filters.length - 1; ++i) {
filters[i].apply(this, flip, flop, PIXI.CLEAR_MODES.CLEAR, state);
var t = flip;
flip = flop;
flop = t;
}
filters[i].apply(this, flip, lastState.renderTexture, PIXI.CLEAR_MODES.BLEND, state);
this.returnFilterTexture(flip);
this.returnFilterTexture(flop);
}
var backdropFree = false;
for (var i = 0; i < filters.length; i++) {
if (filters[i]._backdropActive) {
var bName = filters[i].backdropUniformName;
if (!backdropFree) {
this.returnFilterTexture(filters[i].uniforms[bName]);
backdropFree = true;
}
filters[i].uniforms[bName] = null;
filters[i]._backdropActive = false;
}
}
state.clear();
this.statePool.push(state);
}
var hadBackbufferError = false;
function prepareBackdrop(bounds) {
var renderer = this.renderer;
var renderTarget = renderer.renderTexture.current;
var fr = this.renderer.renderTexture.sourceFrame;
if (!renderTarget) {
if (!hadBackbufferError) {
hadBackbufferError = true;
console.warn('pixi-picture: you are trying to use Blend Filter on main framebuffer! That wont work.');
}
return null;
}
var resolution = renderTarget.baseTexture.resolution;
var x = (bounds.x - fr.x) * resolution;
var y = (bounds.y - fr.y) * resolution;
var w = (bounds.width) * resolution;
var h = (bounds.height) * resolution;
var gl = renderer.gl;
var rt = this.getOptimalFilterTexture(w, h, 1);
rt.filterFrame = fr;
renderer.texture.bindForceLocation(rt.baseTexture, 0);
gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x, y, w, h);
return rt;
}
PIXI.systems.FilterSystem.prototype.push = push;
PIXI.systems.FilterSystem.prototype.pushWithCheck = pushWithCheck;
PIXI.systems.FilterSystem.prototype.pop = pop;
PIXI.systems.FilterSystem.prototype.prepareBackdrop = prepareBackdrop;
})(pixi_picture || (pixi_picture = {}));
var pixi_picture;
(function (pixi_picture) {
var MASK_CHANNEL;
(function (MASK_CHANNEL) {
MASK_CHANNEL[MASK_CHANNEL["RED"] = 0] = "RED";
MASK_CHANNEL[MASK_CHANNEL["GREEN"] = 1] = "GREEN";
MASK_CHANNEL[MASK_CHANNEL["BLUE"] = 2] = "BLUE";
MASK_CHANNEL[MASK_CHANNEL["ALPHA"] = 3] = "ALPHA";
})(MASK_CHANNEL = pixi_picture.MASK_CHANNEL || (pixi_picture.MASK_CHANNEL = {}));
var MaskConfig = (function () {
function MaskConfig(maskBefore, channel) {
if (maskBefore === void 0) { maskBefore = false; }
if (channel === void 0) { channel = MASK_CHANNEL.ALPHA; }
this.maskBefore = maskBefore;
this.uniformCode = 'uniform vec4 uChannel;';
this.uniforms = {
uChannel: new Float32Array([0, 0, 0, 0]),
};
this.blendCode = "b_res = dot(b_src, uChannel) * b_dest;";
this.uniforms.uChannel[channel] = 1.0;
}
return MaskConfig;
}());
pixi_picture.MaskConfig = MaskConfig;
var MaskFilter = (function (_super) {
__extends(MaskFilter, _super);
function MaskFilter(baseFilter, config) {
if (config === void 0) { config = new MaskConfig(); }
var _this = _super.call(this, config) || this;
_this.baseFilter = baseFilter;
_this.config = config;
_this.padding = baseFilter.padding;
return _this;
}
MaskFilter.prototype.apply = function (filterManager, input, output, clearMode) {
var target = filterManager.getFilterTexture(input);
if (this.config.maskBefore) {
var blendMode = this.state.blendMode;
this.state.blendMode = PIXI.BLEND_MODES.NONE;
filterManager.applyFilter(this, input, target, PIXI.CLEAR_MODES.YES);
this.baseFilter.blendMode = blendMode;
this.baseFilter.apply(filterManager, target, output, clearMode);
this.state.blendMode = blendMode;
}
else {
var uBackdrop = this.uniforms.uBackdrop;
this.baseFilter.apply(filterManager, uBackdrop, target, PIXI.CLEAR_MODES.YES);
this.uniforms.uBackdrop = target;
filterManager.applyFilter(this, input, output, clearMode);
this.uniforms.uBackdrop = uBackdrop;
}
filterManager.returnFilterTexture(target);
};
return MaskFilter;
}(pixi_picture.BlendFilter));
pixi_picture.MaskFilter = MaskFilter;
})(pixi_picture || (pixi_picture = {}));
var pixi_picture;
(function (pixi_picture) {
var blends;
(function (blends) {
blends.NPM_BLEND = "if (b_src.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n}\nvec3 Cb = b_src.rgb / b_src.a, Cs;\nif (b_dest.a > 0.0) {\n Cs = b_dest.rgb / b_dest.a;\n}\n%NPM_BLEND%\nb_res.a = b_src.a + b_dest.a * (1.0-b_src.a);\nb_res.rgb = (1.0 - b_src.a) * Cs + b_src.a * B;\nb_res.rgb *= b_res.a;\n";
blends.OVERLAY_PART = "vec3 multiply = Cb * Cs * 2.0;\nvec3 Cb2 = Cb * 2.0 - 1.0;\nvec3 screen = Cb2 + Cs - Cb2 * Cs;\nvec3 B;\nif (Cs.r <= 0.5) {\n B.r = multiply.r;\n} else {\n B.r = screen.r;\n}\nif (Cs.g <= 0.5) {\n B.g = multiply.g;\n} else {\n B.g = screen.g;\n}\nif (Cs.b <= 0.5) {\n B.b = multiply.b;\n} else {\n B.b = screen.b;\n}\n";
blends.HARDLIGHT_PART = "vec3 multiply = Cb * Cs * 2.0;\nvec3 Cs2 = Cs * 2.0 - 1.0;\nvec3 screen = Cb + Cs2 - Cb * Cs2;\nvec3 B;\nif (Cb.r <= 0.5) {\n B.r = multiply.r;\n} else {\n B.r = screen.r;\n}\nif (Cb.g <= 0.5) {\n B.g = multiply.g;\n} else {\n B.g = screen.g;\n}\nif (Cb.b <= 0.5) {\n B.b = multiply.b;\n} else {\n B.b = screen.b;\n}\n";
blends.SOFTLIGHT_PART = "vec3 first = Cb - (1.0 - 2.0 * Cs) * Cb * (1.0 - Cb);\nvec3 B;\nvec3 D;\nif (Cs.r <= 0.5)\n{\n B.r = first.r;\n}\nelse\n{\n if (Cb.r <= 0.25)\n {\n D.r = ((16.0 * Cb.r - 12.0) * Cb.r + 4.0) * Cb.r; \n }\n else\n {\n D.r = sqrt(Cb.r);\n }\n B.r = Cb.r + (2.0 * Cs.r - 1.0) * (D.r - Cb.r);\n}\nif (Cs.g <= 0.5)\n{\n B.g = first.g;\n}\nelse\n{\n if (Cb.g <= 0.25)\n {\n D.g = ((16.0 * Cb.g - 12.0) * Cb.g + 4.0) * Cb.g; \n }\n else\n {\n D.g = sqrt(Cb.g);\n }\n B.g = Cb.g + (2.0 * Cs.g - 1.0) * (D.g - Cb.g);\n}\nif (Cs.b <= 0.5)\n{\n B.b = first.b;\n}\nelse\n{\n if (Cb.b <= 0.25)\n {\n D.b = ((16.0 * Cb.b - 12.0) * Cb.b + 4.0) * Cb.b; \n }\n else\n {\n D.b = sqrt(Cb.b);\n }\n B.b = Cb.b + (2.0 * Cs.b - 1.0) * (D.b - Cb.b);\n}\n";
blends.MULTIPLY_FULL = "if (b_dest.a > 0.0) {\n vec4 mult;\nmult.a = min(b_src.a + b_dest.a - b_src.a * b_dest.a, 1.0);\n mult.rgb = (b_dest.rgb / b_dest.a) * ((1.0 - b_src.a) + b_src.rgb);\n b_res.rgb = (b_dest.rgb / b_dest.a) * ((1.0 - b_src.a) + b_src.rgb);\n b_res.a = min(b_src.a + b_dest.a - b_src.a * b_dest.a, 1.0);\n b_res.rgb *= mult.a;\n}\n";
blends.OVERLAY_FULL = blends.NPM_BLEND.replace("%NPM_BLEND%", blends.OVERLAY_PART);
blends.HARDLIGHT_FULL = blends.NPM_BLEND.replace("%NPM_BLEND%", blends.HARDLIGHT_PART);
blends.SOFTLIGHT_FULL = blends.NPM_BLEND.replace("%NPM_BLEND%", blends.SOFTLIGHT_PART);
blends.blendFullArray = [];
blends.blendFullArray[PIXI.BLEND_MODES.MULTIPLY] = blends.MULTIPLY_FULL;
blends.blendFullArray[PIXI.BLEND_MODES.OVERLAY] = blends.OVERLAY_FULL;
blends.blendFullArray[PIXI.BLEND_MODES.HARD_LIGHT] = blends.HARDLIGHT_FULL;
blends.blendFullArray[PIXI.BLEND_MODES.SOFT_LIGHT] = blends.SOFTLIGHT_FULL;
})(blends = pixi_picture.blends || (pixi_picture.blends = {}));
var filterCache = [];
var filterCacheArray = [];
function getBlendFilter(blendMode) {
if (!blends.blendFullArray[blendMode]) {
return null;
}
if (!filterCache[blendMode]) {
filterCache[blendMode] = new pixi_picture.BlendFilter({ blendCode: blends.blendFullArray[blendMode] });
}
return filterCache[blendMode];
}
pixi_picture.getBlendFilter = getBlendFilter;
function getBlendFilterArray(blendMode) {
if (!blends.blendFullArray[blendMode]) {
return null;
}
if (!filterCacheArray[blendMode]) {
filterCacheArray[blendMode] = [this.getBlendFilter(blendMode)];
}
return filterCacheArray[blendMode];
}
pixi_picture.getBlendFilterArray = getBlendFilterArray;
})(pixi_picture || (pixi_picture = {}));
var pixi_picture;
(function (pixi_picture) {
var Sprite = (function (_super) {
__extends(Sprite, _super);
function Sprite() {
return _super !== null && _super.apply(this, arguments) || this;
}
Sprite.prototype._render = function (renderer) {
var texture = this._texture;
if (!texture || !texture.valid) {
return;
}
var blendFilterArray = pixi_picture.getBlendFilterArray(this.blendMode);
if (blendFilterArray) {
renderer.batch.flush();
if (!renderer.filter.pushWithCheck(this, blendFilterArray)) {
return;
}
}
this.calculateVertices();
renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
renderer.plugins[this.pluginName].render(this);
if (blendFilterArray) {
renderer.batch.flush();
renderer.filter.pop();
}
};
return Sprite;
}(PIXI.Sprite));
pixi_picture.Sprite = Sprite;
})(pixi_picture || (pixi_picture = {}));
var pixi_picture;
(function (pixi_picture) {
var TilingSprite = (function (_super) {
__extends(TilingSprite, _super);
function TilingSprite() {
return _super !== null && _super.apply(this, arguments) || this;
}
TilingSprite.prototype._render = function (renderer) {
var texture = this._texture;
if (!texture || !texture.valid) {
return;
}
var blendFilterArray = pixi_picture.getBlendFilterArray(this.blendMode);
if (blendFilterArray) {
renderer.batch.flush();
if (!renderer.filter.pushWithCheck(this, blendFilterArray)) {
return;
}
}
this.tileTransform.updateLocalTransform();
this.uvMatrix.update();
renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
renderer.plugins[this.pluginName].render(this);
if (blendFilterArray) {
renderer.batch.flush();
renderer.filter.pop();
}
};
return TilingSprite;
}(PIXI.TilingSprite));
pixi_picture.TilingSprite = TilingSprite;
})(pixi_picture || (pixi_picture = {}));
var pixi_picture;
(function (pixi_picture) {
PIXI.picture = pixi_picture;
})(pixi_picture || (pixi_picture = {}));
//# sourceMappingURL=pixi-picture.js.map

View file

@ -0,0 +1,973 @@
/* eslint-disable */
/*!
* pixi-tilemap - v2.1.3
* Compiled Sun, 18 Oct 2020 17:08:58 UTC
*
* pixi-tilemap is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*
* Copyright 2019-2020, Ivan Popelyshev, All Rights Reserved
*/
this.PIXI = this.PIXI || {};
this.PIXI.tilemap = this.PIXI.tilemap || {};
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@pixi/display'), require('@pixi/core'), require('@pixi/constants'), require('@pixi/math'), require('@pixi/graphics'), require('@pixi/sprite')) :
typeof define === 'function' && define.amd ? define(['exports', '@pixi/display', '@pixi/core', '@pixi/constants', '@pixi/math', '@pixi/graphics', '@pixi/sprite'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pixi_tilemap = {}, global.PIXI, global.PIXI, global.PIXI, global.PIXI, global.PIXI, global.PIXI));
}(this, (function (exports, display, core, constants, math, graphics, sprite) {
'use strict';
class CanvasTileRenderer {
constructor(renderer) {
this.tileAnim = [0, 0];
this.dontUseTransform = false;
this.renderer = renderer;
this.tileAnim = [0, 0];
}
}
const cr = PIXI.CanvasRenderer;
if (cr) {
cr.registerPlugin('tilemap', CanvasTileRenderer);
}
const Constant = {
maxTextures: 16,
bufferSize: 2048,
boundSize: 1024,
boundCountPerBuffer: 1,
use32bitIndex: false,
SCALE_MODE: constants.SCALE_MODES.LINEAR,
DO_CLEAR: true
};
const POINT_STRUCT_SIZE = 12;
class RectTileLayer extends display.Container {
constructor(zIndex, texture) {
super();
this.zIndex = 0;
this.modificationMarker = 0;
this._$_localBounds = new display.Bounds();
this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);
this._globalMat = null;
this.pointsBuf = [];
this.hasAnim = false;
this.offsetX = 0;
this.offsetY = 0;
this.compositeParent = false;
this.tileAnim = null;
this.vbId = 0;
this.vb = null;
this.vbBuffer = null;
this.vbArray = null;
this.vbInts = null;
this.initialize(zIndex, texture);
}
initialize(zIndex, textures) {
if (!textures) {
textures = [];
}
else if (!(textures instanceof Array) && textures.baseTexture) {
textures = [textures];
}
this.textures = textures;
this.zIndex = zIndex;
}
clear() {
this.pointsBuf.length = 0;
this.modificationMarker = 0;
this._$_localBounds.clear();
this.hasAnim = false;
}
addFrame(texture_, x, y, animX, animY) {
let texture;
let textureIndex = 0;
if (typeof texture_ === "number") {
textureIndex = texture_;
texture = this.textures[textureIndex];
}
else {
if (typeof texture_ === "string") {
texture = core.Texture.from(texture_);
}
else {
texture = texture_;
}
let found = false;
let textureList = this.textures;
for (let i = 0; i < textureList.length; i++) {
if (textureList[i].baseTexture === texture.baseTexture) {
textureIndex = i;
found = true;
break;
}
}
if (!found) {
return false;
}
}
this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);
return true;
}
addRect(textureIndex, u, v, x, y, tileWidth, tileHeight, animX = 0, animY = 0, rotate = 0, animCountX = 1024, animCountY = 1024) {
let pb = this.pointsBuf;
this.hasAnim = this.hasAnim || animX > 0 || animY > 0;
pb.push(u);
pb.push(v);
pb.push(x);
pb.push(y);
pb.push(tileWidth);
pb.push(tileHeight);
pb.push(rotate);
pb.push(animX | 0);
pb.push(animY | 0);
pb.push(textureIndex);
pb.push(animCountX);
pb.push(animCountY);
this._$_localBounds.addFramePad(x, y, x + tileWidth, y + tileHeight, 0, 0);
return this;
}
tileRotate(rotate) {
const pb = this.pointsBuf;
pb[pb.length - 3] = rotate;
}
tileAnimX(offset, count) {
const pb = this.pointsBuf;
pb[pb.length - 5] = offset;
pb[pb.length - 2] = count;
}
tileAnimY(offset, count) {
const pb = this.pointsBuf;
pb[pb.length - 4] = offset;
pb[pb.length - 1] = count;
}
renderCanvas(renderer) {
let plugin = renderer.plugins.tilemap;
if (!plugin.dontUseTransform) {
let wt = this.worldTransform;
renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
}
this.renderCanvasCore(renderer);
}
renderCanvasCore(renderer) {
if (this.textures.length === 0)
return;
let points = this.pointsBuf;
const tileAnim = this.tileAnim || renderer.plugins.tilemap.tileAnim;
renderer.context.fillStyle = '#000000';
for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {
let x1 = points[i], y1 = points[i + 1];
let x2 = points[i + 2], y2 = points[i + 3];
let w = points[i + 4];
let h = points[i + 5];
var rotate = points[i + 6];
x1 += points[i + 7] * tileAnim[0];
y1 += points[i + 8] * tileAnim[1];
let textureIndex = points[i + 9];
if (textureIndex >= 0) {
renderer.context.drawImage(this.textures[textureIndex].baseTexture.getDrawableSource(), x1, y1, w, h, x2, y2, w, h);
}
else {
renderer.context.globalAlpha = 0.5;
renderer.context.fillRect(x2, y2, w, h);
renderer.context.globalAlpha = 1;
}
}
}
destroyVb() {
if (this.vb) {
this.vb.destroy();
this.vb = null;
}
}
render(renderer) {
let plugin = renderer.plugins['tilemap'];
let shader = plugin.getShader();
renderer.batch.setObjectRenderer(plugin);
this._globalMat = shader.uniforms.projTransMatrix;
renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);
shader.uniforms.shadowColor = this.shadowColor;
shader.uniforms.animationFrame = this.tileAnim || plugin.tileAnim;
this.renderWebGLCore(renderer, plugin);
}
renderWebGLCore(renderer, plugin) {
let points = this.pointsBuf;
if (points.length === 0)
return;
let rectsCount = points.length / POINT_STRUCT_SIZE;
let shader = plugin.getShader();
let textures = this.textures;
if (textures.length === 0)
return;
plugin.bindTextures(renderer, shader, textures);
renderer.shader.bind(shader, false);
let vb = this.vb;
if (!vb) {
vb = plugin.createVb();
this.vb = vb;
this.vbId = vb.id;
this.vbBuffer = null;
this.modificationMarker = 0;
}
plugin.checkIndexBuffer(rectsCount, vb);
const boundCountPerBuffer = Constant.boundCountPerBuffer;
let vertexBuf = vb.getBuffer('aVertexPosition');
let vertices = rectsCount * vb.vertPerQuad;
if (vertices === 0)
return;
if (this.modificationMarker !== vertices) {
this.modificationMarker = vertices;
let vs = vb.stride * vertices;
if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {
let bk = vb.stride;
while (bk < vs) {
bk *= 2;
}
this.vbBuffer = new ArrayBuffer(bk);
this.vbArray = new Float32Array(this.vbBuffer);
this.vbInts = new Uint32Array(this.vbBuffer);
vertexBuf.update(this.vbBuffer);
}
let arr = this.vbArray, ints = this.vbInts;
let sz = 0;
let textureId = 0;
let shiftU = this.offsetX;
let shiftV = this.offsetY;
let tint = -1;
for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {
let eps = 0.5;
if (this.compositeParent) {
if (boundCountPerBuffer > 1) {
textureId = (points[i + 9] >> 2);
shiftU = this.offsetX * (points[i + 9] & 1);
shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);
}
else {
textureId = points[i + 9];
shiftU = 0;
shiftV = 0;
}
}
let x = points[i + 2], y = points[i + 3];
let w = points[i + 4], h = points[i + 5];
let u = points[i] + shiftU, v = points[i + 1] + shiftV;
let rotate = points[i + 6];
const animX = points[i + 7], animY = points[i + 8];
const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;
const animXEncoded = animX + (animWidth * 2048);
const animYEncoded = animY + (animHeight * 2048);
let u0, v0, u1, v1, u2, v2, u3, v3;
if (rotate === 0) {
u0 = u;
v0 = v;
u1 = u + w;
v1 = v;
u2 = u + w;
v2 = v + h;
u3 = u;
v3 = v + h;
}
else {
let w2 = w / 2;
let h2 = h / 2;
if (rotate % 4 !== 0) {
w2 = h / 2;
h2 = w / 2;
}
const cX = u + w2;
const cY = v + h2;
rotate = math.groupD8.add(rotate, math.groupD8.NW);
u0 = cX + (w2 * math.groupD8.uX(rotate));
v0 = cY + (h2 * math.groupD8.uY(rotate));
rotate = math.groupD8.add(rotate, 2);
u1 = cX + (w2 * math.groupD8.uX(rotate));
v1 = cY + (h2 * math.groupD8.uY(rotate));
rotate = math.groupD8.add(rotate, 2);
u2 = cX + (w2 * math.groupD8.uX(rotate));
v2 = cY + (h2 * math.groupD8.uY(rotate));
rotate = math.groupD8.add(rotate, 2);
u3 = cX + (w2 * math.groupD8.uX(rotate));
v3 = cY + (h2 * math.groupD8.uY(rotate));
}
arr[sz++] = x;
arr[sz++] = y;
arr[sz++] = u0;
arr[sz++] = v0;
arr[sz++] = u + eps;
arr[sz++] = v + eps;
arr[sz++] = u + w - eps;
arr[sz++] = v + h - eps;
arr[sz++] = animXEncoded;
arr[sz++] = animYEncoded;
arr[sz++] = textureId;
arr[sz++] = x + w;
arr[sz++] = y;
arr[sz++] = u1;
arr[sz++] = v1;
arr[sz++] = u + eps;
arr[sz++] = v + eps;
arr[sz++] = u + w - eps;
arr[sz++] = v + h - eps;
arr[sz++] = animXEncoded;
arr[sz++] = animYEncoded;
arr[sz++] = textureId;
arr[sz++] = x + w;
arr[sz++] = y + h;
arr[sz++] = u2;
arr[sz++] = v2;
arr[sz++] = u + eps;
arr[sz++] = v + eps;
arr[sz++] = u + w - eps;
arr[sz++] = v + h - eps;
arr[sz++] = animXEncoded;
arr[sz++] = animYEncoded;
arr[sz++] = textureId;
arr[sz++] = x;
arr[sz++] = y + h;
arr[sz++] = u3;
arr[sz++] = v3;
arr[sz++] = u + eps;
arr[sz++] = v + eps;
arr[sz++] = u + w - eps;
arr[sz++] = v + h - eps;
arr[sz++] = animXEncoded;
arr[sz++] = animYEncoded;
arr[sz++] = textureId;
}
vertexBuf.update(arr);
}
renderer.geometry.bind(vb, shader);
renderer.geometry.draw(constants.DRAW_MODES.TRIANGLES, rectsCount * 6, 0);
}
isModified(anim) {
if (this.modificationMarker !== this.pointsBuf.length ||
anim && this.hasAnim) {
return true;
}
return false;
}
clearModify() {
this.modificationMarker = this.pointsBuf.length;
}
_calculateBounds() {
const { minX, minY, maxX, maxY } = this._$_localBounds;
this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);
}
getLocalBounds(rect) {
if (this.children.length === 0) {
return this._$_localBounds.getRectangle(rect);
}
return super.getLocalBounds.call(this, rect);
}
destroy(options) {
super.destroy(options);
this.destroyVb();
}
}
class CompositeRectTileLayer extends display.Container {
constructor(zIndex, bitmaps, texPerChild) {
super();
this.modificationMarker = 0;
this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);
this._globalMat = null;
this._lastLayer = null;
this.tileAnim = null;
this.initialize.apply(this, arguments);
}
initialize(zIndex, bitmaps, texPerChild) {
if (texPerChild === true) {
texPerChild = 0;
}
this.z = this.zIndex = zIndex;
this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;
if (bitmaps) {
this.setBitmaps(bitmaps);
}
}
setBitmaps(bitmaps) {
for (let i = 0; i < bitmaps.length; i++) {
if (bitmaps[i] && !bitmaps[i].baseTexture) {
throw new Error(`pixi-tilemap cannot use destroyed textures. ` +
`Probably, you passed resources['myAtlas'].texture in pixi > 5.2.1, it does not exist there.`);
}
}
let texPerChild = this.texPerChild;
let len1 = this.children.length;
let len2 = Math.ceil(bitmaps.length / texPerChild);
let i;
for (i = 0; i < len1; i++) {
this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);
}
for (i = len1; i < len2; i++) {
let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));
layer.compositeParent = true;
layer.offsetX = Constant.boundSize;
layer.offsetY = Constant.boundSize;
this.addChild(layer);
}
}
clear() {
for (let i = 0; i < this.children.length; i++) {
this.children[i].clear();
}
this.modificationMarker = 0;
}
addRect(textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight) {
const childIndex = textureIndex / this.texPerChild >> 0;
const textureId = textureIndex % this.texPerChild;
if (this.children[childIndex] && this.children[childIndex].textures) {
this._lastLayer = this.children[childIndex];
this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);
}
else {
this._lastLayer = null;
}
return this;
}
tileRotate(rotate) {
if (this._lastLayer) {
this._lastLayer.tileRotate(rotate);
}
return this;
}
tileAnimX(offset, count) {
if (this._lastLayer) {
this._lastLayer.tileAnimX(offset, count);
}
return this;
}
tileAnimY(offset, count) {
if (this._lastLayer) {
this._lastLayer.tileAnimY(offset, count);
}
return this;
}
addFrame(texture_, x, y, animX, animY, animWidth, animHeight) {
let texture;
let layer = null;
let ind = 0;
let children = this.children;
this._lastLayer = null;
if (typeof texture_ === "number") {
let childIndex = texture_ / this.texPerChild >> 0;
layer = children[childIndex];
if (!layer) {
layer = children[0];
if (!layer) {
return this;
}
ind = 0;
}
else {
ind = texture_ % this.texPerChild;
}
texture = layer.textures[ind];
}
else {
if (typeof texture_ === "string") {
texture = core.Texture.from(texture_);
}
else {
texture = texture_;
}
for (let i = 0; i < children.length; i++) {
let child = children[i];
let tex = child.textures;
for (let j = 0; j < tex.length; j++) {
if (tex[j].baseTexture === texture.baseTexture) {
layer = child;
ind = j;
break;
}
}
if (layer) {
break;
}
}
if (!layer) {
for (let i = 0; i < children.length; i++) {
let child = children[i];
if (child.textures.length < this.texPerChild) {
layer = child;
ind = child.textures.length;
child.textures.push(texture);
break;
}
}
if (!layer) {
layer = new RectTileLayer(this.zIndex, texture);
layer.compositeParent = true;
layer.offsetX = Constant.boundSize;
layer.offsetY = Constant.boundSize;
this.addChild(layer);
ind = 0;
}
}
}
this._lastLayer = layer;
layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);
return this;
}
renderCanvas(renderer) {
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
return;
}
let plugin = renderer.plugins.tilemap;
if (!plugin.dontUseTransform) {
let wt = this.worldTransform;
renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
}
let layers = this.children;
for (let i = 0; i < layers.length; i++) {
const layer = layers[i];
layer.tileAnim = this.tileAnim;
layer.renderCanvasCore(renderer);
}
}
render(renderer) {
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
return;
}
let plugin = renderer.plugins['tilemap'];
let shader = plugin.getShader();
renderer.batch.setObjectRenderer(plugin);
this._globalMat = shader.uniforms.projTransMatrix;
renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);
shader.uniforms.shadowColor = this.shadowColor;
shader.uniforms.animationFrame = this.tileAnim || plugin.tileAnim;
renderer.shader.bind(shader, false);
let layers = this.children;
for (let i = 0; i < layers.length; i++) {
const layer = layers[i];
layer.renderWebGLCore(renderer, plugin);
}
}
isModified(anim) {
let layers = this.children;
if (this.modificationMarker !== layers.length) {
return true;
}
for (let i = 0; i < layers.length; i++) {
if (layers[i].isModified(anim)) {
return true;
}
}
return false;
}
clearModify() {
let layers = this.children;
this.modificationMarker = layers.length;
for (let i = 0; i < layers.length; i++) {
layers[i].clearModify();
}
}
}
class GraphicsLayer extends graphics.Graphics {
constructor(zIndex) {
super();
this.zIndex = zIndex;
}
renderCanvas(renderer) {
let wt = null;
if (renderer.plugins.tilemap.dontUseTransform) {
wt = this.transform.worldTransform;
this.transform.worldTransform = math.Matrix.IDENTITY;
}
renderer.plugins.graphics.render(this);
if (renderer.plugins.tilemap.dontUseTransform) {
this.transform.worldTransform = wt;
}
renderer.context.globalAlpha = 1.0;
}
isModified(anim) {
return false;
}
clearModify() {
}
}
class MultiTextureResource extends core.resources.Resource {
constructor(options) {
super(options.bufferSize, options.bufferSize);
this.DO_CLEAR = false;
this.boundSize = 0;
this._clearBuffer = null;
this.baseTex = null;
this.boundSprites = [];
this.dirties = [];
const bounds = this.boundSprites;
const dirties = this.dirties;
this.boundSize = options.boundSize;
for (let j = 0; j < options.boundCountPerBuffer; j++) {
const spr = new sprite.Sprite();
spr.position.x = options.boundSize * (j & 1);
spr.position.y = options.boundSize * (j >> 1);
bounds.push(spr);
dirties.push(0);
}
this.DO_CLEAR = !!options.DO_CLEAR;
}
bind(baseTexture) {
if (this.baseTex) {
throw new Error('Only one baseTexture is allowed for this resource!');
}
this.baseTex = baseTexture;
super.bind(baseTexture);
}
setTexture(ind, texture) {
const spr = this.boundSprites[ind];
if (spr.texture.baseTexture === texture.baseTexture) {
return;
}
spr.texture = texture;
this.baseTex.update();
this.dirties[ind] = this.baseTex.dirtyId;
}
upload(renderer, texture, glTexture) {
const { gl } = renderer;
const { width, height } = this;
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||
texture.alphaMode === constants.ALPHA_MODES.UNPACK);
if (glTexture.dirtyId < 0) {
glTexture.width = width;
glTexture.height = height;
gl.texImage2D(texture.target, 0, texture.format, width, height, 0, texture.format, texture.type, null);
}
const doClear = this.DO_CLEAR;
if (doClear && !this._clearBuffer) {
this._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);
}
const bounds = this.boundSprites;
for (let i = 0; i < bounds.length; i++) {
const spr = bounds[i];
const tex = spr.texture.baseTexture;
if (glTexture.dirtyId >= this.dirties[i]) {
continue;
}
const res = tex.resource;
if (!tex.valid || !res || !res.source) {
continue;
}
if (doClear && (tex.width < this.boundSize || tex.height < this.boundSize)) {
gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, this.boundSize, this.boundSize, texture.format, texture.type, this._clearBuffer);
}
gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, texture.format, texture.type, res.source);
}
return true;
}
}
function fillSamplers(shader, maxTextures) {
let sampleValues = [];
for (let i = 0; i < maxTextures; i++) {
sampleValues[i] = i;
}
shader.uniforms.uSamplers = sampleValues;
let samplerSize = [];
for (let i = 0; i < maxTextures; i++) {
samplerSize.push(1.0 / Constant.bufferSize);
samplerSize.push(1.0 / Constant.bufferSize);
}
shader.uniforms.uSamplerSize = samplerSize;
}
function generateFragmentSrc(maxTextures, fragmentSrc) {
return fragmentSrc.replace(/%count%/gi, maxTextures + "")
.replace(/%forloop%/gi, generateSampleSrc(maxTextures));
}
function generateSampleSrc(maxTextures) {
let src = '';
src += '\n';
src += '\n';
src += 'if(vTextureId <= -1.0) {';
src += '\n\tcolor = shadowColor;';
src += '\n}';
for (let i = 0; i < maxTextures; i++) {
src += '\nelse ';
if (i < maxTextures - 1) {
src += 'if(textureId == ' + i + '.0)';
}
src += '\n{';
src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);';
src += '\n}';
}
src += '\n';
src += '\n';
return src;
}
let rectShaderFrag = `
varying vec2 vTextureCoord;
varying vec4 vFrame;
varying float vTextureId;
uniform vec4 shadowColor;
uniform sampler2D uSamplers[%count%];
uniform vec2 uSamplerSize[%count%];
void main(void){
vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);
float textureId = floor(vTextureId + 0.5);
vec4 color;
%forloop%
gl_FragColor = color;
}
`;
let rectShaderVert = `
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
attribute vec4 aFrame;
attribute vec2 aAnim;
attribute float aTextureId;
uniform mat3 projTransMatrix;
uniform vec2 animationFrame;
varying vec2 vTextureCoord;
varying float vTextureId;
varying vec4 vFrame;
void main(void){
gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vec2 animCount = floor((aAnim + 0.5) / 2048.0);
vec2 animFrameOffset = aAnim - animCount * 2048.0;
vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));
vTextureCoord = aTextureCoord + animOffset;
vFrame = aFrame + vec4(animOffset, animOffset);
vTextureId = aTextureId;
}
`;
class TilemapShader extends core.Shader {
constructor(maxTextures, shaderVert, shaderFrag) {
super(new core.Program(shaderVert, shaderFrag), {
animationFrame: new Float32Array(2),
uSamplers: [],
uSamplerSize: [],
projTransMatrix: new math.Matrix()
});
this.maxTextures = 0;
this.maxTextures = maxTextures;
fillSamplers(this, this.maxTextures);
}
}
class RectTileShader extends TilemapShader {
constructor(maxTextures) {
super(maxTextures, rectShaderVert, generateFragmentSrc(maxTextures, rectShaderFrag));
fillSamplers(this, this.maxTextures);
}
}
class RectTileGeom extends core.Geometry {
constructor() {
super();
this.vertSize = 11;
this.vertPerQuad = 4;
this.stride = this.vertSize * 4;
this.lastTimeAccess = 0;
const buf = this.buf = new core.Buffer(new Float32Array(2), true, false);
this.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)
.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)
.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)
.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)
.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);
}
}
class TileRenderer extends core.ObjectRenderer {
constructor(renderer) {
super(renderer);
this.sn = -1;
this.indexBuffer = null;
this.ibLen = 0;
this.tileAnim = [0, 0];
this.texLoc = [];
this.texResources = [];
this.rectShader = new RectTileShader(Constant.maxTextures);
this.indexBuffer = new core.Buffer(undefined, true, true);
this.checkIndexBuffer(2000);
this.initBounds();
}
initBounds() {
if (Constant.boundCountPerBuffer <= 1) {
return;
}
const maxTextures = Constant.maxTextures;
for (let i = 0; i < maxTextures; i++) {
const resource = new MultiTextureResource(Constant);
const baseTex = new core.BaseTexture(resource);
baseTex.scaleMode = Constant.SCALE_MODE;
baseTex.wrapMode = constants.WRAP_MODES.CLAMP;
this.texResources.push(resource);
}
}
bindTexturesWithoutRT(renderer, shader, textures) {
let samplerSize = shader.uniforms.uSamplerSize;
this.texLoc.length = 0;
for (let i = 0; i < textures.length; i++) {
const texture = textures[i];
if (!texture || !texture.valid) {
return;
}
renderer.texture.bind(textures[i], i);
samplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;
samplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;
}
shader.uniforms.uSamplerSize = samplerSize;
}
bindTextures(renderer, shader, textures) {
const len = textures.length;
const maxTextures = Constant.maxTextures;
if (len > Constant.boundCountPerBuffer * maxTextures) {
return;
}
if (Constant.boundCountPerBuffer <= 1) {
this.bindTexturesWithoutRT(renderer, shader, textures);
return;
}
let i = 0;
for (; i < len; i++) {
const texture = textures[i];
if (!texture || !texture.valid)
continue;
const multi = this.texResources[i >> 2];
multi.setTexture(i & 3, texture);
}
let gltsUsed = (i + 3) >> 2;
for (i = 0; i < gltsUsed; i++) {
renderer.texture.bind(this.texResources[i].baseTex, i);
}
}
start() {
}
createVb() {
const geom = new RectTileGeom();
geom.addIndex(this.indexBuffer);
geom.lastTimeAccess = Date.now();
return geom;
}
checkIndexBuffer(size, vb = null) {
const totalIndices = size * 6;
if (totalIndices <= this.ibLen) {
return;
}
let len = totalIndices;
while (len < totalIndices) {
len <<= 1;
}
this.ibLen = totalIndices;
this.indexBuffer.update(PIXI.utils.createIndicesForQuads(size, Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined));
}
getShader() {
return this.rectShader;
}
destroy() {
super.destroy();
this.rectShader = null;
}
}
core.Renderer.registerPlugin('tilemap', TileRenderer);
class ZLayer extends display.Container {
constructor(tilemap, zIndex) {
super();
this._lastAnimationFrame = -1;
this.tilemap = tilemap;
this.z = zIndex;
}
clear() {
let layers = this.children;
for (let i = 0; i < layers.length; i++)
layers[i].clear();
this._previousLayers = 0;
}
cacheIfDirty() {
let tilemap = this.tilemap;
let layers = this.children;
let modified = this._previousLayers !== layers.length;
this._previousLayers = layers.length;
let buf = this.canvasBuffer;
let tempRender = this._tempRender;
if (!buf) {
buf = this.canvasBuffer = document.createElement('canvas');
tempRender = this._tempRender = new PIXI.CanvasRenderer({ width: 100, height: 100, view: buf });
tempRender.context = tempRender.rootContext;
tempRender.plugins.tilemap.dontUseTransform = true;
}
if (buf.width !== tilemap._layerWidth ||
buf.height !== tilemap._layerHeight) {
buf.width = tilemap._layerWidth;
buf.height = tilemap._layerHeight;
modified = true;
}
let i;
if (!modified) {
for (i = 0; i < layers.length; i++) {
if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {
modified = true;
break;
}
}
}
this._lastAnimationFrame = tilemap.animationFrame;
if (modified) {
if (tilemap._hackRenderer) {
tilemap._hackRenderer(tempRender);
}
tempRender.context.clearRect(0, 0, buf.width, buf.height);
for (i = 0; i < layers.length; i++) {
layers[i].clearModify();
layers[i].renderCanvas(tempRender);
}
}
this.layerTransform = this.worldTransform;
for (i = 0; i < layers.length; i++) {
this.layerTransform = layers[i].worldTransform;
break;
}
}
renderCanvas(renderer) {
this.cacheIfDirty();
let wt = this.layerTransform;
renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
let tilemap = this.tilemap;
renderer.context.drawImage(this.canvasBuffer, 0, 0);
}
}
const pixi_tilemap = {
CanvasTileRenderer,
CompositeRectTileLayer,
Constant,
GraphicsLayer,
MultiTextureResource,
RectTileLayer,
TilemapShader,
RectTileShader,
RectTileGeom,
TileRenderer,
ZLayer,
};
exports.CanvasTileRenderer = CanvasTileRenderer;
exports.CompositeRectTileLayer = CompositeRectTileLayer;
exports.Constant = Constant;
exports.GraphicsLayer = GraphicsLayer;
exports.MultiTextureResource = MultiTextureResource;
exports.POINT_STRUCT_SIZE = POINT_STRUCT_SIZE;
exports.RectTileGeom = RectTileGeom;
exports.RectTileLayer = RectTileLayer;
exports.RectTileShader = RectTileShader;
exports.TileRenderer = TileRenderer;
exports.TilemapShader = TilemapShader;
exports.ZLayer = ZLayer;
exports.fillSamplers = fillSamplers;
exports.generateFragmentSrc = generateFragmentSrc;
exports.generateSampleSrc = generateSampleSrc;
exports.pixi_tilemap = pixi_tilemap;
Object.defineProperty(exports, '__esModule', { value: true });
})));
if (typeof pixi_tilemap !== 'undefined') { Object.assign(this.PIXI.tilemap, pixi_tilemap); }
//# sourceMappingURL=pixi-tilemap.umd.js.map

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,9 @@
//=============================================================================
// main.js
//=============================================================================
PluginManager.setup($plugins);
window.onload = function() {
SceneManager.run(Scene_Boot);
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

BIN
nwjs/nwjs/packagefiles/yad Normal file

Binary file not shown.

7
nwjs/uninstall.sh Normal file
View file

@ -0,0 +1,7 @@
#!/bin/bash
rm -rf "$HOME/desktopapps/nwjs" && rm "$HOME/.local/share/applications/nwjstest.desktop" && rm "$HOME/.local/share/applications/nwjsoptions.desktop" && rm "$HOME/.local/bin/rpgmaker-linux" && rm -rf "$HOME/.steam/steam/compatibilitytools.d/rpgmaker-linux-cicpoffs"
sed -e 's@x-scheme-handler/rpgmakermp.*@@g' -i /home/pasha/.config/mimeapps.list