Skip to content

Commit

Permalink
Merge pull request #6 from ywnico/desktop-builds2
Browse files Browse the repository at this point in the history
Update to enable desktop app distribution.
  • Loading branch information
ywnico authored Mar 6, 2022
2 parents aebaf5e + 4e63f8c commit 012ada5
Show file tree
Hide file tree
Showing 11 changed files with 370 additions and 77 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ ignore

flowit-vita/build
flowit-vita/usb_update_files.sh
build
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
# Flowit-Vita / Flowit-Desktop
A port of the puzzle game [Flowit](https://github.com/Flowit-Game/Flowit/) by ByteHamster. The original is an Android app written in Java; this is a reimplementation written in Lua using [Lua Player Plus Vita](https://github.com/Rinnegatamante/lpp-vita) by Rinnegatamante. The port runs on Desktop and on the PlayStation Vita.
A port of the puzzle game [Flowit](https://github.com/Flowit-Game/Flowit/) by ByteHamster. The original is an Android app written in Java; this is a reimplementation written in Lua. The port runs on desktop and PlayStation Vita.
The desktop port is based on [LÖVE](https://love2d.org) and the Vita port uses [Lua Player Plus Vita](https://github.com/Rinnegatamante/lpp-vita) by Rinnegatamante.

## Screenshots
<img src="screenshots/screenshot01.png" width="350"/>
<img src="screenshots/screenshot02.png" width="350"/>
<img src="screenshots/screenshot03.png" width="350"/>
<img src="screenshots/screenshot04.png" width="350"/>

## Running on Desktop
To run on Desktop, install the [LÖVE](https://love2d.org) engine and execute `love .` from the top directory.
## Running on desktop
### Linux
First, install the [LÖVE](https://love2d.org) engine . The LÖVE package is available in the repositories of Ubuntu, Debian, Arch, Fedora, etc.; additional installation options are available on the website.

To run from the release, download the `flowit.love` release file. The system should recognize it as a LÖVE executable. Otherwise, run from the command line by executing `love /path/to/flowit.love`.

To build for Linux, clone the source and execute `./build_desktop`; this will produce the `flowit.love` file which can then be executed.

The app can also be run directly from the source without any packaging. Just clone the repository and execute `love .` from the top directory.

### Windows
To run from the release, download the `flowit-win.zip` release file and run `Flowit.exe`.

To build the Windows executable on Linux, clone the source and execute `./build_desktop --win` (note that this will not set the Flowit icon for the executable; that must be done from Windows or wine).

To build the Windows executable on Windows, follow the [instructions](https://love2d.org/wiki/Game_Distribution) on the LÖVE wiki (building Flowit on Windows has not been tested).

### Mac
To run from the release, download the `Flowit.app.zip` release file.

To build the Mac app on Linux, clone the source and execute `./build_desktop --mac`. This build process should work on Mac also, but has not been tested.

## Running on PS Vita
Download the latest VPK release file and sideload it using VitaShell or similar.

## Building for PS Vita
Gameplay depends on the touchscreen, so the experience is better on the handheld PS Vita than on PS TV.

On Linux, enter the `flowit-vita` directory and execute `./build.sh`.
### Building (packaging VPK)
On Linux, enter the `flowit-vita` directory and execute `./build.sh` (this requires `vita-mksfoex` from [VitaSDK](https://vitasdk.org)).

The `eboot.bin` file is compiled from [Lua Player Plus](https://github.com/Rinnegatamante/lpp-vita). To build that for yourself as well, note that you need a version of Lua Player Plus recent enough to include text width and height detection (added in [this commit](https://github.com/Rinnegatamante/lpp-vita/commit/8124c469d6b8c43d1567b253a3ba13c6e0dcaa67)).

Expand Down
129 changes: 129 additions & 0 deletions build_desktop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/usr/bin/env bash
set -euo pipefail

BUILD_MAC=0
BUILD_WIN=0

options=$(getopt -l "win,mac,help" -o "w,m,h" -a -- "$@")
eval set -- "$options"
while true
do
case $1 in
-w|--win)
BUILD_WIN=1
;;
-m|--mac)
BUILD_MAC=1
;;
-h|--help)
echo "Produce flowit.love in the build directory."
echo ""
echo "Usage:"
echo " $0 [-w | --win] [-m | --mac]"
echo ""
echo " -w, --win also build windows executable (.exe)"
echo " -m, --mac also build mac app (.app)"
exit 0
;;
--)
shift
break;;
esac
shift
done

shopt -s extglob
mkdir -p build

echo "Compressing flowit.love..."
zip -9 -q -r build/flowit.love lib/!(*_vita.lua) fonts images levels LICENSE main.lua sounds


cd build

if [[ $BUILD_WIN -eq 1 ]]; then
echo "Packaging Windows exe..."

WIN_FLOWIT_DIR="flowit-win"
WIN_FLOWIT_ZIP="$WIN_FLOWIT_DIR.zip"

WIN_LOVE_DIR="love-11.4-win32"
WIN_LOVE_ZIP="$WIN_LOVE_DIR.zip"

# download zip if it doesn't exist
if [ ! -f "$WIN_LOVE_ZIP" ]; then
curl -L -O "https://github.com/love2d/love/releases/download/11.4/love-11.4-win32.zip"
fi

# delete directories built previously
if [ -d "$WIN_LOVE_DIR" ]; then
rm -r "$WIN_LOVE_DIR"
fi
if [ -d "$WIN_FLOWIT_DIR" ]; then
rm -r "$WIN_FLOWIT_DIR"
fi


unzip -q "$WIN_LOVE_ZIP"
mkdir -p "$WIN_FLOWIT_DIR"

cat "$WIN_LOVE_DIR/love.exe" flowit.love > "$WIN_FLOWIT_DIR/Flowit.exe"
cp "$WIN_LOVE_DIR/"*.dll "$WIN_FLOWIT_DIR"

cp "$WIN_LOVE_DIR/license.txt" "$WIN_FLOWIT_DIR/love_license.txt"
cp "../README.md" "$WIN_FLOWIT_DIR/flowit_readme_license.md"
cat "../LICENSE" >> "$WIN_FLOWIT_DIR/flowit_readme_license.md"

zip -q -r "$WIN_FLOWIT_ZIP" "$WIN_FLOWIT_DIR"

rm -r "$WIN_FLOWIT_DIR"
rm -r "$WIN_LOVE_DIR"

fi

if [[ $BUILD_MAC -eq 1 ]]; then
echo "Packaging Mac app..."

MAC_LOVE_APP_DIR="love.app"
MAC_FLOWIT_APP_DIR="Flowit.app"
MAC_FLOWIT_APP_ZIP="Flowit.app.zip"

MAC_LOVE_DIR="love-11.4-macos"
MAC_LOVE_ZIP="$MAC_LOVE_DIR.zip"

# download zip if it doesn't exist
if [ ! -f "$MAC_LOVE_ZIP" ]; then
curl -L -O "https://github.com/love2d/love/releases/download/11.4/love-11.4-macos.zip"
fi

# delete directories built previously
if [ -d "$MAC_LOVE_DIR" ]; then
rm -r "$MAC_LOVE_DIR"
fi
if [ -d "$MAC_LOVE_APP_DIR" ]; then
rm -r "$MAC_LOVE_APP_DIR"
fi
if [ -d "$MAC_FLOWIT_APP_DIR" ]; then
rm -r "$MAC_FLOWIT_APP_DIR"
fi


unzip -q "$MAC_LOVE_ZIP"

mv "$MAC_LOVE_APP_DIR" "$MAC_FLOWIT_APP_DIR"


cp flowit.love "$MAC_FLOWIT_APP_DIR/Contents/Resources/Flowit.love"
cp ../desktop_resources/Info.plist "$MAC_FLOWIT_APP_DIR/Contents/"
cp ../desktop_resources/flowit.icns "$MAC_FLOWIT_APP_DIR/Contents/Resources/GameIcon.icns"
cp ../desktop_resources/flowit.icns "$MAC_FLOWIT_APP_DIR/Contents/Resources/OS X AppIcon.icns"
rm "$MAC_FLOWIT_APP_DIR/Contents/Resources/Assets.car"

cp "../README.md" "$MAC_FLOWIT_APP_DIR/Contents/Resources/flowit_readme_license.md"
cat "../LICENSE" >> "$MAC_FLOWIT_APP_DIR/Contents/Resources/flowit_readme_license.md"

zip -q -r "$MAC_FLOWIT_APP_ZIP" "$MAC_FLOWIT_APP_DIR"

rm -r "$MAC_FLOWIT_APP_DIR"

fi
107 changes: 107 additions & 0 deletions desktop_resources/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>21C52</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>love</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>GameIcon</string>
<key>CFBundleTypeName</key>
<string>LÖVE Project</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>org.love2d.love-game</string>
</array>
<key>LSTypeIsPackage</key>
<integer>1</integer>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>None</string>
</dict>
<dict>
<key>CFBundleTypeIconFile</key>
<string>Document</string>
<key>CFBundleTypeName</key>
<string>Document</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>love</string>
<key>CFBundleIconFile</key>
<string>OS X AppIcon</string>
<key>CFBundleIconName</key>
<string>OS X AppIcon</string>
<key>CFBundleIdentifier</key>
<string>org.Flowit-Game.Flowit</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Flowit</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>11.4</string>
<key>CFBundleSignature</key>
<string>LoVe</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>13C100</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>12.1</string>
<key>DTSDKBuild</key>
<string>21C46</string>
<key>DTSDKName</key>
<string>macosx12.1</string>
<key>DTXcode</key>
<string>1321</string>
<key>DTXcodeBuild</key>
<string>13C100</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key>
<string>10.7</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>© 2006-2022 LÖVE Development Team</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<false/>
</dict>
</plist>
Binary file added desktop_resources/flowit.icns
Binary file not shown.
Binary file added desktop_resources/flowit.ico
Binary file not shown.
15 changes: 8 additions & 7 deletions flowit-vita/app_skeleton/index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ loadlib("io_vita")
loadlib("graphics_vita")
loadlib("controls_vita")

-- globals
loadlib("globals")
platform = PLATFORMS.VITA

-- other libraries
loadlib("util")
loadlib("translation")
loadlib("globals")

--loadlib("app_logic")

loadlib("dialogs")
loadlib("settings")
Expand Down Expand Up @@ -288,23 +289,23 @@ while true do
else
if (button == BUTTON_SINGLE_LTRIGGER or button == BUTTON_HELD_LTRIGGER or button == BUTTON_SINGLE_UP or button == BUTTON_HELD_UP) then
if settings_sel_item == nil then
settings_sel_item = "confirmations"
elseif settings_sel_item == "confirmations" then
settings_sel_item = "reset_button"
elseif settings_sel_item == "reset_button" then
settings_sel_item = "buttons"
elseif settings_sel_item == "buttons" then
settings_sel_item = "confirmations"
elseif settings_sel_item == "confirmations" then
settings_sel_item = "sound"
end
elseif (button == BUTTON_SINGLE_RTRIGGER or button == BUTTON_HELD_RTRIGGER or button == BUTTON_SINGLE_DOWN or button == BUTTON_HELD_DOWN) then
if settings_sel_item == nil then
settings_sel_item = "sound"
elseif settings_sel_item == "sound" then
settings_sel_item = "confirmations"
elseif settings_sel_item == "confirmations" then
settings_sel_item = "buttons"
elseif settings_sel_item == "buttons" then
settings_sel_item = "reset_button"
elseif settings_sel_item == "reset_button" then
settings_sel_item = "confirmations"
end
--elseif (button == BUTTON_SINGLE_CIRCLE) then
elseif (button == BUTTON_SINGLE_CROSS) then
Expand Down
12 changes: 10 additions & 2 deletions lib/dialogs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ local function draw_confirmation_dialog()
end

-- set up buttons
if platform == PLATFORMS.DESKTOP then
VD.button_icon_size = 0
VD.button_icon_gap = 0
end

local no_w, no_h = text_dimensions(get_i18n("no"), VD.font_button, message_font_name)
local yes_w, yes_h = text_dimensions(get_i18n("yes"), VD.font_button, message_font_name)
Expand Down Expand Up @@ -131,11 +135,15 @@ local function draw_confirmation_dialog()

draw_rect(VD.button_no_x, VD.button_y, VD.button_no_x + VD.button_width, VD.button_y + VD.button_height, "X")
draw_text(no_x, no_y, VD.font_button, get_i18n("no"), "d", message_font_name)
draw_general_icon(no_icon_x, no_icon_y, no_icon_x + VD.button_icon_size, no_icon_y + VD.button_icon_size, no_img, "d")
if platform ~= PLATFORMS.DESKTOP then
draw_general_icon(no_icon_x, no_icon_y, no_icon_x + VD.button_icon_size, no_icon_y + VD.button_icon_size, no_img, "d")
end

draw_rect(VD.button_yes_x, VD.button_y, VD.button_yes_x + VD.button_width, VD.button_y + VD.button_height, "X")
draw_text(yes_x, yes_y, VD.font_button, get_i18n("yes"), "d", message_font_name)
draw_general_icon(yes_icon_x, yes_icon_y, yes_icon_x + VD.button_icon_size, yes_icon_y + VD.button_icon_size, yes_img, "d")
if platform ~= PLATFORMS.DESKTOP then
draw_general_icon(yes_icon_x, yes_icon_y, yes_icon_x + VD.button_icon_size, yes_icon_y + VD.button_icon_size, yes_img, "d")
end
end

function xy_to_dialog_control(x, y)
Expand Down
2 changes: 2 additions & 0 deletions lib/globals.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

-- Consts

PLATFORMS = {VITA = 0, DESKTOP = 1}

APP_STATE_IN_GAME = 0
APP_STATE_LEVEL_MENU = 1
APP_STATE_SETTINGS = 2
Expand Down
Loading

0 comments on commit 012ada5

Please sign in to comment.