Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c679b11b73 | ||
|
|
82ccb092c2 | ||
|
|
8bbbfe0be0 | ||
|
|
ee89a9623a | ||
|
|
df91739754 | ||
|
|
5fadbcacea | ||
|
|
c0912d29f0 | ||
|
|
a6648a51d1 | ||
|
|
37cee8b105 | ||
|
|
c766b84796 | ||
|
|
663ad10fba | ||
|
|
1072d38690 | ||
|
|
fd1ac9403b | ||
|
|
43286f23c9 | ||
|
|
c2f63faee6 | ||
|
|
081357578b | ||
|
|
a047d036f3 | ||
|
|
cdd14267f2 | ||
|
|
6ab4bd6e61 | ||
|
|
376c2ee40b | ||
|
|
779699ac43 | ||
|
|
ce01d33aac | ||
|
|
807aa54166 | ||
|
|
96de9c2492 | ||
|
|
117e75c158 | ||
|
|
8f556fd5a5 | ||
|
|
2807328b00 | ||
|
|
77c4078b9f | ||
|
|
ed4f1f4d82 | ||
|
|
41aab988cb | ||
|
|
04c8ea1e82 | ||
|
|
ef325ed4af | ||
|
|
0ce5f1ecd5 | ||
|
|
57a93fb1a2 | ||
|
|
3fac68a0c5 | ||
|
|
194c98327e | ||
|
|
1ece2a38f4 | ||
|
|
8d5fa97bc4 | ||
|
|
f5488096d4 | ||
|
|
200be33406 | ||
|
|
c83544e512 | ||
|
|
26b3845a01 | ||
|
|
6928984362 | ||
|
|
bebdbbbd38 | ||
|
|
f5e643b096 | ||
|
|
513c2822ae | ||
|
|
7170bdef0b | ||
|
|
75e01ce333 | ||
|
|
92dc51e7a8 | ||
|
|
a8c3ec5166 | ||
|
|
bd42b9f151 | ||
|
|
22e7a9eafc | ||
|
|
4b90c5a079 | ||
|
|
9f08f2ad4b | ||
|
|
e9e2862b13 | ||
|
|
d50369a777 | ||
|
|
896b122c9f | ||
|
|
5feb0c44fe | ||
|
|
95b6553a6f | ||
|
|
c4d2a92448 | ||
|
|
61bd0a9ea4 | ||
|
|
89de246311 | ||
|
|
c169a4c6ad | ||
|
|
861ca9ad2e | ||
|
|
cda90a0617 | ||
|
|
9d49f9ce57 | ||
|
|
30fc4584c3 | ||
|
|
cf593bf554 | ||
|
|
c0f2939c9f | ||
|
|
ea800cd672 | ||
|
|
76ea43832c | ||
|
|
c50d857cba | ||
|
|
09c87a8d9a | ||
|
|
ea8604392b | ||
|
|
c02d6ae02a | ||
|
|
12637cc7ef | ||
|
|
f4c753b2f4 | ||
|
|
9a231007f1 | ||
|
|
1ad4e8ee78 | ||
|
|
ed1993bff8 | ||
|
|
7ff89fd78b | ||
|
|
801f49d470 | ||
|
|
7bf9c1859d | ||
|
|
689d08eefa | ||
|
|
60eb87f5f1 | ||
|
|
784d14ac2e | ||
|
|
4db5c1dcf7 | ||
|
|
4eb7b5f19b | ||
|
|
b07aeced88 | ||
|
|
8eb52b6515 | ||
|
|
1d219ca706 | ||
|
|
6f6b7a09e1 | ||
|
|
c39d54b42a | ||
|
|
4a83138cb7 | ||
|
|
0fbd274f4d | ||
|
|
1f21d4d3af | ||
|
|
d92c06a0b4 | ||
|
|
e416d9419a | ||
|
|
5157746aca | ||
|
|
4993ad48e4 | ||
|
|
efd8de98cd | ||
|
|
a5729306ae | ||
|
|
d6373dab29 | ||
|
|
91a250a9be | ||
|
|
22d2b0916d | ||
|
|
6a1d83f8f8 | ||
|
|
ced92152e1 | ||
|
|
22c309e5e6 | ||
|
|
b4922b5c35 | ||
|
|
e455f5c40c | ||
|
|
7fbdfc5c49 | ||
|
|
d78af1d5b9 | ||
|
|
9d3844820f | ||
|
|
1d01a8aa32 | ||
|
|
e5af624e3d | ||
|
|
fe2f9209c6 | ||
|
|
189227f3a1 | ||
|
|
58c33a90d6 | ||
|
|
5a38c6953e | ||
|
|
fcd134a8e1 | ||
|
|
158c66d588 | ||
|
|
14d801fb11 | ||
|
|
93941b5c6a | ||
|
|
62641a2b41 | ||
|
|
ee94071509 | ||
|
|
9770dd6b4c | ||
|
|
8c82f35493 | ||
|
|
71d0e24c39 | ||
|
|
0ceebd055e | ||
|
|
6555f85769 | ||
|
|
6b40d00b5b | ||
|
|
54cfd0e5e6 | ||
|
|
50674fefd6 | ||
|
|
f6dbfc373a | ||
|
|
f5397afcd6 | ||
|
|
47ff302a0f | ||
|
|
dbe2e2fc6a | ||
|
|
ab662be647 | ||
|
|
0341d983d1 | ||
|
|
b2a8b34df1 | ||
|
|
3b73ae0cb4 | ||
|
|
ddf4671297 | ||
|
|
83489725ed | ||
|
|
7fb258f5d5 | ||
|
|
fff3469944 | ||
|
|
731abd410b | ||
|
|
8fd4efb642 | ||
|
|
adf8352e92 | ||
|
|
706a8a0797 | ||
|
|
d068a8b8e0 | ||
|
|
024b16e36b | ||
|
|
16e4ec2711 | ||
|
|
7ce19c045f | ||
|
|
a2e5a594cd | ||
|
|
ec53dd02af | ||
|
|
8d92924849 | ||
|
|
407681fada | ||
|
|
6a3d3f3559 | ||
|
|
ab59ab6b83 | ||
|
|
321afdd465 | ||
|
|
c2f7d75258 | ||
|
|
eba69651a9 | ||
|
|
8fe47c8a32 | ||
|
|
81032a9dcc | ||
|
|
2be97ca801 | ||
|
|
324d18fdfb | ||
|
|
6889777cff | ||
|
|
ea78b73c86 | ||
|
|
1e5768f6b4 | ||
|
|
612f431376 | ||
|
|
f13a88b94e | ||
|
|
e7d9843e94 | ||
|
|
ae438d7c14 | ||
|
|
879f058d7a | ||
|
|
f208429e08 | ||
|
|
827780347b | ||
|
|
791ca2eba9 | ||
|
|
7d3d4d588b | ||
|
|
eec36173c8 | ||
|
|
a21bc16bcd | ||
|
|
79a9f92e35 | ||
|
|
fc77fa2aea | ||
|
|
e21f49cf4d | ||
|
|
a9f2cbb464 | ||
|
|
a0b86526a2 | ||
|
|
d39f908ddb | ||
|
|
cb8cbf4ca7 | ||
|
|
077e400e38 | ||
|
|
050eee00ae | ||
|
|
212160a48a | ||
|
|
96b479b99f | ||
|
|
19570e4b1c | ||
|
|
fc8c583eee | ||
|
|
2612192889 | ||
|
|
ce26a3d2a3 | ||
|
|
b8b1bc9989 | ||
|
|
16a5a33091 | ||
|
|
dac27ce0d8 | ||
|
|
44e70de7d1 | ||
|
|
7c3318ff72 | ||
|
|
170ecc851a | ||
|
|
c0a9484d7e | ||
|
|
310a822ea5 | ||
|
|
f3a437a165 | ||
|
|
f2dbd32df4 | ||
|
|
66cb62b4d3 | ||
|
|
e9c1945511 | ||
|
|
dd7d05fa28 | ||
|
|
ace95aa97c | ||
|
|
b2cca9395c | ||
|
|
548217c10d | ||
|
|
d674586fe9 | ||
|
|
7f48edf8f6 | ||
|
|
18bff54ec5 | ||
|
|
764a652e1c | ||
|
|
d41a12503e | ||
|
|
8f728d97bb | ||
|
|
e43973882e | ||
|
|
1e8976c0d4 | ||
|
|
90adc96782 | ||
|
|
4f1950c488 | ||
|
|
bc27c72034 | ||
|
|
3f7054fe40 | ||
|
|
48a3a78049 | ||
|
|
b9ee0287f5 | ||
|
|
dec0a05dd0 | ||
|
|
6ad78bd288 | ||
|
|
bb40a2822d | ||
|
|
f189300079 | ||
|
|
77f880f3ed | ||
|
|
163bbeaa8c | ||
|
|
54a6016976 | ||
|
|
11add452e2 | ||
|
|
aaf7019067 | ||
|
|
2829f237a1 |
No files matched your search
@@ -0,0 +1,12 @@
|
||||
build-essential
|
||||
ca-certificates
|
||||
curl
|
||||
libcurl4-openssl-dev
|
||||
libdrm-dev
|
||||
libegl1-mesa-dev
|
||||
libgbm-dev
|
||||
libgles2-mesa-dev
|
||||
libsdl2-dev
|
||||
patchelf
|
||||
pkg-config
|
||||
zip
|
||||
@@ -0,0 +1,2 @@
|
||||
build-essential
|
||||
zlib1g-dev
|
||||
@@ -0,0 +1,3 @@
|
||||
build-essential
|
||||
zlib1g-dev
|
||||
zip
|
||||
@@ -0,0 +1,5 @@
|
||||
build-essential
|
||||
gcc-mingw-w64-i686-win32
|
||||
gcc-mingw-w64-x86-64-win32
|
||||
zlib1g-dev
|
||||
zip
|
||||
@@ -1,106 +0,0 @@
|
||||
name: Android Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Build Release APK
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x droid/gradlew
|
||||
|
||||
- name: Create keystore directory
|
||||
run: mkdir -p ~/.android
|
||||
|
||||
- name: Decode Keystore
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
|
||||
echo "Keystore decoded successfully"
|
||||
|
||||
- name: Copy Assets to Android Project
|
||||
run: ./scripts/copy-android-assets.sh
|
||||
|
||||
- name: Run Tests
|
||||
run: make test
|
||||
|
||||
- name: Build Release APK
|
||||
working-directory: ./droid
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
run: |
|
||||
./gradlew assembleRelease \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
-Pkeystore.path="/home/runner/.android/inbe-release.keystore" \
|
||||
--stacktrace
|
||||
|
||||
- name: Rename APK
|
||||
run: |
|
||||
VERSION=$(grep "versionName" droid/app/build.gradle | awk '{print $2}' | tr -d '"')
|
||||
find droid/app/build/outputs/apk/release -name "*-universal-release.apk" -exec cp {} inbe-$VERSION.apk \; 2>/dev/null || true
|
||||
|
||||
- name: Upload APK to Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-apk
|
||||
path: inbe-*.apk
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Create and Push Tag (if new version)
|
||||
id: tag_version
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
VERSION=$(grep "versionName" droid/app/build.gradle | awk '{print $2}' | tr -d '"')
|
||||
TAG="v$VERSION"
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Tag $TAG exists, skipping"
|
||||
echo "tag_pushed=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a "$TAG" -m "Release $VERSION"
|
||||
git push origin "$TAG"
|
||||
echo "tag_pushed=true" >> $GITHUB_OUTPUT
|
||||
echo "tag_name=$TAG" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Create GitHub Release
|
||||
if: steps.tag_version.outputs.tag_pushed == 'true'
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ steps.tag_version.outputs.tag_name }}
|
||||
files: inbe-*.apk
|
||||
generate_release_notes: true
|
||||
draft: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,104 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Test apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: test-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/test-packages.txt') }}
|
||||
restore-keys: |
|
||||
test-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Test Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/test-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Run Tests
|
||||
run: make test
|
||||
|
||||
build-chrome-extension:
|
||||
name: Build Chrome Extension
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Web apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
|
||||
restore-keys: |
|
||||
web-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Web Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/web-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Set up Emscripten
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
|
||||
"$HOME/emsdk/emsdk" install latest
|
||||
"$HOME/emsdk/emsdk" activate latest
|
||||
echo "EMSDK=$HOME/emsdk" >> "$GITHUB_ENV"
|
||||
echo "EM_CONFIG=$HOME/emsdk/.emscripten" >> "$GITHUB_ENV"
|
||||
echo "$HOME/emsdk" >> "$GITHUB_PATH"
|
||||
echo "$HOME/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Build Chrome Extension ZIP
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make package-unpackaged-assets
|
||||
make chrome-web-store
|
||||
test -f build/dist/inbe-chrome-web-store.zip
|
||||
@@ -0,0 +1,456 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Test apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: test-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/test-packages.txt') }}
|
||||
restore-keys: |
|
||||
test-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Test Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/test-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Run Tests
|
||||
run: make test
|
||||
|
||||
build-web:
|
||||
name: Build Web
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Web apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
|
||||
restore-keys: |
|
||||
web-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Web Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/web-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Set up Emscripten
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
|
||||
"$HOME/emsdk/emsdk" install latest
|
||||
"$HOME/emsdk/emsdk" activate latest
|
||||
echo "EMSDK=$HOME/emsdk" >> "$GITHUB_ENV"
|
||||
echo "EM_CONFIG=$HOME/emsdk/.emscripten" >> "$GITHUB_ENV"
|
||||
echo "$HOME/emsdk" >> "$GITHUB_PATH"
|
||||
echo "$HOME/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Build Web ZIP
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make package-unpackaged-assets
|
||||
make web
|
||||
mkdir -p build/release/web
|
||||
cp build/dist/inbe-web.zip build/release/web/
|
||||
|
||||
- name: Upload Web Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-web
|
||||
path: build/release/web/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-chrome-extension:
|
||||
name: Build Chrome Extension
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Web apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
|
||||
restore-keys: |
|
||||
web-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Web Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/web-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Set up Emscripten
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
|
||||
"$HOME/emsdk/emsdk" install latest
|
||||
"$HOME/emsdk/emsdk" activate latest
|
||||
echo "EMSDK=$HOME/emsdk" >> "$GITHUB_ENV"
|
||||
echo "EM_CONFIG=$HOME/emsdk/.emscripten" >> "$GITHUB_ENV"
|
||||
echo "$HOME/emsdk" >> "$GITHUB_PATH"
|
||||
echo "$HOME/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Build Chrome Extension ZIP
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make package-unpackaged-assets
|
||||
make chrome-web-store
|
||||
mkdir -p build/release/chrome-web-store
|
||||
cp build/dist/inbe-chrome-web-store.zip build/release/chrome-web-store/
|
||||
|
||||
- name: Upload Chrome Extension Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-chrome-web-store
|
||||
path: build/release/chrome-web-store/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-linux:
|
||||
name: Build Linux
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Linux apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: linux-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/linux-packages.txt') }}
|
||||
restore-keys: |
|
||||
linux-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/linux-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Install AppImage Tools
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
curl -L -o "$HOME/.local/bin/linuxdeploy" \
|
||||
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
||||
curl -L -o "$HOME/.local/bin/linuxdeploy-plugin-appimage" \
|
||||
https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-appimage-x86_64.AppImage
|
||||
curl -L -o "$HOME/.local/bin/appimagetool" \
|
||||
https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
chmod +x "$HOME/.local/bin/linuxdeploy" "$HOME/.local/bin/linuxdeploy-plugin-appimage" "$HOME/.local/bin/appimagetool"
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Build Linux AppImage
|
||||
env:
|
||||
APPIMAGE_EXTRACT_AND_RUN: "1"
|
||||
RAY_RAYLIB_CONFIG: -DSUPPORT_SCREEN_CAPTURE=0 -DSUPPORT_COMPRESSION_API=0 -DSUPPORT_AUTOMATION_EVENTS=0 -DSUPPORT_CLIPBOARD_IMAGE=0 -DSUPPORT_FILEFORMAT_BMP=0 -DSUPPORT_FILEFORMAT_GIF=0 -DSUPPORT_FILEFORMAT_QOI=0 -DSUPPORT_FILEFORMAT_DDS=0 -DSUPPORT_FILEFORMAT_TTF=0
|
||||
run: |
|
||||
set -euo pipefail
|
||||
RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2 | sed 's,/SDL2$,,')"
|
||||
RAY_CFLAGS="$(pkg-config --cflags sdl2 libdrm gbm egl glesv2)"
|
||||
RAY_LDLIBS="$(pkg-config --libs sdl2 libdrm gbm egl glesv2)"
|
||||
RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
|
||||
export RAY_SDL_INCLUDE_DIR RAY_CFLAGS RAY_LDLIBS RAY_SDL_LDLIBS
|
||||
make appimage
|
||||
mkdir -p build/release/linux
|
||||
find build/dist/linux -maxdepth 1 -type f -name '*.AppImage' -exec cp {} build/release/linux/ \;
|
||||
test -n "$(find build/release/linux -type f -print -quit)"
|
||||
|
||||
- name: Upload Linux Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-linux
|
||||
path: build/release/linux/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-windows:
|
||||
name: Build Windows
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Windows apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: windows-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/windows-packages.txt') }}
|
||||
restore-keys: |
|
||||
windows-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Cache Windows vendor builds
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
vendor-builds/windows
|
||||
vendor-builds/sqlite
|
||||
key: windows-vendor-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile', 'vendor/raylib/src/**', 'vendor/curl/**', 'vendor/sqlite/**') }}
|
||||
restore-keys: |
|
||||
windows-vendor-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Windows Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/windows-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
if [ -x /usr/bin/x86_64-w64-mingw32-gcc-win32 ]; then
|
||||
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-win32
|
||||
fi
|
||||
if [ -x /usr/bin/i686-w64-mingw32-gcc-win32 ]; then
|
||||
sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-win32
|
||||
fi
|
||||
|
||||
- name: Build Windows ZIP
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make windows
|
||||
mkdir -p build/release/windows
|
||||
find build/dist/windows -maxdepth 1 -type f -name '*.zip' -exec cp {} build/release/windows/ \;
|
||||
test -n "$(find build/release/windows -type f -print -quit)"
|
||||
|
||||
- name: Upload Windows Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-windows
|
||||
path: build/release/windows/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-android:
|
||||
name: Build Android
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- name: Cache Android SDK packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ env.ANDROID_HOME }}/platforms/android-35
|
||||
${{ env.ANDROID_HOME }}/build-tools/34.0.0
|
||||
${{ env.ANDROID_HOME }}/ndk/25.1.8937393
|
||||
${{ env.ANDROID_HOME }}/ndk/28.2.13676358
|
||||
${{ env.ANDROID_HOME }}/cmake/3.22.1
|
||||
key: android-sdk-${{ runner.os }}-${{ runner.arch }}-api35-bt34-ndk25-ndk28-cmake322
|
||||
restore-keys: |
|
||||
android-sdk-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Cache Android native build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
droid/app/.cxx
|
||||
droid/app/build/intermediates/cxx
|
||||
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'src/**/*.c', 'src/**/*.h', 'flint/src/**/*.c', 'flint/include/**/*.h', 'vendor/raylib/src/**') }}
|
||||
restore-keys: |
|
||||
android-native-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Android SDK Components
|
||||
run: |
|
||||
set -euo pipefail
|
||||
SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
|
||||
yes | "$SDKMANAGER" --licenses >/dev/null || true
|
||||
"$SDKMANAGER" "platforms;android-35" "build-tools;34.0.0" "ndk;25.1.8937393" "cmake;3.22.1"
|
||||
|
||||
- name: Prepare Android signing key
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p ~/.android
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
|
||||
|
||||
- name: Copy Android Assets
|
||||
run: ./scripts/copy-android-assets.sh
|
||||
|
||||
- name: Build Android APK
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
chmod +x droid/gradlew
|
||||
./droid/gradlew -p droid assembleRelease \
|
||||
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
|
||||
-Pkeystore.alias="$KEY_ALIAS" \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
--stacktrace
|
||||
make android-copy-release-apks
|
||||
|
||||
- name: Collect Android Release Files
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p build/release/android
|
||||
VERSION=$(sed -n 's/^#define INBE_VERSION_STRING "\([^"]*\)".*/\1/p' src/core/version.h)
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Could not read INBE_VERSION_STRING"
|
||||
exit 1
|
||||
fi
|
||||
cp "build/android/inbe-$VERSION.apk" build/release/android/
|
||||
|
||||
- name: Upload Android Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-android
|
||||
path: build/release/android/*
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-web
|
||||
- build-chrome-extension
|
||||
- build-linux
|
||||
- build-windows
|
||||
- build-android
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download Release Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: release-*
|
||||
path: build/release
|
||||
merge-multiple: true
|
||||
|
||||
- name: Verify Release Artifacts
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$(find build/release -type f -print -quit)"
|
||||
|
||||
- name: Create and Push Tag If Version Is New
|
||||
id: tag_version
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION=$(sed -n 's/^#define INBE_VERSION_STRING "\([^"]*\)".*/\1/p' src/core/version.h)
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Could not read INBE_VERSION_STRING"
|
||||
exit 1
|
||||
fi
|
||||
TAG="v$VERSION"
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Tag $TAG exists, skipping release"
|
||||
echo "tag_pushed=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a "$TAG" -m "Release $VERSION"
|
||||
git push origin "$TAG"
|
||||
echo "tag_pushed=true" >> "$GITHUB_OUTPUT"
|
||||
echo "tag_name=$TAG" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Create GitHub Release
|
||||
if: steps.tag_version.outputs.tag_pushed == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ steps.tag_version.outputs.tag_name }}
|
||||
files: build/release/*
|
||||
generate_release_notes: true
|
||||
draft: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -12,12 +12,15 @@
|
||||
.cache/
|
||||
*.wasm
|
||||
build/
|
||||
tmp/
|
||||
vendor-builds/
|
||||
node_modules
|
||||
*.nix-defexpr
|
||||
*.npm
|
||||
*.nix-profile
|
||||
.claude.json
|
||||
.bash_history
|
||||
.env
|
||||
|
||||
|
||||
*.exe
|
||||
|
||||
@@ -10,3 +10,9 @@
|
||||
[submodule "vendor/sqlite"]
|
||||
path = vendor/sqlite
|
||||
url = https://github.com/sqlite/sqlite
|
||||
[submodule "vendor/liboqs"]
|
||||
path = vendor/liboqs
|
||||
url = https://github.com/open-quantum-safe/liboqs.git
|
||||
[submodule "vendor/curl"]
|
||||
path = vendor/curl
|
||||
url = https://github.com/curl/curl.git
|
||||
@@ -1,8 +1,84 @@
|
||||
# Changelog
|
||||
## [1.4.7] - 2026-06-21
|
||||
### Changed
|
||||
- Rework Practice into Manual, start, and configuration tabs with a new localized first-run guide.
|
||||
- Simplify Meditation's manual to one page and make bottom navigation more compact.
|
||||
|
||||
## [1.4.6] - 2026-06-20
|
||||
### Changed
|
||||
- Move habit weekly, monthly, statistics, and edit views into icon tabs under the habit selector.
|
||||
- Improve Flint form, modal, tab, and scrollbar widgets for measured layouts and cleaner scrolling.
|
||||
|
||||
### Fixed
|
||||
- Prevent habit info modal text from overlapping the OK button.
|
||||
|
||||
## [1.4.5] - 2026-06-20
|
||||
### Changed
|
||||
- Fix spacing issues and translations
|
||||
|
||||
## [1.4.4] - 2026-06-20
|
||||
### Added
|
||||
- Add Russian localization.
|
||||
- Add a habit stats view with streak, recent activity, weekday, and linked-practice diagrams.
|
||||
- Add optional in-session volume controls, hidden by default.
|
||||
- Add Mint and Cobalt themes.
|
||||
|
||||
### Changed
|
||||
- Use one canonical pixel font atlas with Flint-managed DPI scaling and cleaner title sizing.
|
||||
- Simplify habit counting so multiple counts are opt-in and independent of linked practices.
|
||||
- Improve habit weekly/calendar spacing, mobile calendar touch feedback, and theme picker ordering.
|
||||
- Reorganize repeated screen UI into reusable Flint helpers.
|
||||
|
||||
### Fixed
|
||||
- Build the Ubuntu Touch Click package with the OpenStore package id
|
||||
- Refactor code base
|
||||
- Sync habit multiple-count settings correctly across clients and preserve queued local habit edits.
|
||||
- Preserve linked session day behavior while hiding redundant count badges.
|
||||
|
||||
## [1.4.3] - 2026-06-20
|
||||
### Fixed
|
||||
- Refresh expired native sync auth tokens before sending queued changes.
|
||||
- Require first-time meditation users to continue through the tutorial before starting.
|
||||
|
||||
## [1.4.2] - 2026-06-20
|
||||
### Fixed
|
||||
- Improve sync auth, websocket reconnects, and queued habit/session updates.
|
||||
- Reduce SQLite-related UI flicker and speed up bulk import sync queueing.
|
||||
- Fixed dropdown menus so temporary option lists cannot crash theme/device selection.
|
||||
- Fixed Linux test and release builds to link against the vendored curl library path.
|
||||
|
||||
## [1.4.1] - 2026-06-19
|
||||
### Changed
|
||||
- Improve account management
|
||||
|
||||
## [1.4.0] - 2026-06-19
|
||||
### Added
|
||||
- optional sync client, offline account creation
|
||||
- simplify tutorial
|
||||
|
||||
## [1.3.6] - 2026-06-18
|
||||
### Fixed
|
||||
- Fixed Tickmate `.db` imports so zero-based months map correctly and long habit histories load without dropping later dates.
|
||||
|
||||
## [1.3.5] - 2026-06-18
|
||||
### Fixed
|
||||
- Improved Android data import for `.db` backups, weekly habit rows, and import conflict handling.
|
||||
|
||||
## [1.3.4] - 2026-06-18
|
||||
### Changed
|
||||
- Reorganized WHM and Meditation into practice-owned modules for cleaner code boundaries.
|
||||
- Split the meditation manual into an image intro page and a shorter music/gong setup page.
|
||||
- Expanded release automation to build Web, Linux AppImage, Windows, APK, and AAB artifacts after tests pass.
|
||||
|
||||
## [1.3.3] - 2026-06-17
|
||||
### Fixed
|
||||
- Import now restores habits, habit sync settings, and optionally app settings from Inbe SQLite exports.
|
||||
|
||||
## [1.3.2] - 2026-06-17
|
||||
### Fixed
|
||||
- Unified scroll containers so content stays out of scrollbar tracks and scroll positions clamp cleanly at the bottom.
|
||||
- Android meditation audio downloads now show a localized network-permission/connectivity modal when the host cannot be resolved.
|
||||
- Windows builds now support runtime meditation audio downloads.
|
||||
|
||||
## [1.3.1] - 2026-06-17
|
||||
### Fixed
|
||||
|
||||
@@ -6,6 +6,7 @@ ANDROID_APP_ID := xyz.waozi.inbe
|
||||
ANDROID_ACTIVITY := xyz.waozi.inbe.MainActivity
|
||||
|
||||
CC ?= gcc
|
||||
CMAKE ?= $(shell if [ -x /usr/bin/cmake ]; then echo /usr/bin/cmake; else command -v cmake; fi)
|
||||
GRADLE ?= gradle
|
||||
ARCH := $(shell uname -m)
|
||||
ANDROID_KEYSTORE ?= $(HOME)/.android/flint-release.keystore
|
||||
@@ -15,6 +16,7 @@ BUILD_DIR := build
|
||||
BUILD_OBJ_DIR := $(BUILD_DIR)/obj
|
||||
BUILD_BIN_DIR := $(BUILD_DIR)/bin
|
||||
BUILD_DIST_DIR := $(BUILD_DIR)/dist
|
||||
VENDOR_BUILD_DIR := vendor-builds
|
||||
LINUX_OBJ_DIR := $(BUILD_OBJ_DIR)/linux
|
||||
LINUX_BIN_DIR := $(BUILD_BIN_DIR)/linux
|
||||
LINUX_DIST_DIR := $(BUILD_DIST_DIR)/linux
|
||||
@@ -24,80 +26,163 @@ LINUX_APPIMAGE_DIR := packaging/linux/appimage
|
||||
LINUX_APPIMAGE_APPRUN := $(LINUX_APPIMAGE_DIR)/AppRun
|
||||
LINUX_APPIMAGE_DESKTOP := $(LINUX_APPIMAGE_DIR)/$(APP_NAME).desktop
|
||||
LINUX_APPIMAGE_ICON := $(LINUX_APPIMAGE_DIR)/$(APP_NAME).png
|
||||
LINUX_APPIMAGE_APPDATA := $(LINUX_APPIMAGE_DIR)/$(APP_NAME).appdata.xml
|
||||
CLICK_PACKAGE ?= inbe
|
||||
CLICK_TITLE ?= $(APP_TITLE)
|
||||
CLICK_MAINTAINER ?= Waozi Project <[email protected]>
|
||||
CLICK_ARCH ?= arm64
|
||||
CLICK_FRAMEWORK ?= ubuntu-sdk-20.04
|
||||
CLICK_POLICY_VERSION ?= 20.04
|
||||
CLICK_INCLUDE_METAINFO ?= 0
|
||||
CLICK_DIR := packaging/click
|
||||
CLICK_MANIFEST_TEMPLATE := $(CLICK_DIR)/manifest.json.in
|
||||
CLICK_CONTROL_TEMPLATE := $(CLICK_DIR)/control.in
|
||||
CLICK_APPARMOR_TEMPLATE := $(CLICK_DIR)/inbe.apparmor.in
|
||||
CLICK_DESKTOP_TEMPLATE := $(CLICK_DIR)/inbe.desktop.in
|
||||
CLICK_METAINFO_TEMPLATE := $(CLICK_DIR)/inbe.metainfo.xml.in
|
||||
CLICK_RUNNER := $(CLICK_DIR)/run-inbe.sh
|
||||
CLICK_BUILD_DIR := $(BUILD_OBJ_DIR)/click/$(CLICK_ARCH)
|
||||
CLICK_ROOT := $(CLICK_BUILD_DIR)/$(CLICK_PACKAGE)
|
||||
CLICK_CONTROL_DIR := $(CLICK_BUILD_DIR)/control
|
||||
CLICK_BIN_DIR := $(BUILD_BIN_DIR)/click/$(CLICK_ARCH)
|
||||
CLICK_DIST_DIR := $(BUILD_DIST_DIR)/click
|
||||
CLICK_TARGET = $(CLICK_DIST_DIR)/$(CLICK_PACKAGE)_$(APP_VERSION)_$(CLICK_ARCH).click
|
||||
CLICK_BIN := $(CLICK_BIN_DIR)/$(APP_NAME)
|
||||
CLICK_BIN_INPUT := $(if $(strip $(CLICK_BIN_SOURCE)),$(CLICK_BIN_SOURCE),$(CLICK_BIN))
|
||||
CLICK_RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib
|
||||
CLICK_RAYLIB_A := $(CLICK_RAYLIB_BUILD_DIR)/libraylib.a
|
||||
CLICK_PATCHELF_INTERPRETER ?= /lib/ld-linux-aarch64.so.1
|
||||
CLICK_RUNTIME_LIBS ?= $(AARCH64_CLICK_RUNTIME_LIBS)
|
||||
WINDOWS_OBJ_DIR := $(BUILD_OBJ_DIR)/windows
|
||||
WINDOWS_BIN_DIR := $(BUILD_BIN_DIR)/windows
|
||||
WINDOWS_DIST_DIR := $(BUILD_DIST_DIR)/windows
|
||||
ANDROID_BUILD_DIR := $(BUILD_DIR)/android
|
||||
WEB_OBJ_DIR := $(BUILD_OBJ_DIR)/web
|
||||
WEB_DIST_DIR := $(BUILD_DIST_DIR)/web
|
||||
CHROME_WEB_STORE_DIR := $(BUILD_DIST_DIR)/chrome-web-store
|
||||
VERSION_FILE := src/core/version.h
|
||||
APP_VERSION := $(shell sed -n 's/^#define INBE_VERSION_STRING "\([^"]*\)".*/\1/p' $(VERSION_FILE) 2>/dev/null)
|
||||
|
||||
RAYLIB_DIR := vendor/raylib/src
|
||||
RAYLIB_BUILD_DIR := $(LINUX_OBJ_DIR)/$(ARCH)/native/raylib
|
||||
RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/linux/$(ARCH)/raylib
|
||||
RAYLIB_A := $(RAYLIB_BUILD_DIR)/libraylib.a
|
||||
WIN64_ARCH := x86_64
|
||||
WIN64_CC ?= $(or $(WIN_CC),x86_64-w64-mingw32-gcc)
|
||||
WIN64_AR ?= $(or $(WIN_AR),x86_64-w64-mingw32-ar)
|
||||
WIN64_RANLIB ?= $(or $(WIN_RANLIB),x86_64-w64-mingw32-ranlib)
|
||||
WIN64_STRIP ?= $(or $(WIN_STRIP),x86_64-w64-mingw32-strip)
|
||||
WIN64_CC_PATH := $(shell command -v $(WIN64_CC) 2>/dev/null || printf '%s' $(WIN64_CC))
|
||||
WIN64_AR_PATH := $(shell command -v $(WIN64_AR) 2>/dev/null || printf '%s' $(WIN64_AR))
|
||||
WIN64_RANLIB_PATH := $(shell command -v $(WIN64_RANLIB) 2>/dev/null || printf '%s' $(WIN64_RANLIB))
|
||||
WIN32_ARCH := i686
|
||||
WIN32_CC ?= i686-w64-mingw32-gcc
|
||||
WIN32_AR ?= i686-w64-mingw32-ar
|
||||
WIN32_RANLIB ?= i686-w64-mingw32-ranlib
|
||||
WIN32_STRIP ?= i686-w64-mingw32-strip
|
||||
WIN64_RAYLIB_BUILD_DIR := $(WINDOWS_OBJ_DIR)/$(WIN64_ARCH)/raylib
|
||||
WIN32_CC_PATH := $(shell command -v $(WIN32_CC) 2>/dev/null || printf '%s' $(WIN32_CC))
|
||||
WIN32_AR_PATH := $(shell command -v $(WIN32_AR) 2>/dev/null || printf '%s' $(WIN32_AR))
|
||||
WIN32_RANLIB_PATH := $(shell command -v $(WIN32_RANLIB) 2>/dev/null || printf '%s' $(WIN32_RANLIB))
|
||||
WIN64_RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib
|
||||
WIN64_RAYLIB_A := $(WIN64_RAYLIB_BUILD_DIR)/libraylib.a
|
||||
WIN32_RAYLIB_BUILD_DIR := $(WINDOWS_OBJ_DIR)/$(WIN32_ARCH)/raylib
|
||||
WIN32_RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib
|
||||
WIN32_RAYLIB_A := $(WIN32_RAYLIB_BUILD_DIR)/libraylib.a
|
||||
WEB_RAYLIB_BUILD_DIR := $(WEB_OBJ_DIR)/raylib
|
||||
WIN64_CURL_BUILD_DIR := $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/curl
|
||||
WIN64_CURL_INCLUDE_DIR := $(WIN64_CURL_BUILD_DIR)/include
|
||||
WIN64_CURL_A := $(WIN64_CURL_BUILD_DIR)/lib/libcurl.a
|
||||
WIN32_CURL_BUILD_DIR := $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/curl
|
||||
WIN32_CURL_INCLUDE_DIR := $(WIN32_CURL_BUILD_DIR)/include
|
||||
WIN32_CURL_A := $(WIN32_CURL_BUILD_DIR)/lib/libcurl.a
|
||||
WEB_RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/web/raylib
|
||||
WEB_RAYLIB_A := $(WEB_RAYLIB_BUILD_DIR)/libraylib.web.a
|
||||
RAYLIB_SOURCES := $(wildcard $(RAYLIB_DIR)/*.c) $(wildcard $(RAYLIB_DIR)/*.h)
|
||||
RAYLIB_SOURCES := $(shell find $(RAYLIB_DIR) -type f \( -name '*.c' -o -name '*.h' \))
|
||||
|
||||
FLINT_DIR := flint
|
||||
FLINT_ICON_FILES := $(wildcard $(FLINT_DIR)/icons/*.png)
|
||||
FLINT_ICON_ASSETS_C := $(FLINT_DIR)/src/flint_icon_assets.c
|
||||
FLINT_SRCS := $(filter-out $(FLINT_ICON_ASSETS_C),$(wildcard $(FLINT_DIR)/src/*.c)) $(FLINT_ICON_ASSETS_C)
|
||||
FLINT_SRCS := $(filter-out $(FLINT_ICON_ASSETS_C),$(wildcard $(FLINT_DIR)/src/*.c) $(wildcard $(FLINT_DIR)/src/ui/*.c)) $(FLINT_ICON_ASSETS_C)
|
||||
FLINT_WEB_SRCS := $(filter-out $(FLINT_DIR)/src/flint_file_dialog.c,$(FLINT_SRCS))
|
||||
FLINT_WINDOWS_SRCS := $(filter-out $(FLINT_DIR)/src/flint_file_dialog.c,$(FLINT_SRCS))
|
||||
FLINT_INCLUDE := -I$(FLINT_DIR)/include
|
||||
FLINT_CURL_CFLAGS ?= $(shell pkg-config --cflags libcurl 2>/dev/null || curl-config --cflags 2>/dev/null)
|
||||
FLINT_CURL_LDLIBS ?= $(shell pkg-config --libs libcurl 2>/dev/null || curl-config --libs 2>/dev/null)
|
||||
CURL_DIR := vendor/curl
|
||||
CURL_BUILD_DIR := $(VENDOR_BUILD_DIR)/linux/$(ARCH)/curl
|
||||
CURL_INCLUDE_DIR := $(CURL_BUILD_DIR)/include
|
||||
CURL_LIB_DIR := $(CURL_BUILD_DIR)/lib64
|
||||
CURL_SO := $(CURL_LIB_DIR)/libcurl.so
|
||||
CURL_PROTOCOL_CHECK := $(CURL_BUILD_DIR)/.protocols-ok
|
||||
OPENSSL_ROOT_DIR ?= $(shell pkg-config --variable=prefix openssl 2>/dev/null)
|
||||
OPENSSL_CMAKE_OPT := $(if $(strip $(OPENSSL_ROOT_DIR)),-DOPENSSL_ROOT_DIR=$(OPENSSL_ROOT_DIR),)
|
||||
OPENSSL_INCLUDE_CMAKE_OPT := $(if $(strip $(OPENSSL_INCLUDE_DIR)),-DOPENSSL_INCLUDE_DIR=$(OPENSSL_INCLUDE_DIR),)
|
||||
OPENSSL_SSL_CMAKE_OPT := $(if $(strip $(OPENSSL_SSL_LIBRARY)),-DOPENSSL_SSL_LIBRARY=$(OPENSSL_SSL_LIBRARY),)
|
||||
OPENSSL_CRYPTO_CMAKE_OPT := $(if $(strip $(OPENSSL_CRYPTO_LIBRARY)),-DOPENSSL_CRYPTO_LIBRARY=$(OPENSSL_CRYPTO_LIBRARY),)
|
||||
OPENSSL_LIB_DIR := $(patsubst %/,%,$(dir $(OPENSSL_SSL_LIBRARY)))
|
||||
OPENSSL_LDLIBS := $(if $(strip $(OPENSSL_SSL_LIBRARY) $(OPENSSL_CRYPTO_LIBRARY)),-Xlinker -rpath -Xlinker $(OPENSSL_LIB_DIR) $(OPENSSL_SSL_LIBRARY) $(OPENSSL_CRYPTO_LIBRARY),$(or $(shell pkg-config --libs openssl 2>/dev/null),-lssl -lcrypto))
|
||||
FLINT_CURL_CFLAGS := -I$(CURL_INCLUDE_DIR)
|
||||
FLINT_CURL_LDLIBS := -L$(CURL_LIB_DIR) -Wl,-rpath,$(abspath $(CURL_LIB_DIR)) -lcurl $(OPENSSL_LDLIBS)
|
||||
FLINT_CURL_VERSION_NUM ?= $(shell printf '%s\n' '#include <curl/curlver.h>' 'LIBCURL_VERSION_NUM' | $(CC) -I$(CURL_DIR)/include -E -P - 2>/dev/null | tail -n 1)
|
||||
FLINT_CURL_VERSION_HEX := $(patsubst 0x%,%,$(FLINT_CURL_VERSION_NUM))
|
||||
SQLITE_DIR := vendor/sqlite
|
||||
SQLITE_BUILD_DIR := $(BUILD_OBJ_DIR)/sqlite
|
||||
SQLITE_BUILD_DIR := $(VENDOR_BUILD_DIR)/sqlite
|
||||
SQLITE_AMALGAMATION_C := $(SQLITE_BUILD_DIR)/sqlite3.c
|
||||
SQLITE_AMALGAMATION_H := $(SQLITE_BUILD_DIR)/sqlite3.h
|
||||
SQLITE_SRC := $(SQLITE_AMALGAMATION_C)
|
||||
SQLITE_INCLUDE := -I$(SQLITE_BUILD_DIR)
|
||||
LIBOQS_DIR := vendor/liboqs
|
||||
LIBOQS_BUILD_DIR := $(VENDOR_BUILD_DIR)/linux/$(ARCH)/liboqs
|
||||
LIBOQS_A := $(LIBOQS_BUILD_DIR)/lib/liboqs.a
|
||||
LIBOQS_INCLUDE := -I$(LIBOQS_BUILD_DIR)/include
|
||||
WEB_LIBOQS_BUILD_DIR := $(VENDOR_BUILD_DIR)/web/liboqs
|
||||
WEB_LIBOQS_A := $(WEB_LIBOQS_BUILD_DIR)/lib/liboqs.a
|
||||
WEB_LIBOQS_INCLUDE := -I$(WEB_LIBOQS_BUILD_DIR)/include
|
||||
TEST_BIN_DIR := $(BUILD_BIN_DIR)/tests
|
||||
STORAGE_IMPORT_TEST := $(TEST_BIN_DIR)/storage_import_test
|
||||
FLINT_TEXT_SCALING_TEST := $(TEST_BIN_DIR)/flint_text_scaling_test
|
||||
FLINT_RUNTIME_ASSET_CFLAGS := -DFLINT_HAS_LIBCURL=1 $(FLINT_CURL_CFLAGS)
|
||||
LOCALE_KEYS_TEST := $(TEST_BIN_DIR)/locale_keys_test
|
||||
SYNC_URL_TEST := $(TEST_BIN_DIR)/sync_url_test
|
||||
SYNC_ACCOUNT_TEST := $(TEST_BIN_DIR)/sync_account_test
|
||||
FLINT_RUNTIME_ASSET_CFLAGS := $(FLINT_CURL_CFLAGS)
|
||||
FLINT_RUNTIME_ASSET_LDLIBS := $(FLINT_CURL_LDLIBS)
|
||||
|
||||
APP_SRCS := \
|
||||
src/main.c \
|
||||
src/core/breath_engine.c \
|
||||
src/app/app.c \
|
||||
src/app/app_settings.c \
|
||||
src/app/device_preferences.c \
|
||||
src/session/session.c \
|
||||
src/practices/practice_registry.c \
|
||||
src/practices/whm/whm_practice.c \
|
||||
src/practices/whm/whm_session.c \
|
||||
src/practices/whm/whm_manual.c \
|
||||
src/practices/whm/whm_config.c \
|
||||
src/practices/meditation/meditation_practice.c \
|
||||
src/practices/meditation/meditation_session.c \
|
||||
src/practices/meditation/meditation_manual.c \
|
||||
src/practices/meditation/meditation_config.c \
|
||||
src/screens/habits_screen.c \
|
||||
src/session/meditation_music.c \
|
||||
src/core/locale.c \
|
||||
src/screens/statistics_screen.c \
|
||||
src/screens/habits/edit.c \
|
||||
src/screens/habits/session.c \
|
||||
src/practices/meditation/meditation_music.c \
|
||||
src/core/theme.c \
|
||||
src/storage/data.c \
|
||||
src/storage/db.c \
|
||||
src/storage/import.c \
|
||||
src/storage/storage.c \
|
||||
src/storage/sync_account.c \
|
||||
src/storage/sync_client.c \
|
||||
src/third_party/miniz.c \
|
||||
src/platform/android/android_device.c \
|
||||
src/screens/practice_screen.c \
|
||||
src/screens/language_screen.c \
|
||||
src/screens/manual_screen.c \
|
||||
src/screens/settings/settings_screen.c
|
||||
src/screens/settings/settings_screen.c \
|
||||
src/screens/settings/settings_device.c \
|
||||
src/screens/settings/settings_theme.c \
|
||||
src/screens/settings/settings_data.c \
|
||||
src/screens/settings/settings_sync_account.c
|
||||
|
||||
LOCALE_FILES := $(wildcard locales/*.txt)
|
||||
IMAGE_FILES := assets/whm/1.jpg assets/whm/2.jpg
|
||||
IMAGE_FILES := assets/practices/whm/1.jpg assets/practices/whm/2.jpg assets/practices/meditation/1.jpg
|
||||
SOUND_FILES := $(wildcard assets/sounds/*.ogg)
|
||||
FONT_OUTPUTS := assets/fonts/locales.png assets/fonts/locales.dat assets/fonts/locales-8.png assets/fonts/locales-8.dat
|
||||
FONT_OUTPUTS := assets/fonts/locales.png assets/fonts/locales.dat
|
||||
OTFCHOP_DIR ?= vendor/otfchop
|
||||
FONT_TOOL := $(OTFCHOP_DIR)/otfchop
|
||||
FONT_SOURCE := $(OTFCHOP_DIR)/unifont-17.0.04.otf
|
||||
@@ -105,14 +190,15 @@ EMBEDDED_ASSETS_C := $(BUILD_OBJ_DIR)/$(APP_NAME)_embedded_assets.c
|
||||
EMBEDDED_ASSET_FILES := $(LOCALE_FILES) $(IMAGE_FILES) $(SOUND_FILES) $(FONT_OUTPUTS)
|
||||
SRC := $(APP_SRCS) $(EMBEDDED_ASSETS_C)
|
||||
|
||||
APP_INCLUDE := -Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/session -Isrc/storage -Isrc/platform/android -Isrc/third_party
|
||||
APP_INCLUDE := -Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/practices -Isrc/practices/whm -Isrc/practices/meditation -Isrc/storage -Isrc/platform/android -Isrc/third_party
|
||||
APP_RAYLIB_CONFIG := $(filter-out -DSUPPORT_MODULE_RAUDIO=0 -DSUPPORT_FILEFORMAT_PNG=0 -DSUPPORT_FILEFORMAT_JPG=0 -DSUPPORT_FILEFORMAT_OGG=0 -DSUPPORT_FILEFORMAT_MP3=0,$(RAY_RAYLIB_CONFIG)) -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1 -DSUPPORT_FILEFORMAT_MP3=1
|
||||
CFLAGS := -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -DFLINT_EMBEDDED_ONLY=1 $(FLINT_RUNTIME_ASSET_CFLAGS)
|
||||
WINDOWS_CFLAGS := -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -DFLINT_EMBEDDED_ONLY=1
|
||||
WEB_CFLAGS := $(filter-out -std=c99,$(CFLAGS)) -std=gnu99
|
||||
CLICK_CFLAGS := -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -DFLINT_EMBEDDED_ONLY=1 $(AARCH64_FLINT_CURL_CFLAGS)
|
||||
LDFLAGS := -Wl,--gc-sections -s
|
||||
WINDOWS_LDFLAGS := -Wl,--gc-sections -static -static-libgcc -mwindows
|
||||
WINDOWS_LDLIBS := -lgdi32 -lwinmm -lopengl32 -luser32 -lshell32 -lole32 -lcomdlg32 -lcomctl32 -luuid -lm
|
||||
WINDOWS_LDLIBS := -lgdi32 -lwinmm -lopengl32 -luser32 -lshell32 -lole32 -lcomdlg32 -lcomctl32 -luuid -lwininet -lws2_32 -liphlpapi -lcrypt32 -lsecur32 -lbcrypt -ladvapi32 -lm
|
||||
ifneq ($(strip $(MCFGTHREADS)),)
|
||||
WIN64_THREAD_LDFLAGS := -L$(MCFGTHREADS)/lib
|
||||
else
|
||||
@@ -136,14 +222,27 @@ APPIMAGE_TARGET := $(LINUX_DIST_DIR)/$(APPIMAGE_NAME)
|
||||
LINUXDEPLOY ?= linuxdeploy
|
||||
WEB_CC ?= emcc
|
||||
WEB_AR ?= emar
|
||||
WEB_CACHE_BUSTER ?= $(shell git rev-parse --short HEAD 2>/dev/null || date +%s)
|
||||
WEB_CACHE_BUSTER ?= $(shell if git diff --quiet --ignore-submodules HEAD -- 2>/dev/null; then git rev-parse --short HEAD 2>/dev/null; else date +%s; fi)
|
||||
WEB_TARGET := $(WEB_DIST_DIR)/index.html
|
||||
WEB_BOOT_JS := src/web_boot.js
|
||||
WEB_DIST_ZIP := $(BUILD_DIST_DIR)/$(APP_NAME)-web.zip
|
||||
WEB_APP_URL ?= https://inbe.waozi.xyz/
|
||||
CHROME_WEB_STORE_ZIP := $(BUILD_DIST_DIR)/$(APP_NAME)-chrome-web-store.zip
|
||||
CHROME_WEB_STORE_MANIFEST := packaging/chrome-web-store/manifest.json
|
||||
CHROME_WEB_STORE_WORKER := packaging/chrome-web-store/service_worker.js
|
||||
CHROME_WEB_STORE_ICON_DIR := packaging/chrome-web-store/icons
|
||||
CHROME_WEB_STORE_ICONS := \
|
||||
$(CHROME_WEB_STORE_ICON_DIR)/icon-16.png \
|
||||
$(CHROME_WEB_STORE_ICON_DIR)/icon-32.png \
|
||||
$(CHROME_WEB_STORE_ICON_DIR)/icon-48.png \
|
||||
$(CHROME_WEB_STORE_ICON_DIR)/icon-128.png
|
||||
WEB_ASSET_FILES := $(shell find web-assets -type f 2>/dev/null)
|
||||
UNPACKAGED_AUDIO_DIR := unpackaged_assets/audio
|
||||
UNPACKAGED_AUDIO_FILES := $(shell find $(UNPACKAGED_AUDIO_DIR) -type f 2>/dev/null)
|
||||
MEDITATION_AUDIO_ZIP := web-assets/dl/inbe-meditation-audio-v1.zip
|
||||
|
||||
.PHONY: all native run test dist appimage clean clean-linux clean-raylib android-check-keystore android-copy-assets android-debug android-release android-bundle android-install android-install-release android-clean package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web
|
||||
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle
|
||||
.PHONY: all native run run-fresh screenshot test dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows clean clean-linux clean-vendor-builds android-check-keystore android-copy-assets android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web chrome-web-store
|
||||
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click
|
||||
|
||||
all: native
|
||||
|
||||
@@ -165,6 +264,8 @@ dist:
|
||||
$(MAKE) android-check-keystore PASSWORD="$$password" && \
|
||||
$(MAKE) package-unpackaged-assets && \
|
||||
$(MAKE) web && \
|
||||
$(MAKE) chrome-web-store && \
|
||||
$(MAKE) click && \
|
||||
$(MAKE) appimage && \
|
||||
$(MAKE) windows && \
|
||||
$(MAKE) android-release PASSWORD="$$password" && \
|
||||
@@ -172,28 +273,66 @@ dist:
|
||||
|
||||
appimage: $(APPIMAGE_TARGET)
|
||||
|
||||
click: $(CLICK_TARGET)
|
||||
|
||||
click-verify: $(CLICK_TARGET)
|
||||
@command -v clickable >/dev/null || { \
|
||||
echo "clickable is missing. Re-enter the flake shell with: nix develop"; \
|
||||
exit 1; \
|
||||
}
|
||||
clickable review $(CLICK_TARGET)
|
||||
|
||||
vendor-prebuilds: vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows
|
||||
|
||||
vendor-prebuilds-native: $(RAYLIB_A) $(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H) $(LIBOQS_A) $(CURL_PROTOCOL_CHECK)
|
||||
|
||||
vendor-prebuilds-web: $(WEB_RAYLIB_A) $(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H) $(WEB_LIBOQS_A)
|
||||
|
||||
vendor-prebuilds-windows: $(WIN64_RAYLIB_A) $(WIN32_RAYLIB_A) $(WIN64_CURL_A) $(WIN32_CURL_A) $(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H)
|
||||
|
||||
run: $(TARGET)
|
||||
./$(TARGET)
|
||||
|
||||
test: $(STORAGE_IMPORT_TEST) $(FLINT_TEXT_SCALING_TEST)
|
||||
$(STORAGE_IMPORT_TEST)
|
||||
$(FLINT_TEXT_SCALING_TEST)
|
||||
run-fresh: $(TARGET)
|
||||
@root=$$(mktemp -d /tmp/inbe-fresh.XXXXXX); \
|
||||
echo "INBE_DATA_ROOT=$$root"; \
|
||||
INBE_DATA_ROOT="$$root" ./$(TARGET)
|
||||
|
||||
$(STORAGE_IMPORT_TEST): tests/storage_import_test.c src/storage/storage.c src/storage/storage.h src/screens/habits_screen.c src/screens/habits_screen.h src/third_party/miniz.c src/third_party/miniz.h $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) | $(TEST_BIN_DIR)
|
||||
screenshot: $(TARGET)
|
||||
./scripts/generate-screenshots.sh "$(TARGET)"
|
||||
|
||||
test: $(STORAGE_IMPORT_TEST) $(LOCALE_KEYS_TEST) $(SYNC_URL_TEST) $(SYNC_ACCOUNT_TEST)
|
||||
$(STORAGE_IMPORT_TEST)
|
||||
$(LOCALE_KEYS_TEST)
|
||||
$(SYNC_URL_TEST)
|
||||
$(SYNC_ACCOUNT_TEST)
|
||||
|
||||
$(STORAGE_IMPORT_TEST): tests/storage_import_test.c src/storage/storage.c src/storage/db.c src/storage/import.c src/storage/storage.h src/storage/db.h src/storage/import.h src/screens/habits_screen.c src/screens/habits/edit.c src/screens/habits/session.c src/screens/habits_screen.h src/screens/habits/habits.h src/third_party/miniz.c src/third_party/miniz.h $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) | $(TEST_BIN_DIR)
|
||||
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE -D_GNU_SOURCE -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -ffunction-sections -fdata-sections \
|
||||
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/session -Isrc/storage -Isrc/platform/android -Isrc/third_party -Ivendor/raylib/src $(FLINT_INCLUDE) $(SQLITE_INCLUDE) \
|
||||
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/practices -Isrc/practices/whm -Isrc/practices/meditation -Isrc/storage -Isrc/platform/android -Isrc/third_party -Ivendor/raylib/src $(FLINT_INCLUDE) $(SQLITE_INCLUDE) \
|
||||
-o $@ \
|
||||
tests/storage_import_test.c src/storage/storage.c src/screens/habits_screen.c src/third_party/miniz.c $(SQLITE_SRC) \
|
||||
tests/storage_import_test.c src/storage/storage.c src/storage/db.c src/storage/import.c src/screens/habits_screen.c src/screens/habits/edit.c src/screens/habits/session.c src/third_party/miniz.c $(SQLITE_SRC) \
|
||||
-Wl,--gc-sections -lm -lpthread -ldl
|
||||
|
||||
$(FLINT_TEXT_SCALING_TEST): tests/flint_text_scaling_test.c flint/src/flint_text.c flint/src/flint_clip.c flint/src/flint_scaling.c flint/include/flint_text.h flint/include/flint_clip.h flint/include/flint_scaling.h | $(TEST_BIN_DIR)
|
||||
$(CC) -Wall -Wextra -std=c99 -ffunction-sections -fdata-sections \
|
||||
-Iflint/include -Ivendor/raylib/src \
|
||||
$(LOCALE_KEYS_TEST): tests/locale_keys_test.c $(LOCALE_FILES) | $(TEST_BIN_DIR)
|
||||
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE \
|
||||
-o $@ \
|
||||
tests/flint_text_scaling_test.c flint/src/flint_text.c flint/src/flint_clip.c flint/src/flint_scaling.c \
|
||||
-Wl,--gc-sections -lm
|
||||
tests/locale_keys_test.c
|
||||
|
||||
$(BUILD_OBJ_DIR) $(LINUX_BIN_DIR) $(LINUX_DIST_DIR) $(LINUX_APPIMAGE_BUILD_DIR) $(WINDOWS_DIST_DIR) $(ANDROID_BUILD_DIR) $(TEST_BIN_DIR) $(WEB_OBJ_DIR) $(WEB_DIST_DIR):
|
||||
$(SYNC_URL_TEST): tests/sync_url_test.c src/storage/sync_client.c src/storage/sync_client.h $(CURL_PROTOCOL_CHECK) | $(TEST_BIN_DIR)
|
||||
$(CC) -Wall -Wextra -Wno-unused-function -std=c99 -D_DEFAULT_SOURCE -DINBE_SYNC_CLIENT_TESTS -ffunction-sections -fdata-sections \
|
||||
-Isrc/storage -Isrc -Ivendor/raylib/src $(FLINT_CURL_CFLAGS) -o $@ \
|
||||
tests/sync_url_test.c src/storage/sync_client.c \
|
||||
-Wl,--gc-sections $(FLINT_CURL_LDLIBS)
|
||||
|
||||
$(SYNC_ACCOUNT_TEST): tests/sync_account_test.c src/storage/sync_account.c src/storage/sync_account.h src/storage/storage.c src/storage/db.c src/storage/import.c src/storage/storage.h src/storage/db.h src/storage/import.h src/third_party/miniz.c src/third_party/miniz.h $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) | $(TEST_BIN_DIR)
|
||||
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE -D_GNU_SOURCE -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -ffunction-sections -fdata-sections \
|
||||
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/practices -Isrc/practices/whm -Isrc/practices/meditation -Isrc/storage -Isrc/platform/android -Isrc/third_party -Ivendor/raylib/src $(SQLITE_INCLUDE) \
|
||||
-o $@ \
|
||||
tests/sync_account_test.c src/storage/sync_account.c src/storage/storage.c src/storage/db.c src/storage/import.c src/third_party/miniz.c $(SQLITE_SRC) \
|
||||
-Wl,--gc-sections -lm -lpthread -ldl
|
||||
|
||||
$(BUILD_OBJ_DIR) $(LINUX_BIN_DIR) $(LINUX_DIST_DIR) $(LINUX_APPIMAGE_BUILD_DIR) $(CLICK_BIN_DIR) $(CLICK_BUILD_DIR) $(CLICK_DIST_DIR) $(WINDOWS_DIST_DIR) $(ANDROID_BUILD_DIR) $(TEST_BIN_DIR) $(WEB_OBJ_DIR) $(WEB_DIST_DIR) $(CHROME_WEB_STORE_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(WINDOWS_BIN_DIR)/$(WIN64_ARCH) $(WINDOWS_BIN_DIR)/$(WIN32_ARCH):
|
||||
@@ -206,10 +345,7 @@ $(FONT_TOOL): vendor/otfchop/otfchop.c vendor/otfchop/stb_truetype.h vendor/otfc
|
||||
$(MAKE) -C vendor/otfchop otfchop
|
||||
|
||||
assets/fonts/locales.png assets/fonts/locales.dat: $(LOCALE_FILES) $(FONT_TOOL) | assets/fonts
|
||||
$(FONT_TOOL) --size 16 $(FONT_SOURCE) $(LOCALE_FILES) assets/fonts/locales
|
||||
|
||||
assets/fonts/locales-8.png assets/fonts/locales-8.dat: $(LOCALE_FILES) $(FONT_TOOL) | assets/fonts
|
||||
$(FONT_TOOL) --size 8 $(FONT_SOURCE) $(LOCALE_FILES) assets/fonts/locales-8
|
||||
$(FONT_TOOL) $(FONT_SOURCE) $(LOCALE_FILES) assets/fonts/locales
|
||||
|
||||
$(EMBEDDED_ASSETS_C): $(EMBEDDED_ASSET_FILES) $(FLINT_DIR)/scripts/embed-assets.sh | $(BUILD_OBJ_DIR)
|
||||
sh $(FLINT_DIR)/scripts/embed-assets.sh $@ $(EMBEDDED_ASSET_FILES)
|
||||
@@ -218,10 +354,10 @@ $(FLINT_ICON_ASSETS_C): $(FLINT_ICON_FILES) $(FLINT_DIR)/scripts/embed-icons.sh
|
||||
sh $(FLINT_DIR)/scripts/embed-icons.sh $(FLINT_DIR)/icons $@
|
||||
|
||||
$(RAYLIB_A): $(RAYLIB_SOURCES)
|
||||
rm -rf $(LINUX_OBJ_DIR)/$(ARCH)/native/raylib-src
|
||||
mkdir -p $(LINUX_OBJ_DIR)/$(ARCH)/native/raylib-src $(RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(LINUX_OBJ_DIR)/$(ARCH)/native/raylib-src/
|
||||
$(MAKE) -j1 -C $(LINUX_OBJ_DIR)/$(ARCH)/native/raylib-src \
|
||||
rm -rf $(VENDOR_BUILD_DIR)/linux/$(ARCH)/raylib-src
|
||||
mkdir -p $(VENDOR_BUILD_DIR)/linux/$(ARCH)/raylib-src $(RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/linux/$(ARCH)/raylib-src/
|
||||
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/linux/$(ARCH)/raylib-src \
|
||||
PLATFORM=PLATFORM_DESKTOP_SDL \
|
||||
GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
|
||||
RAYLIB_LIBTYPE=STATIC \
|
||||
@@ -233,10 +369,10 @@ $(RAYLIB_A): $(RAYLIB_SOURCES)
|
||||
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(RAY_CFLAGS) $(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
|
||||
|
||||
$(WEB_RAYLIB_A): $(RAYLIB_SOURCES) | $(WEB_OBJ_DIR)
|
||||
rm -rf $(WEB_OBJ_DIR)/raylib-src
|
||||
mkdir -p $(WEB_OBJ_DIR)/raylib-src $(WEB_RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(WEB_OBJ_DIR)/raylib-src/
|
||||
$(MAKE) -j1 -C $(WEB_OBJ_DIR)/raylib-src \
|
||||
rm -rf $(VENDOR_BUILD_DIR)/web/raylib-src
|
||||
mkdir -p $(VENDOR_BUILD_DIR)/web/raylib-src $(WEB_RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/web/raylib-src/
|
||||
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/web/raylib-src \
|
||||
PLATFORM=PLATFORM_WEB \
|
||||
RAYLIB_LIBTYPE=STATIC \
|
||||
RAYLIB_RELEASE_PATH=../raylib \
|
||||
@@ -246,11 +382,29 @@ $(WEB_RAYLIB_A): $(RAYLIB_SOURCES) | $(WEB_OBJ_DIR)
|
||||
AR="$(WEB_AR)" \
|
||||
CUSTOM_CFLAGS="$(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
|
||||
|
||||
$(CLICK_RAYLIB_A): $(RAYLIB_SOURCES)
|
||||
rm -rf $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib-src
|
||||
mkdir -p $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib-src $(CLICK_RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib-src/
|
||||
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib-src \
|
||||
PLATFORM=PLATFORM_DESKTOP_SDL \
|
||||
GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
|
||||
RAYLIB_LIBTYPE=STATIC \
|
||||
RAYLIB_RELEASE_PATH=../raylib \
|
||||
RAYLIB_MODULE_AUDIO=TRUE \
|
||||
RAYLIB_MODULE_MODELS=FALSE \
|
||||
CC="$(AARCH64_CC)" \
|
||||
AR="$(AARCH64_AR)" \
|
||||
RANLIB="$(AARCH64_RANLIB)" \
|
||||
SDL_INCLUDE_PATH="$(AARCH64_RAY_SDL_INCLUDE_DIR)" \
|
||||
SDL_LIBRARIES="$(AARCH64_RAY_SDL_LDLIBS)" \
|
||||
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(AARCH64_RAY_CFLAGS) $(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
|
||||
|
||||
$(WIN64_RAYLIB_A): $(RAYLIB_SOURCES)
|
||||
rm -rf $(WINDOWS_OBJ_DIR)/$(WIN64_ARCH)/raylib-src
|
||||
mkdir -p $(WINDOWS_OBJ_DIR)/$(WIN64_ARCH)/raylib-src $(WIN64_RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(WINDOWS_OBJ_DIR)/$(WIN64_ARCH)/raylib-src/
|
||||
$(MAKE) -j1 -C $(WINDOWS_OBJ_DIR)/$(WIN64_ARCH)/raylib-src \
|
||||
rm -rf $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib-src
|
||||
mkdir -p $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib-src $(WIN64_RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib-src/
|
||||
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib-src \
|
||||
OS=Windows_NT \
|
||||
PLATFORM=PLATFORM_DESKTOP_RGFW \
|
||||
GRAPHICS=GRAPHICS_API_OPENGL_11 \
|
||||
@@ -264,10 +418,10 @@ $(WIN64_RAYLIB_A): $(RAYLIB_SOURCES)
|
||||
CUSTOM_CFLAGS="$(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
|
||||
|
||||
$(WIN32_RAYLIB_A): $(RAYLIB_SOURCES)
|
||||
rm -rf $(WINDOWS_OBJ_DIR)/$(WIN32_ARCH)/raylib-src
|
||||
mkdir -p $(WINDOWS_OBJ_DIR)/$(WIN32_ARCH)/raylib-src $(WIN32_RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(WINDOWS_OBJ_DIR)/$(WIN32_ARCH)/raylib-src/
|
||||
$(MAKE) -j1 -C $(WINDOWS_OBJ_DIR)/$(WIN32_ARCH)/raylib-src \
|
||||
rm -rf $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib-src
|
||||
mkdir -p $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib-src $(WIN32_RAYLIB_BUILD_DIR)
|
||||
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib-src/
|
||||
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib-src \
|
||||
OS=Windows_NT \
|
||||
PLATFORM=PLATFORM_DESKTOP_RGFW \
|
||||
GRAPHICS=GRAPHICS_API_OPENGL_11 \
|
||||
@@ -282,16 +436,150 @@ $(WIN32_RAYLIB_A): $(RAYLIB_SOURCES)
|
||||
|
||||
$(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H): $(SQLITE_DIR)/configure $(SQLITE_DIR)/manifest | $(BUILD_OBJ_DIR)
|
||||
mkdir -p $(SQLITE_BUILD_DIR)
|
||||
cd $(SQLITE_BUILD_DIR) && ../../../$(SQLITE_DIR)/configure
|
||||
cd $(SQLITE_BUILD_DIR) && $(abspath $(SQLITE_DIR))/configure
|
||||
$(MAKE) -C $(SQLITE_BUILD_DIR) sqlite3.c sqlite3.h
|
||||
|
||||
$(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(RAYLIB_A) | $(LINUX_BIN_DIR)
|
||||
$(LIBOQS_A): $(LIBOQS_DIR)/CMakeLists.txt | $(BUILD_OBJ_DIR)
|
||||
$(CMAKE) -S $(LIBOQS_DIR) -B $(LIBOQS_BUILD_DIR) \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DOQS_BUILD_ONLY_LIB=ON \
|
||||
-DOQS_USE_OPENSSL=OFF \
|
||||
-DOQS_MINIMAL_BUILD=SIG_ml_dsa_44
|
||||
$(CMAKE) --build $(LIBOQS_BUILD_DIR) --target oqs
|
||||
|
||||
$(WEB_LIBOQS_A): $(LIBOQS_DIR)/CMakeLists.txt | $(BUILD_OBJ_DIR)
|
||||
emcmake $(CMAKE) -S $(LIBOQS_DIR) -B $(WEB_LIBOQS_BUILD_DIR) \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DOQS_BUILD_ONLY_LIB=ON \
|
||||
-DOQS_USE_OPENSSL=OFF \
|
||||
-DOQS_DIST_BUILD=OFF \
|
||||
-DOQS_OPT_TARGET=generic \
|
||||
-DOQS_MINIMAL_BUILD=SIG_ml_dsa_44
|
||||
$(CMAKE) --build $(WEB_LIBOQS_BUILD_DIR) --target oqs
|
||||
|
||||
$(CURL_SO): $(CURL_DIR)/CMakeLists.txt
|
||||
$(CMAKE) -S $(CURL_DIR) -B $(CURL_BUILD_DIR) \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DCMAKE_INSTALL_PREFIX=$(abspath $(CURL_BUILD_DIR)) \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib64 \
|
||||
-DBUILD_CURL_EXE=OFF \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DBUILD_STATIC_LIBS=OFF \
|
||||
-DCURL_USE_OPENSSL=ON \
|
||||
$(OPENSSL_CMAKE_OPT) \
|
||||
$(OPENSSL_INCLUDE_CMAKE_OPT) \
|
||||
$(OPENSSL_SSL_CMAKE_OPT) \
|
||||
$(OPENSSL_CRYPTO_CMAKE_OPT) \
|
||||
-DCURL_DISABLE_WEBSOCKETS=OFF \
|
||||
-DCURL_DISABLE_INSTALL=OFF \
|
||||
-DCURL_DISABLE_LDAP=ON \
|
||||
-DCURL_DISABLE_LDAPS=ON \
|
||||
-DCURL_DISABLE_DICT=ON \
|
||||
-DCURL_DISABLE_FILE=ON \
|
||||
-DCURL_DISABLE_FTP=ON \
|
||||
-DCURL_DISABLE_GOPHER=ON \
|
||||
-DCURL_DISABLE_IMAP=ON \
|
||||
-DCURL_DISABLE_MQTT=ON \
|
||||
-DCURL_DISABLE_POP3=ON \
|
||||
-DCURL_DISABLE_RTSP=ON \
|
||||
-DCURL_DISABLE_SMB=ON \
|
||||
-DCURL_DISABLE_SMTP=ON \
|
||||
-DCURL_DISABLE_TELNET=ON \
|
||||
-DCURL_DISABLE_TFTP=ON \
|
||||
-DCURL_DISABLE_LIBCURL_OPTION=ON \
|
||||
-DCURL_ZLIB=OFF \
|
||||
-DCURL_BROTLI=OFF \
|
||||
-DCURL_ZSTD=OFF \
|
||||
-DCURL_USE_LIBPSL=OFF \
|
||||
-DCURL_USE_LIBSSH2=OFF \
|
||||
-DCURL_USE_GSSAPI=OFF \
|
||||
-DUSE_NGHTTP2=OFF \
|
||||
-DUSE_LIBIDN2=OFF \
|
||||
-DENABLE_CURL_MANUAL=OFF \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
-DBUILD_LIBCURL_DOCS=OFF \
|
||||
-DBUILD_MISC_DOCS=OFF \
|
||||
-DBUILD_TESTING=OFF
|
||||
$(CMAKE) --build $(CURL_BUILD_DIR) --target install
|
||||
|
||||
$(CURL_PROTOCOL_CHECK): $(CURL_SO)
|
||||
@$(CURL_BUILD_DIR)/bin/curl-config --protocols | grep -Eq '(^|[[:space:]])WS([[:space:]]|$$)' || { echo "vendored libcurl was built without WS protocol support"; exit 1; }
|
||||
@$(CURL_BUILD_DIR)/bin/curl-config --protocols | grep -Eq '(^|[[:space:]])WSS([[:space:]]|$$)' || { echo "vendored libcurl was built without WSS protocol support"; exit 1; }
|
||||
@touch $@
|
||||
|
||||
$(WIN64_CURL_A): $(CURL_DIR)/CMakeLists.txt
|
||||
rm -rf $(WIN64_CURL_BUILD_DIR)
|
||||
$(CMAKE) -S $(CURL_DIR) -B $(WIN64_CURL_BUILD_DIR) \
|
||||
-DCMAKE_SYSTEM_NAME=Windows \
|
||||
-DCMAKE_C_COMPILER=$(WIN64_CC_PATH) \
|
||||
-DCMAKE_AR=$(WIN64_AR_PATH) \
|
||||
-DCMAKE_RANLIB=$(WIN64_RANLIB_PATH) \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$(WIN64_THREAD_LDFLAGS)" \
|
||||
-DCMAKE_INSTALL_PREFIX=$(abspath $(WIN64_CURL_BUILD_DIR)) \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_STATIC_LIBS=ON \
|
||||
-DBUILD_CURL_EXE=OFF \
|
||||
-DCURL_STATICLIB=ON \
|
||||
-DCURL_USE_SCHANNEL=ON \
|
||||
-DCURL_USE_OPENSSL=OFF \
|
||||
-DCURL_USE_LIBPSL=OFF \
|
||||
-DCURL_USE_LIBSSH2=OFF \
|
||||
-DCURL_USE_GSSAPI=OFF \
|
||||
-DUSE_NGHTTP2=OFF \
|
||||
-DUSE_LIBIDN2=OFF \
|
||||
-DCURL_DISABLE_LDAP=ON \
|
||||
-DCURL_DISABLE_LDAPS=ON \
|
||||
-DCURL_DISABLE_SMB=ON \
|
||||
-DENABLE_CURL_MANUAL=OFF \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
-DBUILD_LIBCURL_DOCS=OFF \
|
||||
-DBUILD_MISC_DOCS=OFF \
|
||||
-DBUILD_TESTING=OFF
|
||||
$(CMAKE) --build $(WIN64_CURL_BUILD_DIR) --target install
|
||||
|
||||
$(WIN32_CURL_A): $(CURL_DIR)/CMakeLists.txt
|
||||
rm -rf $(WIN32_CURL_BUILD_DIR)
|
||||
$(CMAKE) -S $(CURL_DIR) -B $(WIN32_CURL_BUILD_DIR) \
|
||||
-DCMAKE_SYSTEM_NAME=Windows \
|
||||
-DCMAKE_C_COMPILER=$(WIN32_CC_PATH) \
|
||||
-DCMAKE_AR=$(WIN32_AR_PATH) \
|
||||
-DCMAKE_RANLIB=$(WIN32_RANLIB_PATH) \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$(WIN32_THREAD_LDFLAGS)" \
|
||||
-DCMAKE_INSTALL_PREFIX=$(abspath $(WIN32_CURL_BUILD_DIR)) \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_STATIC_LIBS=ON \
|
||||
-DBUILD_CURL_EXE=OFF \
|
||||
-DCURL_STATICLIB=ON \
|
||||
-DCURL_USE_SCHANNEL=ON \
|
||||
-DCURL_USE_OPENSSL=OFF \
|
||||
-DCURL_USE_LIBPSL=OFF \
|
||||
-DCURL_USE_LIBSSH2=OFF \
|
||||
-DCURL_USE_GSSAPI=OFF \
|
||||
-DUSE_NGHTTP2=OFF \
|
||||
-DUSE_LIBIDN2=OFF \
|
||||
-DCURL_DISABLE_LDAP=ON \
|
||||
-DCURL_DISABLE_LDAPS=ON \
|
||||
-DCURL_DISABLE_SMB=ON \
|
||||
-DENABLE_CURL_MANUAL=OFF \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
-DBUILD_LIBCURL_DOCS=OFF \
|
||||
-DBUILD_MISC_DOCS=OFF \
|
||||
-DBUILD_TESTING=OFF
|
||||
$(CMAKE) --build $(WIN32_CURL_BUILD_DIR) --target install
|
||||
|
||||
$(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(RAYLIB_A) $(LIBOQS_A) $(CURL_PROTOCOL_CHECK) | $(LINUX_BIN_DIR)
|
||||
$(CC) $(CFLAGS) \
|
||||
$(APP_INCLUDE) \
|
||||
$(FLINT_INCLUDE) \
|
||||
$(SQLITE_INCLUDE) \
|
||||
$(LIBOQS_INCLUDE) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
$(RAY_CFLAGS) \
|
||||
-DINBE_HAS_LIBOQS=1 \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-DSUPPORT_FILEFORMAT_MP3=1 \
|
||||
@@ -300,46 +588,142 @@ $(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H)
|
||||
$(FLINT_SRCS) \
|
||||
$(SQLITE_SRC) \
|
||||
$(RAYLIB_A) \
|
||||
$(LIBOQS_A) \
|
||||
$(RAY_LDLIBS) \
|
||||
$(FLINT_RUNTIME_ASSET_LDLIBS) \
|
||||
-lm -lpthread -ldl -lrt \
|
||||
$(LDFLAGS)
|
||||
|
||||
$(WIN64_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WIN64_RAYLIB_A) | $(WINDOWS_BIN_DIR)/$(WIN64_ARCH)
|
||||
$(WIN64_CC) $(WINDOWS_CFLAGS) \
|
||||
$(CLICK_BIN): Makefile $(SRC) $(FLINT_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(CLICK_RAYLIB_A) | $(CLICK_BIN_DIR)
|
||||
$(AARCH64_CC) $(CLICK_CFLAGS) \
|
||||
$(APP_INCLUDE) \
|
||||
$(FLINT_INCLUDE) \
|
||||
$(SQLITE_INCLUDE) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
$(AARCH64_RAY_CFLAGS) \
|
||||
-DPLATFORM_DESKTOP \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-DSUPPORT_FILEFORMAT_MP3=1 \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(FLINT_SRCS) \
|
||||
$(SQLITE_SRC) \
|
||||
$(CLICK_RAYLIB_A) \
|
||||
$(AARCH64_RAY_LDLIBS) \
|
||||
$(AARCH64_FLINT_CURL_LDLIBS) \
|
||||
-lm -lpthread -ldl -lrt \
|
||||
$(LDFLAGS)
|
||||
@if command -v patchelf >/dev/null; then \
|
||||
patchelf --set-interpreter "$(CLICK_PATCHELF_INTERPRETER)" --set-rpath '$$ORIGIN/../lib' $@; \
|
||||
fi
|
||||
|
||||
$(CLICK_TARGET): $(CLICK_BIN_INPUT) $(CLICK_MANIFEST_TEMPLATE) $(CLICK_CONTROL_TEMPLATE) $(CLICK_APPARMOR_TEMPLATE) $(CLICK_DESKTOP_TEMPLATE) $(CLICK_METAINFO_TEMPLATE) $(CLICK_RUNNER) $(LINUX_APPIMAGE_ICON) | $(CLICK_BUILD_DIR) $(CLICK_DIST_DIR)
|
||||
@command -v ar >/dev/null || { \
|
||||
echo "ar is missing. Re-enter the flake shell with: nix develop"; \
|
||||
exit 1; \
|
||||
}
|
||||
rm -rf $(CLICK_ROOT) $(CLICK_CONTROL_DIR)
|
||||
rm -f $(CLICK_DIST_DIR)/$(CLICK_PACKAGE)_*_$(CLICK_ARCH).click
|
||||
rm -f $(CLICK_BUILD_DIR)/debian-binary $(CLICK_BUILD_DIR)/control.tar.gz $(CLICK_BUILD_DIR)/data.tar.gz
|
||||
mkdir -p $(CLICK_ROOT)/usr/bin $(CLICK_ROOT)/usr/lib $(CLICK_ROOT)/usr/share/applications $(CLICK_ROOT)/usr/share/icons/hicolor/512x512/apps $(CLICK_ROOT)/usr/share/metainfo
|
||||
mkdir -p $(CLICK_CONTROL_DIR)
|
||||
cp $(CLICK_BIN_INPUT) $(CLICK_ROOT)/usr/bin/$(APP_NAME)
|
||||
cp $(CLICK_RUNNER) $(CLICK_ROOT)/run-inbe.sh
|
||||
chmod +x $(CLICK_ROOT)/run-inbe.sh $(CLICK_ROOT)/usr/bin/$(APP_NAME)
|
||||
@for lib in $(CLICK_RUNTIME_LIBS); do \
|
||||
if [ -f "$$lib" ]; then \
|
||||
cp -L "$$lib" $(CLICK_ROOT)/usr/lib/; \
|
||||
fi; \
|
||||
done
|
||||
@if command -v patchelf >/dev/null; then \
|
||||
for elf in $(CLICK_ROOT)/usr/lib/*.so*; do \
|
||||
if [ -f "$$elf" ]; then patchelf --set-rpath '$$ORIGIN' "$$elf" >/dev/null 2>&1 || true; fi; \
|
||||
done; \
|
||||
fi
|
||||
sed -e 's#__CLICK_PACKAGE__#$(CLICK_PACKAGE)#g' \
|
||||
-e 's#__CLICK_TITLE__#$(CLICK_TITLE)#g' \
|
||||
-e 's#__APP_VERSION__#$(APP_VERSION)#g' \
|
||||
-e 's#__CLICK_ARCH__#$(CLICK_ARCH)#g' \
|
||||
-e 's#__CLICK_FRAMEWORK__#$(CLICK_FRAMEWORK)#g' \
|
||||
-e 's#__CLICK_MAINTAINER__#$(CLICK_MAINTAINER)#g' \
|
||||
$(CLICK_MANIFEST_TEMPLATE) > $(CLICK_ROOT)/manifest.json
|
||||
cp $(CLICK_ROOT)/manifest.json $(CLICK_CONTROL_DIR)/manifest
|
||||
installed_size=$$(du -sk $(CLICK_ROOT) | awk '{ print $$1 }'); \
|
||||
sed -e 's#__CLICK_PACKAGE__#$(CLICK_PACKAGE)#g' \
|
||||
-e 's#__APP_VERSION__#$(APP_VERSION)#g' \
|
||||
-e 's#__CLICK_ARCH__#$(CLICK_ARCH)#g' \
|
||||
-e 's#__CLICK_TITLE__#$(CLICK_TITLE)#g' \
|
||||
-e 's#__CLICK_MAINTAINER__#$(CLICK_MAINTAINER)#g' \
|
||||
-e "s#__INSTALLED_SIZE__#$$installed_size#g" \
|
||||
$(CLICK_CONTROL_TEMPLATE) > $(CLICK_CONTROL_DIR)/control
|
||||
printf '%s\n' '#! /bin/sh' \
|
||||
'echo "Click packages may not be installed directly using dpkg."' \
|
||||
'echo "Use '\''click install'\'' instead."' \
|
||||
'exit 1' > $(CLICK_CONTROL_DIR)/preinst
|
||||
sed -e 's#__CLICK_POLICY_VERSION__#$(CLICK_POLICY_VERSION)#g' \
|
||||
$(CLICK_APPARMOR_TEMPLATE) > $(CLICK_ROOT)/inbe.apparmor
|
||||
sed -e 's#__CLICK_TITLE__#$(CLICK_TITLE)#g' \
|
||||
$(CLICK_DESKTOP_TEMPLATE) > $(CLICK_ROOT)/inbe.desktop
|
||||
@if [ "$(CLICK_INCLUDE_METAINFO)" = "1" ]; then \
|
||||
sed -e 's#__CLICK_PACKAGE__#$(CLICK_PACKAGE)#g' \
|
||||
-e 's#__APP_VERSION__#$(APP_VERSION)#g' \
|
||||
-e 's#__RELEASE_DATE__#$(shell date -u +%Y-%m-%d)#g' \
|
||||
$(CLICK_METAINFO_TEMPLATE) > $(CLICK_ROOT)/usr/share/metainfo/$(CLICK_PACKAGE).metainfo.xml; \
|
||||
fi
|
||||
cp $(LINUX_APPIMAGE_ICON) $(CLICK_ROOT)/inbe.png
|
||||
cp $(LINUX_APPIMAGE_ICON) $(CLICK_ROOT)/usr/share/icons/hicolor/512x512/apps/inbe.png
|
||||
cd $(CLICK_ROOT) && find . -type f -printf '%P\n' | LC_ALL=C sort | xargs md5sum > $(abspath $(CLICK_CONTROL_DIR)/md5sums)
|
||||
printf '2.0\n' > $(CLICK_BUILD_DIR)/debian-binary
|
||||
tar -C $(CLICK_CONTROL_DIR) --sort=name --owner=0 --group=0 --numeric-owner -czf $(abspath $(CLICK_BUILD_DIR)/control.tar.gz) control manifest md5sums preinst
|
||||
tar -C $(CLICK_ROOT) --sort=name --owner=0 --group=0 --numeric-owner -czf $(abspath $(CLICK_BUILD_DIR)/data.tar.gz) inbe.apparmor inbe.desktop inbe.png manifest.json run-inbe.sh usr
|
||||
cd $(CLICK_BUILD_DIR) && ar rcs $(abspath $@) debian-binary control.tar.gz data.tar.gz
|
||||
test -f $@
|
||||
ar t $@ | grep -qx debian-binary
|
||||
ar t $@ | grep -qx control.tar.gz
|
||||
ar t $@ | grep -qx data.tar.gz
|
||||
|
||||
$(WIN64_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WIN64_RAYLIB_A) $(WIN64_CURL_A) | $(WINDOWS_BIN_DIR)/$(WIN64_ARCH)
|
||||
$(WIN64_CC) $(WINDOWS_CFLAGS) \
|
||||
$(APP_INCLUDE) \
|
||||
$(FLINT_INCLUDE) \
|
||||
$(SQLITE_INCLUDE) \
|
||||
-I$(WIN64_CURL_INCLUDE_DIR) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-DPLATFORM_DESKTOP \
|
||||
-DCURL_STATICLIB \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(FLINT_WINDOWS_SRCS) \
|
||||
$(SQLITE_SRC) \
|
||||
$(WIN64_RAYLIB_A) \
|
||||
$(WIN64_CURL_A) \
|
||||
$(WINDOWS_LDLIBS) \
|
||||
$(WIN64_THREAD_LDFLAGS) \
|
||||
$(WINDOWS_LDFLAGS)
|
||||
$(WIN64_STRIP) $@
|
||||
|
||||
$(WIN32_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WIN32_RAYLIB_A) | $(WINDOWS_BIN_DIR)/$(WIN32_ARCH)
|
||||
$(WIN32_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WIN32_RAYLIB_A) $(WIN32_CURL_A) | $(WINDOWS_BIN_DIR)/$(WIN32_ARCH)
|
||||
$(WIN32_CC) $(WINDOWS_CFLAGS) \
|
||||
$(APP_INCLUDE) \
|
||||
$(FLINT_INCLUDE) \
|
||||
$(SQLITE_INCLUDE) \
|
||||
-I$(WIN32_CURL_INCLUDE_DIR) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-DPLATFORM_DESKTOP \
|
||||
-DCURL_STATICLIB \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(FLINT_WINDOWS_SRCS) \
|
||||
$(SQLITE_SRC) \
|
||||
$(WIN32_RAYLIB_A) \
|
||||
$(WIN32_CURL_A) \
|
||||
$(WINDOWS_LDLIBS) \
|
||||
$(WIN32_THREAD_LDFLAGS) \
|
||||
$(WINDOWS_LDFLAGS)
|
||||
$(WIN32_STRIP) $@
|
||||
|
||||
$(APPIMAGE_TARGET): $(TARGET) $(LINUX_APPIMAGE_APPRUN) $(LINUX_APPIMAGE_DESKTOP) $(LINUX_APPIMAGE_ICON) | $(LINUX_DIST_DIR) $(LINUX_APPIMAGE_BUILD_DIR)
|
||||
$(APPIMAGE_TARGET): $(TARGET) $(LINUX_APPIMAGE_APPRUN) $(LINUX_APPIMAGE_DESKTOP) $(LINUX_APPIMAGE_ICON) $(LINUX_APPIMAGE_APPDATA) | $(LINUX_DIST_DIR) $(LINUX_APPIMAGE_BUILD_DIR)
|
||||
@command -v linuxdeploy-plugin-appimage >/dev/null || { \
|
||||
echo "linuxdeploy-plugin-appimage is missing. Re-enter the flake shell with: nix develop"; \
|
||||
exit 1; \
|
||||
@@ -355,13 +739,29 @@ $(APPIMAGE_TARGET): $(TARGET) $(LINUX_APPIMAGE_APPRUN) $(LINUX_APPIMAGE_DESKTOP)
|
||||
rm -rf $(LINUX_APPDIR)
|
||||
rm -rf $(LINUX_DIST_DIR)/*.AppDir
|
||||
rm -f $(LINUX_DIST_DIR)/*.AppImage
|
||||
mkdir -p $(LINUX_APPDIR)/usr/bin $(LINUX_APPDIR)/usr/share/applications $(LINUX_APPDIR)/usr/share/icons/hicolor/512x512/apps
|
||||
mkdir -p $(LINUX_APPDIR)/usr/bin $(LINUX_APPDIR)/usr/lib $(LINUX_APPDIR)/usr/share/applications $(LINUX_APPDIR)/usr/share/icons/hicolor/512x512/apps $(LINUX_APPDIR)/usr/share/metainfo
|
||||
cp $(TARGET) $(LINUX_APPDIR)/usr/bin/$(APP_NAME)
|
||||
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 $(LINUX_APPDIR)/usr/bin/$(APP_NAME)
|
||||
cp $(LINUX_APPIMAGE_APPRUN) $(LINUX_APPDIR)/AppRun
|
||||
chmod +x $(LINUX_APPDIR)/AppRun
|
||||
@loader=$$(LC_ALL=C readelf -l $(TARGET) | sed -n 's#.*Requesting program interpreter: \(.*\)]#\1#p'); \
|
||||
if printf '%s\n' "$$loader" | grep -q '^/nix/store/.*glibc.*/'; then \
|
||||
glibc_lib_dir=$$(dirname "$$loader"); \
|
||||
echo "Bundling glibc loader: $$loader"; \
|
||||
cp "$$loader" $(LINUX_APPDIR)/usr/lib/; \
|
||||
for lib in libc.so.6 libm.so.6 libpthread.so.0 libdl.so.2 librt.so.1 libresolv.so.2 libnss_files.so.2; do \
|
||||
if [ -f "$$glibc_lib_dir/$$lib" ]; then \
|
||||
cp "$$glibc_lib_dir/$$lib" $(LINUX_APPDIR)/usr/lib/; \
|
||||
chmod u+w $(LINUX_APPDIR)/usr/lib/$$lib; \
|
||||
fi; \
|
||||
done; \
|
||||
chmod u+w $(LINUX_APPDIR)/usr/lib/$$(basename "$$loader"); \
|
||||
else \
|
||||
echo "Not bundling glibc; build interpreter is $$loader"; \
|
||||
fi
|
||||
cp $(LINUX_APPIMAGE_DESKTOP) $(LINUX_APPDIR)/$(APP_NAME).desktop
|
||||
cp $(LINUX_APPIMAGE_DESKTOP) $(LINUX_APPDIR)/usr/share/applications/$(APP_NAME).desktop
|
||||
cp $(LINUX_APPIMAGE_APPDATA) $(LINUX_APPDIR)/usr/share/metainfo/$(ANDROID_APP_ID).metainfo.xml
|
||||
cp $(LINUX_APPIMAGE_ICON) $(LINUX_APPDIR)/$(APP_NAME).png
|
||||
cp $(LINUX_APPIMAGE_ICON) $(LINUX_APPDIR)/usr/share/icons/hicolor/512x512/apps/$(APP_NAME).png
|
||||
cd $(LINUX_APPIMAGE_BUILD_DIR) && env -u SOURCE_DATE_EPOCH ARCH=$(ARCH) LDAI_OUTPUT=$(abspath $(APPIMAGE_TARGET)) $(LINUXDEPLOY) \
|
||||
@@ -372,12 +772,15 @@ $(APPIMAGE_TARGET): $(TARGET) $(LINUX_APPIMAGE_APPRUN) $(LINUX_APPIMAGE_DESKTOP)
|
||||
--output appimage
|
||||
test -f $@
|
||||
|
||||
$(WEB_TARGET): Makefile $(SRC) $(FLINT_WEB_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WEB_RAYLIB_A) src/web_shell.html manifest.json $(WEB_ASSET_FILES) | $(WEB_DIST_DIR)
|
||||
$(WEB_TARGET): Makefile $(SRC) $(FLINT_WEB_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WEB_RAYLIB_A) $(WEB_LIBOQS_A) src/web_shell.html $(WEB_BOOT_JS) manifest.json $(WEB_ASSET_FILES) $(MEDITATION_AUDIO_ZIP) | $(WEB_DIST_DIR)
|
||||
rm -f $(WEB_DIST_DIR)/index.data
|
||||
$(WEB_CC) $(WEB_CFLAGS) \
|
||||
$(APP_INCLUDE) \
|
||||
$(FLINT_INCLUDE) \
|
||||
$(SQLITE_INCLUDE) \
|
||||
$(WEB_LIBOQS_INCLUDE) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-DINBE_HAS_LIBOQS=1 \
|
||||
-DPLATFORM_WEB \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
@@ -387,17 +790,22 @@ $(WEB_TARGET): Makefile $(SRC) $(FLINT_WEB_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMA
|
||||
$(FLINT_WEB_SRCS) \
|
||||
$(SQLITE_SRC) \
|
||||
$(WEB_RAYLIB_A) \
|
||||
$(WEB_LIBOQS_A) \
|
||||
-sUSE_GLFW=3 \
|
||||
-sASYNCIFY \
|
||||
-sFORCE_FILESYSTEM=1 \
|
||||
-sFETCH=1 \
|
||||
-sALLOW_MEMORY_GROWTH=1 \
|
||||
-sSTACK_SIZE=8388608 \
|
||||
-sEXPORTED_FUNCTIONS=_main,_malloc,_free,_app_web_get_play_in_background,_app_web_set_backgrounded,_app_web_background_tick \
|
||||
--shell-file src/web_shell.html \
|
||||
-lidbfs.js \
|
||||
-lm
|
||||
perl -0pi -e 's/WEB_CACHE_BUSTER/$(WEB_CACHE_BUSTER)/g' $(WEB_DIST_DIR)/index.html
|
||||
cp $(WEB_BOOT_JS) $(WEB_DIST_DIR)/index_boot.js
|
||||
perl -0pi -e 's/WEB_CACHE_BUSTER/$(WEB_CACHE_BUSTER)/g' $(WEB_DIST_DIR)/index_boot.js
|
||||
cp -R web-assets $(WEB_DIST_DIR)/
|
||||
cp manifest.json $(WEB_DIST_DIR)/
|
||||
cp manifest.json $(WEB_DIST_DIR)/webmanifest.json
|
||||
|
||||
android-copy-assets:
|
||||
$(MAKE) $(FONT_OUTPUTS)
|
||||
@@ -425,13 +833,25 @@ android-check-keystore:
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-debug: android-copy-assets
|
||||
android-local-properties:
|
||||
@if [ -f droid/local.properties ]; then sed -i '/^ndk\.dir=/d' droid/local.properties; fi
|
||||
@if [ -d /mnt/storage/Android/Sdk/ndk/28.2.13676358 ]; then \
|
||||
if [ -f droid/local.properties ]; then \
|
||||
sed -i 's#^sdk\.dir=.*#sdk.dir=/mnt/storage/Android/Sdk#' droid/local.properties; \
|
||||
sed -i 's#^cmake\.dir=.*#cmake.dir=/mnt/storage/Android/Sdk/cmake/3.22.1#' droid/local.properties; \
|
||||
else \
|
||||
printf 'sdk.dir=/mnt/storage/Android/Sdk\ncmake.dir=/mnt/storage/Android/Sdk/cmake/3.22.1\n' > droid/local.properties; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
android-debug: android-copy-assets android-local-properties
|
||||
unset ANDROID_HOME; $(GRADLE) -p droid assembleDebug
|
||||
$(MAKE) android-copy-debug-apks
|
||||
|
||||
android-release:
|
||||
$(MAKE) android-check-keystore PASSWORD="$(PASSWORD)"
|
||||
$(MAKE) android-copy-assets
|
||||
$(MAKE) android-local-properties
|
||||
@if [ -n "$(PASSWORD)" ]; then \
|
||||
unset ANDROID_HOME; $(GRADLE) -p droid assembleRelease -Pkeystore.path="$(ANDROID_KEYSTORE)" -Pkeystore.alias="$(ANDROID_KEY_ALIAS)" -Pkeystore.password="$(PASSWORD)" || exit $$?; \
|
||||
else \
|
||||
@@ -443,6 +863,7 @@ android-release:
|
||||
android-bundle:
|
||||
$(MAKE) android-check-keystore PASSWORD="$(PASSWORD)"
|
||||
$(MAKE) android-copy-assets
|
||||
$(MAKE) android-local-properties
|
||||
@if [ -n "$(PASSWORD)" ]; then \
|
||||
unset ANDROID_HOME; $(GRADLE) -p droid bundleRelease -Pkeystore.path="$(ANDROID_KEYSTORE)" -Pkeystore.alias="$(ANDROID_KEY_ALIAS)" -Pkeystore.password="$(PASSWORD)" || exit $$?; \
|
||||
else \
|
||||
@@ -520,15 +941,15 @@ android-clean:
|
||||
$(GRADLE) -p droid clean
|
||||
rm -rf $(ANDROID_BUILD_DIR)
|
||||
|
||||
package-unpackaged-assets:
|
||||
$(MEDITATION_AUDIO_ZIP): $(UNPACKAGED_AUDIO_FILES)
|
||||
mkdir -p $(dir $(MEDITATION_AUDIO_ZIP))
|
||||
rm -f $(MEDITATION_AUDIO_ZIP)
|
||||
cd $(UNPACKAGED_AUDIO_DIR) && find . -mindepth 2 -type f -name '*.ogg' -exec zip -9 -r $(abspath $(MEDITATION_AUDIO_ZIP)) {} + && zip -9 -r $(abspath $(MEDITATION_AUDIO_ZIP)) LICENSE.md MANIFEST.txt
|
||||
|
||||
package-unpackaged-assets: $(MEDITATION_AUDIO_ZIP)
|
||||
|
||||
windows-runtime-assets-check:
|
||||
@echo "Windows runtime asset downloads are not wired into this build yet"; \
|
||||
echo "Refusing to build Windows binaries that cannot download meditation audio."; \
|
||||
exit 1
|
||||
@:
|
||||
|
||||
windows64: windows-runtime-assets-check $(WIN64_TARGET)
|
||||
|
||||
@@ -546,6 +967,21 @@ windows:
|
||||
|
||||
web:
|
||||
$(MAKE) $(WEB_TARGET)
|
||||
rm -f $(WEB_DIST_ZIP)
|
||||
cd $(WEB_DIST_DIR) && zip -9 -r $(abspath $(WEB_DIST_ZIP)) .
|
||||
|
||||
chrome-web-store: $(CHROME_WEB_STORE_ZIP)
|
||||
|
||||
$(CHROME_WEB_STORE_ZIP): $(WEB_TARGET) $(CHROME_WEB_STORE_MANIFEST) $(CHROME_WEB_STORE_WORKER) $(CHROME_WEB_STORE_ICONS) | $(CHROME_WEB_STORE_DIR)
|
||||
rm -rf $(CHROME_WEB_STORE_DIR)
|
||||
mkdir -p $(CHROME_WEB_STORE_DIR)/icons
|
||||
cp -R $(WEB_DIST_DIR)/. $(CHROME_WEB_STORE_DIR)/
|
||||
sed -e 's#__APP_VERSION__#$(APP_VERSION)#g' \
|
||||
$(CHROME_WEB_STORE_MANIFEST) > $(CHROME_WEB_STORE_DIR)/manifest.json
|
||||
cp $(CHROME_WEB_STORE_WORKER) $(CHROME_WEB_STORE_DIR)/service_worker.js
|
||||
cp $(CHROME_WEB_STORE_ICONS) $(CHROME_WEB_STORE_DIR)/icons/
|
||||
rm -f $(CHROME_WEB_STORE_ZIP)
|
||||
cd $(CHROME_WEB_STORE_DIR) && zip -9 -r $(abspath $(CHROME_WEB_STORE_ZIP)) .
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
@@ -553,10 +989,10 @@ clean:
|
||||
clean-linux:
|
||||
rm -rf $(LINUX_OBJ_DIR) $(LINUX_BIN_DIR) $(LINUX_DIST_DIR)
|
||||
|
||||
clean-raylib:
|
||||
rm -rf $(RAYLIB_BUILD_DIR) $(LINUX_OBJ_DIR)/*/native/raylib-src vendor/raylib/build
|
||||
clean-vendor-builds:
|
||||
rm -rf $(VENDOR_BUILD_DIR)
|
||||
|
||||
NEEDS_NATIVE_ENV := $(if $(MAKECMDGOALS),$(filter all native run dist appimage,$(MAKECMDGOALS)),native)
|
||||
NEEDS_NATIVE_ENV := $(if $(MAKECMDGOALS),$(filter all native run run-fresh dist appimage vendor-prebuilds vendor-prebuilds-native,$(MAKECMDGOALS)),native)
|
||||
ifneq ($(strip $(NEEDS_NATIVE_ENV)),)
|
||||
ifeq ($(strip $(RAY_CFLAGS)),)
|
||||
$(error RAY_CFLAGS is not set. Enter the ray flake shell with 'nix develop')
|
||||
@@ -574,6 +1010,36 @@ ifeq ($(strip $(RAY_RAYLIB_CONFIG)),)
|
||||
$(error RAY_RAYLIB_CONFIG is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(FLINT_CURL_LDLIBS)),)
|
||||
$(error libcurl pkg-config metadata is missing. Runtime asset downloads are required; enter the flake shell with 'nix develop' or set FLINT_CURL_CFLAGS/FLINT_CURL_LDLIBS explicitly)
|
||||
$(error libcurl metadata is missing. Sync is required; enter the flake shell with 'nix develop' or set FLINT_CURL_CFLAGS/FLINT_CURL_LDLIBS explicitly)
|
||||
endif
|
||||
ifneq ($(shell v='$(FLINT_CURL_VERSION_HEX)'; if [ "$$v" = 075600 ] || [ "$$v" \> 075600 ]; then echo yes; fi),yes)
|
||||
$(error libcurl >= 7.86.0 is required for websocket sync; found LIBCURL_VERSION_NUM=$(FLINT_CURL_VERSION_NUM))
|
||||
endif
|
||||
endif
|
||||
|
||||
NEEDS_CLICK_ENV := $(filter click click-verify,$(MAKECMDGOALS))
|
||||
ifneq ($(strip $(NEEDS_CLICK_ENV)),)
|
||||
ifeq ($(strip $(CLICK_BIN_SOURCE)),)
|
||||
ifeq ($(strip $(AARCH64_CC)),)
|
||||
$(error AARCH64_CC is not set. Enter the ray flake shell with 'nix develop' or pass CLICK_BIN_SOURCE=/path/to/inbe)
|
||||
endif
|
||||
ifeq ($(strip $(AARCH64_AR)),)
|
||||
$(error AARCH64_AR is not set. Enter the ray flake shell with 'nix develop' or pass CLICK_BIN_SOURCE=/path/to/inbe)
|
||||
endif
|
||||
ifeq ($(strip $(AARCH64_RANLIB)),)
|
||||
$(error AARCH64_RANLIB is not set. Enter the ray flake shell with 'nix develop' or pass CLICK_BIN_SOURCE=/path/to/inbe)
|
||||
endif
|
||||
ifeq ($(strip $(AARCH64_RAY_CFLAGS)),)
|
||||
$(error AARCH64_RAY_CFLAGS is not set. Enter the ray flake shell with 'nix develop' or pass CLICK_BIN_SOURCE=/path/to/inbe)
|
||||
endif
|
||||
ifeq ($(strip $(AARCH64_RAY_LDLIBS)),)
|
||||
$(error AARCH64_RAY_LDLIBS is not set. Enter the ray flake shell with 'nix develop' or pass CLICK_BIN_SOURCE=/path/to/inbe)
|
||||
endif
|
||||
ifeq ($(strip $(AARCH64_RAY_SDL_INCLUDE_DIR)),)
|
||||
$(error AARCH64_RAY_SDL_INCLUDE_DIR is not set. Enter the ray flake shell with 'nix develop' or pass CLICK_BIN_SOURCE=/path/to/inbe)
|
||||
endif
|
||||
ifeq ($(strip $(AARCH64_FLINT_CURL_LDLIBS)),)
|
||||
$(error AARCH64_FLINT_CURL_LDLIBS is not set. Enter the ray flake shell with 'nix develop' or pass CLICK_BIN_SOURCE=/path/to/inbe)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 235 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 305 B |
|
After Width: | Height: | Size: 328 B |
|
After Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 131 KiB |
@@ -5,7 +5,7 @@ plugins {
|
||||
android {
|
||||
namespace 'xyz.waozi.inbe'
|
||||
compileSdk 35
|
||||
ndkVersion "25.1.8937393"
|
||||
ndkVersion "28.2.13676358"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
@@ -33,10 +33,10 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdk 19
|
||||
minSdk 21
|
||||
targetSdk 35
|
||||
versionCode 30
|
||||
versionName "1.3.2"
|
||||
versionCode 42
|
||||
versionName "1.4.7"
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,12 @@ android {
|
||||
dependenciesInfo {
|
||||
includeInApk = false
|
||||
}
|
||||
|
||||
packaging {
|
||||
jniLibs {
|
||||
useLegacyPackaging = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
|
||||
@@ -10,18 +10,21 @@ set(SQLITE_BUILD_DIR "${CMAKE_BINARY_DIR}/sqlite")
|
||||
set(SQLITE_AMALGAMATION_C "${SQLITE_BUILD_DIR}/sqlite3.c")
|
||||
set(SQLITE_AMALGAMATION_H "${SQLITE_BUILD_DIR}/sqlite3.h")
|
||||
set(NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
file(GLOB FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c")
|
||||
set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "" FORCE)
|
||||
set(OQS_USE_OPENSSL OFF CACHE BOOL "" FORCE)
|
||||
set(OQS_MINIMAL_BUILD "SIG_ml_dsa_44" CACHE STRING "" FORCE)
|
||||
add_subdirectory("${REPO_ROOT}/vendor/liboqs" "${CMAKE_BINARY_DIR}/liboqs")
|
||||
file(GLOB FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c" "${FLINT_DIR}/src/ui/*.c")
|
||||
list(REMOVE_ITEM FLINT_SOURCES "${FLINT_DIR}/src/flint_file_dialog.c")
|
||||
file(GLOB INBE_LOCALE_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/locales/*.txt")
|
||||
file(GLOB INBE_SOUND_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/assets/sounds/*.ogg")
|
||||
set(INBE_EMBEDDED_INPUTS
|
||||
${INBE_LOCALE_ASSETS}
|
||||
assets/whm/1.jpg
|
||||
assets/whm/2.jpg
|
||||
assets/practices/whm/1.jpg
|
||||
assets/practices/whm/2.jpg
|
||||
assets/practices/meditation/1.jpg
|
||||
assets/fonts/locales.png
|
||||
assets/fonts/locales.dat
|
||||
assets/fonts/locales-8.png
|
||||
assets/fonts/locales-8.dat
|
||||
${INBE_SOUND_ASSETS}
|
||||
)
|
||||
set(INBE_EMBEDDED_DEPS)
|
||||
@@ -88,14 +91,29 @@ add_library(main SHARED
|
||||
"${SRC_DIR}/main.c"
|
||||
"${SRC_DIR}/core/breath_engine.c"
|
||||
"${SRC_DIR}/app/app.c"
|
||||
"${SRC_DIR}/app/app_settings.c"
|
||||
"${SRC_DIR}/app/device_preferences.c"
|
||||
"${SRC_DIR}/session/session.c"
|
||||
"${SRC_DIR}/practices/practice_registry.c"
|
||||
"${SRC_DIR}/practices/whm/whm_practice.c"
|
||||
"${SRC_DIR}/practices/whm/whm_session.c"
|
||||
"${SRC_DIR}/practices/whm/whm_manual.c"
|
||||
"${SRC_DIR}/practices/whm/whm_config.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_practice.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_session.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_manual.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_config.c"
|
||||
"${SRC_DIR}/screens/habits_screen.c"
|
||||
"${SRC_DIR}/session/meditation_music.c"
|
||||
"${SRC_DIR}/core/locale.c"
|
||||
"${SRC_DIR}/screens/statistics_screen.c"
|
||||
"${SRC_DIR}/screens/habits/edit.c"
|
||||
"${SRC_DIR}/screens/habits/session.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_music.c"
|
||||
"${SRC_DIR}/core/theme.c"
|
||||
"${SRC_DIR}/storage/data.c"
|
||||
"${SRC_DIR}/storage/db.c"
|
||||
"${SRC_DIR}/storage/import.c"
|
||||
"${SRC_DIR}/storage/storage.c"
|
||||
"${SRC_DIR}/storage/sync_account.c"
|
||||
"${SRC_DIR}/storage/sync_client.c"
|
||||
"${SRC_DIR}/third_party/miniz.c"
|
||||
"${SQLITE_AMALGAMATION_C}"
|
||||
"${SRC_DIR}/platform/android/android_device.c"
|
||||
@@ -106,6 +124,10 @@ add_library(main SHARED
|
||||
"${SRC_DIR}/screens/language_screen.c"
|
||||
"${SRC_DIR}/screens/manual_screen.c"
|
||||
"${SRC_DIR}/screens/settings/settings_screen.c"
|
||||
"${SRC_DIR}/screens/settings/settings_device.c"
|
||||
"${SRC_DIR}/screens/settings/settings_theme.c"
|
||||
"${SRC_DIR}/screens/settings/settings_data.c"
|
||||
"${SRC_DIR}/screens/settings/settings_sync_account.c"
|
||||
"${INBE_EMBEDDED_ASSETS_C}"
|
||||
${FLINT_SOURCES}
|
||||
"${SRC_DIR}/platform/android/android_insets.c"
|
||||
@@ -120,7 +142,9 @@ target_include_directories(main PRIVATE
|
||||
"${SRC_DIR}/core"
|
||||
"${SRC_DIR}/screens"
|
||||
"${SRC_DIR}/screens/settings"
|
||||
"${SRC_DIR}/session"
|
||||
"${SRC_DIR}/practices"
|
||||
"${SRC_DIR}/practices/whm"
|
||||
"${SRC_DIR}/practices/meditation"
|
||||
"${SRC_DIR}/storage"
|
||||
"${SRC_DIR}/platform/android"
|
||||
"${SRC_DIR}/third_party"
|
||||
@@ -141,6 +165,7 @@ target_compile_definitions(main PRIVATE
|
||||
SUPPORT_MODULE_RAUDIO=1
|
||||
SUPPORT_FILEFORMAT_OGG=1
|
||||
FLINT_EMBEDDED_ONLY=1
|
||||
INBE_HAS_LIBOQS=1
|
||||
)
|
||||
|
||||
target_compile_options(main PRIVATE
|
||||
@@ -153,11 +178,13 @@ target_compile_options(main PRIVATE
|
||||
target_link_options(main PRIVATE
|
||||
-Wl,--gc-sections
|
||||
-Wl,--strip-all
|
||||
-Wl,-z,max-page-size=16384
|
||||
-Wl,--wrap=fopen
|
||||
)
|
||||
|
||||
target_link_libraries(main
|
||||
raylib
|
||||
oqs
|
||||
android
|
||||
log
|
||||
OpenSLES
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.KeyEvent;
|
||||
@@ -26,11 +27,17 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.SecureRandom;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
|
||||
public class MainActivity extends NativeActivity {
|
||||
private static final String TAG = "InbeMainActivity";
|
||||
@@ -51,6 +58,7 @@ public class MainActivity extends NativeActivity {
|
||||
private boolean windowFocused = true;
|
||||
private boolean backgroundExecutionActive = false;
|
||||
private boolean autoPausedForLifecycle = false;
|
||||
private int lastDeleteRepeatCount = -1;
|
||||
|
||||
private native void nativeSetInsets(int status, int nav,
|
||||
int cutoutLeft, int cutoutTop, int cutoutRight, int cutoutBottom);
|
||||
@@ -149,18 +157,32 @@ public class MainActivity extends NativeActivity {
|
||||
if (event != null && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
int keyCode = event.getKeyCode();
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL) {
|
||||
nativeTextInputBackspace();
|
||||
int repeatCount = event.getRepeatCount();
|
||||
int deleteCount = lastDeleteRepeatCount < 0
|
||||
? 1
|
||||
: Math.max(1, repeatCount - lastDeleteRepeatCount);
|
||||
lastDeleteRepeatCount = repeatCount;
|
||||
for (int i = 0; i < deleteCount; i++) {
|
||||
nativeTextInputBackspace();
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_ENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) {
|
||||
lastDeleteRepeatCount = -1;
|
||||
nativeTextInputEnter();
|
||||
} else {
|
||||
lastDeleteRepeatCount = -1;
|
||||
int unicode = event.getUnicodeChar();
|
||||
if (unicode >= 32) {
|
||||
nativeTextInputCommit(unicode);
|
||||
}
|
||||
}
|
||||
} else if (event != null && event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_DEL) {
|
||||
lastDeleteRepeatCount = -1;
|
||||
}
|
||||
} else if (event != null && event.getAction() == KeyEvent.ACTION_MULTIPLE &&
|
||||
event.getCharacters() != null) {
|
||||
lastDeleteRepeatCount = -1;
|
||||
String chars = event.getCharacters();
|
||||
for (int i = 0; i < chars.length();) {
|
||||
int codepoint = chars.codePointAt(i);
|
||||
@@ -268,7 +290,228 @@ public class MainActivity extends NativeActivity {
|
||||
}, "inbe-runtime-asset-download").start();
|
||||
}
|
||||
|
||||
public void openImportPicker() {
|
||||
public String syncHttpRequest(String method, String urlText, String body, String[] headers) {
|
||||
HttpURLConnection connection = null;
|
||||
int status = 0;
|
||||
|
||||
try {
|
||||
byte[] bodyBytes = body != null ? body.getBytes(StandardCharsets.UTF_8) : new byte[0];
|
||||
connection = (HttpURLConnection)new URL(urlText).openConnection();
|
||||
connection.setInstanceFollowRedirects(false);
|
||||
connection.setConnectTimeout(15000);
|
||||
connection.setReadTimeout(30000);
|
||||
connection.setRequestMethod(method);
|
||||
connection.setRequestProperty("User-Agent", "inbe-sync/1");
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
if (header == null) continue;
|
||||
int colon = header.indexOf(':');
|
||||
if (colon <= 0) continue;
|
||||
String key = header.substring(0, colon).trim();
|
||||
String value = header.substring(colon + 1).trim();
|
||||
if (!key.isEmpty()) {
|
||||
connection.setRequestProperty(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("POST".equals(method) || "DELETE".equals(method)) {
|
||||
connection.setDoOutput(true);
|
||||
connection.setFixedLengthStreamingMode(bodyBytes.length);
|
||||
try (OutputStream output = connection.getOutputStream()) {
|
||||
output.write(bodyBytes);
|
||||
}
|
||||
}
|
||||
|
||||
status = connection.getResponseCode();
|
||||
InputStream stream = status >= 400 ? connection.getErrorStream() : connection.getInputStream();
|
||||
String response = "";
|
||||
if (stream != null) {
|
||||
try (InputStream input = stream) {
|
||||
byte[] bytes = readAllBytesCompat(input);
|
||||
response = new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
return status + "\n" + response;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Sync HTTP request failed", e);
|
||||
return status + "\n" + (e.getMessage() != null ? e.getMessage() : "request failed");
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String syncWebSocketWait(String urlText, String[] headers) {
|
||||
Socket socket = null;
|
||||
|
||||
try {
|
||||
URI url = new URI(urlText);
|
||||
String protocol = url.getScheme();
|
||||
boolean secure = "wss".equals(protocol);
|
||||
int port = url.getPort();
|
||||
String path = url.getRawPath();
|
||||
if (path == null || path.isEmpty()) path = "/";
|
||||
if (url.getRawQuery() != null && !url.getRawQuery().isEmpty()) {
|
||||
path += "?" + url.getRawQuery();
|
||||
}
|
||||
if (port <= 0) port = secure ? 443 : 80;
|
||||
if (!secure && !"ws".equals(protocol)) {
|
||||
return "0\ninvalid websocket url";
|
||||
}
|
||||
|
||||
socket = secure
|
||||
? SSLSocketFactory.getDefault().createSocket(url.getHost(), port)
|
||||
: new Socket(url.getHost(), port);
|
||||
socket.setTcpNoDelay(true);
|
||||
|
||||
byte[] keyBytes = new byte[16];
|
||||
new SecureRandom().nextBytes(keyBytes);
|
||||
String key = Base64.encodeToString(keyBytes, Base64.NO_WRAP);
|
||||
|
||||
StringBuilder request = new StringBuilder();
|
||||
request.append("GET ").append(path).append(" HTTP/1.1\r\n");
|
||||
request.append("Host: ").append(url.getHost());
|
||||
if ((secure && port != 443) || (!secure && port != 80)) {
|
||||
request.append(":").append(port);
|
||||
}
|
||||
request.append("\r\n");
|
||||
request.append("Upgrade: websocket\r\n");
|
||||
request.append("Connection: Upgrade\r\n");
|
||||
request.append("Sec-WebSocket-Version: 13\r\n");
|
||||
request.append("Sec-WebSocket-Key: ").append(key).append("\r\n");
|
||||
request.append("User-Agent: inbe-sync/1\r\n");
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
if (header != null && !header.isEmpty()) {
|
||||
request.append(header).append("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
request.append("\r\n");
|
||||
socket.getOutputStream().write(request.toString().getBytes(StandardCharsets.US_ASCII));
|
||||
socket.getOutputStream().flush();
|
||||
|
||||
String statusLine = readAsciiLine(socket);
|
||||
int status = parseHttpStatus(statusLine);
|
||||
while (true) {
|
||||
String line = readAsciiLine(socket);
|
||||
if (line == null || line.isEmpty()) break;
|
||||
}
|
||||
if (status != 101) {
|
||||
return status + "\nwebsocket upgrade failed";
|
||||
}
|
||||
Log.i(TAG, "Sync WebSocket connected");
|
||||
|
||||
while (true) {
|
||||
String message = readWebSocketText(socket);
|
||||
if (message == null) {
|
||||
return "0\nwebsocket closed";
|
||||
}
|
||||
if (message.contains("\"type\":\"sync_changed\"")) {
|
||||
return "101\n" + message;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "WebSocket wait failed", e);
|
||||
return "0\n" + (e.getMessage() != null ? e.getMessage() : "websocket failed");
|
||||
} finally {
|
||||
if (socket != null) {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int parseHttpStatus(String statusLine) {
|
||||
if (statusLine == null) return 0;
|
||||
String[] parts = statusLine.split(" ", 3);
|
||||
if (parts.length < 2) return 0;
|
||||
try {
|
||||
return Integer.parseInt(parts[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static String readAsciiLine(Socket socket) throws java.io.IOException {
|
||||
StringBuilder line = new StringBuilder();
|
||||
while (true) {
|
||||
int b = socket.getInputStream().read();
|
||||
if (b < 0) {
|
||||
return line.length() > 0 ? line.toString() : null;
|
||||
}
|
||||
if (b == '\n') break;
|
||||
if (b != '\r') line.append((char)b);
|
||||
}
|
||||
return line.toString();
|
||||
}
|
||||
|
||||
private static String readWebSocketText(Socket socket) throws java.io.IOException {
|
||||
int b0 = socket.getInputStream().read();
|
||||
int b1 = socket.getInputStream().read();
|
||||
if (b0 < 0 || b1 < 0) return null;
|
||||
|
||||
int opcode = b0 & 0x0f;
|
||||
boolean masked = (b1 & 0x80) != 0;
|
||||
long length = b1 & 0x7f;
|
||||
if (length == 126) {
|
||||
length = ((long)readByte(socket) << 8) | readByte(socket);
|
||||
} else if (length == 127) {
|
||||
length = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
length = (length << 8) | readByte(socket);
|
||||
}
|
||||
}
|
||||
if (length < 0 || length > 1024 * 1024) {
|
||||
throw new java.io.IOException("websocket frame too large");
|
||||
}
|
||||
|
||||
byte[] mask = null;
|
||||
if (masked) {
|
||||
mask = readExact(socket, 4);
|
||||
}
|
||||
byte[] payload = readExact(socket, (int)length);
|
||||
if (masked) {
|
||||
for (int i = 0; i < payload.length; i++) {
|
||||
payload[i] = (byte)(payload[i] ^ mask[i % 4]);
|
||||
}
|
||||
}
|
||||
if (opcode == 8) return null;
|
||||
if (opcode != 1) return "";
|
||||
return new String(payload, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private static int readByte(Socket socket) throws java.io.IOException {
|
||||
int b = socket.getInputStream().read();
|
||||
if (b < 0) throw new java.io.IOException("unexpected eof");
|
||||
return b;
|
||||
}
|
||||
|
||||
private static byte[] readExact(Socket socket, int count) throws java.io.IOException {
|
||||
byte[] data = new byte[count];
|
||||
int offset = 0;
|
||||
while (offset < count) {
|
||||
int read = socket.getInputStream().read(data, offset, count - offset);
|
||||
if (read < 0) throw new java.io.IOException("unexpected eof");
|
||||
offset += read;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private static byte[] readAllBytesCompat(InputStream input) throws java.io.IOException {
|
||||
byte[] buffer = new byte[8192];
|
||||
int read;
|
||||
java.io.ByteArrayOutputStream output = new java.io.ByteArrayOutputStream();
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
}
|
||||
return output.toByteArray();
|
||||
}
|
||||
|
||||
public void openImportPicker(final String mimeTypesCsv) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -276,13 +519,10 @@ public class MainActivity extends NativeActivity {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("*/*");
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[] {
|
||||
"application/zip",
|
||||
"application/x-zip-compressed",
|
||||
"application/vnd.sqlite3",
|
||||
"application/x-sqlite",
|
||||
"application/x-sqlite3"
|
||||
});
|
||||
String[] mimeTypes = parseMimeTypes(mimeTypesCsv);
|
||||
if (mimeTypes.length > 0) {
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
|
||||
}
|
||||
startActivityForResult(intent, REQUEST_IMPORT_ZIP);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to open import picker", e);
|
||||
@@ -292,6 +532,22 @@ public class MainActivity extends NativeActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private static String[] parseMimeTypes(String mimeTypesCsv) {
|
||||
if (mimeTypesCsv == null || mimeTypesCsv.trim().isEmpty()) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
String[] raw = mimeTypesCsv.split(",");
|
||||
java.util.ArrayList<String> result = new java.util.ArrayList<>();
|
||||
for (String mimeType : raw) {
|
||||
String trimmed = mimeType.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
result.add(trimmed);
|
||||
}
|
||||
}
|
||||
return result.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
@@ -11,6 +11,40 @@ import java.io.FileOutputStream;
|
||||
public class ShareHelper {
|
||||
private static final String TAG = "InbeShare";
|
||||
|
||||
public static void shareFile(Activity activity, byte[] data, String filename, String mimeType, String chooserTitle) {
|
||||
if (activity == null || data == null) return;
|
||||
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
File cacheFile = new File(activity.getCacheDir(), filename);
|
||||
FileOutputStream fos = new FileOutputStream(cacheFile);
|
||||
fos.write(data);
|
||||
fos.close();
|
||||
|
||||
Uri contentUri = FileProvider.getUriForFile(
|
||||
activity,
|
||||
"xyz.waozi.inbe.fileprovider",
|
||||
cacheFile
|
||||
);
|
||||
|
||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.setType(mimeType != null ? mimeType : "application/octet-stream");
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
|
||||
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
Intent shareIntent = Intent.createChooser(sendIntent, chooserTitle);
|
||||
activity.startActivity(shareIntent);
|
||||
|
||||
Log.i(TAG, "Share sheet shown");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Share failed", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void shareZipFile(Activity activity, byte[] zipData, String filename, String chooserTitle) {
|
||||
if (activity == null || zipData == null) return;
|
||||
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
android.useAndroidX=true
|
||||
android.suppressUnsupportedCompileSdk=35
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
@@ -2,11 +2,9 @@ Eine freie, quelloffene App für Atmung, Meditation und Gewohnheiten.
|
||||
|
||||
Funktionen:
|
||||
- Geführte Übungen mit visuellen und akustischen Hinweisen
|
||||
- Mind, Yoga und Fitness für Gewohnheiten und Übungen
|
||||
- Anpassbare Atemsitzungen und Meditationstimer
|
||||
- Gewohnheitstracking mit Sitzungsverlauf
|
||||
- Mind, Yoga und Fitness für verschiedene Übungsroutinen
|
||||
- Anpassbare Atemsitzungen, Meditationstimer und Zähler
|
||||
- Gewohnheitstracking mit Verlauf und verknüpften Übungszahlen
|
||||
- Optionale Synchronisierung von Gewohnheiten, Sitzungen und Fortschritt
|
||||
- Lokale Speicherung mit Import und Export
|
||||
- Anpassbare Designs mit hellen und dunklen Varianten
|
||||
- Touch-optimierte Oberfläche für Mobilgeräte
|
||||
|
||||
Verfügbare Plattformen: Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
Eine freie App für Atmung, Meditation und Gewohnheiten.
|
||||
Atmung, Meditation und Gewohnheiten mit Synchronisierung.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Import now restores habits, habit sync settings, and optionally app settings from Inbe SQLite exports.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
- Reorganized WHM and Meditation into practice-owned modules for cleaner code boundaries.
|
||||
- Split the meditation manual into an image intro page and a shorter music/gong setup page.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Improved Android data import for `.db` backups, weekly habit rows, and import conflict handling.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Fixed Tickmate `.db` imports so zero-based months map correctly and long habit histories load without dropping later dates.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Added
|
||||
- optional sync client, offline account creation
|
||||
@@ -0,0 +1,2 @@
|
||||
### Changed
|
||||
- Improve account management
|
||||
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
- Improve sync auth, websocket reconnects, and queued habit/session updates.
|
||||
- Reduce SQLite-related UI flicker and speed up bulk import sync queueing.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
- Refresh expired native sync auth tokens before sending queued changes.
|
||||
- Require first-time meditation users to continue through the tutorial before starting.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
- Build the Ubuntu Touch Click package with the OpenStore package id and review-compatible control metadata.
|
||||
- Omit Click AppStream metadata by default to avoid OpenStore revision import failures.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Changed
|
||||
- Fix spacing issues and translations
|
||||
@@ -0,0 +1,4 @@
|
||||
### Changed
|
||||
- Add a responsive Flint sidebar, configurable bottom navigation, and independent Statistics screen.
|
||||
### Fixed
|
||||
- Preserve queued local habit counter settings when applying sync responses.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
- Rework Practice into Manual, start, and configuration tabs with a new localized first-run guide.
|
||||
- Simplify Meditation's manual to one page and make bottom navigation more compact.
|
||||
@@ -2,11 +2,9 @@ A free, open-source practice app for breathing, meditation, and habit tracking.
|
||||
|
||||
Features:
|
||||
- Guided practice sessions with visual and audio cues
|
||||
- Mind, Yoga, and Fitness organization for habits and practice views
|
||||
- Configurable breathing sessions and meditation timers
|
||||
- Habit tracking with session history
|
||||
- Mind, Yoga, and Fitness organization for different practice routines
|
||||
- Customizable breathing sessions, meditation timers, and habit counters
|
||||
- Habit tracking with session history and linked practice counts
|
||||
- Optional sync for habits, sessions, and practice progress
|
||||
- Local storage with import/export support
|
||||
- Theme customization with light and dark variants
|
||||
- Touch-optimized UI for mobile devices
|
||||
|
||||
Available platforms: Linux, Windows, Android, WebAssembly.
|
||||
|
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 169 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 169 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 169 KiB |
@@ -1 +1 @@
|
||||
A free, open-source app for breathing, meditation, and habit tracking.
|
||||
Syncable breathing, meditation, and habit practice app.
|
||||
@@ -2,11 +2,9 @@ Una app libre y de código abierto para respiración, meditación y hábitos.
|
||||
|
||||
Funciones:
|
||||
- Prácticas guiadas con señales visuales y de audio
|
||||
- Organización Mind, Yoga y Fitness para hábitos y prácticas
|
||||
- Sesiones de respiración y temporizadores de meditación configurables
|
||||
- Seguimiento de hábitos con historial de sesiones
|
||||
- Organización Mind, Yoga y Fitness para distintas rutinas de práctica
|
||||
- Sesiones de respiración, temporizadores y contadores configurables
|
||||
- Seguimiento de hábitos con historial y recuentos vinculados a prácticas
|
||||
- Sincronización opcional de hábitos, sesiones y progreso
|
||||
- Almacenamiento local con importación y exportación
|
||||
- Temas personalizables con variantes claras y oscuras
|
||||
- Interfaz optimizada para pantallas táctiles
|
||||
|
||||
Plataformas disponibles: Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
Una app libre para respiración, meditación y hábitos.
|
||||
Respiración, meditación y hábitos con sincronización.
|
||||
@@ -2,11 +2,9 @@ Une app libre et open source pour respiration, méditation et habitudes.
|
||||
|
||||
Fonctionnalités :
|
||||
- Pratiques guidées avec repères visuels et audio
|
||||
- Organisation Mind, Yoga et Fitness pour habitudes et pratiques
|
||||
- Séances de respiration et minuteries de méditation configurables
|
||||
- Suivi des habitudes avec historique des séances
|
||||
- Organisation Mind, Yoga et Fitness pour différentes routines
|
||||
- Séances de respiration, minuteries et compteurs personnalisables
|
||||
- Suivi des habitudes avec historique et comptes liés aux pratiques
|
||||
- Synchronisation optionnelle des habitudes, séances et progrès
|
||||
- Stockage local avec import et export
|
||||
- Thèmes personnalisables avec variantes claires et sombres
|
||||
- Interface optimisée pour les écrans tactiles
|
||||
|
||||
Plateformes disponibles : Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
Une app libre pour respiration, méditation et habitudes.
|
||||
Respiration, méditation et habitudes avec synchronisation.
|
||||
@@ -2,11 +2,9 @@ Um app livre e de código aberto para respiração, meditação e hábitos.
|
||||
|
||||
Recursos:
|
||||
- Práticas guiadas com sinais visuais e sonoros
|
||||
- Organização Mind, Yoga e Fitness para hábitos e práticas
|
||||
- Sessões de respiração e timers de meditação configuráveis
|
||||
- Acompanhamento de hábitos com histórico de sessões
|
||||
- Organização Mind, Yoga e Fitness para diferentes rotinas de prática
|
||||
- Sessões de respiração, timers de meditação e contadores configuráveis
|
||||
- Acompanhamento de hábitos com histórico e contagens ligadas às práticas
|
||||
- Sincronização opcional de hábitos, sessões e progresso
|
||||
- Armazenamento local com importação e exportação
|
||||
- Temas personalizáveis com variantes claras e escuras
|
||||
- Interface otimizada para toque em dispositivos móveis
|
||||
|
||||
Plataformas disponíveis: Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
Um app livre para respiração, meditação e hábitos.
|
||||
Respiração, meditação e hábitos com sincronização.
|
||||
@@ -64,7 +64,7 @@
|
||||
buildToolsVersions = [ "34.0.0" ];
|
||||
platformVersions = [ "34" "35" ];
|
||||
includeNDK = true;
|
||||
ndkVersions = [ "25.1.8937393" ];
|
||||
ndkVersions = [ "28.2.13676358" ];
|
||||
cmakeVersions = [ "3.22.1" ];
|
||||
includeEmulator = true;
|
||||
includeSystemImages = true;
|
||||
@@ -78,6 +78,7 @@
|
||||
pkgConfigPath = pkgs.lib.makeSearchPath "lib/pkgconfig" [
|
||||
sdl2Pkgs.SDL2.dev
|
||||
pkgs.curl.dev
|
||||
pkgs.openssl.dev
|
||||
pkgs.libdrm.dev
|
||||
pkgs.libgbm
|
||||
pkgs.libglvnd.dev
|
||||
@@ -85,9 +86,12 @@
|
||||
|
||||
aarch64PkgConfigPath = pkgs.lib.makeSearchPath "lib/pkgconfig" [
|
||||
aarch64Pkgs.SDL2.dev
|
||||
aarch64Pkgs.curl.dev
|
||||
aarch64Pkgs.openssl.dev
|
||||
aarch64Pkgs.libdrm.dev
|
||||
aarch64Pkgs.libgbm
|
||||
aarch64Pkgs.libglvnd.dev
|
||||
aarch64Pkgs.zlib.dev
|
||||
];
|
||||
|
||||
windowsTargetPkgs = pkgs.lib.optionals windowsCrossEnabled [
|
||||
@@ -189,6 +193,8 @@ EOF
|
||||
sdl2Pkgs.SDL2
|
||||
sdl2Pkgs.SDL2.dev
|
||||
butler
|
||||
binutils
|
||||
clickable
|
||||
cmake
|
||||
curl
|
||||
curl.dev
|
||||
@@ -199,33 +205,50 @@ EOF
|
||||
gradle
|
||||
imagemagick
|
||||
jdk17
|
||||
libxml2
|
||||
libdrm
|
||||
libdrm.dev
|
||||
libgbm
|
||||
libglvnd
|
||||
libglvnd.dev
|
||||
alsa-lib
|
||||
appimagetool
|
||||
libpulseaudio
|
||||
linuxdeploy
|
||||
linuxdeployPluginAppImage
|
||||
mesa
|
||||
ncurses
|
||||
ninja
|
||||
openssl
|
||||
openssl.dev
|
||||
patchelf
|
||||
pkg-config
|
||||
pipewire
|
||||
rsync
|
||||
xvfb-run
|
||||
zlib
|
||||
zip
|
||||
aarch64Pkgs.stdenv.cc
|
||||
aarch64Pkgs.SDL2
|
||||
aarch64Pkgs.SDL2.dev
|
||||
aarch64Pkgs.curl
|
||||
aarch64Pkgs.curl.dev
|
||||
aarch64Pkgs.openssl
|
||||
aarch64Pkgs.openssl.dev
|
||||
aarch64Pkgs.libdrm
|
||||
aarch64Pkgs.libdrm.dev
|
||||
aarch64Pkgs.libgbm
|
||||
aarch64Pkgs.libglvnd
|
||||
aarch64Pkgs.libglvnd.dev
|
||||
aarch64Pkgs.zlib
|
||||
aarch64Pkgs.zlib.dev
|
||||
] ++ windowsTargetPkgs;
|
||||
|
||||
profile = ''
|
||||
export JAVA_HOME="${pkgs.jdk17.home}"
|
||||
export OPENSSL_INCLUDE_DIR="${pkgs.openssl.dev}/include"
|
||||
export OPENSSL_SSL_LIBRARY="${pkgs.openssl.out}/lib/libssl.so"
|
||||
export OPENSSL_CRYPTO_LIBRARY="${pkgs.openssl.out}/lib/libcrypto.so"
|
||||
|
||||
# Android SDK - override any system ANDROID_HOME
|
||||
export ANDROID_HOME="${sdk}/libexec/android-sdk"
|
||||
@@ -255,6 +278,7 @@ EOF
|
||||
|
||||
export AARCH64_CC="${aarch64Pkgs.stdenv.cc}/bin/${aarch64Pkgs.stdenv.cc.targetPrefix}cc"
|
||||
export AARCH64_AR="${aarch64Pkgs.stdenv.cc.bintools.bintools}/bin/${aarch64Pkgs.stdenv.cc.targetPrefix}ar"
|
||||
export AARCH64_RANLIB="${aarch64Pkgs.stdenv.cc.bintools.bintools}/bin/${aarch64Pkgs.stdenv.cc.targetPrefix}ranlib"
|
||||
export AARCH64_PKG_CONFIG_PATH="${aarch64PkgConfigPath}"
|
||||
export AARCH64_RAY_SDL_CFLAGS="-D_GNU_SOURCE=1 -D_REENTRANT -I${aarch64Pkgs.SDL2.dev}/include -I${aarch64Pkgs.SDL2.dev}/include/SDL2"
|
||||
export AARCH64_RAY_SDL_LDLIBS="-L${aarch64Pkgs.SDL2}/lib -lSDL2"
|
||||
@@ -263,15 +287,21 @@ EOF
|
||||
export AARCH64_RAY_CFLAGS="$AARCH64_RAY_SDL_CFLAGS $AARCH64_RAY_GL_CFLAGS"
|
||||
export AARCH64_RAY_LDLIBS="$AARCH64_RAY_SDL_LDLIBS $AARCH64_RAY_GL_LDLIBS"
|
||||
export AARCH64_RAY_SDL_INCLUDE_DIR="${aarch64Pkgs.SDL2.dev}/include"
|
||||
export AARCH64_FLINT_CURL_CFLAGS="$(PKG_CONFIG_PATH="$AARCH64_PKG_CONFIG_PATH" pkg-config --cflags libcurl)"
|
||||
export AARCH64_FLINT_CURL_LDLIBS="$(PKG_CONFIG_PATH="$AARCH64_PKG_CONFIG_PATH" pkg-config --libs libcurl)"
|
||||
export AARCH64_CLICK_RUNTIME_LIBS="${aarch64Pkgs.SDL2}/lib/libSDL2-2.0.so.0 ${aarch64Pkgs.curl.out}/lib/libcurl.so.4 ${aarch64Pkgs.openssl.out}/lib/libssl.so.3 ${aarch64Pkgs.openssl.out}/lib/libcrypto.so.3 ${aarch64Pkgs.libdrm}/lib/libdrm.so.2 ${aarch64Pkgs.libgbm}/lib/libgbm.so.1 ${aarch64Pkgs.libglvnd}/lib/libEGL.so.1 ${aarch64Pkgs.libglvnd}/lib/libGLESv2.so.2 ${aarch64Pkgs.zlib}/lib/libz.so.1"
|
||||
|
||||
${windowsProfile}
|
||||
|
||||
for project in inbe; do
|
||||
if [ -d "$project/droid" ]; then
|
||||
android_local_sdk="$ANDROID_SDK_ROOT"
|
||||
if [ -d /mnt/storage/Android/Sdk/ndk/28.2.13676358 ]; then
|
||||
android_local_sdk="/mnt/storage/Android/Sdk"
|
||||
fi
|
||||
cat > "$project/droid/local.properties" <<EOF
|
||||
sdk.dir=$ANDROID_SDK_ROOT
|
||||
ndk.dir=$ANDROID_NDK_ROOT
|
||||
cmake.dir=$ANDROID_SDK_ROOT/cmake/3.22.1
|
||||
sdk.dir=$android_local_sdk
|
||||
cmake.dir=$android_local_sdk/cmake/3.22.1
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
|
||||
|
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 150 B |
|
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 197 B |
@@ -10,6 +10,7 @@
|
||||
#include "flint_text.h"
|
||||
#include "flint_ui.h"
|
||||
#include "flint_text_layout.h"
|
||||
#include "flint_transition.h"
|
||||
#include "flint_locale.h"
|
||||
#include "flint_theme.h"
|
||||
#include "flint_theme_meta.h"
|
||||
|
||||
@@ -37,12 +37,14 @@ int flint_file_dialog_save(FlintFileDialog *dlg, const char *title, const char *
|
||||
|
||||
/* Load file dialog - returns 1 if file selected, 0 if cancelled */
|
||||
int flint_file_dialog_load(FlintFileDialog *dlg, const char *title);
|
||||
int flint_file_dialog_load_filtered(FlintFileDialog *dlg, const char *title, const char *filter);
|
||||
|
||||
/* Select folder dialog - returns 1 if folder selected, 0 if cancelled */
|
||||
int flint_file_dialog_select_folder(FlintFileDialog *dlg, const char *title);
|
||||
|
||||
/* Begin non-blocking dialogs. Call flint_file_dialog_update() each frame while active. */
|
||||
void flint_file_dialog_begin_load(FlintFileDialog *dlg, const char *title);
|
||||
void flint_file_dialog_begin_load_filtered(FlintFileDialog *dlg, const char *title, const char *filter);
|
||||
void flint_file_dialog_begin_save(FlintFileDialog *dlg, const char *title, const char *default_filename);
|
||||
|
||||
/* Draw/update active dialog: 1 confirmed, 0 cancelled, -1 still active. */
|
||||
|
||||
@@ -5,12 +5,8 @@
|
||||
|
||||
#define FLINT_TEXT_8 8
|
||||
#define FLINT_TEXT_12 12
|
||||
#define FLINT_TEXT_14 14
|
||||
#define FLINT_TEXT_16 16
|
||||
#define FLINT_TEXT_18 18
|
||||
#define FLINT_TEXT_20 20
|
||||
#define FLINT_TEXT_24 24
|
||||
#define FLINT_TEXT_32 32
|
||||
#define FLINT_TEXT_BASE_SIZE 16
|
||||
|
||||
void flint_text_set_font(Font font);
|
||||
@@ -19,16 +15,14 @@ Font flint_text_font(void);
|
||||
Font flint_text_load_chopped_font(const char *png_path, const char *dat_path, int base_size);
|
||||
Font flint_text_load_chopped_font_from_memory(const unsigned char *png_data, unsigned int png_size, const unsigned char *dat_data, unsigned int dat_size, int base_size);
|
||||
void flint_text_unload_font(Font *font);
|
||||
int flint_text_size(int preferred_size);
|
||||
int flint_text_dpi_size(int base_size);
|
||||
int flint_text_measure(const char *text, int font_size);
|
||||
int flint_text_height(const char *text, int font_size);
|
||||
int flint_text_line_height(int font_size);
|
||||
int flint_text_measure_scaled(const char *text, int scale);
|
||||
void flint_text_draw(const char *text, int x, int y, int font_size, Color color);
|
||||
void flint_text_draw_scaled(const char *text, int x, int y, int scale, Color color);
|
||||
void flint_text_draw_centered(const char *text, int center_x, int center_y, int font_size, Color color);
|
||||
void flint_text_draw_in_rect(const char *text, Rectangle rect, int font_size, Color color);
|
||||
void flint_text_draw_fitted_in_rect(const char *text, Rectangle rect, int preferred_size, int min_size, Color color);
|
||||
int flint_text_y(const char *text, int box_y, int box_h, int font_size);
|
||||
int flint_text_y_scaled(const char *text, int box_y, int box_h, int scale);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define FLINT_THEME_COUNT 10
|
||||
#define FLINT_THEME_COUNT 12
|
||||
|
||||
typedef enum {
|
||||
FLINT_THEME_SKY = 0,
|
||||
@@ -17,7 +17,9 @@ typedef enum {
|
||||
FLINT_THEME_DAWN = 6,
|
||||
FLINT_THEME_SAGE = 7,
|
||||
FLINT_THEME_INK = 8,
|
||||
FLINT_THEME_MONO = 9
|
||||
FLINT_THEME_MONO = 9,
|
||||
FLINT_THEME_MINT = 10,
|
||||
FLINT_THEME_COBALT = 11
|
||||
} FlintThemeId;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef FLINT_TRANSITION_H
|
||||
#define FLINT_TRANSITION_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
typedef enum FlintTransitionPhase {
|
||||
FLINT_TRANSITION_NONE = 0,
|
||||
FLINT_TRANSITION_OUT = 1,
|
||||
FLINT_TRANSITION_IN = 2
|
||||
} FlintTransitionPhase;
|
||||
|
||||
typedef struct FlintTransition {
|
||||
int active;
|
||||
int phase;
|
||||
int ticks;
|
||||
int duration;
|
||||
} FlintTransition;
|
||||
|
||||
void flint_transition_reset(FlintTransition *transition);
|
||||
void flint_transition_begin(FlintTransition *transition, int duration);
|
||||
void flint_transition_reverse_to_out(FlintTransition *transition);
|
||||
float flint_transition_alpha(const FlintTransition *transition);
|
||||
int flint_transition_step(FlintTransition *transition);
|
||||
void flint_transition_draw_fade(const FlintTransition *transition,
|
||||
int width, int height, Color color);
|
||||
|
||||
#endif
|
||||
@@ -60,6 +60,194 @@ typedef struct {
|
||||
float radius;
|
||||
} FlintUIIconButton;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
int x;
|
||||
int y;
|
||||
int icon_size;
|
||||
int icon_padding;
|
||||
Texture2D icon;
|
||||
int *open;
|
||||
int *value;
|
||||
int min;
|
||||
int max;
|
||||
int popup_width;
|
||||
int popup_height;
|
||||
} FlintUIIconSliderPopup;
|
||||
|
||||
typedef struct {
|
||||
Texture2D icon;
|
||||
int disabled;
|
||||
} FlintUIIconRowItem;
|
||||
|
||||
typedef struct {
|
||||
int center_x;
|
||||
int view_width;
|
||||
int view_height;
|
||||
int count;
|
||||
const FlintUIIconRowItem *items;
|
||||
int icon_size;
|
||||
int icon_padding;
|
||||
int gap;
|
||||
int side_margin;
|
||||
int bottom_margin;
|
||||
int max_button_width;
|
||||
int min_icon_size;
|
||||
int min_icon_padding;
|
||||
int min_gap;
|
||||
} FlintUIBottomIconRow;
|
||||
|
||||
typedef struct {
|
||||
int clicked_index;
|
||||
int y;
|
||||
int button_width;
|
||||
} FlintUIIconRowResult;
|
||||
|
||||
typedef struct {
|
||||
int route;
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
int active;
|
||||
int disabled;
|
||||
} FlintUIBottomNavItem;
|
||||
|
||||
typedef struct {
|
||||
int view_width;
|
||||
int view_height;
|
||||
int count;
|
||||
const FlintUIBottomNavItem *items;
|
||||
int height;
|
||||
int icon_size;
|
||||
int icon_padding;
|
||||
int side_margin;
|
||||
int bottom_margin;
|
||||
int max_button_width;
|
||||
} FlintUIBottomNav;
|
||||
|
||||
typedef struct {
|
||||
int clicked_index;
|
||||
int clicked_route;
|
||||
int y;
|
||||
int height;
|
||||
} FlintUIBottomNavResult;
|
||||
|
||||
typedef struct {
|
||||
int route;
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
} FlintUIBottomNavOption;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
const char *title;
|
||||
int *routes;
|
||||
int *route_count;
|
||||
int max_route_count;
|
||||
const char **slot_labels;
|
||||
const FlintUIBottomNavOption *options;
|
||||
int option_count;
|
||||
const char *add_label;
|
||||
const char *cancel_label;
|
||||
const char *save_label;
|
||||
const char *reset_label;
|
||||
Texture2D close_icon;
|
||||
} FlintUIBottomNavConfigModal;
|
||||
|
||||
typedef struct {
|
||||
int action;
|
||||
int changed;
|
||||
} FlintUIBottomNavConfigResult;
|
||||
|
||||
typedef struct {
|
||||
const char *message;
|
||||
int width;
|
||||
int header_h;
|
||||
int button_h;
|
||||
int line_gap;
|
||||
int extra_lines;
|
||||
int min_height;
|
||||
int font;
|
||||
} FlintUIParagraphModalMeasure;
|
||||
|
||||
typedef struct {
|
||||
Texture2D icon;
|
||||
int disabled;
|
||||
} FlintUIToolbarAction;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
int draw_menu;
|
||||
const char **options;
|
||||
int option_count;
|
||||
int *selected_index;
|
||||
int dropdown_min_width;
|
||||
int dropdown_max_width;
|
||||
int dropdown_height;
|
||||
const FlintUIToolbarAction *actions;
|
||||
int action_count;
|
||||
int action_icon_size;
|
||||
int action_icon_padding;
|
||||
int action_gap;
|
||||
int side_padding;
|
||||
} FlintUIToolbar;
|
||||
|
||||
typedef struct {
|
||||
int selected_menu_item;
|
||||
int clicked_action;
|
||||
} FlintUIToolbarResult;
|
||||
|
||||
typedef struct {
|
||||
FlintUIToolbar toolbar;
|
||||
Texture2D leading_icon;
|
||||
int leading_width;
|
||||
int leading_icon_size;
|
||||
int leading_icon_padding;
|
||||
} FlintUIToolbarHeader;
|
||||
|
||||
typedef struct {
|
||||
FlintUIToolbarResult toolbar;
|
||||
int leading_clicked;
|
||||
} FlintUIToolbarHeaderResult;
|
||||
|
||||
typedef struct {
|
||||
const char *text;
|
||||
int font;
|
||||
Color color;
|
||||
} FlintUIInfoRow;
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int row_height;
|
||||
int padding_x;
|
||||
const FlintUIInfoRow *rows;
|
||||
int row_count;
|
||||
Color background;
|
||||
Color separator;
|
||||
Color default_text;
|
||||
} FlintUIInfoRows;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
UIButtonStyle style;
|
||||
int disabled;
|
||||
} FlintUIButtonRowItem;
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
int gap;
|
||||
const FlintUIButtonRowItem *items;
|
||||
int count;
|
||||
} FlintUIButtonRow;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
const char *text;
|
||||
@@ -98,6 +286,33 @@ typedef struct {
|
||||
int *commit_pressed;
|
||||
} FlintUITextField;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
FlintUITextField field;
|
||||
int label_font;
|
||||
int label_h;
|
||||
int field_h;
|
||||
int gap;
|
||||
int bottom_gap;
|
||||
Color label_color;
|
||||
} FlintUILabelTextField;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
int font;
|
||||
int info_button;
|
||||
int icon_diameter;
|
||||
int height;
|
||||
Color color;
|
||||
} FlintUISectionLabel;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
int *value;
|
||||
int height;
|
||||
int disabled;
|
||||
} FlintUICheckboxRow;
|
||||
|
||||
typedef struct {
|
||||
const char *text;
|
||||
Texture2D icon;
|
||||
@@ -111,6 +326,8 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
int icon_size;
|
||||
int disabled;
|
||||
Color accent;
|
||||
} FlintUISubtab;
|
||||
@@ -161,6 +378,31 @@ typedef struct {
|
||||
int right_clicked;
|
||||
} FlintUIHeader;
|
||||
|
||||
typedef int (*FlintUIScrollPageHeightFn)(int content_width, void *user_data);
|
||||
|
||||
typedef struct {
|
||||
int y;
|
||||
int height;
|
||||
int max_content_width;
|
||||
int min_content_width;
|
||||
int side_padding;
|
||||
int *scroll_offset;
|
||||
int wheel_step;
|
||||
int scrollbar_x;
|
||||
int measure_passes;
|
||||
FlintUIScrollPageHeightFn content_height;
|
||||
void *user_data;
|
||||
} FlintUIScrollPageSpec;
|
||||
|
||||
typedef struct {
|
||||
FlintUIScrollArea area;
|
||||
FlintUIScrollView view;
|
||||
int content_x;
|
||||
int content_y;
|
||||
int content_w;
|
||||
int content_h;
|
||||
} FlintUIScrollPage;
|
||||
|
||||
typedef void (*FlintUITextInputPlatformCallback)(int active);
|
||||
|
||||
void ui_init(int width, int height, float dpi);
|
||||
@@ -172,9 +414,11 @@ void ui_set_cursor_disabled(int *cursor_disabled);
|
||||
void ui_set_icons(Texture2D gear_icon, Texture2D x_icon);
|
||||
void ui_set_input_blocked(int blocked);
|
||||
int ui_input_captures_click(Vector2 point);
|
||||
int ui_hover_effects_enabled(void);
|
||||
/* DPI scaling, color, and layout functions now from Flint: flint_px, flint_clamp_px, flint_lighten, flint_darken, flint_centered_column, flint_page_side_padding */
|
||||
int flint_ui_font(void);
|
||||
int flint_ui_font_small(void);
|
||||
int flint_ui_title_font(const char *title, int max_width);
|
||||
int flint_ui_text_y(const char *text, int box_y, int box_h, int font);
|
||||
void flint_ui_draw_text_centered(const char *text, int center_x, int center_y, int font, Color color);
|
||||
void flint_ui_draw_text_left_in_rect(const char *text, Rectangle rect, int font_size, Color color);
|
||||
@@ -198,6 +442,23 @@ int ui_icon_btn_size(UIIconSize size);
|
||||
int ui_icon_btn_padding(UIIconSize size);
|
||||
int ui_draw_icon_btn(int x, int y, UIIconSize size, Texture2D icon, int *hover);
|
||||
int ui_draw_icon_btn_padded(int x, int y, int size, int padding, Texture2D icon, int *hover);
|
||||
int ui_draw_info_button(int center_x, int center_y, int diameter);
|
||||
int ui_draw_icon_slider_popup(FlintUIIconSliderPopup popup);
|
||||
FlintUIIconRowResult ui_draw_bottom_icon_row(FlintUIBottomIconRow row);
|
||||
int ui_bottom_nav_height(void);
|
||||
FlintUIBottomNavResult ui_draw_bottom_nav(FlintUIBottomNav nav);
|
||||
FlintUIBottomNavConfigResult ui_draw_bottom_nav_config_modal(FlintUIBottomNavConfigModal modal);
|
||||
FlintUIToolbarResult ui_draw_toolbar(FlintUIToolbar toolbar);
|
||||
FlintUIToolbarHeaderResult ui_draw_toolbar_header(FlintUIToolbarHeader header);
|
||||
void ui_draw_info_rows(FlintUIInfoRows rows);
|
||||
int ui_label_text_field_height(FlintUILabelTextField row);
|
||||
int ui_draw_label_text_field(FlintUILabelTextField row, int x, int y, int w);
|
||||
int ui_section_label_height(FlintUISectionLabel label);
|
||||
int ui_draw_section_label(FlintUISectionLabel label, int x, int y);
|
||||
int ui_checkbox_row_height(FlintUICheckboxRow row);
|
||||
int ui_draw_checkbox_row(FlintUICheckboxRow row, int x, int y);
|
||||
int ui_button_row_height(FlintUIButtonRow row);
|
||||
int ui_draw_button_row(FlintUIButtonRow row);
|
||||
int ui_draw_text_btn(int x, int y, const char *label, int *hover);
|
||||
|
||||
/* Generic button component with unified styling */
|
||||
@@ -216,37 +477,24 @@ int ui_draw_slider_vertical_with_marks(int id, int x, int y, int h,
|
||||
int ui_draw_toggle_switch(int x, int y, int w, int h, int *value,
|
||||
const char *off_label, const char *on_label);
|
||||
int ui_draw_checkbox_toggle(int x, int y, const char *label, int *value);
|
||||
int ui_draw_checkbox_toggle_disabled(int x, int y, const char *label,
|
||||
int *value, int disabled);
|
||||
int ui_draw_dropdown_button(int id, int x, int y, int w, int h, const char **options, int option_count, int *selected_index);
|
||||
int ui_draw_dropdown_menu(int id);
|
||||
int ui_dropdown_captures_click(Vector2 point);
|
||||
void ui_set_dropdown_clip_top(int top);
|
||||
void ui_set_dropdown_clip_bottom(int bottom);
|
||||
int ui_draw_theme_switcher(int x, int y, int w, const char *label,
|
||||
const char *light_label, const char *dark_label,
|
||||
int *theme_id, int *dark_mode);
|
||||
int ui_draw_theme_picker(int x, int y, int w, const char *label,
|
||||
int dark_mode, int *theme_id);
|
||||
int ui_theme_picker_height(int w);
|
||||
typedef struct UITab {
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
UIIconType icon_type;
|
||||
void (*on_click)(void *user_data);
|
||||
void *user_data;
|
||||
} UITab;
|
||||
|
||||
typedef struct UITabBar {
|
||||
UITab *tabs;
|
||||
int count;
|
||||
} UITabBar;
|
||||
|
||||
int ui_nav_button_width(const char *label, int icon_size, int show_label, int font);
|
||||
int ui_draw_nav_button(int x, int y, int icon_size, Texture2D icon, const char *label, int show_label, int *hover);
|
||||
int ui_draw_nav_button_expand(int x, int y, int icon_size, int w, Texture2D icon, const char *label, int show_label, int *hover);
|
||||
void ui_draw_tab_bar(UITab *tabs, int count);
|
||||
void ui_draw_tutorial_image_placeholder(const char *label, int x, int y, int w, int h);
|
||||
void ui_draw_tutorial_image(Texture2D texture, const char *fallback, int x, int y, int w, int h);
|
||||
int ui_draw_modal(const char *title, const char *message, const char *cancel_btn, const char *confirm_btn);
|
||||
int ui_draw_modal_3btn(const char *title, const char *message, const char *left_btn, const char *middle_btn, const char *right_btn);
|
||||
int ui_paragraph_modal_height(FlintUIParagraphModalMeasure measure);
|
||||
int ui_draw_screen_header(const char *title, int show_close);
|
||||
int ui_screen_header_height(void);
|
||||
FlintUIHeader ui_draw_title_header(int height, const char *title,
|
||||
@@ -262,6 +510,8 @@ int ui_scrollbar_safe_content_width(int content_x, int content_width,
|
||||
FlintUIScrollView ui_scroll_container_measure(FlintUIScrollArea area);
|
||||
FlintUIScrollView ui_scroll_container_begin(FlintUIScrollArea area);
|
||||
void ui_scroll_container_end(FlintUIScrollArea area, FlintUIScrollView view);
|
||||
FlintUIScrollPage ui_scroll_page_begin(FlintUIScrollPageSpec spec);
|
||||
void ui_scroll_page_end(FlintUIScrollPage page);
|
||||
int ui_draw_scrollbar(int x, int y, int viewport_h, int content_h, int *scroll_offset, int max_scroll);
|
||||
|
||||
void ui_focus_begin(void);
|
||||
|
||||
@@ -38,6 +38,10 @@ void flint_file_dialog_set_theme_scope(const char *scope) {
|
||||
|
||||
static FlintFileDialogInternal *create_internal(void) {
|
||||
FlintFileDialogInternal *internal = calloc(1, sizeof(FlintFileDialogInternal));
|
||||
if(internal != NULL) {
|
||||
internal->hover_index = -1;
|
||||
internal->last_clicked_index = -1;
|
||||
}
|
||||
return internal;
|
||||
}
|
||||
|
||||
@@ -214,6 +218,9 @@ static int scan_directory(FlintFileDialogInternal *internal) {
|
||||
qsort(internal->entries, internal->file_count,
|
||||
sizeof(DirEntry), compare_entries);
|
||||
}
|
||||
internal->hover_index = -1;
|
||||
internal->last_clicked_index = -1;
|
||||
internal->last_click_time = 0.0f;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -306,7 +313,7 @@ static void render_file_list(FlintFileDialog *dlg, Rectangle dialog_rect) {
|
||||
int list_x = dialog_rect.x + flint_px(16);
|
||||
int scrollbar_w = flint_px(12);
|
||||
int list_width = dialog_rect.width - flint_px(32);
|
||||
int bottom_y = dialog_rect.y + internal->dialog_height - flint_px(72);
|
||||
int bottom_y = dialog_rect.y + internal->dialog_height - flint_px(112);
|
||||
int list_height = bottom_y - list_y;
|
||||
if(list_height < FILE_DIALOG_ITEM_HEIGHT)
|
||||
list_height = FILE_DIALOG_ITEM_HEIGHT;
|
||||
@@ -401,12 +408,11 @@ static void render_scrollbar(FlintFileDialog *dlg, Rectangle dialog_rect) {
|
||||
static void render_filename_input(FlintFileDialog *dlg, Rectangle dialog_rect) {
|
||||
FlintFileDialogInternal *internal = (FlintFileDialogInternal *)dlg->_internal;
|
||||
|
||||
int input_y = dialog_rect.y + internal->dialog_height - flint_px(58);
|
||||
int input_y = dialog_rect.y + internal->dialog_height - flint_px(96);
|
||||
int input_x = dialog_rect.x + flint_px(16);
|
||||
int font = flint_ui_font_small();
|
||||
int label_width = flint_text_measure("Filename:", font) + flint_px(8);
|
||||
int button_area_width = flint_px(176);
|
||||
int input_width = dialog_rect.width - flint_px(32) - label_width - button_area_width;
|
||||
int input_width = dialog_rect.width - flint_px(32) - label_width;
|
||||
int input_height = flint_px(24);
|
||||
if(input_width < flint_px(24))
|
||||
input_width = flint_px(24);
|
||||
@@ -575,9 +581,10 @@ static int handle_mouse_input(FlintFileDialog *dlg) {
|
||||
if(hover_idx >= 0 && hover_idx < internal->file_count) {
|
||||
float current_time = GetTime();
|
||||
if(current_time - internal->last_click_time < 0.5 &&
|
||||
internal->hover_index == hover_idx) {
|
||||
internal->last_clicked_index == hover_idx) {
|
||||
if(internal->entries[hover_idx].is_dir) {
|
||||
navigate_into(internal, internal->entries[hover_idx].name);
|
||||
internal->last_clicked_index = -1;
|
||||
} else {
|
||||
copy_text(internal->selected_file, sizeof(internal->selected_file),
|
||||
internal->entries[hover_idx].name);
|
||||
@@ -595,6 +602,7 @@ static int handle_mouse_input(FlintFileDialog *dlg) {
|
||||
}
|
||||
|
||||
internal->last_click_time = current_time;
|
||||
internal->last_clicked_index = hover_idx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,7 +762,7 @@ run_dialog(FlintFileDialog *dlg)
|
||||
}
|
||||
|
||||
void
|
||||
flint_file_dialog_begin_load(FlintFileDialog *dlg, const char *title)
|
||||
flint_file_dialog_begin_load_filtered(FlintFileDialog *dlg, const char *title, const char *filter)
|
||||
{
|
||||
FlintFileDialogInternal *internal;
|
||||
|
||||
@@ -762,7 +770,7 @@ flint_file_dialog_begin_load(FlintFileDialog *dlg, const char *title)
|
||||
flint_file_dialog_init(dlg);
|
||||
dlg->mode = FLINT_FILE_DIALOG_LOAD;
|
||||
copy_text(dlg->title, sizeof(dlg->title), title);
|
||||
copy_text(dlg->filter, sizeof(dlg->filter), ".db,.zip");
|
||||
copy_text(dlg->filter, sizeof(dlg->filter), filter != NULL ? filter : "");
|
||||
dlg->active = 1;
|
||||
dlg->confirmed = 0;
|
||||
|
||||
@@ -771,10 +779,23 @@ flint_file_dialog_begin_load(FlintFileDialog *dlg, const char *title)
|
||||
scan_directory(internal);
|
||||
internal->filename_input[0] = '\0';
|
||||
internal->selected_file[0] = '\0';
|
||||
internal->hover_index = 0;
|
||||
internal->hover_index = -1;
|
||||
internal->last_clicked_index = -1;
|
||||
internal->focus_area = 0;
|
||||
}
|
||||
|
||||
void
|
||||
flint_file_dialog_begin_load(FlintFileDialog *dlg, const char *title)
|
||||
{
|
||||
flint_file_dialog_begin_load_filtered(dlg, title, NULL);
|
||||
}
|
||||
|
||||
int flint_file_dialog_load_filtered(FlintFileDialog *dlg, const char *title, const char *filter) {
|
||||
if(!dlg || !title) return 0;
|
||||
flint_file_dialog_begin_load_filtered(dlg, title, filter);
|
||||
return run_dialog(dlg);
|
||||
}
|
||||
|
||||
int flint_file_dialog_load(FlintFileDialog *dlg, const char *title) {
|
||||
if(!dlg || !title) return 0;
|
||||
flint_file_dialog_begin_load(dlg, title);
|
||||
@@ -839,7 +860,8 @@ int flint_file_dialog_select_folder(FlintFileDialog *dlg, const char *title) {
|
||||
FlintFileDialogInternal *internal = (FlintFileDialogInternal *)dlg->_internal;
|
||||
internal->filename_input[0] = '\0';
|
||||
internal->selected_file[0] = '\0';
|
||||
internal->hover_index = 0;
|
||||
internal->hover_index = -1;
|
||||
internal->last_clicked_index = -1;
|
||||
internal->focus_area = 0;
|
||||
|
||||
if(run_dialog(dlg)) {
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef struct {
|
||||
DirEntry *entries;
|
||||
int scroll_offset;
|
||||
int hover_index;
|
||||
int last_clicked_index;
|
||||
int focus_area;
|
||||
Rectangle breadcrumb_rect;
|
||||
Rectangle file_list_rect;
|
||||
|
||||
@@ -105,15 +105,19 @@ static const unsigned char flint_icon_droid[] = {
|
||||
|
||||
static const unsigned char flint_icon_edit[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
|
||||
0x61, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
|
||||
0x00, 0x66, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0x52, 0x5b, 0x0e, 0xc0, 0x20, 0x08, 0x13,
|
||||
0xef, 0x7f, 0xe7, 0xed, 0x47, 0x13, 0x84, 0xae, 0x6d, 0x4c, 0xc6, 0xa7, 0xf4, 0x41, 0x91, 0x31,
|
||||
0x8c, 0x7a, 0x56, 0xa1, 0x5e, 0x38, 0xe4, 0x83, 0x10, 0x21, 0x39, 0x9f, 0xce, 0x68, 0x92, 0xe9,
|
||||
0x3a, 0x67, 0xf7, 0xdc, 0x83, 0x02, 0x1b, 0x80, 0x08, 0xf5, 0xad, 0x09, 0x54, 0x32, 0x12, 0x39,
|
||||
0xa6, 0x62, 0x64, 0x16, 0xa9, 0x61, 0xd8, 0x57, 0x59, 0x98, 0x5b, 0xf2, 0xac, 0x20, 0x26, 0x8e,
|
||||
0xa2, 0xc1, 0x05, 0x65, 0x20, 0x23, 0x43, 0xe7, 0x3c, 0xaa, 0xb3, 0x17, 0x79, 0x48, 0xea, 0x74,
|
||||
0x65, 0x84, 0xdf, 0x2b, 0x54, 0x46, 0x55, 0x2f, 0xf8, 0xdc, 0x8b, 0xb8, 0x5d, 0x5e, 0xd7, 0x7f,
|
||||
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x08, 0x06, 0x00, 0x00, 0x00, 0x8d, 0x89, 0x1d,
|
||||
0x0d, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
|
||||
0x00, 0xa6, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0xd3, 0x51, 0x0e, 0xc3, 0x20, 0x0c, 0x03,
|
||||
0x50, 0x67, 0xea, 0x41, 0xe1, 0x64, 0x70, 0xd3, 0xf4, 0xa3, 0x43, 0x4b, 0x43, 0xdc, 0x80, 0xb6,
|
||||
0xf9, 0xaf, 0x2a, 0x7d, 0x32, 0x89, 0x0a, 0xfc, 0x38, 0xb2, 0x7a, 0xb0, 0xb5, 0xa6, 0xf6, 0xb9,
|
||||
0xd6, 0x1a, 0x7e, 0xbb, 0x04, 0x0e, 0xac, 0x94, 0x02, 0x00, 0xe8, 0xbd, 0x53, 0x34, 0x05, 0x3d,
|
||||
0x36, 0xc2, 0xd0, 0x47, 0xd0, 0x63, 0x22, 0x22, 0x00, 0xa0, 0xaa, 0xca, 0xd0, 0xd7, 0x6e, 0x33,
|
||||
0x0b, 0x8f, 0x77, 0x76, 0xbe, 0x21, 0x98, 0x35, 0x8b, 0x50, 0x0a, 0x32, 0x2c, 0x42, 0xa3, 0xdc,
|
||||
0x40, 0x86, 0xf9, 0x56, 0xfa, 0x0e, 0xf0, 0x99, 0x23, 0x6d, 0xc8, 0x30, 0x8f, 0x5a, 0x2c, 0x5d,
|
||||
0x0a, 0xc3, 0x46, 0x3b, 0x86, 0xdd, 0x40, 0xbb, 0x29, 0x36, 0xa7, 0x0c, 0x9b, 0x1a, 0xda, 0x8d,
|
||||
0x79, 0x74, 0x05, 0x9b, 0x40, 0xe0, 0xba, 0xae, 0xdf, 0xe8, 0x2a, 0x16, 0x82, 0x3e, 0x3b, 0x18,
|
||||
0x00, 0x1c, 0x0c, 0xb0, 0xc8, 0x48, 0x86, 0x4d, 0xa0, 0x07, 0x56, 0x91, 0xbf, 0x46, 0xb2, 0x5f,
|
||||
0x69, 0x37, 0x47, 0x74, 0xcd, 0x6f, 0x72, 0x02, 0x63, 0x94, 0x8b, 0x26, 0xd7, 0xd9, 0x8c, 0x86,
|
||||
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
|
||||
};
|
||||
|
||||
@@ -844,17 +848,15 @@ static const unsigned char flint_icon_stack[] = {
|
||||
|
||||
static const unsigned char flint_icon_stat[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
|
||||
0x61, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
|
||||
0x00, 0x6e, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xdd, 0x53, 0x41, 0x0e, 0xc0, 0x20, 0x08, 0x2b,
|
||||
0x8b, 0x2f, 0x52, 0xff, 0xff, 0x35, 0x76, 0x19, 0x4b, 0xc7, 0x20, 0x24, 0x64, 0xa7, 0xf5, 0xa2,
|
||||
0x52, 0xac, 0x55, 0x04, 0x7b, 0x4d, 0x55, 0x55, 0x45, 0x13, 0x47, 0x67, 0x93, 0x5e, 0x00, 0x80,
|
||||
0x11, 0x91, 0x3e, 0x26, 0x22, 0xe2, 0x79, 0x8b, 0x3d, 0x1c, 0x30, 0x69, 0x88, 0x44, 0x59, 0xf0,
|
||||
0x75, 0x05, 0x26, 0x79, 0xcd, 0xb6, 0x19, 0x23, 0x4a, 0xae, 0x44, 0x19, 0xe9, 0x23, 0x56, 0x95,
|
||||
0x31, 0xbe, 0x55, 0x85, 0xd4, 0x41, 0x76, 0x2a, 0xc7, 0x7d, 0xce, 0xb7, 0x0e, 0x7e, 0x20, 0xc0,
|
||||
0xf5, 0xae, 0xe6, 0x36, 0xde, 0x1f, 0xa9, 0xdb, 0x91, 0xb2, 0xd7, 0x6c, 0xb7, 0x32, 0x00, 0x9c,
|
||||
0x73, 0xd6, 0x3f, 0x54, 0x44, 0xc9, 0x6d, 0x34, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44,
|
||||
0xae, 0x42, 0x60, 0x82,
|
||||
0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x08, 0x06, 0x00, 0x00, 0x00, 0xe0, 0x77, 0x3d,
|
||||
0xf8, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
|
||||
0x00, 0x50, 0x49, 0x44, 0x41, 0x54, 0x48, 0x89, 0xed, 0x94, 0x41, 0x0a, 0x00, 0x20, 0x08, 0x04,
|
||||
0xd7, 0xe8, 0xff, 0x5f, 0xd0, 0x9f, 0x6e, 0xe7, 0x0e, 0x11, 0x95, 0x42, 0x82, 0x73, 0xd7, 0x51,
|
||||
0x59, 0x04, 0x8a, 0xef, 0x51, 0x55, 0x92, 0xe4, 0x6d, 0x7d, 0xf3, 0x1c, 0x26, 0xb7, 0x60, 0x75,
|
||||
0xca, 0x3c, 0x1b, 0xb8, 0x0a, 0x4e, 0x92, 0x35, 0x09, 0x5e, 0x23, 0xb9, 0x15, 0x44, 0x50, 0x82,
|
||||
0x12, 0x24, 0x10, 0xe4, 0x47, 0xbc, 0x5f, 0xc3, 0xd4, 0x5c, 0x44, 0xba, 0x99, 0x45, 0xf5, 0x07,
|
||||
0x00, 0x0c, 0x3d, 0xf1, 0x21, 0x64, 0x00, 0x66, 0x6f, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
|
||||
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
|
||||
};
|
||||
|
||||
static const unsigned char flint_icon_stripe[] = {
|
||||
@@ -876,13 +878,15 @@ static const unsigned char flint_icon_sun[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
|
||||
0x61, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
|
||||
0x00, 0x5f, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x53, 0x41, 0x12, 0x00, 0x21, 0x08, 0x8a,
|
||||
0xfe, 0xff, 0x67, 0xf7, 0xb4, 0x3b, 0xd5, 0x42, 0x61, 0x7a, 0x32, 0x54, 0x68, 0x28, 0xd1, 0x48,
|
||||
0x44, 0x44, 0x30, 0x1c, 0x00, 0x18, 0xfe, 0x1b, 0x66, 0x04, 0x0a, 0x4f, 0x35, 0x6d, 0xeb, 0x96,
|
||||
0x82, 0xea, 0x73, 0x87, 0x59, 0x3f, 0xbe, 0xc4, 0x31, 0x68, 0x21, 0x99, 0x13, 0xf7, 0xba, 0x4b,
|
||||
0xbd, 0x1f, 0x15, 0x0e, 0x22, 0x92, 0xc0, 0x0d, 0x49, 0x30, 0x7a, 0xb2, 0xf3, 0xa7, 0x6e, 0xe2,
|
||||
0x7b, 0xb8, 0x7d, 0xc6, 0x34, 0x49, 0xe9, 0x37, 0x96, 0xf6, 0x41, 0xe1, 0xd4, 0xb8, 0xcc, 0x3a,
|
||||
0x3f, 0xfb, 0x0f, 0xaf, 0x73, 0x1a, 0x91, 0x95, 0xf6, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
|
||||
0x00, 0x7f, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x53, 0x41, 0x0e, 0xc0, 0x20, 0x08, 0xa3,
|
||||
0xbe, 0x54, 0x5f, 0xa6, 0x3f, 0x65, 0xa7, 0x1a, 0xd7, 0xe1, 0x30, 0xb1, 0x27, 0xad, 0xb4, 0x82,
|
||||
0x02, 0x2c, 0x40, 0xef, 0xdd, 0x23, 0xbe, 0xb5, 0x06, 0xe5, 0x3e, 0x04, 0xc5, 0xb5, 0xd6, 0x17,
|
||||
0x3f, 0xc6, 0x08, 0x4d, 0x5e, 0x1b, 0x15, 0x03, 0x80, 0x99, 0x99, 0xbb, 0xfb, 0xce, 0x04, 0x99,
|
||||
0x98, 0xd8, 0x99, 0xe0, 0x44, 0xfc, 0x67, 0x82, 0x2c, 0xed, 0x99, 0xea, 0xa6, 0x9c, 0x92, 0xd5,
|
||||
0xcc, 0x40, 0x72, 0x8c, 0xa1, 0xa6, 0xe8, 0x0d, 0x04, 0x85, 0xba, 0xd6, 0xd8, 0x62, 0x97, 0x98,
|
||||
0x06, 0x5a, 0xf3, 0xda, 0x07, 0xda, 0x13, 0x6b, 0xec, 0xf5, 0x23, 0xde, 0x7f, 0x23, 0x0f, 0xaf,
|
||||
0x1a, 0x29, 0x33, 0x39, 0x6a, 0xe5, 0x9d, 0x09, 0x71, 0x34, 0x4c, 0x6a, 0xa2, 0x88, 0xc6, 0xf9,
|
||||
0x01, 0xde, 0xe5, 0x8f, 0xcd, 0xb7, 0xb6, 0xd5, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
|
||||
0x44, 0xae, 0x42, 0x60, 0x82,
|
||||
};
|
||||
|
||||
@@ -1220,7 +1224,7 @@ const FlintIconAsset flint_icon_assets[] = {
|
||||
{UI_ICON_TYPE_CHECK, "check", flint_icon_check, 131u},
|
||||
{UI_ICON_TYPE_DISCORD, "discord", flint_icon_discord, 180u},
|
||||
{UI_ICON_TYPE_DROID, "droid", flint_icon_droid, 170u},
|
||||
{UI_ICON_TYPE_EDIT, "edit", flint_icon_edit, 172u},
|
||||
{UI_ICON_TYPE_EDIT, "edit", flint_icon_edit, 236u},
|
||||
{UI_ICON_TYPE_EYE_CLOSED, "eye-closed", flint_icon_eye_closed, 157u},
|
||||
{UI_ICON_TYPE_FDROID, "fdroid", flint_icon_fdroid, 268u},
|
||||
{UI_ICON_TYPE_FORWARD, "forward", flint_icon_forward, 153u},
|
||||
@@ -1261,9 +1265,9 @@ const FlintIconAsset flint_icon_assets[] = {
|
||||
{UI_ICON_TYPE_SOUND3, "sound3", flint_icon_sound3, 278u},
|
||||
{UI_ICON_TYPE_SRHT, "srht", flint_icon_srht, 233u},
|
||||
{UI_ICON_TYPE_STACK, "stack", flint_icon_stack, 112u},
|
||||
{UI_ICON_TYPE_STAT, "stat", flint_icon_stat, 180u},
|
||||
{UI_ICON_TYPE_STAT, "stat", flint_icon_stat, 150u},
|
||||
{UI_ICON_TYPE_STRIPE, "stripe", flint_icon_stripe, 180u},
|
||||
{UI_ICON_TYPE_SUN, "sun", flint_icon_sun, 165u},
|
||||
{UI_ICON_TYPE_SUN, "sun", flint_icon_sun, 197u},
|
||||
{UI_ICON_TYPE_TCL, "tcl", flint_icon_tcl, 325u},
|
||||
{UI_ICON_TYPE_TELEGRAM, "telegram", flint_icon_telegram, 182u},
|
||||
{UI_ICON_TYPE_TEXT, "text", flint_icon_text, 216u},
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <direct.h>
|
||||
#include <windows.h>
|
||||
#include <wininet.h>
|
||||
#define FLINT_MKDIR(path) _mkdir(path)
|
||||
#else
|
||||
#include <errno.h>
|
||||
@@ -208,6 +210,128 @@ fetch_failed(emscripten_fetch_t *fetch)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(__EMSCRIPTEN__)
|
||||
typedef struct WindowsDownloadContext {
|
||||
FlintRuntimeAssetDownload *download;
|
||||
} WindowsDownloadContext;
|
||||
|
||||
static void
|
||||
windows_set_last_error(FlintRuntimeAssetDownload *download, const char *prefix)
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
|
||||
if(download == NULL)
|
||||
return;
|
||||
snprintf(download->error, sizeof(download->error), "%s (%lu)",
|
||||
prefix != NULL ? prefix : "Windows download failed",
|
||||
(unsigned long)err);
|
||||
}
|
||||
|
||||
static DWORD WINAPI
|
||||
windows_download_thread_main(void *user_data)
|
||||
{
|
||||
WindowsDownloadContext *ctx = (WindowsDownloadContext *)user_data;
|
||||
FlintRuntimeAssetDownload *download = ctx != NULL ? ctx->download : NULL;
|
||||
HINTERNET internet = NULL;
|
||||
HINTERNET request = NULL;
|
||||
FILE *file = NULL;
|
||||
char status_buf[32];
|
||||
DWORD status_len = sizeof(status_buf);
|
||||
DWORD status_index = 0;
|
||||
char length_buf[64];
|
||||
DWORD length_len = sizeof(length_buf);
|
||||
DWORD length_index = 0;
|
||||
BYTE buffer[32768];
|
||||
DWORD bytes_read = 0;
|
||||
BOOL read_ok;
|
||||
|
||||
free(ctx);
|
||||
if(download == NULL)
|
||||
return 0;
|
||||
|
||||
file = fopen(download->path, "wb");
|
||||
if(file == NULL) {
|
||||
snprintf(download->error, sizeof(download->error), "failed to open %.200s", download->path);
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
internet = InternetOpenA("flint-runtime-assets/1",
|
||||
INTERNET_OPEN_TYPE_PRECONFIG,
|
||||
NULL, NULL, 0);
|
||||
if(internet == NULL) {
|
||||
fclose(file);
|
||||
windows_set_last_error(download, "failed to initialize Windows networking");
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
request = InternetOpenUrlA(internet, download->url, NULL, 0,
|
||||
INTERNET_FLAG_RELOAD |
|
||||
INTERNET_FLAG_NO_CACHE_WRITE |
|
||||
INTERNET_FLAG_PRAGMA_NOCACHE,
|
||||
0);
|
||||
if(request == NULL) {
|
||||
fclose(file);
|
||||
InternetCloseHandle(internet);
|
||||
remove(download->path);
|
||||
windows_set_last_error(download, "Windows download failed");
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(HttpQueryInfoA(request, HTTP_QUERY_STATUS_CODE, status_buf, &status_len, &status_index)) {
|
||||
status_buf[sizeof(status_buf) - 1] = '\0';
|
||||
download->http_status = strtol(status_buf, NULL, 10);
|
||||
}
|
||||
if(download->http_status < 200 || download->http_status >= 300) {
|
||||
snprintf(download->error, sizeof(download->error), "HTTP %ld", download->http_status);
|
||||
fclose(file);
|
||||
InternetCloseHandle(request);
|
||||
InternetCloseHandle(internet);
|
||||
remove(download->path);
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(HttpQueryInfoA(request, HTTP_QUERY_CONTENT_LENGTH, length_buf, &length_len, &length_index)) {
|
||||
length_buf[sizeof(length_buf) - 1] = '\0';
|
||||
download->total_bytes = (size_t)strtoull(length_buf, NULL, 10);
|
||||
}
|
||||
|
||||
while((read_ok = InternetReadFile(request, buffer, sizeof(buffer), &bytes_read)) && bytes_read > 0) {
|
||||
if(fwrite(buffer, 1, bytes_read, file) != bytes_read) {
|
||||
snprintf(download->error, sizeof(download->error), "failed to write %.200s", download->path);
|
||||
fclose(file);
|
||||
InternetCloseHandle(request);
|
||||
InternetCloseHandle(internet);
|
||||
remove(download->path);
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return 0;
|
||||
}
|
||||
download->bytes += (size_t)bytes_read;
|
||||
}
|
||||
|
||||
if(!read_ok) {
|
||||
fclose(file);
|
||||
InternetCloseHandle(request);
|
||||
InternetCloseHandle(internet);
|
||||
remove(download->path);
|
||||
windows_set_last_error(download, "Windows download failed");
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
InternetCloseHandle(request);
|
||||
InternetCloseHandle(internet);
|
||||
if(download->total_bytes == 0)
|
||||
download->total_bytes = download->bytes;
|
||||
download->status = FLINT_RUNTIME_ASSET_READY;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FLINT_HAS_LIBCURL) && !defined(__EMSCRIPTEN__)
|
||||
typedef struct NativeDownloadContext {
|
||||
FlintRuntimeAssetDownload *download;
|
||||
@@ -251,7 +375,7 @@ curl_thread_main(void *user_data)
|
||||
|
||||
file = fopen(download->path, "wb");
|
||||
if(file == NULL) {
|
||||
snprintf(download->error, sizeof(download->error), "failed to open %s", download->path);
|
||||
snprintf(download->error, sizeof(download->error), "failed to open %.200s", download->path);
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
@@ -348,6 +472,26 @@ flint_runtime_asset_download(FlintRuntimeAssetDownload *download,
|
||||
emscripten_fetch(&attr, download->url);
|
||||
return 1;
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
{
|
||||
HANDLE thread;
|
||||
WindowsDownloadContext *ctx = (WindowsDownloadContext *)calloc(1, sizeof(*ctx));
|
||||
if(ctx == NULL) {
|
||||
snprintf(download->error, sizeof(download->error), "out of memory");
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return 0;
|
||||
}
|
||||
ctx->download = download;
|
||||
thread = CreateThread(NULL, 0, windows_download_thread_main, ctx, 0, NULL);
|
||||
if(thread == NULL) {
|
||||
free(ctx);
|
||||
windows_set_last_error(download, "failed to create download thread");
|
||||
download->status = FLINT_RUNTIME_ASSET_ERROR;
|
||||
return 0;
|
||||
}
|
||||
CloseHandle(thread);
|
||||
return 1;
|
||||
}
|
||||
#elif defined(FLINT_HAS_LIBCURL)
|
||||
{
|
||||
pthread_t thread;
|
||||
|
||||
@@ -11,6 +11,13 @@
|
||||
static Font g_flint_text_font = {0};
|
||||
static Font g_flint_text_small_font = {0};
|
||||
|
||||
static int
|
||||
font_valid(Font font)
|
||||
{
|
||||
return font.texture.id != 0 && font.glyphs != NULL && font.recs != NULL &&
|
||||
font.glyphCount > 0 && font.baseSize > 0;
|
||||
}
|
||||
|
||||
typedef struct FlintChoppedGlyph {
|
||||
int32_t value;
|
||||
int32_t x;
|
||||
@@ -25,9 +32,7 @@ typedef struct FlintChoppedGlyph {
|
||||
static Font
|
||||
active_font(void)
|
||||
{
|
||||
if(g_flint_text_font.texture.id != 0 && g_flint_text_font.glyphs != NULL &&
|
||||
g_flint_text_font.recs != NULL && g_flint_text_font.glyphCount > 0 &&
|
||||
g_flint_text_font.baseSize > 0)
|
||||
if(font_valid(g_flint_text_font))
|
||||
return g_flint_text_font;
|
||||
|
||||
return GetFontDefault();
|
||||
@@ -36,25 +41,33 @@ active_font(void)
|
||||
static Font
|
||||
active_font_for_size(int font_size)
|
||||
{
|
||||
if(font_size <= flint_px(FLINT_TEXT_8) &&
|
||||
g_flint_text_small_font.texture.id != 0 &&
|
||||
g_flint_text_small_font.glyphs != NULL &&
|
||||
g_flint_text_small_font.recs != NULL &&
|
||||
g_flint_text_small_font.glyphCount > 0 &&
|
||||
g_flint_text_small_font.baseSize > 0)
|
||||
if(font_size == FLINT_TEXT_8 && font_valid(g_flint_text_small_font))
|
||||
return g_flint_text_small_font;
|
||||
|
||||
return active_font();
|
||||
}
|
||||
|
||||
static int
|
||||
font_integer_scale(int font_size)
|
||||
{
|
||||
int target_size = flint_px(font_size);
|
||||
int base_size = FLINT_TEXT_BASE_SIZE;
|
||||
int scale;
|
||||
|
||||
if(target_size < base_size)
|
||||
target_size = base_size;
|
||||
scale = (target_size + base_size / 2) / base_size;
|
||||
return scale > 0 ? scale : 1;
|
||||
}
|
||||
|
||||
static float
|
||||
font_spacing(Font font, int font_size)
|
||||
{
|
||||
(void)font_size;
|
||||
if(font.baseSize <= 0)
|
||||
return 1.0f;
|
||||
|
||||
float spacing = (float)font_size / (float)font.baseSize;
|
||||
return spacing > 0.0f ? spacing : 1.0f;
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -227,57 +240,15 @@ flint_text_unload_font(Font *font)
|
||||
*font = (Font){0};
|
||||
}
|
||||
|
||||
int
|
||||
flint_text_size(int preferred_size)
|
||||
{
|
||||
static const int sizes[] = {
|
||||
FLINT_TEXT_8,
|
||||
FLINT_TEXT_12,
|
||||
FLINT_TEXT_14,
|
||||
FLINT_TEXT_16,
|
||||
FLINT_TEXT_18,
|
||||
FLINT_TEXT_20,
|
||||
FLINT_TEXT_24,
|
||||
FLINT_TEXT_32
|
||||
};
|
||||
int dpi_sizes[sizeof(sizes) / sizeof(sizes[0])];
|
||||
int best;
|
||||
int best_delta;
|
||||
|
||||
for(size_t i = 0; i < sizeof(sizes) / sizeof(sizes[0]); i++)
|
||||
dpi_sizes[i] = flint_px(sizes[i]);
|
||||
|
||||
best = dpi_sizes[0];
|
||||
best_delta = abs(preferred_size - best);
|
||||
|
||||
for(size_t i = 1; i < sizeof(sizes) / sizeof(sizes[0]); i++) {
|
||||
int delta = abs(preferred_size - dpi_sizes[i]);
|
||||
if(delta < best_delta) {
|
||||
best = dpi_sizes[i];
|
||||
best_delta = delta;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
int
|
||||
flint_text_dpi_size(int base_size)
|
||||
{
|
||||
return flint_text_size(flint_px(base_size));
|
||||
}
|
||||
|
||||
int
|
||||
flint_text_measure(const char *text, int font_size)
|
||||
{
|
||||
Font font = active_font_for_size(font_size);
|
||||
Vector2 size;
|
||||
|
||||
if(text == NULL || font.texture.id == 0)
|
||||
return 0;
|
||||
|
||||
size = MeasureTextEx(font, text, (float)font_size, font_spacing(font, font_size));
|
||||
return (int)size.x;
|
||||
return flint_text_measure_scaled(text, font_integer_scale(font_size));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -292,7 +263,7 @@ flint_text_height(const char *text, int font_size)
|
||||
if(text == NULL || text[0] == '\0' || font.texture.id == 0 || font.baseSize <= 0)
|
||||
return font_size;
|
||||
|
||||
scale = (float)font_size / (float)font.baseSize;
|
||||
scale = (float)font_integer_scale(font_size);
|
||||
for(int i = 0; text[i] != '\0';) {
|
||||
int codepoint_byte_count = 0;
|
||||
int codepoint = GetCodepointNext(&text[i], &codepoint_byte_count);
|
||||
@@ -321,10 +292,19 @@ flint_text_height(const char *text, int font_size)
|
||||
}
|
||||
|
||||
if(!seen_glyph)
|
||||
return font_size;
|
||||
return font.baseSize * font_integer_scale(font_size);
|
||||
return (int)(max_bottom - min_top + 0.5f);
|
||||
}
|
||||
|
||||
int
|
||||
flint_text_line_height(int font_size)
|
||||
{
|
||||
Font font = active_font_for_size(font_size);
|
||||
int scale = font_integer_scale(font_size);
|
||||
|
||||
return font.baseSize > 0 ? font.baseSize * scale : FLINT_TEXT_BASE_SIZE * scale;
|
||||
}
|
||||
|
||||
int
|
||||
flint_text_measure_scaled(const char *text, int scale)
|
||||
{
|
||||
@@ -354,12 +334,7 @@ flint_text_measure_scaled(const char *text, int scale)
|
||||
void
|
||||
flint_text_draw(const char *text, int x, int y, int font_size, Color color)
|
||||
{
|
||||
Font font = active_font_for_size(font_size);
|
||||
|
||||
if(text == NULL || font.texture.id == 0)
|
||||
return;
|
||||
|
||||
DrawTextEx(font, text, (Vector2){(float)x, (float)y}, (float)font_size, font_spacing(font, font_size), color);
|
||||
flint_text_draw_scaled(text, x, y, font_integer_scale(font_size), color);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -402,8 +377,10 @@ flint_text_draw_scaled(const char *text, int x, int y, int scale, Color color)
|
||||
void
|
||||
flint_text_draw_centered(const char *text, int center_x, int center_y, int font_size, Color color)
|
||||
{
|
||||
Font font = active_font_for_size(font_size);
|
||||
int actual_size = font.baseSize > 0 ? font.baseSize * font_integer_scale(font_size) : font_size;
|
||||
int text_w = flint_text_measure(text, font_size);
|
||||
int y = flint_text_y(text, center_y - font_size / 2, font_size, font_size);
|
||||
int y = flint_text_y(text, center_y - actual_size / 2, actual_size, font_size);
|
||||
|
||||
flint_text_draw(text, center_x - text_w / 2, y, font_size, color);
|
||||
}
|
||||
@@ -423,25 +400,6 @@ flint_text_draw_in_rect(const char *text, Rectangle rect, int font_size, Color c
|
||||
flint_clip_end();
|
||||
}
|
||||
|
||||
void
|
||||
flint_text_draw_fitted_in_rect(const char *text, Rectangle rect, int preferred_size, int min_size, Color color)
|
||||
{
|
||||
const char *value = text != NULL ? text : "";
|
||||
int font_size = flint_text_size(preferred_size);
|
||||
int min_allowed = flint_text_size(min_size);
|
||||
|
||||
if(min_allowed < min_size)
|
||||
min_allowed = flint_text_size(min_size + 1);
|
||||
|
||||
if(font_size < min_allowed)
|
||||
font_size = min_allowed;
|
||||
|
||||
while(font_size > min_allowed && flint_text_measure(value, font_size) > (int)rect.width)
|
||||
font_size = flint_text_size(font_size - 1);
|
||||
|
||||
flint_text_draw_in_rect(value, rect, font_size, color);
|
||||
}
|
||||
|
||||
int
|
||||
flint_text_y_scaled(const char *text, int box_y, int box_h, int scale)
|
||||
{
|
||||
@@ -466,7 +424,7 @@ flint_text_y(const char *text, int box_y, int box_h, int font_size)
|
||||
if(text == NULL || text[0] == '\0' || font.texture.id == 0 || font.baseSize <= 0)
|
||||
return box_y + (int)(((float)box_h - (float)font_size) * 0.5f + 0.5f);
|
||||
|
||||
scale = (float)font_size / (float)font.baseSize;
|
||||
scale = (float)font_integer_scale(font_size);
|
||||
|
||||
for(int i = 0; text[i] != '\0';) {
|
||||
int codepoint_byte_count = 0;
|
||||
|
||||
@@ -142,7 +142,13 @@ flint_text_layout_reflow(FlintTextLayout *layout, int max_width, int font_size,
|
||||
|
||||
layout->line_widths[layout->line_count] = current_line_width;
|
||||
layout->line_count++;
|
||||
layout->total_height = layout->line_count > 0 ? layout->line_count * font_size + (layout->line_count - 1) * line_height : 0;
|
||||
{
|
||||
int drawn_line_height = flint_text_line_height(font_size);
|
||||
layout->total_height = layout->line_count > 0
|
||||
? layout->line_count * drawn_line_height +
|
||||
(layout->line_count - 1) * line_height
|
||||
: 0;
|
||||
}
|
||||
layout->line_height = line_height; /* Store for later use in draw */
|
||||
}
|
||||
|
||||
@@ -157,11 +163,12 @@ flint_text_layout_draw(FlintTextLayout *layout, int x, int *y, int font_size, Co
|
||||
int space_width = flint_text_measure(" ", font_size);
|
||||
int icon_spacing = flint_px(4);
|
||||
int line_spacing = (layout->line_height > 0) ? layout->line_height : flint_px(4);
|
||||
int drawn_line_height = flint_text_line_height(font_size);
|
||||
int next_break_line = 1;
|
||||
|
||||
for(int i = 0; i < layout->element_count; i++) {
|
||||
if(next_break_line <= layout->line_count && next_break_line > 0 && i == layout->line_breaks[next_break_line]) {
|
||||
current_y += font_size + line_spacing;
|
||||
current_y += drawn_line_height + line_spacing;
|
||||
current_x = x;
|
||||
next_break_line++;
|
||||
}
|
||||
@@ -191,7 +198,7 @@ flint_text_layout_draw(FlintTextLayout *layout, int x, int *y, int font_size, Co
|
||||
}
|
||||
}
|
||||
|
||||
*y = current_y + font_size;
|
||||
*y = current_y + drawn_line_height;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -23,7 +23,9 @@ const FlintThemeMeta flint_themes[FLINT_THEME_COUNT] = {
|
||||
[FLINT_THEME_DAWN] = {"Dawn", "dawn_light", "dawn_dark"},
|
||||
[FLINT_THEME_SAGE] = {"Sage", "sage_light", "sage_dark"},
|
||||
[FLINT_THEME_INK] = {"Sepia", "ink_light", "ink_dark"},
|
||||
[FLINT_THEME_MONO] = {"Mono", "mono_light", "mono_dark"}
|
||||
[FLINT_THEME_MONO] = {"Mono", "mono_light", "mono_dark"},
|
||||
[FLINT_THEME_MINT] = {"Mint", "mint_light", "mint_dark"},
|
||||
[FLINT_THEME_COBALT] = {"Cobalt", "cobalt_light", "cobalt_dark"}
|
||||
};
|
||||
|
||||
static const FlintThemeCatalogColors catalog_light[FLINT_THEME_COUNT] = {
|
||||
@@ -36,7 +38,9 @@ static const FlintThemeCatalogColors catalog_light[FLINT_THEME_COUNT] = {
|
||||
[FLINT_THEME_DAWN] = {{0xF5,0xE9,0xDF,0xFF}, {0xE7,0xD9,0xD0,0xFF}, {0x39,0x3B,0x4A,0xFF}, {0xE0,0x7A,0x6D,0xFF}, {0x8F,0xCF,0xC6,0xFF}, {0x62,0xB8,0xB0,0xFF}, {0xF5,0xE9,0xDF,0xFF}, {0xC8,0x62,0x5C,0xFF}},
|
||||
[FLINT_THEME_SAGE] = {{0xE8,0xEC,0xDF,0xFF}, {0xD9,0xE0,0xD0,0xFF}, {0x35,0x44,0x38,0xFF}, {0x82,0xA0,0x7D,0xFF}, {0xB6,0xC9,0xA6,0xFF}, {0x94,0xAF,0x84,0xFF}, {0xE8,0xEC,0xDF,0xFF}, {0x5D,0x82,0x68,0xFF}},
|
||||
[FLINT_THEME_INK] = {{0xF3,0xE4,0xC8,0xFF}, {0xE4,0xCF,0xAA,0xFF}, {0x3F,0x2B,0x1C,0xFF}, {0xB8,0x76,0x3F,0xFF}, {0xD8,0xB0,0x72,0xFF}, {0xC7,0x91,0x51,0xFF}, {0xF8,0xEE,0xD6,0xFF}, {0x8F,0x5B,0x2F,0xFF}},
|
||||
[FLINT_THEME_MONO] = {{0xFF,0xFF,0xFF,0xFF}, {0xEF,0xEF,0xEF,0xFF}, {0x00,0x00,0x00,0xFF}, {0x00,0x00,0x00,0xFF}, {0xDD,0xDD,0xDD,0xFF}, {0xC8,0xC8,0xC8,0xFF}, {0xFF,0xFF,0xFF,0xFF}, {0x00,0x00,0x00,0xFF}}
|
||||
[FLINT_THEME_MONO] = {{0xFF,0xFF,0xFF,0xFF}, {0xEF,0xEF,0xEF,0xFF}, {0x00,0x00,0x00,0xFF}, {0x00,0x00,0x00,0xFF}, {0xDD,0xDD,0xDD,0xFF}, {0xC8,0xC8,0xC8,0xFF}, {0xFF,0xFF,0xFF,0xFF}, {0x00,0x00,0x00,0xFF}},
|
||||
[FLINT_THEME_MINT] = {{0xE4,0xF4,0xEE,0xFF}, {0xD2,0xE7,0xDF,0xFF}, {0x1E,0x45,0x3A,0xFF}, {0x4B,0xB6,0x9A,0xFF}, {0x98,0xD8,0xC6,0xFF}, {0x70,0xC7,0xB2,0xFF}, {0xE4,0xF4,0xEE,0xFF}, {0x2D,0x8F,0x78,0xFF}},
|
||||
[FLINT_THEME_COBALT] = {{0xE7,0xEA,0xF4,0xFF}, {0xD7,0xDD,0xEC,0xFF}, {0x19,0x27,0x4A,0xFF}, {0x4F,0x67,0xC8,0xFF}, {0xA9,0xB8,0xEF,0xFF}, {0x7D,0x92,0xE0,0xFF}, {0xE7,0xEA,0xF4,0xFF}, {0x35,0x4F,0xB5,0xFF}}
|
||||
};
|
||||
|
||||
static const FlintThemeCatalogColors catalog_dark[FLINT_THEME_COUNT] = {
|
||||
@@ -49,7 +53,9 @@ static const FlintThemeCatalogColors catalog_dark[FLINT_THEME_COUNT] = {
|
||||
[FLINT_THEME_DAWN] = {{0x27,0x22,0x2C,0xFF}, {0x35,0x2D,0x38,0xFF}, {0xE9,0xC7,0xB7,0xFF}, {0xB8,0x5F,0x60,0xFF}, {0x3A,0x6B,0x70,0xFF}, {0x4D,0x83,0x85,0xFF}, {0xE9,0xC7,0xB7,0xFF}, {0xD0,0x72,0x67,0xFF}},
|
||||
[FLINT_THEME_SAGE] = {{0x1F,0x2A,0x22,0xFF}, {0x2D,0x3A,0x30,0xFF}, {0xC7,0xD4,0xC0,0xFF}, {0x5F,0x81,0x65,0xFF}, {0x3C,0x54,0x40,0xFF}, {0x4E,0x66,0x50,0xFF}, {0xC7,0xD4,0xC0,0xFF}, {0x8B,0xA0,0x70,0xFF}},
|
||||
[FLINT_THEME_INK] = {{0x25,0x1A,0x12,0xFF}, {0x33,0x24,0x18,0xFF}, {0xF1,0xD8,0xB0,0xFF}, {0xA3,0x65,0x32,0xFF}, {0x5A,0x3C,0x24,0xFF}, {0x72,0x4B,0x2C,0xFF}, {0xF1,0xD8,0xB0,0xFF}, {0xD5,0x91,0x52,0xFF}},
|
||||
[FLINT_THEME_MONO] = {{0x00,0x00,0x00,0xFF}, {0x12,0x12,0x12,0xFF}, {0xFF,0xFF,0xFF,0xFF}, {0xFF,0xFF,0xFF,0xFF}, {0x22,0x22,0x22,0xFF}, {0x3A,0x3A,0x3A,0xFF}, {0xFF,0xFF,0xFF,0xFF}, {0xFF,0xFF,0xFF,0xFF}}
|
||||
[FLINT_THEME_MONO] = {{0x00,0x00,0x00,0xFF}, {0x12,0x12,0x12,0xFF}, {0xFF,0xFF,0xFF,0xFF}, {0xFF,0xFF,0xFF,0xFF}, {0x22,0x22,0x22,0xFF}, {0x3A,0x3A,0x3A,0xFF}, {0xFF,0xFF,0xFF,0xFF}, {0xFF,0xFF,0xFF,0xFF}},
|
||||
[FLINT_THEME_MINT] = {{0x12,0x2D,0x28,0xFF}, {0x1B,0x3B,0x34,0xFF}, {0xB9,0xE4,0xD5,0xFF}, {0x2E,0x82,0x72,0xFF}, {0x25,0x55,0x4B,0xFF}, {0x32,0x69,0x5E,0xFF}, {0xB9,0xE4,0xD5,0xFF}, {0x6E,0xC8,0xB0,0xFF}},
|
||||
[FLINT_THEME_COBALT] = {{0x12,0x18,0x33,0xFF}, {0x1B,0x24,0x45,0xFF}, {0xC2,0xCC,0xF5,0xFF}, {0x38,0x4C,0xA8,0xFF}, {0x27,0x35,0x73,0xFF}, {0x34,0x45,0x8B,0xFF}, {0xC2,0xCC,0xF5,0xFF}, {0x8E,0xA0,0xF0,0xFF}}
|
||||
};
|
||||
|
||||
FlintThemeId
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#include "flint_transition.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void
|
||||
flint_transition_reset(FlintTransition *transition)
|
||||
{
|
||||
if(transition == NULL)
|
||||
return;
|
||||
transition->active = 0;
|
||||
transition->phase = FLINT_TRANSITION_NONE;
|
||||
transition->ticks = 0;
|
||||
transition->duration = 0;
|
||||
}
|
||||
|
||||
void
|
||||
flint_transition_begin(FlintTransition *transition, int duration)
|
||||
{
|
||||
if(transition == NULL)
|
||||
return;
|
||||
if(duration <= 0)
|
||||
duration = 1;
|
||||
transition->active = 1;
|
||||
transition->phase = FLINT_TRANSITION_OUT;
|
||||
transition->ticks = 0;
|
||||
transition->duration = duration;
|
||||
}
|
||||
|
||||
void
|
||||
flint_transition_reverse_to_out(FlintTransition *transition)
|
||||
{
|
||||
if(transition == NULL || !transition->active)
|
||||
return;
|
||||
if(transition->phase == FLINT_TRANSITION_IN) {
|
||||
transition->phase = FLINT_TRANSITION_OUT;
|
||||
transition->ticks = transition->duration - transition->ticks;
|
||||
if(transition->ticks < 0)
|
||||
transition->ticks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
flint_transition_alpha(const FlintTransition *transition)
|
||||
{
|
||||
float progress;
|
||||
|
||||
if(transition == NULL || !transition->active || transition->duration <= 0)
|
||||
return 0.0f;
|
||||
progress = (float)transition->ticks / (float)transition->duration;
|
||||
if(progress < 0.0f)
|
||||
progress = 0.0f;
|
||||
if(progress > 1.0f)
|
||||
progress = 1.0f;
|
||||
if(transition->phase == FLINT_TRANSITION_OUT)
|
||||
return progress;
|
||||
if(transition->phase == FLINT_TRANSITION_IN)
|
||||
return 1.0f - progress;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
int
|
||||
flint_transition_step(FlintTransition *transition)
|
||||
{
|
||||
if(transition == NULL || !transition->active)
|
||||
return FLINT_TRANSITION_NONE;
|
||||
|
||||
transition->ticks++;
|
||||
if(transition->ticks < transition->duration)
|
||||
return FLINT_TRANSITION_NONE;
|
||||
|
||||
if(transition->phase == FLINT_TRANSITION_OUT) {
|
||||
transition->phase = FLINT_TRANSITION_IN;
|
||||
transition->ticks = 0;
|
||||
return FLINT_TRANSITION_OUT;
|
||||
}
|
||||
|
||||
flint_transition_reset(transition);
|
||||
return FLINT_TRANSITION_IN;
|
||||
}
|
||||
|
||||
void
|
||||
flint_transition_draw_fade(const FlintTransition *transition,
|
||||
int width, int height, Color color)
|
||||
{
|
||||
int alpha;
|
||||
|
||||
if(transition == NULL || !transition->active)
|
||||
return;
|
||||
alpha = (int)(flint_transition_alpha(transition) * 255.0f);
|
||||
if(alpha <= 0)
|
||||
return;
|
||||
if(alpha > 255)
|
||||
alpha = 255;
|
||||
color.a = (unsigned char)(((int)color.a * alpha) / 255);
|
||||
if(color.a == 0)
|
||||
return;
|
||||
DrawRectangle(0, 0, width, height, color);
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
#include "ui.h"
|
||||
|
||||
int
|
||||
ui_bottom_nav_height(void)
|
||||
{
|
||||
return flint_px(40);
|
||||
}
|
||||
|
||||
FlintUIBottomNavResult
|
||||
ui_draw_bottom_nav(FlintUIBottomNav nav)
|
||||
{
|
||||
FlintUIBottomNavResult result = {-1, -1, 0, 0};
|
||||
int count = nav.count;
|
||||
int height = nav.height > 0 ? nav.height : ui_bottom_nav_height();
|
||||
int bottom_margin = nav.bottom_margin > 0 ? nav.bottom_margin : 0;
|
||||
int side_margin = nav.side_margin > 0 ? nav.side_margin : 0;
|
||||
int icon_size = nav.icon_size > 0 ? nav.icon_size : flint_px(22);
|
||||
int y = nav.view_height - bottom_margin - height;
|
||||
int available_w = nav.view_width - side_margin * 2;
|
||||
int tab_w;
|
||||
int group_w;
|
||||
int start_x;
|
||||
|
||||
result.y = y;
|
||||
result.height = height;
|
||||
if(nav.items == NULL || count <= 0 || nav.view_width <= 0 || nav.view_height <= 0)
|
||||
return result;
|
||||
if(count > 8)
|
||||
count = 8;
|
||||
if(available_w < flint_px(96))
|
||||
available_w = flint_px(96);
|
||||
|
||||
tab_w = available_w / count;
|
||||
if(tab_w < flint_px(56))
|
||||
tab_w = flint_px(56);
|
||||
group_w = tab_w * count;
|
||||
if(group_w > available_w)
|
||||
group_w = available_w;
|
||||
tab_w = group_w / count;
|
||||
start_x = side_margin + (available_w - group_w) / 2;
|
||||
|
||||
DrawRectangle(0, y, nav.view_width, height, flint_darken(c_bg, 10));
|
||||
DrawLine(0, y, nav.view_width, y, flint_darken(c_bg, 42));
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
const FlintUIBottomNavItem *item = &nav.items[i];
|
||||
int x = start_x + i * tab_w;
|
||||
int w = i == count - 1 ? start_x + group_w - x : tab_w;
|
||||
int icon_x = x + (w - icon_size) / 2;
|
||||
int icon_y = y + (height - icon_size) / 2;
|
||||
int hover = 0;
|
||||
UIButtonStyle style = item->active
|
||||
? UI_BUTTON_STYLE_TAB_SELECTED
|
||||
: UI_BUTTON_STYLE_TAB;
|
||||
Color icon_color = item->disabled ? flint_darken(c_icon, 40) : c_icon;
|
||||
|
||||
if(ui_draw_generic_button(x, y, w, height, "", style,
|
||||
item->disabled, &hover)) {
|
||||
result.clicked_index = i;
|
||||
result.clicked_route = item->route;
|
||||
}
|
||||
|
||||
if(item->icon.id != 0) {
|
||||
DrawTexturePro(item->icon,
|
||||
(Rectangle){0, 0, item->icon.width, item->icon.height},
|
||||
(Rectangle){icon_x, icon_y, icon_size, icon_size},
|
||||
(Vector2){0}, 0, icon_color);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
bottom_nav_option_index(const FlintUIBottomNavOption *options, int option_count,
|
||||
int route)
|
||||
{
|
||||
if(options == NULL || option_count <= 0)
|
||||
return 0;
|
||||
for(int i = 0; i < option_count; i++) {
|
||||
if(options[i].route == route)
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
FlintUIBottomNavConfigResult
|
||||
ui_draw_bottom_nav_config_modal(FlintUIBottomNavConfigModal modal)
|
||||
{
|
||||
static int route_scroll_offset = 0;
|
||||
FlintUIBottomNavConfigResult result = {0, 0};
|
||||
FlintUIPanelFrame frame;
|
||||
FlintUIScrollArea route_area;
|
||||
FlintUIScrollView route_view;
|
||||
const char *option_labels[16];
|
||||
int option_count = modal.option_count;
|
||||
int route_count = modal.route_count != NULL ? *modal.route_count : 0;
|
||||
int max_route_count = modal.max_route_count > 0 ? modal.max_route_count : route_count;
|
||||
int selected[16] = {0};
|
||||
int row_h = flint_px(58);
|
||||
int dropdown_h = flint_px(36);
|
||||
int remove_w = flint_px(36);
|
||||
int add_h = flint_px(34);
|
||||
int button_h = flint_px(36);
|
||||
int button_gap = flint_px(8);
|
||||
int y;
|
||||
int button_w;
|
||||
int total_button_w;
|
||||
int button_y;
|
||||
int add_y;
|
||||
int add_w;
|
||||
int route_view_h;
|
||||
int route_content_h;
|
||||
int reset_hover = 0;
|
||||
int cancel_hover = 0;
|
||||
int save_hover = 0;
|
||||
int dropdown_blocks_buttons;
|
||||
|
||||
if(max_route_count > 16)
|
||||
max_route_count = 16;
|
||||
if(route_count < 0)
|
||||
route_count = 0;
|
||||
if(route_count > max_route_count)
|
||||
route_count = max_route_count;
|
||||
if(option_count > 16)
|
||||
option_count = 16;
|
||||
for(int i = 0; i < option_count; i++)
|
||||
option_labels[i] = modal.options[i].label;
|
||||
for(int i = 0; i < route_count; i++)
|
||||
selected[i] = bottom_nav_option_index(modal.options, option_count,
|
||||
modal.routes != NULL ? modal.routes[i] : 0);
|
||||
|
||||
frame = ui_draw_modal_frame(flint_px(340),
|
||||
flint_px(128) + row_h * route_count + add_h + flint_px(58),
|
||||
modal.title,
|
||||
(Texture2D){0},
|
||||
modal.close_icon);
|
||||
if(frame.right_clicked) {
|
||||
result.action = 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
button_w = (frame.content_w - button_gap * 2) / 3;
|
||||
if(button_w > flint_px(92))
|
||||
button_w = flint_px(92);
|
||||
total_button_w = button_w * 3 + button_gap * 2;
|
||||
button_y = frame.y + frame.h - button_h - flint_px(16);
|
||||
add_y = button_y - button_gap - add_h;
|
||||
route_view_h = add_y - frame.content_y - flint_px(12);
|
||||
if(route_view_h < row_h)
|
||||
route_view_h = row_h;
|
||||
if(frame.content_y + route_view_h > add_y - flint_px(8))
|
||||
route_view_h = add_y - frame.content_y - flint_px(8);
|
||||
if(route_view_h < flint_px(48))
|
||||
route_view_h = flint_px(48);
|
||||
route_content_h = row_h * route_count;
|
||||
route_area = (FlintUIScrollArea){
|
||||
.bounds = {
|
||||
(float)frame.content_x,
|
||||
(float)frame.content_y,
|
||||
(float)frame.content_w,
|
||||
(float)route_view_h
|
||||
},
|
||||
.content_height = route_content_h,
|
||||
.content_x = frame.content_x,
|
||||
.content_width = frame.content_w,
|
||||
.scroll_offset = &route_scroll_offset,
|
||||
.wheel_step = row_h,
|
||||
.scrollbar_x = frame.content_x + frame.content_w - flint_px(8)
|
||||
};
|
||||
|
||||
route_view = ui_scroll_container_begin(route_area);
|
||||
y = route_view.content_y;
|
||||
for(int i = 0; i < route_count; i++) {
|
||||
const char *slot_label = modal.slot_labels != NULL && modal.slot_labels[i] != NULL
|
||||
? modal.slot_labels[i]
|
||||
: "";
|
||||
int remove_hover = 0;
|
||||
flint_text_draw(slot_label, frame.content_x, y, flint_ui_font(), c_text);
|
||||
ui_draw_dropdown_button(modal.id + i, frame.content_x,
|
||||
y + flint_px(22), frame.content_w - remove_w - flint_px(8),
|
||||
dropdown_h, option_labels, option_count,
|
||||
&selected[i]);
|
||||
if(ui_draw_icon_btn_padded(frame.content_x + frame.content_w - remove_w,
|
||||
y + flint_px(22), flint_px(20),
|
||||
flint_px(8), modal.close_icon,
|
||||
&remove_hover)) {
|
||||
for(int j = i; j < route_count - 1; j++)
|
||||
modal.routes[j] = modal.routes[j + 1];
|
||||
route_count--;
|
||||
if(modal.route_count != NULL)
|
||||
*modal.route_count = route_count;
|
||||
result.changed = 1;
|
||||
break;
|
||||
}
|
||||
y += row_h;
|
||||
}
|
||||
ui_scroll_container_end(route_area, route_view);
|
||||
|
||||
ui_set_dropdown_clip_top(frame.content_y);
|
||||
ui_set_dropdown_clip_bottom(add_y - flint_px(8));
|
||||
|
||||
y = add_y;
|
||||
dropdown_blocks_buttons = ui_dropdown_captures_click(ui_mouse_world());
|
||||
if(route_count < max_route_count && modal.routes != NULL) {
|
||||
int add_hover = 0;
|
||||
add_w = frame.content_w < flint_px(180) ? frame.content_w : flint_px(180);
|
||||
if(ui_draw_generic_button(frame.content_x + (frame.content_w - add_w) / 2,
|
||||
y, add_w, add_h, modal.add_label,
|
||||
UI_BUTTON_STYLE_SECONDARY,
|
||||
dropdown_blocks_buttons, &add_hover)) {
|
||||
modal.routes[route_count] = option_count > 0 ? modal.options[0].route : 0;
|
||||
route_count++;
|
||||
if(modal.route_count != NULL)
|
||||
*modal.route_count = route_count;
|
||||
result.changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int x = frame.x + (frame.w - total_button_w) / 2;
|
||||
if(ui_draw_generic_button(x, button_y, button_w, button_h,
|
||||
modal.reset_label, UI_BUTTON_STYLE_SECONDARY,
|
||||
dropdown_blocks_buttons, &reset_hover))
|
||||
result.action = 3;
|
||||
x += button_w + button_gap;
|
||||
if(ui_draw_generic_button(x, button_y, button_w, button_h,
|
||||
modal.cancel_label, UI_BUTTON_STYLE_SECONDARY,
|
||||
dropdown_blocks_buttons, &cancel_hover))
|
||||
result.action = 1;
|
||||
x += button_w + button_gap;
|
||||
if(ui_draw_generic_button(x, button_y, button_w, button_h,
|
||||
modal.save_label, UI_BUTTON_STYLE_PRIMARY,
|
||||
dropdown_blocks_buttons, &save_hover))
|
||||
result.action = 2;
|
||||
}
|
||||
|
||||
for(int i = 0; i < route_count; i++) {
|
||||
if(ui_draw_dropdown_menu(modal.id + i) &&
|
||||
modal.routes != NULL && selected[i] >= 0 && selected[i] < option_count) {
|
||||
modal.routes[i] = modal.options[selected[i]].route;
|
||||
result.changed = 1;
|
||||
}
|
||||
}
|
||||
ui_set_dropdown_clip_top(0);
|
||||
ui_set_dropdown_clip_bottom(0);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
#include "ui.h"
|
||||
|
||||
|
||||
/* Per-dropdown state to track open/closed and click handling */
|
||||
#define MAX_DROPDOWN_OPTIONS 128
|
||||
#define DROPDOWN_OPTION_TEXT_SIZE 256
|
||||
|
||||
typedef struct UIDropdownState {
|
||||
int id;
|
||||
int open;
|
||||
int just_opened;
|
||||
int scroll_offset;
|
||||
int x, y, w, h;
|
||||
const char *options[MAX_DROPDOWN_OPTIONS];
|
||||
char option_text[MAX_DROPDOWN_OPTIONS][DROPDOWN_OPTION_TEXT_SIZE];
|
||||
int option_count;
|
||||
int *selected_index;
|
||||
int touch_pressed;
|
||||
int touch_press_start_y;
|
||||
int touch_drag_active;
|
||||
} UIDropdownState;
|
||||
|
||||
#define MAX_DROPDOWNS 24
|
||||
static UIDropdownState dropdown_states[MAX_DROPDOWNS];
|
||||
static int dropdown_state_count = 0;
|
||||
static int dropdown_clip_top = 0;
|
||||
static int dropdown_clip_bottom = 0;
|
||||
|
||||
static Color
|
||||
ui_dropdown_panel_color(int amount)
|
||||
{
|
||||
int luminance = ((int)c_bg.r + (int)c_bg.g + (int)c_bg.b) / 3;
|
||||
return luminance < 96 ? flint_lighten(c_bg, amount) : flint_darken(c_bg, amount);
|
||||
}
|
||||
|
||||
void
|
||||
ui_set_dropdown_clip_top(int top)
|
||||
{
|
||||
dropdown_clip_top = top > 0 ? top : 0;
|
||||
}
|
||||
|
||||
void
|
||||
ui_set_dropdown_clip_bottom(int bottom)
|
||||
{
|
||||
dropdown_clip_bottom = bottom > 0 ? bottom : 0;
|
||||
}
|
||||
|
||||
static void
|
||||
dropdown_menu_layout(const UIDropdownState *state, int *dropdown_y, int *dropdown_h,
|
||||
int *visible_options, int *open_up)
|
||||
{
|
||||
int option_h;
|
||||
int menu_gap;
|
||||
int padding_top;
|
||||
int padding_bottom;
|
||||
int below_y;
|
||||
int below_space;
|
||||
int above_space;
|
||||
int bottom_limit;
|
||||
int max_visible_h;
|
||||
int total_h;
|
||||
|
||||
if(state == NULL || dropdown_y == NULL || dropdown_h == NULL)
|
||||
return;
|
||||
|
||||
option_h = state->h;
|
||||
menu_gap = flint_px(4);
|
||||
padding_top = flint_px(4);
|
||||
padding_bottom = flint_px(4);
|
||||
total_h = padding_top + option_h * state->option_count + padding_bottom;
|
||||
below_y = state->y + state->h + menu_gap;
|
||||
if(below_y < dropdown_clip_top)
|
||||
below_y = dropdown_clip_top;
|
||||
bottom_limit = dropdown_clip_bottom > 0 ? dropdown_clip_bottom : ui_view_height;
|
||||
below_space = bottom_limit - below_y - flint_px(16);
|
||||
above_space = state->y - dropdown_clip_top - flint_px(16);
|
||||
|
||||
if(below_space < 0)
|
||||
below_space = 0;
|
||||
if(above_space < 0)
|
||||
above_space = 0;
|
||||
|
||||
if(open_up != NULL)
|
||||
*open_up = (above_space > below_space);
|
||||
|
||||
max_visible_h = (above_space > below_space) ? above_space : below_space;
|
||||
if(total_h > max_visible_h) {
|
||||
int count = (max_visible_h - flint_px(8)) / option_h;
|
||||
if(count < 1)
|
||||
count = 1;
|
||||
total_h = count * option_h + flint_px(8);
|
||||
if(visible_options != NULL)
|
||||
*visible_options = count;
|
||||
} else if(visible_options != NULL) {
|
||||
*visible_options = state->option_count;
|
||||
}
|
||||
|
||||
if(open_up != NULL && *open_up)
|
||||
*dropdown_y = state->y - menu_gap - total_h;
|
||||
else
|
||||
*dropdown_y = below_y;
|
||||
|
||||
*dropdown_h = total_h;
|
||||
}
|
||||
|
||||
int
|
||||
ui_dropdown_captures_click(Vector2 point)
|
||||
{
|
||||
(void)point;
|
||||
for(int i = 0; i < dropdown_state_count; i++) {
|
||||
UIDropdownState *state = &dropdown_states[i];
|
||||
if(state->open && state->option_count > 0)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UIDropdownState *
|
||||
get_or_create_dropdown_state(int id)
|
||||
{
|
||||
/* Find existing state */
|
||||
for(int i = 0; i < dropdown_state_count; i++) {
|
||||
if(dropdown_states[i].id == id)
|
||||
return &dropdown_states[i];
|
||||
}
|
||||
|
||||
/* Create new state */
|
||||
if(dropdown_state_count < MAX_DROPDOWNS) {
|
||||
dropdown_states[dropdown_state_count].id = id;
|
||||
dropdown_states[dropdown_state_count].open = 0;
|
||||
dropdown_states[dropdown_state_count].just_opened = 0;
|
||||
dropdown_states[dropdown_state_count].scroll_offset = 0;
|
||||
dropdown_states[dropdown_state_count].option_count = 0;
|
||||
dropdown_states[dropdown_state_count].selected_index = NULL;
|
||||
dropdown_states[dropdown_state_count].touch_pressed = 0;
|
||||
dropdown_states[dropdown_state_count].touch_press_start_y = 0;
|
||||
dropdown_states[dropdown_state_count].touch_drag_active = 0;
|
||||
return &dropdown_states[dropdown_state_count++];
|
||||
}
|
||||
|
||||
/* Fallback - use first slot */
|
||||
dropdown_states[0].id = id;
|
||||
return &dropdown_states[0];
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_dropdown_button(int id, int x, int y, int w, int h,
|
||||
const char **options, int option_count, int *selected_index)
|
||||
{
|
||||
UIDropdownState *state = get_or_create_dropdown_state(id);
|
||||
int font = flint_ui_font();
|
||||
int arrow_pad = flint_px(24);
|
||||
int arrow_size = flint_px(6);
|
||||
int changed = 0;
|
||||
Rectangle btn_bounds = {x, y, w, h};
|
||||
Vector2 mouse = ui_mouse_world();
|
||||
Color button_bg;
|
||||
int button_inside = CheckCollisionPointRec(mouse, btn_bounds);
|
||||
int active = button_inside &&
|
||||
(state->open
|
||||
? !ui_base_input_captures_click(mouse, 1)
|
||||
: !ui_input_captures_click(mouse));
|
||||
int hover = active && ui_hover_effects_enabled();
|
||||
|
||||
/* Calculate arrow position */
|
||||
int arrow_x = x + w - arrow_pad;
|
||||
int arrow_y = y + h / 2;
|
||||
|
||||
/* Store state for menu drawing */
|
||||
state->x = x;
|
||||
state->y = y;
|
||||
state->w = w;
|
||||
state->h = h;
|
||||
state->selected_index = selected_index;
|
||||
if(option_count < 0)
|
||||
option_count = 0;
|
||||
if(option_count > MAX_DROPDOWN_OPTIONS)
|
||||
option_count = MAX_DROPDOWN_OPTIONS;
|
||||
state->option_count = option_count;
|
||||
for(int i = 0; i < option_count; i++) {
|
||||
snprintf(state->option_text[i], sizeof(state->option_text[i]), "%s",
|
||||
options != NULL && options[i] != NULL ? options[i] : "");
|
||||
state->options[i] = state->option_text[i];
|
||||
}
|
||||
|
||||
if(active)
|
||||
ui_mark_clickable();
|
||||
|
||||
/* Handle click on button */
|
||||
if(active && IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
|
||||
state->open = !state->open;
|
||||
if(state->open) {
|
||||
state->just_opened = 1;
|
||||
state->scroll_offset = 0;
|
||||
state->touch_drag_active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw button background */
|
||||
button_bg = state->open ? ui_dropdown_panel_color(28)
|
||||
: (hover ? c_button_hover : ui_dropdown_panel_color(16));
|
||||
DrawRectangleRec(btn_bounds, button_bg);
|
||||
ui_draw_bevel(x, y, w, h,
|
||||
state->open ? flint_lighten(button_bg, 34) : flint_lighten(button_bg, 24),
|
||||
state->open ? flint_darken(button_bg, 38) : flint_darken(button_bg, 30));
|
||||
|
||||
/* Draw current selection text, clipped before the X icon. */
|
||||
int current_index = selected_index != NULL ? *selected_index : 0;
|
||||
if(current_index < 0 || current_index >= option_count)
|
||||
current_index = 0;
|
||||
const char *current_name = option_count > 0 ? state->options[current_index] : "";
|
||||
int text_x = x + flint_px(12);
|
||||
int text_w = arrow_x - arrow_size - flint_px(8) - text_x;
|
||||
if(text_w > 0) {
|
||||
flint_clip_begin((int)(g_ui_camera.offset.x + (float)text_x * g_ui_camera.zoom),
|
||||
(int)(g_ui_camera.offset.y + (float)y * g_ui_camera.zoom),
|
||||
(int)((float)text_w * g_ui_camera.zoom),
|
||||
(int)((float)h * g_ui_camera.zoom));
|
||||
flint_text_draw(current_name, text_x, flint_ui_text_y(current_name, y, h, font), font, c_text);
|
||||
flint_clip_end();
|
||||
}
|
||||
|
||||
/* Draw dropdown X icon */
|
||||
int x_size = arrow_size;
|
||||
int x_half = x_size / 2;
|
||||
int x1 = arrow_x - x_half;
|
||||
int x2 = arrow_x + x_half;
|
||||
int y1 = arrow_y - x_half;
|
||||
int y2 = arrow_y + x_half;
|
||||
DrawLine(x1, y1, x2, y2, c_text);
|
||||
DrawLine(x1, y2, x2, y1, c_text);
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_dropdown_menu(int id)
|
||||
{
|
||||
UIDropdownState *state = get_or_create_dropdown_state(id);
|
||||
int changed = 0;
|
||||
|
||||
if(!state->open || state->option_count <= 0 || state->selected_index == NULL)
|
||||
return 0;
|
||||
|
||||
int font = flint_ui_font();
|
||||
int x = state->x;
|
||||
int y = state->y;
|
||||
int w = state->w;
|
||||
int h = state->h;
|
||||
int option_h = h;
|
||||
int option_count = state->option_count;
|
||||
int *selected_index = state->selected_index;
|
||||
const char **options = state->options;
|
||||
|
||||
int dropdown_y = 0;
|
||||
int dropdown_h = 0;
|
||||
int padding_top = flint_px(4);
|
||||
int padding_bottom = flint_px(4);
|
||||
int content_h = padding_top + option_h * option_count + padding_bottom;
|
||||
int max_scroll;
|
||||
int scrollbar_w = flint_px(8);
|
||||
int option_w = w;
|
||||
|
||||
dropdown_menu_layout(state, &dropdown_y, &dropdown_h, NULL, NULL);
|
||||
max_scroll = content_h - dropdown_h;
|
||||
if(max_scroll < 0)
|
||||
max_scroll = 0;
|
||||
if(state->scroll_offset > max_scroll)
|
||||
state->scroll_offset = max_scroll;
|
||||
if(state->scroll_offset < 0)
|
||||
state->scroll_offset = 0;
|
||||
if(max_scroll > 0)
|
||||
option_w = w - scrollbar_w - flint_px(2);
|
||||
|
||||
Rectangle menu_bounds = {x, dropdown_y, w, dropdown_h};
|
||||
Rectangle btn_bounds = {x, y, w, h};
|
||||
Vector2 mouse = ui_mouse_world();
|
||||
int my = (int)mouse.y;
|
||||
int pointer_in_dropdown = CheckCollisionPointRec(mouse, btn_bounds) ||
|
||||
CheckCollisionPointRec(mouse, menu_bounds);
|
||||
|
||||
/* Track pointer movement to distinguish click from drag */
|
||||
if(IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
|
||||
if(!state->touch_pressed && pointer_in_dropdown) {
|
||||
/* Pointer just went down - reset drag state */
|
||||
state->touch_pressed = 1;
|
||||
state->touch_press_start_y = my;
|
||||
state->touch_drag_active = 0;
|
||||
} else if(!state->touch_drag_active) {
|
||||
/* Check if movement exceeded threshold (making it a drag, not a click) */
|
||||
int dy = my - state->touch_press_start_y;
|
||||
if(abs(dy) > flint_px(8)) { /* 8px threshold */
|
||||
state->touch_drag_active = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* If dragging, scroll the dropdown */
|
||||
if(state->touch_drag_active && max_scroll > 0) {
|
||||
int dy = my - state->touch_press_start_y;
|
||||
state->scroll_offset -= dy;
|
||||
/* Update start position for continuous scrolling */
|
||||
state->touch_press_start_y = my;
|
||||
|
||||
/* Clamp scroll offset */
|
||||
if(state->scroll_offset < 0)
|
||||
state->scroll_offset = 0;
|
||||
if(state->scroll_offset > max_scroll)
|
||||
state->scroll_offset = max_scroll;
|
||||
}
|
||||
} else if(state->touch_pressed) {
|
||||
/* Pointer just released - only reset touch_pressed, keep touch_drag_active for selection check */
|
||||
state->touch_pressed = 0;
|
||||
}
|
||||
|
||||
/* Click outside closes dropdown */
|
||||
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
|
||||
if(!state->just_opened &&
|
||||
!CheckCollisionPointRec(mouse, btn_bounds) &&
|
||||
!CheckCollisionPointRec(mouse, menu_bounds)) {
|
||||
state->open = 0;
|
||||
state->touch_drag_active = 0;
|
||||
state->touch_pressed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(state->just_opened && !IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
state->just_opened = 0;
|
||||
|
||||
if(CheckCollisionPointRec(mouse, menu_bounds)) {
|
||||
float wheel = GetMouseWheelMove();
|
||||
if(wheel != 0.0f && max_scroll > 0) {
|
||||
state->scroll_offset -= (int)(wheel * (float)option_h);
|
||||
if(state->scroll_offset < 0)
|
||||
state->scroll_offset = 0;
|
||||
if(state->scroll_offset > max_scroll)
|
||||
state->scroll_offset = max_scroll;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw dropdown background */
|
||||
DrawRectangle(x, dropdown_y, w, dropdown_h, ui_dropdown_panel_color(18));
|
||||
ui_draw_bevel(x, dropdown_y, w, dropdown_h,
|
||||
ui_dropdown_panel_color(32), ui_dropdown_panel_color(8));
|
||||
|
||||
flint_clip_begin((int)(g_ui_camera.offset.x + (float)x * g_ui_camera.zoom),
|
||||
(int)(g_ui_camera.offset.y + (float)dropdown_y * g_ui_camera.zoom),
|
||||
(int)((float)w * g_ui_camera.zoom),
|
||||
(int)((float)dropdown_h * g_ui_camera.zoom));
|
||||
|
||||
/* Draw options */
|
||||
for(int i = 0; i < option_count; i++) {
|
||||
int option_y = dropdown_y + padding_top + i * option_h - state->scroll_offset;
|
||||
Rectangle option_bounds = {x, option_y, option_w, option_h};
|
||||
|
||||
/* Skip if outside visible area - use inclusive bounds for last item */
|
||||
if(option_y + option_h < dropdown_y || option_y >= dropdown_y + dropdown_h)
|
||||
continue;
|
||||
|
||||
int option_active = CheckCollisionPointRec(mouse, option_bounds);
|
||||
int option_hover = option_active && ui_hover_effects_enabled();
|
||||
|
||||
if(option_active) {
|
||||
if(option_hover)
|
||||
DrawRectangle(x, option_y, w, option_h, c_button_hover);
|
||||
ui_mark_clickable();
|
||||
|
||||
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT) && !state->just_opened && !state->touch_drag_active) {
|
||||
*selected_index = i;
|
||||
state->open = 0;
|
||||
state->just_opened = 0;
|
||||
state->touch_drag_active = 0;
|
||||
state->touch_pressed = 0;
|
||||
state->scroll_offset = 0;
|
||||
changed = 1;
|
||||
flint_clip_end();
|
||||
goto draw_arrow;
|
||||
}
|
||||
}
|
||||
|
||||
flint_text_draw(options[i], x + flint_px(12), flint_ui_text_y(options[i], option_y, option_h, font), font, c_text);
|
||||
}
|
||||
|
||||
flint_clip_end();
|
||||
|
||||
if(max_scroll > 0)
|
||||
ui_draw_scrollbar(x + w - scrollbar_w, dropdown_y + flint_px(2),
|
||||
dropdown_h - flint_px(4), content_h, &state->scroll_offset, max_scroll);
|
||||
|
||||
draw_arrow:
|
||||
;
|
||||
|
||||
/* Redraw arrow on top of everything */
|
||||
int arrow_pad = flint_px(24);
|
||||
int arrow_size = flint_px(6);
|
||||
int arrow_x = x + w - arrow_pad;
|
||||
int arrow_y = y + h / 2;
|
||||
|
||||
/* Draw dropdown X icon */
|
||||
int x_size = arrow_size;
|
||||
int x_half = x_size / 2;
|
||||
int x1 = arrow_x - x_half;
|
||||
int x2 = arrow_x + x_half;
|
||||
int y1 = arrow_y - x_half;
|
||||
int y2 = arrow_y + x_half;
|
||||
DrawLine(x1, y1, x2, y2, c_text);
|
||||
DrawLine(x1, y2, x2, y1, c_text);
|
||||
return changed;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* TUTORIAL HELPERS
|
||||
* ================================================================ */
|
||||
@@ -0,0 +1,113 @@
|
||||
#include "ui.h"
|
||||
|
||||
int
|
||||
ui_draw_icon_slider_popup(FlintUIIconSliderPopup popup)
|
||||
{
|
||||
int hover = 0;
|
||||
int popup_w;
|
||||
int popup_h;
|
||||
int popup_x;
|
||||
int popup_y;
|
||||
Vector2 mouse;
|
||||
|
||||
if(popup.open == NULL || popup.value == NULL)
|
||||
return 0;
|
||||
|
||||
if(ui_draw_icon_btn_padded(popup.x, popup.y, popup.icon_size,
|
||||
popup.icon_padding, popup.icon, &hover))
|
||||
*popup.open = !*popup.open;
|
||||
|
||||
if(!*popup.open)
|
||||
return 0;
|
||||
|
||||
popup_w = popup.popup_width > 0 ? popup.popup_width : flint_px(44);
|
||||
popup_h = popup.popup_height > 0 ? popup.popup_height : flint_px(200);
|
||||
popup_x = popup.x;
|
||||
popup_y = popup.y + popup.icon_size + popup.icon_padding * 2;
|
||||
mouse = ui_mouse_world();
|
||||
|
||||
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT) &&
|
||||
(mouse.x < popup_x || mouse.x > popup_x + popup_w ||
|
||||
mouse.y < popup_y || mouse.y > popup_y + popup_h)) {
|
||||
*popup.open = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DrawRectangle(popup_x, popup_y, popup_w, popup_h, c_surface);
|
||||
ui_draw_bevel(popup_x, popup_y, popup_w, popup_h,
|
||||
flint_lighten(c_surface, 40), flint_darken(c_surface, 40));
|
||||
|
||||
return ui_draw_slider_vertical(popup.id, popup_x + popup_w / 2,
|
||||
popup_y + flint_px(10),
|
||||
popup_h - flint_px(20),
|
||||
popup.min, popup.max, popup.value);
|
||||
}
|
||||
|
||||
FlintUIIconRowResult
|
||||
ui_draw_bottom_icon_row(FlintUIBottomIconRow row)
|
||||
{
|
||||
FlintUIIconRowResult result = {-1, 0, 0};
|
||||
int count = row.count;
|
||||
int icon_size = row.icon_size > 0 ? row.icon_size : flint_px(24);
|
||||
int icon_padding = row.icon_padding > 0 ? row.icon_padding : flint_px(10);
|
||||
int gap = row.gap > 0 ? row.gap : flint_px(12);
|
||||
int side_margin = row.side_margin > 0 ? row.side_margin : flint_px(24);
|
||||
int bottom_margin = row.bottom_margin > 0 ? row.bottom_margin : flint_px(6);
|
||||
int min_icon_size = row.min_icon_size > 0 ? row.min_icon_size : flint_px(16);
|
||||
int min_icon_padding = row.min_icon_padding > 0 ? row.min_icon_padding : flint_px(6);
|
||||
int min_gap = row.min_gap > 0 ? row.min_gap : flint_px(8);
|
||||
int available_w;
|
||||
int max_btn_w;
|
||||
int button_w;
|
||||
int row_w;
|
||||
int start_x;
|
||||
|
||||
if(row.items == NULL || count <= 0)
|
||||
return result;
|
||||
|
||||
available_w = row.view_width - side_margin * 2;
|
||||
if(available_w < flint_px(120))
|
||||
available_w = flint_px(120);
|
||||
|
||||
max_btn_w = row.max_button_width > 0 ? row.max_button_width : available_w;
|
||||
if(count > 1) {
|
||||
int fit_btn_w = (available_w - gap * (count - 1)) / count;
|
||||
if(max_btn_w <= 0 || max_btn_w > fit_btn_w)
|
||||
max_btn_w = fit_btn_w;
|
||||
}
|
||||
|
||||
button_w = icon_size + icon_padding * 2;
|
||||
if(button_w > max_btn_w) {
|
||||
button_w = max_btn_w;
|
||||
icon_padding = button_w / 4;
|
||||
icon_size = button_w - icon_padding * 2;
|
||||
}
|
||||
|
||||
if(icon_padding < min_icon_padding)
|
||||
icon_padding = min_icon_padding;
|
||||
if(icon_size < min_icon_size)
|
||||
icon_size = min_icon_size;
|
||||
|
||||
button_w = icon_size + icon_padding * 2;
|
||||
gap = button_w / 4;
|
||||
if(gap < min_gap)
|
||||
gap = min_gap;
|
||||
|
||||
row_w = button_w * count + gap * (count - 1);
|
||||
start_x = row.center_x - row_w / 2;
|
||||
result.y = row.view_height - bottom_margin - button_w;
|
||||
result.button_width = button_w;
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
int hover = 0;
|
||||
int x = start_x + i * (button_w + gap);
|
||||
|
||||
if(row.items[i].disabled)
|
||||
continue;
|
||||
if(ui_draw_icon_btn_padded(x, result.y, icon_size, icon_padding,
|
||||
row.items[i].icon, &hover))
|
||||
result.clicked_index = i;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
#include "ui.h"
|
||||
|
||||
static int
|
||||
ui_modal_button(int x, int y, int w, int h, const char *label, int font,
|
||||
Vector2 mouse_world)
|
||||
{
|
||||
Rectangle bounds = {(float)x, (float)y, (float)w, (float)h};
|
||||
int active = CheckCollisionPointRec(mouse_world, bounds);
|
||||
int hovered = active && ui_hover_effects_enabled();
|
||||
Color fill = hovered ? c_button_hover : c_button;
|
||||
int text_w;
|
||||
|
||||
DrawRectangle(x, y, w, h, fill);
|
||||
ui_draw_bevel(x, y, w, h, flint_lighten(fill, 40), flint_darken(fill, 40));
|
||||
if(active)
|
||||
ui_mark_clickable();
|
||||
|
||||
text_w = flint_text_measure(label, font);
|
||||
flint_text_draw(label, x + (w - text_w) / 2, flint_ui_text_y(label, y, h, font),
|
||||
font, c_text);
|
||||
|
||||
return active && IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_modal(const char *title, const char *message,
|
||||
const char *cancel_btn, const char *confirm_btn)
|
||||
{
|
||||
int modal_w = flint_px(280);
|
||||
int modal_x;
|
||||
int modal_y;
|
||||
int title_font = flint_ui_font();
|
||||
int msg_font = flint_ui_font();
|
||||
int btn_font = flint_ui_font();
|
||||
int btn_h = flint_clamp_px(36, 32, 40);
|
||||
int btn_w = flint_px(100);
|
||||
int btn_gap = flint_px(12);
|
||||
int title_h = flint_px(32);
|
||||
int msg_x;
|
||||
int msg_y;
|
||||
int msg_w = modal_w - flint_px(32);
|
||||
int msg_gap = flint_px(18);
|
||||
int modal_h;
|
||||
int btn_y;
|
||||
Vector2 mouse_world = ui_mouse_world();
|
||||
FlintTextLayout msg_layout = flint_text_layout_parse(message, g_ui_gear_icon,
|
||||
UI_ICON_TYPE_GEAR, msg_font);
|
||||
flint_text_layout_reflow(&msg_layout, msg_w, msg_font, flint_px(4));
|
||||
|
||||
modal_h = title_h + flint_text_layout_get_height(&msg_layout) + msg_gap + btn_h + flint_px(20);
|
||||
if(modal_h < flint_px(160))
|
||||
modal_h = flint_px(160);
|
||||
if(modal_h > ui_view_height - flint_px(24))
|
||||
modal_h = ui_view_height - flint_px(24);
|
||||
modal_x = (ui_view_width - modal_w) / 2;
|
||||
modal_y = (ui_view_height - modal_h) / 2;
|
||||
msg_x = modal_x + flint_px(16);
|
||||
msg_y = modal_y + title_h;
|
||||
btn_y = modal_y + modal_h - btn_h - flint_px(16);
|
||||
|
||||
/* Dim background */
|
||||
DrawRectangle(0, 0, ui_view_width, ui_view_height, (Color){0, 0, 0, 180});
|
||||
|
||||
/* Modal background */
|
||||
DrawRectangle(modal_x, modal_y, modal_w, modal_h, c_surface);
|
||||
ui_draw_bevel(modal_x, modal_y, modal_w, modal_h, flint_lighten(c_surface, 40), flint_darken(c_surface, 40));
|
||||
|
||||
/* Title */
|
||||
int title_w = flint_text_measure(title, title_font);
|
||||
flint_text_draw(title, modal_x + (modal_w - title_w) / 2, modal_y + flint_px(12), title_font, c_text);
|
||||
|
||||
/* Draw the layout */
|
||||
flint_text_layout_draw(&msg_layout, msg_x, &msg_y, msg_font, c_text);
|
||||
flint_text_layout_free(&msg_layout);
|
||||
|
||||
/* Buttons */
|
||||
int cancel_x = modal_x + (modal_w - btn_w * 2 - btn_gap) / 2;
|
||||
int confirm_x = cancel_x + btn_w + btn_gap;
|
||||
int result = 0;
|
||||
|
||||
if(ui_modal_button(cancel_x, btn_y, btn_w, btn_h, cancel_btn, btn_font, mouse_world))
|
||||
result = 1;
|
||||
if(ui_modal_button(confirm_x, btn_y, btn_w, btn_h, confirm_btn, btn_font, mouse_world))
|
||||
result = 2;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_modal_3btn(const char *title, const char *message,
|
||||
const char *left_btn, const char *middle_btn, const char *right_btn)
|
||||
{
|
||||
int modal_w = flint_px(300);
|
||||
int modal_x;
|
||||
int modal_y;
|
||||
int title_font = flint_ui_font();
|
||||
int msg_font = flint_ui_font();
|
||||
int btn_font = flint_ui_font();
|
||||
int btn_h = flint_clamp_px(36, 32, 40);
|
||||
int btn_w = flint_px(90);
|
||||
int btn_gap = flint_px(8);
|
||||
int title_h = flint_px(32);
|
||||
int msg_x;
|
||||
int msg_y;
|
||||
int msg_w = modal_w - flint_px(32);
|
||||
int msg_gap = flint_px(18);
|
||||
int modal_h;
|
||||
int btn_y;
|
||||
Vector2 mouse_world = ui_mouse_world();
|
||||
FlintTextLayout msg_layout = flint_text_layout_parse(message, g_ui_gear_icon,
|
||||
UI_ICON_TYPE_GEAR, msg_font);
|
||||
flint_text_layout_reflow(&msg_layout, msg_w, msg_font, flint_px(4));
|
||||
|
||||
modal_h = title_h + flint_text_layout_get_height(&msg_layout) + msg_gap + btn_h + flint_px(20);
|
||||
if(modal_h < flint_px(160))
|
||||
modal_h = flint_px(160);
|
||||
if(modal_h > ui_view_height - flint_px(24))
|
||||
modal_h = ui_view_height - flint_px(24);
|
||||
modal_x = (ui_view_width - modal_w) / 2;
|
||||
modal_y = (ui_view_height - modal_h) / 2;
|
||||
msg_x = modal_x + flint_px(16);
|
||||
msg_y = modal_y + title_h;
|
||||
btn_y = modal_y + modal_h - btn_h - flint_px(16);
|
||||
|
||||
/* Dim background */
|
||||
DrawRectangle(0, 0, ui_view_width, ui_view_height, (Color){0, 0, 0, 180});
|
||||
|
||||
/* Modal background */
|
||||
DrawRectangle(modal_x, modal_y, modal_w, modal_h, c_surface);
|
||||
ui_draw_bevel(modal_x, modal_y, modal_w, modal_h, flint_lighten(c_surface, 40), flint_darken(c_surface, 40));
|
||||
|
||||
/* Title */
|
||||
int title_w = flint_text_measure(title, title_font);
|
||||
flint_text_draw(title, modal_x + (modal_w - title_w) / 2, modal_y + flint_px(12), title_font, c_text);
|
||||
|
||||
/* Draw the layout */
|
||||
flint_text_layout_draw(&msg_layout, msg_x, &msg_y, msg_font, c_text);
|
||||
flint_text_layout_free(&msg_layout);
|
||||
|
||||
/* Calculate button positions */
|
||||
int total_btn_w = btn_w * 3 + btn_gap * 2;
|
||||
int left_x = modal_x + (modal_w - total_btn_w) / 2;
|
||||
int middle_x = left_x + btn_w + btn_gap;
|
||||
int right_x = middle_x + btn_w + btn_gap;
|
||||
|
||||
int result = 0;
|
||||
|
||||
if(ui_modal_button(left_x, btn_y, btn_w, btn_h, left_btn, btn_font, mouse_world))
|
||||
result = 1;
|
||||
if(ui_modal_button(middle_x, btn_y, btn_w, btn_h, middle_btn, btn_font, mouse_world))
|
||||
result = 2;
|
||||
if(ui_modal_button(right_x, btn_y, btn_w, btn_h, right_btn, btn_font, mouse_world))
|
||||
result = 3;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
ui_paragraph_modal_height(FlintUIParagraphModalMeasure measure)
|
||||
{
|
||||
int width = measure.width > 0 ? measure.width : flint_px(320);
|
||||
int header_h = measure.header_h > 0 ? measure.header_h : flint_px(58);
|
||||
int button_h = measure.button_h > 0 ? measure.button_h : flint_px(36);
|
||||
int line_gap = measure.line_gap > 0 ? measure.line_gap : flint_px(4);
|
||||
int font = measure.font > 0 ? measure.font : flint_ui_font();
|
||||
int extra_lines = measure.extra_lines > 0 ? measure.extra_lines : 0;
|
||||
int min_h = measure.min_height > 0 ? measure.min_height : 0;
|
||||
int content_w;
|
||||
FlintUIParagraph paragraph;
|
||||
int height;
|
||||
|
||||
if(width > ui_view_width - flint_px(24))
|
||||
width = ui_view_width - flint_px(24);
|
||||
if(width < flint_px(160))
|
||||
width = flint_px(160);
|
||||
content_w = width - flint_px(36);
|
||||
if(content_w < flint_px(120))
|
||||
content_w = flint_px(120);
|
||||
paragraph = (FlintUIParagraph){
|
||||
.text = measure.message,
|
||||
.width = content_w,
|
||||
.font = font,
|
||||
.line_gap = line_gap,
|
||||
.color = c_text
|
||||
};
|
||||
height = header_h +
|
||||
flint_ui_paragraph_height(paragraph) +
|
||||
extra_lines * (font + line_gap) +
|
||||
button_h +
|
||||
flint_px(18);
|
||||
if(height < min_h)
|
||||
height = min_h;
|
||||
return height;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* SCREEN HEADER (TITLE BAR)
|
||||
* ================================================================ */
|
||||
|
||||
int
|
||||
ui_screen_header_height(void)
|
||||
{
|
||||
return flint_clamp_px(60, 48, 60);
|
||||
}
|
||||
|
||||
FlintUIHeader
|
||||
ui_draw_title_header(int height, const char *title,
|
||||
Texture2D left_icon,
|
||||
Texture2D right_icon)
|
||||
{
|
||||
FlintUIHeader header = {height, 0, 0};
|
||||
int icon_size = flint_px(20);
|
||||
int icon_padding = flint_px(8);
|
||||
int icon_w = icon_size + icon_padding * 2;
|
||||
int title_font = flint_ui_title_font(title, ui_view_width - icon_w * 2 - flint_px(48));
|
||||
int title_w = flint_text_measure(title, title_font);
|
||||
int hover = 0;
|
||||
|
||||
DrawRectangle(0, 0, ui_view_width, height, c_bg);
|
||||
DrawLine(0, height - 1, ui_view_width, height - 1, flint_darken(c_button, 18));
|
||||
|
||||
if(left_icon.id != 0) {
|
||||
header.left_clicked = ui_draw_icon_btn_padded(flint_px(12), flint_px(12),
|
||||
icon_size, icon_padding,
|
||||
left_icon, &hover);
|
||||
}
|
||||
if(right_icon.id != 0) {
|
||||
header.right_clicked = ui_draw_icon_btn_padded(ui_view_width - icon_w - flint_px(12),
|
||||
flint_px(12), icon_size, icon_padding,
|
||||
right_icon, &hover);
|
||||
}
|
||||
|
||||
flint_text_draw(title, (ui_view_width - title_w) / 2,
|
||||
flint_ui_text_y(title, 0, height, title_font),
|
||||
title_font, c_text);
|
||||
return header;
|
||||
}
|
||||
|
||||
FlintUIPanelFrame
|
||||
ui_draw_modal_frame(int width, int height, const char *title,
|
||||
Texture2D left_icon,
|
||||
Texture2D right_icon)
|
||||
{
|
||||
FlintUIPanelFrame frame = {0};
|
||||
int title_font;
|
||||
int icon_size = flint_px(20);
|
||||
int icon_padding = flint_px(8);
|
||||
int icon_w = icon_size + icon_padding * 2;
|
||||
int title_w;
|
||||
int hover = 0;
|
||||
|
||||
if(width > ui_view_width - flint_px(24))
|
||||
width = ui_view_width - flint_px(24);
|
||||
if(height > ui_view_height - flint_px(24))
|
||||
height = ui_view_height - flint_px(24);
|
||||
|
||||
frame.w = width;
|
||||
frame.h = height;
|
||||
frame.x = (ui_view_width - width) / 2;
|
||||
frame.y = (ui_view_height - height) / 2;
|
||||
frame.content_x = frame.x + flint_px(18);
|
||||
frame.content_y = frame.y + flint_px(58);
|
||||
frame.content_w = frame.w - flint_px(36);
|
||||
frame.content_h = frame.h - flint_px(74);
|
||||
title_font = flint_ui_title_font(title, frame.w - icon_w * 2 - flint_px(24));
|
||||
title_w = flint_text_measure(title, title_font);
|
||||
|
||||
DrawRectangle(0, 0, ui_view_width, ui_view_height, (Color){0, 0, 0, 180});
|
||||
DrawRectangle(frame.x, frame.y, frame.w, frame.h, c_surface);
|
||||
ui_draw_bevel(frame.x, frame.y, frame.w, frame.h,
|
||||
flint_lighten(c_surface, 40), flint_darken(c_surface, 40));
|
||||
|
||||
flint_text_draw(title, frame.x + (frame.w - title_w) / 2,
|
||||
frame.y + flint_px(14), title_font, c_text);
|
||||
|
||||
if(left_icon.id != 0) {
|
||||
frame.left_clicked = ui_draw_icon_btn_padded(frame.x + flint_px(6),
|
||||
frame.y + flint_px(6),
|
||||
icon_size, icon_padding,
|
||||
left_icon, &hover);
|
||||
}
|
||||
if(right_icon.id != 0) {
|
||||
frame.right_clicked = ui_draw_icon_btn_padded(frame.x + frame.w - icon_w - flint_px(6),
|
||||
frame.y + flint_px(6),
|
||||
icon_size, icon_padding,
|
||||
right_icon, &hover);
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
int
|
||||
ui_draw_screen_header(const char *title, int show_close)
|
||||
{
|
||||
(void)c_bg; /* unused */
|
||||
int title_h = ui_screen_header_height();
|
||||
int title_font;
|
||||
int close_hover = 0;
|
||||
int close_clicked = 0;
|
||||
|
||||
/* Draw header background */
|
||||
DrawRectangle(0, 0, ui_view_width, title_h, flint_darken(c_bg, 14));
|
||||
DrawLine(0, title_h - 1, ui_view_width, title_h - 1, flint_darken(c_bg, 42));
|
||||
|
||||
/* Draw close button if requested */
|
||||
int close_x = ui_view_width - flint_px(40) - ui_icon_btn_padding(UI_ICON_SIZE_TINY);
|
||||
int title_x = flint_px(16);
|
||||
int title_max_w = show_close ? close_x - title_x - flint_px(12) : ui_view_width - title_x * 2;
|
||||
title_font = flint_ui_title_font(title, title_max_w);
|
||||
flint_text_draw(title, title_x, flint_ui_text_y(title, 0, title_h, title_font), title_font, c_text);
|
||||
|
||||
if(show_close) {
|
||||
close_clicked = ui_draw_icon_btn(close_x, flint_px(8), UI_ICON_SIZE_TINY,
|
||||
g_ui_x_icon, &close_hover);
|
||||
}
|
||||
|
||||
return close_clicked;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* SCROLLBAR
|
||||
* ================================================================ */
|
||||
@@ -0,0 +1,134 @@
|
||||
#include "ui.h"
|
||||
|
||||
void
|
||||
ui_draw_info_rows(FlintUIInfoRows rows)
|
||||
{
|
||||
Color background = rows.background.a != 0
|
||||
? rows.background
|
||||
: flint_darken(c_bg, 6);
|
||||
Color separator = rows.separator.a != 0
|
||||
? rows.separator
|
||||
: flint_darken(c_bg, 30);
|
||||
Color default_text = rows.default_text.a != 0 ? rows.default_text : c_text;
|
||||
int row_h = rows.row_height > 0 ? rows.row_height : flint_px(32);
|
||||
int padding_x = rows.padding_x > 0 ? rows.padding_x : flint_px(10);
|
||||
|
||||
if(rows.rows == NULL || rows.row_count <= 0 || rows.width <= 0 || row_h <= 0)
|
||||
return;
|
||||
|
||||
DrawRectangle(rows.x, rows.y, rows.width, row_h * rows.row_count,
|
||||
background);
|
||||
for(int i = 0; i < rows.row_count; i++) {
|
||||
const FlintUIInfoRow *row = &rows.rows[i];
|
||||
int y = rows.y + i * row_h;
|
||||
int font = row->font > 0 ? row->font : flint_ui_font();
|
||||
Color text = row->color.a != 0 ? row->color : default_text;
|
||||
|
||||
if(i > 0)
|
||||
DrawLine(rows.x, y, rows.x + rows.width, y, separator);
|
||||
flint_ui_draw_text_left_in_rect(row->text ? row->text : "",
|
||||
(Rectangle){(float)(rows.x + padding_x),
|
||||
(float)y,
|
||||
(float)(rows.width - padding_x * 2),
|
||||
(float)row_h},
|
||||
font, text);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ui_label_text_field_height(FlintUILabelTextField row)
|
||||
{
|
||||
int label_h = row.label_h > 0 ? row.label_h : flint_px(22);
|
||||
int field_h = row.field_h > 0 ? row.field_h : flint_px(40);
|
||||
int gap = row.gap > 0 ? row.gap : 0;
|
||||
int bottom_gap = row.bottom_gap > 0 ? row.bottom_gap : flint_px(24);
|
||||
|
||||
return label_h + gap + field_h + bottom_gap;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_label_text_field(FlintUILabelTextField row, int x, int y, int w)
|
||||
{
|
||||
int label_font = row.label_font > 0 ? row.label_font : flint_ui_font_small();
|
||||
int label_h = row.label_h > 0 ? row.label_h : flint_px(22);
|
||||
int field_h = row.field_h > 0 ? row.field_h : flint_px(40);
|
||||
int gap = row.gap > 0 ? row.gap : 0;
|
||||
Color label_color = row.label_color.a != 0 ? row.label_color : flint_darken(c_text, 34);
|
||||
FlintUITextField field = row.field;
|
||||
|
||||
flint_text_draw(row.label != NULL ? row.label : "", x, y, label_font, label_color);
|
||||
field.bounds = (Rectangle){(float)x, (float)(y + label_h + gap), (float)w, (float)field_h};
|
||||
return flint_ui_text_field(field);
|
||||
}
|
||||
|
||||
int
|
||||
ui_section_label_height(FlintUISectionLabel label)
|
||||
{
|
||||
return label.height > 0 ? label.height : flint_px(24);
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_section_label(FlintUISectionLabel label, int x, int y)
|
||||
{
|
||||
int font = label.font > 0 ? label.font : flint_ui_font_small();
|
||||
int icon_d = label.icon_diameter > 0 ? label.icon_diameter : flint_px(18);
|
||||
Color color = label.color.a != 0 ? label.color : flint_darken(c_text, 34);
|
||||
const char *text = label.label != NULL ? label.label : "";
|
||||
int label_w;
|
||||
|
||||
flint_text_draw(text, x, y, font, color);
|
||||
if(!label.info_button)
|
||||
return 0;
|
||||
label_w = flint_text_measure(text, font);
|
||||
return ui_draw_info_button(x + label_w + flint_px(16),
|
||||
y + font / 2 + flint_px(1), icon_d);
|
||||
}
|
||||
|
||||
int
|
||||
ui_checkbox_row_height(FlintUICheckboxRow row)
|
||||
{
|
||||
return row.height > 0 ? row.height : flint_px(42);
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_checkbox_row(FlintUICheckboxRow row, int x, int y)
|
||||
{
|
||||
if(row.disabled)
|
||||
return ui_draw_checkbox_toggle_disabled(x, y, row.label, row.value, 1);
|
||||
return ui_draw_checkbox_toggle(x, y, row.label, row.value);
|
||||
}
|
||||
|
||||
int
|
||||
ui_button_row_height(FlintUIButtonRow row)
|
||||
{
|
||||
return row.height > 0 ? row.height : flint_px(40);
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_button_row(FlintUIButtonRow row)
|
||||
{
|
||||
int clicked = -1;
|
||||
int gap = row.gap > 0 ? row.gap : flint_px(10);
|
||||
int button_w;
|
||||
|
||||
if(row.items == NULL || row.count <= 0 || row.width <= 0 || row.height <= 0)
|
||||
return -1;
|
||||
|
||||
button_w = (row.width - gap * (row.count - 1)) / row.count;
|
||||
if(button_w <= 0)
|
||||
return -1;
|
||||
|
||||
for(int i = 0; i < row.count; i++) {
|
||||
int hover = 0;
|
||||
int x = row.x + i * (button_w + gap);
|
||||
|
||||
if(ui_draw_generic_button(x, row.y, button_w, row.height,
|
||||
row.items[i].label,
|
||||
row.items[i].style,
|
||||
row.items[i].disabled,
|
||||
&hover))
|
||||
clicked = i;
|
||||
}
|
||||
|
||||
return clicked;
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
#include "ui.h"
|
||||
|
||||
int
|
||||
ui_scrollbar_reserved_width(int max_scroll)
|
||||
{
|
||||
return max_scroll > 0 ? flint_px(16) : 0;
|
||||
}
|
||||
|
||||
int
|
||||
ui_scrollbar_content_width(int content_width, int max_scroll)
|
||||
{
|
||||
int reserved = ui_scrollbar_reserved_width(max_scroll);
|
||||
|
||||
if(reserved <= 0)
|
||||
return content_width;
|
||||
if(content_width <= reserved)
|
||||
return 0;
|
||||
return content_width - reserved;
|
||||
}
|
||||
|
||||
int
|
||||
ui_scrollbar_safe_content_width(int content_x, int content_width,
|
||||
int scrollbar_x, int max_scroll)
|
||||
{
|
||||
int gap = flint_px(20);
|
||||
int safe_width = content_width;
|
||||
|
||||
if(max_scroll <= 0 || scrollbar_x <= 0)
|
||||
return content_width;
|
||||
|
||||
safe_width = scrollbar_x - content_x - gap;
|
||||
if(safe_width > content_width)
|
||||
return content_width;
|
||||
if(safe_width < 0)
|
||||
return 0;
|
||||
return safe_width;
|
||||
}
|
||||
|
||||
FlintUIScrollView
|
||||
ui_scroll_container_measure(FlintUIScrollArea area)
|
||||
{
|
||||
FlintUIScrollView view;
|
||||
int x = (int)area.bounds.x;
|
||||
int y = (int)area.bounds.y;
|
||||
int w = (int)area.bounds.width;
|
||||
int h = (int)area.bounds.height;
|
||||
int scrollbar_w = flint_px(8);
|
||||
int scrollbar_x = area.scrollbar_x > 0
|
||||
? area.scrollbar_x
|
||||
: x + w - scrollbar_w;
|
||||
int content_x = area.content_x > 0 ? area.content_x : x;
|
||||
int content_w = area.content_width > 0 ? area.content_width : w;
|
||||
|
||||
memset(&view, 0, sizeof(view));
|
||||
view.content_x = content_x;
|
||||
view.viewport_h = h;
|
||||
view.content_h = area.content_height > 0 ? area.content_height : 0;
|
||||
view.max_scroll = view.content_h - h;
|
||||
if(view.max_scroll < 0)
|
||||
view.max_scroll = 0;
|
||||
|
||||
if(area.scroll_offset != NULL) {
|
||||
int scroll_offset = ui_clampi(*area.scroll_offset, 0, view.max_scroll);
|
||||
view.content_y = y - scroll_offset;
|
||||
} else {
|
||||
view.content_y = y;
|
||||
}
|
||||
view.content_w = ui_scrollbar_safe_content_width(content_x, content_w,
|
||||
scrollbar_x, view.max_scroll);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
FlintUIScrollPage
|
||||
ui_scroll_page_begin(FlintUIScrollPageSpec spec)
|
||||
{
|
||||
FlintUIScrollPage page;
|
||||
FlintUIScrollArea area;
|
||||
FlintUIScrollView measured;
|
||||
int max_content_w = spec.max_content_width;
|
||||
int min_content_w = spec.min_content_width;
|
||||
int side_padding = spec.side_padding > 0 ? spec.side_padding : flint_page_side_padding();
|
||||
int content_x = 0;
|
||||
int content_w = 0;
|
||||
int draw_w;
|
||||
int passes = spec.measure_passes > 0 ? spec.measure_passes : 3;
|
||||
|
||||
memset(&page, 0, sizeof(page));
|
||||
|
||||
if(max_content_w <= 0)
|
||||
max_content_w = ui_view_width;
|
||||
if(max_content_w > ui_view_width - side_padding * 2)
|
||||
max_content_w = ui_view_width - side_padding * 2;
|
||||
if(min_content_w > 0 && max_content_w < min_content_w)
|
||||
max_content_w = min_content_w;
|
||||
if(max_content_w < 0)
|
||||
max_content_w = 0;
|
||||
|
||||
flint_centered_column(max_content_w, side_padding, &content_x, &content_w);
|
||||
draw_w = content_w;
|
||||
|
||||
for(int i = 0; i < passes; i++) {
|
||||
int content_h;
|
||||
|
||||
if(spec.content_height != NULL)
|
||||
content_h = spec.content_height(draw_w, spec.user_data);
|
||||
else
|
||||
content_h = 0;
|
||||
area = (FlintUIScrollArea){
|
||||
.bounds = {0.0f, (float)spec.y, (float)ui_view_width, (float)spec.height},
|
||||
.content_height = content_h,
|
||||
.content_x = content_x,
|
||||
.content_width = content_w,
|
||||
.scroll_offset = spec.scroll_offset,
|
||||
.wheel_step = spec.wheel_step > 0 ? spec.wheel_step : flint_px(42),
|
||||
.scrollbar_x = spec.scrollbar_x > 0 ? spec.scrollbar_x : ui_view_width - flint_px(8)
|
||||
};
|
||||
measured = ui_scroll_container_measure(area);
|
||||
if(measured.content_w == draw_w)
|
||||
break;
|
||||
draw_w = measured.content_w;
|
||||
}
|
||||
|
||||
if(spec.content_height != NULL)
|
||||
area.content_height = spec.content_height(draw_w, spec.user_data);
|
||||
page.area = area;
|
||||
page.view = ui_scroll_container_begin(area);
|
||||
page.content_x = page.view.content_x;
|
||||
page.content_y = page.view.content_y;
|
||||
page.content_w = page.view.content_w;
|
||||
page.content_h = area.content_height;
|
||||
return page;
|
||||
}
|
||||
|
||||
void
|
||||
ui_scroll_page_end(FlintUIScrollPage page)
|
||||
{
|
||||
ui_scroll_container_end(page.area, page.view);
|
||||
}
|
||||
FlintUIScrollView
|
||||
ui_scroll_container_begin(FlintUIScrollArea area)
|
||||
{
|
||||
static int content_drag_active = 0;
|
||||
static int content_dragging = 0;
|
||||
static int content_drag_start_y = 0;
|
||||
static int content_drag_start_scroll = 0;
|
||||
FlintUIScrollView view = ui_scroll_container_measure(area);
|
||||
Vector2 mouse_world = ui_mouse_world();
|
||||
int y = (int)area.bounds.y;
|
||||
int wheel_step = area.wheel_step > 0 ? area.wheel_step : flint_px(42);
|
||||
int inside = CheckCollisionPointRec(mouse_world, area.bounds);
|
||||
int captured = ui_input_captures_click(mouse_world);
|
||||
int drag_threshold = flint_px(5);
|
||||
int scrollbar_w = flint_px(8);
|
||||
int scrollbar_x = area.scrollbar_x > 0
|
||||
? area.scrollbar_x
|
||||
: (int)(area.bounds.x + area.bounds.width) - scrollbar_w;
|
||||
Rectangle scrollbar_bounds = {
|
||||
(float)scrollbar_x,
|
||||
area.bounds.y,
|
||||
(float)scrollbar_w,
|
||||
area.bounds.height
|
||||
};
|
||||
int on_scrollbar = view.max_scroll > 0 &&
|
||||
CheckCollisionPointRec(mouse_world, scrollbar_bounds);
|
||||
|
||||
if(area.scroll_offset != NULL) {
|
||||
*area.scroll_offset = ui_clampi(*area.scroll_offset, 0, view.max_scroll);
|
||||
if(view.max_scroll > 0 && inside && !captured) {
|
||||
float wheel = GetMouseWheelMove();
|
||||
if(wheel != 0.0f) {
|
||||
*area.scroll_offset -= (int)(wheel * (float)wheel_step);
|
||||
*area.scroll_offset = ui_clampi(*area.scroll_offset, 0, view.max_scroll);
|
||||
}
|
||||
}
|
||||
|
||||
if(g_ui_slider_active_id != 0 &&
|
||||
g_ui_pointer_owner == UI_POINTER_OWNER_NONE &&
|
||||
g_ui_pointer_dragging &&
|
||||
ui_pointer_drag_is_horizontal())
|
||||
g_ui_pointer_owner = UI_POINTER_OWNER_HORIZONTAL_SLIDER;
|
||||
|
||||
if(g_ui_pointer_owner == UI_POINTER_OWNER_HORIZONTAL_SLIDER ||
|
||||
g_ui_pointer_owner == UI_POINTER_OWNER_VERTICAL_SLIDER) {
|
||||
content_drag_active = 0;
|
||||
content_dragging = 0;
|
||||
}
|
||||
|
||||
if(view.max_scroll > 0 &&
|
||||
g_ui_pointer_owner == UI_POINTER_OWNER_NONE &&
|
||||
IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && inside && !captured &&
|
||||
!on_scrollbar) {
|
||||
content_drag_active = 1;
|
||||
content_dragging = 0;
|
||||
content_drag_start_y = (int)mouse_world.y;
|
||||
content_drag_start_scroll = *area.scroll_offset;
|
||||
}
|
||||
if(content_drag_active && IsMouseButtonDown(MOUSE_BUTTON_LEFT) &&
|
||||
g_ui_pointer_owner != UI_POINTER_OWNER_HORIZONTAL_SLIDER &&
|
||||
g_ui_pointer_owner != UI_POINTER_OWNER_VERTICAL_SLIDER) {
|
||||
int dy = (int)mouse_world.y - content_drag_start_y;
|
||||
if(content_dragging || dy > drag_threshold || dy < -drag_threshold) {
|
||||
g_ui_pointer_owner = UI_POINTER_OWNER_SCROLL;
|
||||
content_dragging = 1;
|
||||
*area.scroll_offset = content_drag_start_scroll - dy;
|
||||
*area.scroll_offset = ui_clampi(*area.scroll_offset, 0, view.max_scroll);
|
||||
ui_set_input_blocked(1);
|
||||
}
|
||||
} else if(content_drag_active) {
|
||||
if(content_dragging)
|
||||
ui_set_input_blocked(1);
|
||||
content_drag_active = 0;
|
||||
content_dragging = 0;
|
||||
}
|
||||
view.content_y = y - *area.scroll_offset;
|
||||
} else {
|
||||
view.content_y = y;
|
||||
}
|
||||
{
|
||||
Rectangle screen_bounds = {
|
||||
g_ui_camera.offset.x + area.bounds.x * g_ui_camera.zoom,
|
||||
g_ui_camera.offset.y + area.bounds.y * g_ui_camera.zoom,
|
||||
area.bounds.width * g_ui_camera.zoom,
|
||||
area.bounds.height * g_ui_camera.zoom
|
||||
};
|
||||
Rectangle clipped_screen_bounds = flint_clip_effective(screen_bounds);
|
||||
Rectangle clipped_world_bounds = {
|
||||
(clipped_screen_bounds.x - g_ui_camera.offset.x) / g_ui_camera.zoom,
|
||||
(clipped_screen_bounds.y - g_ui_camera.offset.y) / g_ui_camera.zoom,
|
||||
clipped_screen_bounds.width / g_ui_camera.zoom,
|
||||
clipped_screen_bounds.height / g_ui_camera.zoom
|
||||
};
|
||||
|
||||
ui_push_input_clip(clipped_world_bounds);
|
||||
flint_clip_begin((int)screen_bounds.x, (int)screen_bounds.y,
|
||||
(int)screen_bounds.width, (int)screen_bounds.height);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
void
|
||||
ui_scroll_container_end(FlintUIScrollArea area, FlintUIScrollView view)
|
||||
{
|
||||
int scrollbar_w = flint_px(8);
|
||||
int scrollbar_x;
|
||||
|
||||
flint_clip_end();
|
||||
ui_pop_input_clip();
|
||||
|
||||
if(area.scroll_offset == NULL || view.max_scroll <= 0)
|
||||
return;
|
||||
|
||||
scrollbar_x = area.scrollbar_x > 0
|
||||
? area.scrollbar_x
|
||||
: (int)(area.bounds.x + area.bounds.width) - scrollbar_w;
|
||||
ui_draw_scrollbar(scrollbar_x,
|
||||
(int)area.bounds.y,
|
||||
(int)area.bounds.height,
|
||||
view.content_h,
|
||||
area.scroll_offset,
|
||||
view.max_scroll);
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* SCROLLBAR
|
||||
* ================================================================ */
|
||||
|
||||
int
|
||||
ui_draw_scrollbar(int x, int y, int viewport_h, int content_h, int *scroll_offset, int max_scroll)
|
||||
{
|
||||
/* Don't show scrollbar if no scrolling needed */
|
||||
if(max_scroll <= 0)
|
||||
return 0;
|
||||
|
||||
static int scrollbar_drag_active = 0;
|
||||
static int scrollbar_drag_start_y = 0;
|
||||
static int scrollbar_drag_start_scroll = 0;
|
||||
|
||||
int scrollbar_width = flint_px(8);
|
||||
int scrollbar_min_thumb = flint_px(24);
|
||||
int track_padding = 0;
|
||||
|
||||
/* Calculate thumb size and position */
|
||||
float content_ratio = (float)viewport_h / (float)content_h;
|
||||
int thumb_height = (int)(viewport_h * content_ratio);
|
||||
if(thumb_height < scrollbar_min_thumb)
|
||||
thumb_height = scrollbar_min_thumb;
|
||||
if(thumb_height > viewport_h)
|
||||
thumb_height = viewport_h;
|
||||
|
||||
float scroll_ratio = max_scroll > 0 ? (float)*scroll_offset / (float)max_scroll : 0.0f;
|
||||
int thumb_y = y + (int)(scroll_ratio * (viewport_h - thumb_height));
|
||||
|
||||
Vector2 mouse_pos = ui_mouse_world();
|
||||
int my = (int)mouse_pos.y;
|
||||
Rectangle thumb_bounds = {x + track_padding, thumb_y, scrollbar_width - track_padding * 2, thumb_height};
|
||||
int input_captured = ui_input_captures_click_internal(mouse_pos, 0);
|
||||
int thumb_active = CheckCollisionPointRec(mouse_pos, thumb_bounds) && !input_captured;
|
||||
int thumb_hover = thumb_active && ui_hover_effects_enabled();
|
||||
|
||||
/* Handle drag state */
|
||||
if(IsMouseButtonDown(MOUSE_BUTTON_LEFT) &&
|
||||
(!input_captured || scrollbar_drag_active)) {
|
||||
if(!scrollbar_drag_active) {
|
||||
/* Start drag if clicking on thumb */
|
||||
if(thumb_active && g_ui_pointer_owner == UI_POINTER_OWNER_NONE) {
|
||||
scrollbar_drag_active = 1;
|
||||
g_ui_pointer_owner = UI_POINTER_OWNER_SCROLL;
|
||||
scrollbar_drag_start_y = my;
|
||||
scrollbar_drag_start_scroll = *scroll_offset;
|
||||
}
|
||||
} else {
|
||||
/* Continue drag */
|
||||
int dy = my - scrollbar_drag_start_y;
|
||||
float scroll_per_pixel = (float)max_scroll / (float)(viewport_h - thumb_height);
|
||||
int new_scroll = scrollbar_drag_start_scroll + (int)(dy * scroll_per_pixel);
|
||||
*scroll_offset = new_scroll;
|
||||
if(*scroll_offset < 0) *scroll_offset = 0;
|
||||
if(*scroll_offset > max_scroll) *scroll_offset = max_scroll;
|
||||
}
|
||||
} else {
|
||||
if(scrollbar_drag_active && g_ui_pointer_owner == UI_POINTER_OWNER_SCROLL)
|
||||
g_ui_pointer_owner = UI_POINTER_OWNER_NONE;
|
||||
scrollbar_drag_active = 0;
|
||||
}
|
||||
|
||||
DrawRectangle(x, y, scrollbar_width, viewport_h, flint_darken(c_bg, 20));
|
||||
|
||||
Color thumb_color = thumb_hover || scrollbar_drag_active ? c_button_hover : c_button;
|
||||
DrawRectangleRec(thumb_bounds, thumb_color);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* END OF UI FUNCTIONS
|
||||
* ================================================================ */
|
||||
@@ -0,0 +1,211 @@
|
||||
#include "ui.h"
|
||||
#include "flint_layout.h"
|
||||
#include "flint_locale.h"
|
||||
|
||||
|
||||
static const FlintThemeId theme_picker_order[FLINT_THEME_COUNT] = {
|
||||
FLINT_THEME_SKY,
|
||||
FLINT_THEME_OCEAN,
|
||||
FLINT_THEME_COBALT,
|
||||
FLINT_THEME_FOREST,
|
||||
FLINT_THEME_SAGE,
|
||||
FLINT_THEME_MINT,
|
||||
FLINT_THEME_SUNSET,
|
||||
FLINT_THEME_INK,
|
||||
FLINT_THEME_DAWN,
|
||||
FLINT_THEME_CHERRY,
|
||||
FLINT_THEME_LAVENDER,
|
||||
FLINT_THEME_MONO
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int circle_size;
|
||||
int label_gap;
|
||||
int col_gap;
|
||||
int cell_w;
|
||||
int per_row;
|
||||
int row_width;
|
||||
int row_step;
|
||||
int row_count;
|
||||
int height;
|
||||
} UIThemeGridLayout;
|
||||
|
||||
static const char *
|
||||
ui_theme_label(FlintThemeId theme)
|
||||
{
|
||||
const char *key = NULL;
|
||||
const char *label;
|
||||
|
||||
switch(flint_theme_normalize(theme)) {
|
||||
case FLINT_THEME_SKY: key = "theme_sky"; break;
|
||||
case FLINT_THEME_OCEAN: key = "theme_ocean"; break;
|
||||
case FLINT_THEME_FOREST: key = "theme_forest"; break;
|
||||
case FLINT_THEME_SUNSET: key = "theme_sunset"; break;
|
||||
case FLINT_THEME_LAVENDER: key = "theme_lavender"; break;
|
||||
case FLINT_THEME_CHERRY: key = "theme_cherry"; break;
|
||||
case FLINT_THEME_DAWN: key = "theme_dawn"; break;
|
||||
case FLINT_THEME_SAGE: key = "theme_sage"; break;
|
||||
case FLINT_THEME_INK: key = "theme_sepia"; break;
|
||||
case FLINT_THEME_MONO: key = "theme_mono"; break;
|
||||
case FLINT_THEME_MINT: key = "theme_mint"; break;
|
||||
case FLINT_THEME_COBALT: key = "theme_cobalt"; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if(key == NULL)
|
||||
return flint_theme_label(theme);
|
||||
label = locale_get(key);
|
||||
if(label == NULL || label[0] == '\0' || strcmp(label, key) == 0)
|
||||
return flint_theme_label(theme);
|
||||
return label;
|
||||
}
|
||||
|
||||
static UIThemeGridLayout
|
||||
ui_theme_grid_layout(int w)
|
||||
{
|
||||
UIThemeGridLayout layout = {0};
|
||||
int small_font = FLINT_TEXT_12;
|
||||
|
||||
int row_gap = flint_px(14);
|
||||
layout.circle_size = flint_px(24);
|
||||
layout.label_gap = flint_px(6);
|
||||
layout.col_gap = flint_px(10);
|
||||
layout.cell_w = layout.circle_size;
|
||||
for(int i = 0; i < FLINT_THEME_COUNT; i++) {
|
||||
int name_w = flint_text_measure(ui_theme_label((FlintThemeId)i), small_font) + flint_px(8);
|
||||
if(name_w > layout.cell_w)
|
||||
layout.cell_w = name_w;
|
||||
}
|
||||
|
||||
layout.per_row = (w + layout.col_gap) / (layout.cell_w + layout.col_gap);
|
||||
if(layout.per_row < 1)
|
||||
layout.per_row = 1;
|
||||
if(layout.per_row > 3)
|
||||
layout.per_row = 3;
|
||||
if(layout.per_row > FLINT_THEME_COUNT)
|
||||
layout.per_row = FLINT_THEME_COUNT;
|
||||
layout.row_width = layout.per_row * layout.cell_w + (layout.per_row - 1) * layout.col_gap;
|
||||
|
||||
layout.row_step = layout.circle_size + layout.label_gap + small_font + row_gap;
|
||||
layout.row_count = (FLINT_THEME_COUNT + layout.per_row - 1) / layout.per_row;
|
||||
layout.height = layout.circle_size + layout.label_gap + small_font;
|
||||
if(layout.row_count > 1)
|
||||
layout.height += (layout.row_count - 1) * layout.row_step;
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
static int
|
||||
ui_draw_theme_grid(int x, int circle_y, int w, int dark, int *theme_id)
|
||||
{
|
||||
int changed = 0;
|
||||
int small_font = FLINT_TEXT_12;
|
||||
int selected = theme_id != NULL ? *theme_id : FLINT_THEME_SKY;
|
||||
UIThemeGridLayout layout = ui_theme_grid_layout(w);
|
||||
int start_x = x + (w - layout.row_width) / 2;
|
||||
Vector2 mouse_world = ui_mouse_world();
|
||||
|
||||
if(selected < 0 || selected >= FLINT_THEME_COUNT)
|
||||
selected = FLINT_THEME_SKY;
|
||||
|
||||
for(int i = 0; i < FLINT_THEME_COUNT; i++) {
|
||||
FlintThemeId theme = theme_picker_order[i];
|
||||
int row = i / layout.per_row;
|
||||
int col = i % layout.per_row;
|
||||
int cell_x = start_x + col * (layout.cell_w + layout.col_gap);
|
||||
int cx = cell_x + layout.cell_w / 2;
|
||||
int cy = circle_y + row * layout.row_step;
|
||||
Color theme_color = c_circle;
|
||||
|
||||
if(!flint_theme_catalog_color(theme, dark != 0, "circle", &theme_color)) {
|
||||
const char *scope = flint_theme_scope_for(theme, dark != 0);
|
||||
theme_color = flint_theme_get(scope, "circle");
|
||||
}
|
||||
|
||||
DrawCircle(cx, cy, layout.circle_size / 2, theme_color);
|
||||
DrawCircleLines(cx, cy, layout.circle_size / 2 + (selected == theme ? flint_px(2) : flint_px(1)),
|
||||
selected == theme ? c_text : flint_darken(c_bg, 30));
|
||||
|
||||
Rectangle bounds = {
|
||||
(float)(cx - layout.circle_size / 2 - flint_px(4)),
|
||||
(float)(cy - layout.circle_size / 2 - flint_px(4)),
|
||||
(float)(layout.circle_size + flint_px(8)),
|
||||
(float)(layout.circle_size + flint_px(8))
|
||||
};
|
||||
if(CheckCollisionPointRec(mouse_world, bounds) && !ui_input_captures_click(mouse_world)) {
|
||||
ui_mark_clickable();
|
||||
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
|
||||
selected = theme;
|
||||
if(theme_id != NULL)
|
||||
*theme_id = theme;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
const char *name = ui_theme_label(theme);
|
||||
int name_w = flint_text_measure(name, small_font);
|
||||
flint_text_draw(name, cx - name_w / 2,
|
||||
cy + layout.circle_size / 2 + layout.label_gap,
|
||||
small_font, c_text);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_theme_switcher(int x, int y, int w, const char *label,
|
||||
const char *light_label, const char *dark_label,
|
||||
int *theme_id, int *dark_mode)
|
||||
{
|
||||
int changed = 0;
|
||||
int font = flint_ui_font();
|
||||
int dark = dark_mode != NULL ? *dark_mode : 0;
|
||||
|
||||
flint_text_draw(label ? label : "Theme", x, y, font, c_text);
|
||||
|
||||
int light_w = flint_text_measure(light_label ? light_label : "Light", font);
|
||||
int dark_w = flint_text_measure(dark_label ? dark_label : "Dark", font);
|
||||
int max_label_w = light_w > dark_w ? light_w : dark_w;
|
||||
int toggle_w = max_label_w * 2 + flint_px(32);
|
||||
int min_toggle_w = flint_px(100);
|
||||
if(toggle_w < min_toggle_w)
|
||||
toggle_w = min_toggle_w;
|
||||
if(toggle_w > w)
|
||||
toggle_w = w;
|
||||
|
||||
int toggle_h = flint_px(28);
|
||||
int toggle_x = x + w - toggle_w - flint_px(8);
|
||||
int toggle_y = y - flint_px(2);
|
||||
if(ui_draw_toggle_switch(toggle_x, toggle_y, toggle_w, toggle_h, &dark,
|
||||
light_label ? light_label : "Light",
|
||||
dark_label ? dark_label : "Dark")) {
|
||||
if(dark_mode != NULL)
|
||||
*dark_mode = dark;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
if(ui_draw_theme_grid(x, y + flint_px(64), w, dark, theme_id))
|
||||
changed = 1;
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_theme_picker(int x, int y, int w, const char *label, int dark_mode,
|
||||
int *theme_id)
|
||||
{
|
||||
int changed = 0;
|
||||
int font = flint_ui_font();
|
||||
|
||||
flint_text_draw(label ? label : "Theme", x, y, font, c_text);
|
||||
if(ui_draw_theme_grid(x, y + flint_px(54), w, dark_mode != 0, theme_id))
|
||||
changed = 1;
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_theme_picker_height(int w)
|
||||
{
|
||||
return flint_px(54) + ui_theme_grid_layout(w).height;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
#include "ui.h"
|
||||
|
||||
FlintUIToolbarResult
|
||||
ui_draw_toolbar(FlintUIToolbar toolbar)
|
||||
{
|
||||
FlintUIToolbarResult result = {-1, -1};
|
||||
int side_padding = toolbar.side_padding > 0 ? toolbar.side_padding : flint_px(12);
|
||||
int action_icon_size = toolbar.action_icon_size > 0
|
||||
? toolbar.action_icon_size
|
||||
: flint_px(20);
|
||||
int action_icon_padding = toolbar.action_icon_padding > 0
|
||||
? toolbar.action_icon_padding
|
||||
: flint_px(8);
|
||||
int action_gap = toolbar.action_gap > 0 ? toolbar.action_gap : flint_px(6);
|
||||
int action_w = action_icon_size + action_icon_padding * 2;
|
||||
int action_y = toolbar.y + (toolbar.height - action_w) / 2;
|
||||
int controls_x = toolbar.x + toolbar.width - side_padding;
|
||||
|
||||
if(toolbar.draw_menu) {
|
||||
if(toolbar.options != NULL && toolbar.selected_index != NULL &&
|
||||
ui_draw_dropdown_menu(toolbar.id))
|
||||
result.selected_menu_item = toolbar.selected_index != NULL
|
||||
? *toolbar.selected_index
|
||||
: -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
DrawRectangle(toolbar.x, toolbar.y, toolbar.width, toolbar.height,
|
||||
flint_darken(c_bg, 14));
|
||||
DrawLine(toolbar.x, toolbar.y + toolbar.height - 1,
|
||||
toolbar.x + toolbar.width, toolbar.y + toolbar.height - 1,
|
||||
flint_darken(c_bg, 42));
|
||||
|
||||
if(toolbar.actions != NULL && toolbar.action_count > 0) {
|
||||
for(int i = toolbar.action_count - 1; i >= 0; i--) {
|
||||
int hover = 0;
|
||||
int action_x;
|
||||
|
||||
controls_x -= action_w;
|
||||
action_x = controls_x;
|
||||
if(!toolbar.actions[i].disabled &&
|
||||
ui_draw_icon_btn_padded(action_x, action_y, action_icon_size,
|
||||
action_icon_padding,
|
||||
toolbar.actions[i].icon, &hover))
|
||||
result.clicked_action = i;
|
||||
controls_x -= action_gap;
|
||||
}
|
||||
}
|
||||
|
||||
if(toolbar.options != NULL && toolbar.option_count > 0 &&
|
||||
toolbar.selected_index != NULL) {
|
||||
int dropdown_h = toolbar.dropdown_height > 0
|
||||
? toolbar.dropdown_height
|
||||
: flint_px(36);
|
||||
int dropdown_x = toolbar.x + side_padding;
|
||||
int dropdown_y = toolbar.y + (toolbar.height - dropdown_h) / 2;
|
||||
int dropdown_w = controls_x - dropdown_x;
|
||||
int dropdown_available_w;
|
||||
|
||||
if(toolbar.action_count > 0)
|
||||
dropdown_w -= side_padding - action_gap;
|
||||
dropdown_available_w = dropdown_w;
|
||||
if(toolbar.dropdown_min_width > 0 && dropdown_w < toolbar.dropdown_min_width)
|
||||
dropdown_w = toolbar.dropdown_min_width;
|
||||
if(toolbar.dropdown_max_width > 0 && dropdown_w > toolbar.dropdown_max_width)
|
||||
dropdown_w = toolbar.dropdown_max_width;
|
||||
if(dropdown_available_w > 0 && dropdown_w > dropdown_available_w)
|
||||
dropdown_w = dropdown_available_w;
|
||||
if(dropdown_w < 0)
|
||||
dropdown_w = 0;
|
||||
ui_draw_dropdown_button(toolbar.id, dropdown_x, dropdown_y,
|
||||
dropdown_w, dropdown_h,
|
||||
toolbar.options, toolbar.option_count,
|
||||
toolbar.selected_index);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
FlintUIToolbarHeaderResult
|
||||
ui_draw_toolbar_header(FlintUIToolbarHeader header)
|
||||
{
|
||||
FlintUIToolbarHeaderResult result;
|
||||
FlintUIToolbar toolbar = header.toolbar;
|
||||
int height = toolbar.height > 0 ? toolbar.height : flint_px(58);
|
||||
int icon_size = header.leading_icon_size > 0 ? header.leading_icon_size : flint_px(20);
|
||||
int icon_padding = header.leading_icon_padding > 0 ? header.leading_icon_padding : flint_px(8);
|
||||
int leading_w = header.leading_width;
|
||||
int hover = 0;
|
||||
|
||||
memset(&result, 0, sizeof(result));
|
||||
if(leading_w <= 0 && header.leading_icon.id != 0)
|
||||
leading_w = icon_size + icon_padding * 2 + flint_px(24);
|
||||
|
||||
if(!toolbar.draw_menu) {
|
||||
DrawRectangle(0, 0, ui_view_width, height, flint_darken(c_bg, 14));
|
||||
DrawLine(0, height - 1, ui_view_width, height - 1,
|
||||
flint_darken(c_bg, 42));
|
||||
if(header.leading_icon.id != 0) {
|
||||
result.leading_clicked = ui_draw_icon_btn_padded(flint_px(12), flint_px(12),
|
||||
icon_size, icon_padding,
|
||||
header.leading_icon,
|
||||
&hover);
|
||||
}
|
||||
toolbar.x = leading_w;
|
||||
toolbar.y = 0;
|
||||
toolbar.width = ui_view_width - leading_w;
|
||||
toolbar.height = height;
|
||||
if(toolbar.width < 0)
|
||||
toolbar.width = 0;
|
||||
}
|
||||
|
||||
result.toolbar = ui_draw_toolbar(toolbar);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "ui.h"
|
||||
|
||||
void
|
||||
ui_draw_tutorial_image_placeholder(const char *label, int x, int y, int w, int h)
|
||||
{
|
||||
DrawRectangle(x, y, w, h, flint_darken(c_bg, 12));
|
||||
ui_draw_bevel(x, y, w, h, flint_darken(c_bg, 45), flint_lighten(c_bg, 35));
|
||||
int font = flint_ui_font();
|
||||
int tw = flint_text_measure(label, font);
|
||||
flint_text_draw(label, x + w / 2 - tw / 2, flint_ui_text_y(label, y, h, font), font, c_text);
|
||||
}
|
||||
|
||||
void
|
||||
ui_draw_tutorial_image(Texture2D texture, const char *fallback, int x, int y, int w, int h)
|
||||
{
|
||||
if(texture.id == 0) {
|
||||
ui_draw_tutorial_image_placeholder(fallback, x, y, w, h);
|
||||
return;
|
||||
}
|
||||
|
||||
float scale_x = (float)w / (float)texture.width;
|
||||
float scale_y = (float)h / (float)texture.height;
|
||||
float scale = scale_x < scale_y ? scale_x : scale_y;
|
||||
float dst_w = (float)texture.width * scale;
|
||||
float dst_h = (float)texture.height * scale;
|
||||
Rectangle src = {0, 0, (float)texture.width, (float)texture.height};
|
||||
Rectangle dst = {x + ((float)w - dst_w) * 0.5f, y + ((float)h - dst_h) * 0.5f, dst_w, dst_h};
|
||||
|
||||
DrawTexturePro(texture, src, dst, (Vector2){0}, 0, WHITE);
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* MODAL DIALOGS
|
||||
* ================================================================ */
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef FLINT_UI_INTERNAL_H
|
||||
#define FLINT_UI_INTERNAL_H
|
||||
|
||||
#include "flint_ui.h"
|
||||
#include "flint_clip.h"
|
||||
#include "flint_dpi.h"
|
||||
#include "flint.h"
|
||||
#include "flint_text_layout.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
extern Color c_text, c_bg, c_surface, c_circle, c_button, c_button_hover, c_icon;
|
||||
extern Camera2D g_ui_camera;
|
||||
extern Texture2D g_ui_gear_icon;
|
||||
extern Texture2D g_ui_x_icon;
|
||||
extern int g_ui_slider_active_id;
|
||||
extern int g_ui_input_blocked;
|
||||
extern int g_ui_pointer_dragging;
|
||||
extern int g_ui_pointer_owner;
|
||||
|
||||
enum {
|
||||
UI_POINTER_OWNER_NONE = 0,
|
||||
UI_POINTER_OWNER_SCROLL,
|
||||
UI_POINTER_OWNER_HORIZONTAL_SLIDER,
|
||||
UI_POINTER_OWNER_VERTICAL_SLIDER
|
||||
};
|
||||
|
||||
Vector2 ui_mouse_world(void);
|
||||
void ui_mark_clickable(void);
|
||||
void ui_mark_disabled(void);
|
||||
int ui_pointer_drag_is_horizontal(void);
|
||||
int ui_hover_effects_enabled(void);
|
||||
int ui_base_input_captures_click(Vector2 point, int include_pointer_drag);
|
||||
int ui_input_captures_click_internal(Vector2 point, int include_pointer_drag);
|
||||
void ui_push_input_clip(Rectangle bounds);
|
||||
void ui_pop_input_clip(void);
|
||||
int ui_clampi(int value, int min_value, int max_value);
|
||||
|
||||
#endif
|
||||
@@ -25,6 +25,9 @@ Návod
|
||||
[tab_settings]
|
||||
Nastavení
|
||||
---
|
||||
[tab_statistics]
|
||||
Statistiky
|
||||
---
|
||||
[play_button]
|
||||
SPUSTIT
|
||||
---
|
||||
@@ -40,8 +43,11 @@ Meditace
|
||||
[meditation_manual_title]
|
||||
Meditace
|
||||
---
|
||||
[meditation_manual_intro_text]
|
||||
Jednoduchá meditační praxe pro dech, klid a uvědomění.
|
||||
---
|
||||
[meditation_manual_text]
|
||||
Vyberte hudbu, pokud pomáhá sezení zklidnit, a pohodlně se posaďte. Nechte pozornost spočinout na dechu. Když vás myšlenky odvedou, jasně si toho všimněte a vraťte se bez úsilí. Gong označí začátek i konec.
|
||||
Vyberte hudbu, pokud chcete. Gong oznaci zacatek a konec.
|
||||
---
|
||||
[meditation_music_settings_title]
|
||||
Meditační hudba
|
||||
@@ -77,19 +83,19 @@ Síť není dostupná
|
||||
Nelze se připojit k serveru s meditačním audiem. Zkontrolujte síťová oprávnění Androidu a připojení k internetu a zkuste to znovu.
|
||||
---
|
||||
[duration_5m]
|
||||
5m
|
||||
5 min
|
||||
---
|
||||
[duration_15m]
|
||||
15m
|
||||
15 min
|
||||
---
|
||||
[duration_30m]
|
||||
30m
|
||||
30 min
|
||||
---
|
||||
[duration_1h]
|
||||
1h
|
||||
1 h
|
||||
---
|
||||
[duration_2h]
|
||||
2h
|
||||
2 h
|
||||
---
|
||||
[breath_button]
|
||||
DÝCHAT
|
||||
@@ -213,13 +219,13 @@ Pocatecni rychlost
|
||||
Upravit pocatecni rychlost
|
||||
---
|
||||
[breath_animation_label]
|
||||
Breathing animation
|
||||
Animace dýchání
|
||||
---
|
||||
[breath_animation_linear]
|
||||
Linear
|
||||
Lineární
|
||||
---
|
||||
[breath_animation_in_out]
|
||||
In / Out
|
||||
Nádech / výdech
|
||||
---
|
||||
[progressive_start_speed_editor_title]
|
||||
Pocatecni rychlost
|
||||
@@ -251,6 +257,9 @@ Kruh
|
||||
[volume_label]
|
||||
Hlasitost
|
||||
---
|
||||
[show_session_volume_control_label]
|
||||
Zobrazit ovládání hlasitosti v sezeních
|
||||
---
|
||||
[reset_to_defaults_label]
|
||||
Obnovit výchozí
|
||||
---
|
||||
@@ -303,6 +312,9 @@ Importovat data
|
||||
[import_failed]
|
||||
Import selhal
|
||||
---
|
||||
[imported_data]
|
||||
Data importována
|
||||
---
|
||||
[imported_sessions]
|
||||
Importováno %d sezení
|
||||
---
|
||||
@@ -312,26 +324,38 @@ Neplatný exportní soubor
|
||||
[import_cancelled]
|
||||
Import zrušen
|
||||
---
|
||||
[import_choice_title]
|
||||
Importovat nastavení?
|
||||
---
|
||||
[import_choice_message]
|
||||
Nalezeny data a nastavení.
|
||||
---
|
||||
[import_data_only_button]
|
||||
Data
|
||||
---
|
||||
[import_data_settings_button]
|
||||
Data+Nastavení
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
Export zrušen
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
Žádná data k exportu
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
Žádná data ke smazání
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
Smazat všechna data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
Tím se trvale smažou všechna uložená sezení.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
Mazání zrušeno
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
Smazáno %lld sezení
|
||||
---
|
||||
[toggle_off]
|
||||
VYP
|
||||
@@ -379,21 +403,20 @@ Nikdy ho nepoužívejte při řízení,
|
||||
vestoje ani ve vodě.
|
||||
---
|
||||
[tutorial_step_method]
|
||||
Stačí postupovat ve 4 krocích:
|
||||
Jednoduše postupujte podle 3 kroků:
|
||||
|
||||
1. Dýchejte rytmicky.
|
||||
1. Třicetkrát se nadechněte a vydechněte.
|
||||
2. Vydechněte a zadržte dech.
|
||||
3. Zhluboka se nadechněte a zadržte dech.
|
||||
4. Vydechněte a opakujte.
|
||||
3. Když pocítíte potřebu nadechnout se, nadechněte se a zadržte dech na 15 sekund.
|
||||
|
||||
Pomocí ikony ozubeného kola %i upravíte kola, nádechy, rychlost a pauzy.
|
||||
Vydechněte a postup opakujte.
|
||||
|
||||
Ikonou klíče %i upravíte kola, dechy, rychlost a pauzy.
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
Naplňte plíce úplně a potom nechte dech volně odejít.
|
||||
Třicetkrát se nadechněte a vydechněte.
|
||||
|
||||
Tímto posuvníkem nastavíte tempo dechového kruhu.
|
||||
|
||||
Najděte rytmus, který vám připadá přirozený.
|
||||
Najděte rytmus, který vám připadá přirozený: stabilní a rychlý, ale stále s plným dechem.
|
||||
---
|
||||
[tutorial_step_progressive_speed]
|
||||
Postupná rychlost usnadňuje vstup do prvního kola.
|
||||
@@ -401,17 +424,14 @@ Postupná rychlost usnadňuje vstup do prvního kola.
|
||||
Když je zapnutá, první kolo začne rychlostí 1 pro prvních 5 nádechů a potom se postupně zvýší na vámi vybranou rychlost.
|
||||
---
|
||||
[tutorial_step_exhale_hold]
|
||||
Po dechovém kole
|
||||
normálně vydechněte a zadržte dech.
|
||||
Po 30 deších vydechněte a zadržte dech tak dlouho, jak můžete.
|
||||
|
||||
Uvolněte se, až si tělo řekne
|
||||
o vzduch. Nenuťte to.
|
||||
Když pocítíte potřebu nadechnout se, stiskněte tlačítko DECH.
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
Plně se nadechněte a zadržte dech asi na 15 sekund.
|
||||
Plně se nadechněte a zadržte dech na 15 sekund.
|
||||
|
||||
Potom vydechněte a začněte další kolo.
|
||||
Časem může každé kolo působit hlouběji.
|
||||
Vydechněte a začne další kolo.
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
PŘESKOČIT
|
||||
@@ -455,3 +475,303 @@ Smazat toto kolo? Tuto akci nelze vrátit.
|
||||
[delete_button]
|
||||
Smazat
|
||||
---
|
||||
[meditation_music_attribution]
|
||||
Hudba od Elijah_K.
|
||||
---
|
||||
[theme_system]
|
||||
Systém
|
||||
---
|
||||
[theme_sky]
|
||||
Obloha
|
||||
---
|
||||
[theme_ocean]
|
||||
Oceán
|
||||
---
|
||||
[theme_forest]
|
||||
Les
|
||||
---
|
||||
[theme_sunset]
|
||||
Západ slunce
|
||||
---
|
||||
[theme_lavender]
|
||||
Levandule
|
||||
---
|
||||
[theme_cherry]
|
||||
Třešeň
|
||||
---
|
||||
[theme_dawn]
|
||||
Úsvit
|
||||
---
|
||||
[theme_sage]
|
||||
Šalvěj
|
||||
---
|
||||
[theme_sepia]
|
||||
Sépie
|
||||
---
|
||||
[theme_mono]
|
||||
Mono
|
||||
---
|
||||
[theme_mint]
|
||||
Máta
|
||||
---
|
||||
[theme_cobalt]
|
||||
Kobalt
|
||||
---
|
||||
[orientation_label]
|
||||
Orientace
|
||||
---
|
||||
[orientation_system]
|
||||
Systém
|
||||
---
|
||||
[orientation_portrait]
|
||||
Na výšku
|
||||
---
|
||||
[orientation_landscape]
|
||||
Na šířku
|
||||
---
|
||||
[orientation_sensor]
|
||||
Senzor
|
||||
---
|
||||
[back_button]
|
||||
Zpět
|
||||
---
|
||||
[close_button]
|
||||
Zavřít
|
||||
---
|
||||
[sync_account_title]
|
||||
Účet
|
||||
---
|
||||
[sync_configure_account_button]
|
||||
Nastavit účet
|
||||
---
|
||||
[sync_create_account_button]
|
||||
Vytvořit účet
|
||||
---
|
||||
[sync_account_created]
|
||||
Účet vytvořen
|
||||
---
|
||||
[sync_account_create_failed]
|
||||
Účet se nepodařilo vytvořit
|
||||
---
|
||||
[sync_import_key_button]
|
||||
Importovat soubor .key
|
||||
---
|
||||
[sync_import_key_dialog_title]
|
||||
Importovat klíč účtu
|
||||
---
|
||||
[sync_private_key_imported]
|
||||
Klíč účtu importován
|
||||
---
|
||||
[sync_private_key_import_failed]
|
||||
Klíč účtu se nepodařilo importovat
|
||||
---
|
||||
[sync_private_key_import_cancelled]
|
||||
Import klíče účtu zrušen
|
||||
---
|
||||
[sync_liboqs_unavailable]
|
||||
liboqs není pro tento cíl sestaveno.
|
||||
---
|
||||
[sync_public_id_label]
|
||||
Veřejné ID
|
||||
---
|
||||
[sync_copy_id_button]
|
||||
Kopírovat ID
|
||||
---
|
||||
[sync_public_id_copied]
|
||||
Veřejné ID zkopírováno
|
||||
---
|
||||
[sync_backup_key_button]
|
||||
Zálohovat klíč
|
||||
---
|
||||
[sync_remote_label]
|
||||
Vzdálený server
|
||||
---
|
||||
[sync_connect_button]
|
||||
Připojit
|
||||
---
|
||||
[sync_connected_button]
|
||||
Připojeno
|
||||
---
|
||||
[sync_server_url_invalid]
|
||||
Použijte https:// nebo loopback jako localhost:8080
|
||||
---
|
||||
[sync_server_saved]
|
||||
Synchronizační server uložen
|
||||
---
|
||||
[sync_connected]
|
||||
Vzdálená synchronizace dokončena
|
||||
---
|
||||
[sync_failed]
|
||||
Vzdálená synchronizace selhala
|
||||
---
|
||||
[sync_unavailable]
|
||||
Vzdálená synchronizace není na této platformě dostupná
|
||||
---
|
||||
[sync_no_account]
|
||||
Před připojením vytvořte účet
|
||||
---
|
||||
[sync_auth_failed]
|
||||
Vzdálený server odmítl tento účet
|
||||
---
|
||||
[sync_backup_warning]
|
||||
Uložte tento soukromý klíč někam, kde jej máte pod kontrolou. Kdokoli s ním může převzít tento účet.
|
||||
---
|
||||
[sync_backup_title]
|
||||
Zálohovat klíč účtu
|
||||
---
|
||||
[sync_save_key_file_button]
|
||||
Uložit soubor .key
|
||||
---
|
||||
[sync_save_key_dialog_title]
|
||||
Uložit klíč účtu
|
||||
---
|
||||
[sync_private_key_backup_saved]
|
||||
Záloha klíče účtu uložena
|
||||
---
|
||||
[sync_private_key_backup_failed]
|
||||
Zálohu klíče účtu se nepodařilo uložit
|
||||
---
|
||||
[sync_private_key_backup_cancelled]
|
||||
Záloha klíče účtu zrušena
|
||||
---
|
||||
[sync_delete_account_button]
|
||||
Smazat účet
|
||||
---
|
||||
[sync_delete_account_title]
|
||||
Smazat účet?
|
||||
---
|
||||
[sync_delete_account_message]
|
||||
Smazat tento účet ze vzdáleného serveru a z tohoto zařízení? Tuto akci nelze vrátit zpět.
|
||||
---
|
||||
[sync_account_deleted]
|
||||
Účet smazán
|
||||
---
|
||||
[sync_account_delete_cancelled]
|
||||
Smazání účtu zrušeno
|
||||
---
|
||||
[habit_new_default_name]
|
||||
Nový návyk
|
||||
---
|
||||
[habit_new_title]
|
||||
Nový návyk
|
||||
---
|
||||
[habit_edit_title]
|
||||
Upravit návyk
|
||||
---
|
||||
[habit_name_label]
|
||||
Název
|
||||
---
|
||||
[habit_underline_label]
|
||||
Podtržení
|
||||
---
|
||||
[habit_practice_list_title]
|
||||
Seznam cvičení
|
||||
---
|
||||
[habit_practice_list_info]
|
||||
Propojte tento návyk se cvičeními. Dny s odpovídajícími záznamy se zobrazí jako splněné a mohou otevřít editor sezení.
|
||||
---
|
||||
[habit_counting_title]
|
||||
Počítání
|
||||
---
|
||||
[habit_counting_info]
|
||||
Více počtů umožní uložit v jednom dni více než jeden záznam. Nechte vypnuto pro jednoduché sledování splněno nebo nesplněno.
|
||||
---
|
||||
[habit_multiple_counts_label]
|
||||
Více počtů
|
||||
---
|
||||
[habit_delete_title]
|
||||
Smazat návyk?
|
||||
---
|
||||
[habit_delete_message]
|
||||
Smazat tento návyk? Tuto akci nelze vrátit zpět.
|
||||
---
|
||||
[habit_delete_button]
|
||||
Smazat návyk
|
||||
---
|
||||
[habit_add_new_option]
|
||||
Přidat nový návyk
|
||||
---
|
||||
[habit_load_more_button]
|
||||
Načíst další
|
||||
---
|
||||
[habit_empty_title]
|
||||
Nejsou vytvořeny žádné návyky
|
||||
---
|
||||
[habit_create_button]
|
||||
Vytvořit návyk
|
||||
---
|
||||
[habit_stats_no_rounds_week]
|
||||
Za poslední týden nejsou žádná kola
|
||||
---
|
||||
[habit_stats_current_streak]
|
||||
Aktuální série
|
||||
---
|
||||
[habit_stats_last_30_days]
|
||||
Posledních 30 dní
|
||||
---
|
||||
[habit_stats_wim_hof_hold_rounds]
|
||||
Kola zádrže dechu Wim Hof
|
||||
---
|
||||
[habit_stats_weekday_pattern]
|
||||
Vzorec podle dnů v týdnu
|
||||
---
|
||||
[habit_stats_practice_time]
|
||||
Čas cvičení
|
||||
---
|
||||
[habit_stats_best_hold]
|
||||
Nejlepší zádrž
|
||||
---
|
||||
[habit_stats_total_hold]
|
||||
Celková zádrž
|
||||
---
|
||||
[habit_stats_best_streak]
|
||||
Nejlepší série
|
||||
---
|
||||
[bottom_nav_customize_button]
|
||||
Upravit spodní navigaci
|
||||
---
|
||||
[bottom_nav_customize_title]
|
||||
Spodní navigace
|
||||
---
|
||||
[bottom_nav_add_button]
|
||||
Přidat položku
|
||||
---
|
||||
[bottom_nav_slot_1]
|
||||
Položka 1
|
||||
---
|
||||
[bottom_nav_slot_2]
|
||||
Položka 2
|
||||
---
|
||||
[bottom_nav_slot_3]
|
||||
Položka 3
|
||||
---
|
||||
[bottom_nav_slot_4]
|
||||
Položka 4
|
||||
---
|
||||
[bottom_nav_slot_5]
|
||||
Položka 5
|
||||
---
|
||||
[bottom_nav_slot_6]
|
||||
Položka 6
|
||||
---
|
||||
[bottom_nav_slot_7]
|
||||
Položka 7
|
||||
---
|
||||
[bottom_nav_slot_8]
|
||||
Položka 8
|
||||
---
|
||||
[reset_button]
|
||||
Obnovit
|
||||
---
|
||||
[practice_guide_dropdown]
|
||||
Zde si vyberte praxi.
|
||||
---
|
||||
[practice_guide_manual]
|
||||
Pred zahajenim praxe si prectete navod, abyste porozumeli celemu cviceni.
|
||||
---
|
||||
[practice_guide_sun]
|
||||
Az budete pripraveni zacit cviceni, pouzijte kartu se sluncem.
|
||||
---
|
||||
[practice_guide_config]
|
||||
Upravte konfiguraci praxe podle svych potreb.
|
||||
---
|
||||
@@ -20,11 +20,14 @@ Erledigt
|
||||
Markieren
|
||||
---
|
||||
[tab_manual]
|
||||
Tutorial
|
||||
Anleitung
|
||||
---
|
||||
[tab_settings]
|
||||
Einstellungen
|
||||
---
|
||||
[tab_statistics]
|
||||
Statistiken
|
||||
---
|
||||
[play_button]
|
||||
START
|
||||
---
|
||||
@@ -40,8 +43,11 @@ Meditation
|
||||
[meditation_manual_title]
|
||||
Meditation
|
||||
---
|
||||
[meditation_manual_intro_text]
|
||||
Eine einfache Meditationspraxis für Atem, Ruhe und Achtsamkeit.
|
||||
---
|
||||
[meditation_manual_text]
|
||||
Wähle Musik, wenn sie die Sitzung ruhiger macht, und setze dich bequem hin. Lass die Aufmerksamkeit auf dem Atem ruhen. Wenn Gedanken dich wegziehen, bemerke es klar und kehre ohne Druck zurück. Ein Gong markiert Anfang und Ende.
|
||||
Wahlen Sie Musik, wenn Sie mochten. Ein Gong markiert Anfang und Ende.
|
||||
---
|
||||
[meditation_music_settings_title]
|
||||
Meditationsmusik
|
||||
@@ -77,19 +83,19 @@ Netzwerk nicht verfügbar
|
||||
Der Meditations-Audioserver konnte nicht erreicht werden. Prüfe die Android-Netzwerkberechtigungen und deine Internetverbindung und versuche es erneut.
|
||||
---
|
||||
[duration_5m]
|
||||
5m
|
||||
5 Min.
|
||||
---
|
||||
[duration_15m]
|
||||
15m
|
||||
15 Min.
|
||||
---
|
||||
[duration_30m]
|
||||
30m
|
||||
30 Min.
|
||||
---
|
||||
[duration_1h]
|
||||
1h
|
||||
1 Std.
|
||||
---
|
||||
[duration_2h]
|
||||
2h
|
||||
2 Std.
|
||||
---
|
||||
[breath_button]
|
||||
ATEM
|
||||
@@ -213,13 +219,13 @@ Startgeschwindigkeit
|
||||
Startgeschwindigkeit andern
|
||||
---
|
||||
[breath_animation_label]
|
||||
Breathing animation
|
||||
Atemanimation
|
||||
---
|
||||
[breath_animation_linear]
|
||||
Linear
|
||||
Gleichmäßig
|
||||
---
|
||||
[breath_animation_in_out]
|
||||
In / Out
|
||||
Ein / Aus
|
||||
---
|
||||
[progressive_start_speed_editor_title]
|
||||
Startgeschwindigkeit
|
||||
@@ -251,6 +257,9 @@ Kreis
|
||||
[volume_label]
|
||||
Lautstärke
|
||||
---
|
||||
[show_session_volume_control_label]
|
||||
Lautstärkeregler in Sitzungen anzeigen
|
||||
---
|
||||
[reset_to_defaults_label]
|
||||
Auf Standard zurücksetzen
|
||||
---
|
||||
@@ -303,6 +312,9 @@ Daten importieren
|
||||
[import_failed]
|
||||
Import fehlgeschlagen
|
||||
---
|
||||
[imported_data]
|
||||
Daten importiert
|
||||
---
|
||||
[imported_sessions]
|
||||
%d Sitzungen importiert
|
||||
---
|
||||
@@ -310,28 +322,40 @@ Import fehlgeschlagen
|
||||
Ungültige Exportdatei
|
||||
---
|
||||
[import_cancelled]
|
||||
Import cancelled
|
||||
Import abgebrochen
|
||||
---
|
||||
[import_choice_title]
|
||||
Einstellungen importieren?
|
||||
---
|
||||
[import_choice_message]
|
||||
Daten und Einstellungen gefunden.
|
||||
---
|
||||
[import_data_only_button]
|
||||
Daten
|
||||
---
|
||||
[import_data_settings_button]
|
||||
Daten+Einstellungen
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
Export abgebrochen
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
Keine Daten zum Exportieren
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
Keine Daten zum Löschen
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
Alle Daten löschen?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
Dadurch werden alle gespeicherten Sitzungen dauerhaft gelöscht.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
Löschen abgebrochen
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
%lld Sitzungen gelöscht
|
||||
---
|
||||
[toggle_off]
|
||||
AUS
|
||||
@@ -379,21 +403,20 @@ Benutzen Sie sie niemals beim Fahren,
|
||||
Stehen oder im Wasser.
|
||||
---
|
||||
[tutorial_step_method]
|
||||
Folgen Sie einfach 4 Schritten:
|
||||
Folge einfach 3 Schritten:
|
||||
|
||||
1. Atmen Sie rhythmisch.
|
||||
2. Atmen Sie aus und halten Sie.
|
||||
3. Atmen Sie tief ein und halten Sie.
|
||||
4. Atmen Sie aus und wiederholen Sie.
|
||||
1. Atme 30 Mal ein und aus.
|
||||
2. Atme aus und halte.
|
||||
3. Wenn du den Drang zu atmen spürst, atme ein und halte 15 Sekunden.
|
||||
|
||||
Nutzen Sie das Schraubenschlüssel-Symbol %i, um Runden, Atemzüge, Geschwindigkeit und Pausen anzupassen.
|
||||
Atme aus und wiederhole den Ablauf.
|
||||
|
||||
Mit dem Schraubenschlüssel-Symbol %i passt du Runden, Atemzüge, Tempo und Pausen an.
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
Füllen Sie Ihre Lungen vollständig, dann lassen Sie den Atem herausfließen.
|
||||
Atme 30 Mal ein und aus.
|
||||
|
||||
Nutzen Sie diesen Schieberegler, um das Tempo des Atemkreises einzustellen.
|
||||
|
||||
Finden Sie einen Rhythmus, der sich natürlich für Sie anfühlt.
|
||||
Finde einen Rhythmus, der sich natürlich anfühlt: gleichmäßig und schnell, aber weiterhin vollständig.
|
||||
---
|
||||
[tutorial_step_progressive_speed]
|
||||
Progressive Geschwindigkeit macht den Einstieg in die erste Runde leichter.
|
||||
@@ -401,20 +424,17 @@ Progressive Geschwindigkeit macht den Einstieg in die erste Runde leichter.
|
||||
Wenn sie aktiviert ist, beginnt die erste Runde bei Geschwindigkeit 1 für die ersten 5 Atemzüge und steigt dann schrittweise auf Ihre gewählte Geschwindigkeit.
|
||||
---
|
||||
[tutorial_step_exhale_hold]
|
||||
Nach der Atemrunde,
|
||||
atmen Sie normal aus und halten Sie.
|
||||
Atme nach 30 Atemzügen aus und halte so lange du kannst.
|
||||
|
||||
Lassen Sie los, wenn Ihr Körper
|
||||
nach Luft verlangt. Zwängen Sie es nicht.
|
||||
Wenn du den Drang zu atmen spürst, drücke die ATEM-Taste.
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
Atmen Sie vollständig ein und halten Sie etwa 15 Sekunden.
|
||||
Atme vollständig ein und halte 15 Sekunden.
|
||||
|
||||
Dann atmen Sie aus und beginnen die nächste Runde.
|
||||
Mit der Zeit kann sich jede Runde tiefer anfühlen.
|
||||
Atme aus, dann beginnt die nächste Runde.
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
SKIP
|
||||
ÜBERSPRINGEN
|
||||
---
|
||||
[tutorial_back_button]
|
||||
ZURÜCK
|
||||
@@ -455,3 +475,303 @@ Diese Runde löschen? Das kann nicht rückgängig gemacht werden.
|
||||
[delete_button]
|
||||
Löschen
|
||||
---
|
||||
[meditation_music_attribution]
|
||||
Musik von Elijah_K.
|
||||
---
|
||||
[theme_system]
|
||||
System
|
||||
---
|
||||
[theme_sky]
|
||||
Himmel
|
||||
---
|
||||
[theme_ocean]
|
||||
Ozean
|
||||
---
|
||||
[theme_forest]
|
||||
Wald
|
||||
---
|
||||
[theme_sunset]
|
||||
Sonnenuntergang
|
||||
---
|
||||
[theme_lavender]
|
||||
Lavendel
|
||||
---
|
||||
[theme_cherry]
|
||||
Kirsche
|
||||
---
|
||||
[theme_dawn]
|
||||
Morgenrot
|
||||
---
|
||||
[theme_sage]
|
||||
Salbei
|
||||
---
|
||||
[theme_sepia]
|
||||
Sepia
|
||||
---
|
||||
[theme_mono]
|
||||
Mono
|
||||
---
|
||||
[theme_mint]
|
||||
Minze
|
||||
---
|
||||
[theme_cobalt]
|
||||
Kobalt
|
||||
---
|
||||
[orientation_label]
|
||||
Ausrichtung
|
||||
---
|
||||
[orientation_system]
|
||||
System
|
||||
---
|
||||
[orientation_portrait]
|
||||
Hochformat
|
||||
---
|
||||
[orientation_landscape]
|
||||
Querformat
|
||||
---
|
||||
[orientation_sensor]
|
||||
Sensor
|
||||
---
|
||||
[back_button]
|
||||
Zurück
|
||||
---
|
||||
[close_button]
|
||||
Schließen
|
||||
---
|
||||
[sync_account_title]
|
||||
Konto
|
||||
---
|
||||
[sync_configure_account_button]
|
||||
Konto einrichten
|
||||
---
|
||||
[sync_create_account_button]
|
||||
Konto erstellen
|
||||
---
|
||||
[sync_account_created]
|
||||
Konto erstellt
|
||||
---
|
||||
[sync_account_create_failed]
|
||||
Konto konnte nicht erstellt werden
|
||||
---
|
||||
[sync_import_key_button]
|
||||
.key-Datei importieren
|
||||
---
|
||||
[sync_import_key_dialog_title]
|
||||
Kontoschlüssel importieren
|
||||
---
|
||||
[sync_private_key_imported]
|
||||
Kontoschlüssel importiert
|
||||
---
|
||||
[sync_private_key_import_failed]
|
||||
Kontoschlüssel konnte nicht importiert werden
|
||||
---
|
||||
[sync_private_key_import_cancelled]
|
||||
Import des Kontoschlüssels abgebrochen
|
||||
---
|
||||
[sync_liboqs_unavailable]
|
||||
liboqs ist für dieses Ziel nicht gebaut.
|
||||
---
|
||||
[sync_public_id_label]
|
||||
Öffentliche ID
|
||||
---
|
||||
[sync_copy_id_button]
|
||||
ID kopieren
|
||||
---
|
||||
[sync_public_id_copied]
|
||||
Öffentliche ID kopiert
|
||||
---
|
||||
[sync_backup_key_button]
|
||||
Schlüssel sichern
|
||||
---
|
||||
[sync_remote_label]
|
||||
Server
|
||||
---
|
||||
[sync_connect_button]
|
||||
Verbinden
|
||||
---
|
||||
[sync_connected_button]
|
||||
Verbunden
|
||||
---
|
||||
[sync_server_url_invalid]
|
||||
Nutze https:// oder Loopback wie localhost:8080
|
||||
---
|
||||
[sync_server_saved]
|
||||
Sync-Server gespeichert
|
||||
---
|
||||
[sync_connected]
|
||||
Remote-Sync abgeschlossen
|
||||
---
|
||||
[sync_failed]
|
||||
Remote-Sync fehlgeschlagen
|
||||
---
|
||||
[sync_unavailable]
|
||||
Remote-Sync ist auf dieser Plattform nicht verfügbar
|
||||
---
|
||||
[sync_no_account]
|
||||
Erstelle ein Konto, bevor du dich verbindest
|
||||
---
|
||||
[sync_auth_failed]
|
||||
Remote hat dieses Konto abgelehnt
|
||||
---
|
||||
[sync_backup_warning]
|
||||
Speichere diesen privaten Schlüssel an einem Ort, den du kontrollierst. Jeder mit diesem Schlüssel kann dieses Konto übernehmen.
|
||||
---
|
||||
[sync_backup_title]
|
||||
Kontoschlüssel sichern
|
||||
---
|
||||
[sync_save_key_file_button]
|
||||
.key-Datei speichern
|
||||
---
|
||||
[sync_save_key_dialog_title]
|
||||
Kontoschlüssel speichern
|
||||
---
|
||||
[sync_private_key_backup_saved]
|
||||
Kontoschlüssel-Sicherung gespeichert
|
||||
---
|
||||
[sync_private_key_backup_failed]
|
||||
Kontoschlüssel-Sicherung konnte nicht gespeichert werden
|
||||
---
|
||||
[sync_private_key_backup_cancelled]
|
||||
Kontoschlüssel-Sicherung abgebrochen
|
||||
---
|
||||
[sync_delete_account_button]
|
||||
Konto löschen
|
||||
---
|
||||
[sync_delete_account_title]
|
||||
Konto löschen?
|
||||
---
|
||||
[sync_delete_account_message]
|
||||
Dieses Konto vom Remote-Server und von diesem Gerät löschen? Das kann nicht rückgängig gemacht werden.
|
||||
---
|
||||
[sync_account_deleted]
|
||||
Konto gelöscht
|
||||
---
|
||||
[sync_account_delete_cancelled]
|
||||
Kontolöschung abgebrochen
|
||||
---
|
||||
[habit_new_default_name]
|
||||
Neue Gewohnheit
|
||||
---
|
||||
[habit_new_title]
|
||||
Neue Gewohnheit
|
||||
---
|
||||
[habit_edit_title]
|
||||
Gewohnheit bearbeiten
|
||||
---
|
||||
[habit_name_label]
|
||||
Bezeichnung
|
||||
---
|
||||
[habit_underline_label]
|
||||
Unterstreichung
|
||||
---
|
||||
[habit_practice_list_title]
|
||||
Übungsliste
|
||||
---
|
||||
[habit_practice_list_info]
|
||||
Verknüpfe diese Gewohnheit mit Übungssitzungen. Tage mit passenden Sitzungen werden als erledigt angezeigt und können den Sitzungseditor öffnen.
|
||||
---
|
||||
[habit_counting_title]
|
||||
Zählen
|
||||
---
|
||||
[habit_counting_info]
|
||||
Mehrfachzählungen erlauben mehr als einen Eintrag pro Tag. Lass es aus für einfaches Erledigt-oder-nicht-Tracking.
|
||||
---
|
||||
[habit_multiple_counts_label]
|
||||
Mehrfachzählungen
|
||||
---
|
||||
[habit_delete_title]
|
||||
Gewohnheit löschen?
|
||||
---
|
||||
[habit_delete_message]
|
||||
Diese Gewohnheit löschen? Das kann nicht rückgängig gemacht werden.
|
||||
---
|
||||
[habit_delete_button]
|
||||
Gewohnheit löschen
|
||||
---
|
||||
[habit_add_new_option]
|
||||
Neue Gewohnheit hinzufügen
|
||||
---
|
||||
[habit_load_more_button]
|
||||
Mehr laden
|
||||
---
|
||||
[habit_empty_title]
|
||||
Keine Gewohnheiten erstellt
|
||||
---
|
||||
[habit_create_button]
|
||||
Gewohnheit erstellen
|
||||
---
|
||||
[habit_stats_no_rounds_week]
|
||||
Keine Runden in der letzten Woche
|
||||
---
|
||||
[habit_stats_current_streak]
|
||||
Aktuelle Serie
|
||||
---
|
||||
[habit_stats_last_30_days]
|
||||
Letzte 30 Tage
|
||||
---
|
||||
[habit_stats_wim_hof_hold_rounds]
|
||||
Wim-Hof-Atemhalte-Runden
|
||||
---
|
||||
[habit_stats_weekday_pattern]
|
||||
Wochentagsmuster
|
||||
---
|
||||
[habit_stats_practice_time]
|
||||
Übungszeit
|
||||
---
|
||||
[habit_stats_best_hold]
|
||||
Beste Atemhaltezeit
|
||||
---
|
||||
[habit_stats_total_hold]
|
||||
Gesamte Atemhaltezeit
|
||||
---
|
||||
[habit_stats_best_streak]
|
||||
Beste Serie
|
||||
---
|
||||
[bottom_nav_customize_button]
|
||||
Untere Navigation anpassen
|
||||
---
|
||||
[bottom_nav_customize_title]
|
||||
Untere Navigation
|
||||
---
|
||||
[bottom_nav_add_button]
|
||||
Eintrag hinzufügen
|
||||
---
|
||||
[bottom_nav_slot_1]
|
||||
Eintrag 1
|
||||
---
|
||||
[bottom_nav_slot_2]
|
||||
Eintrag 2
|
||||
---
|
||||
[bottom_nav_slot_3]
|
||||
Eintrag 3
|
||||
---
|
||||
[bottom_nav_slot_4]
|
||||
Eintrag 4
|
||||
---
|
||||
[bottom_nav_slot_5]
|
||||
Eintrag 5
|
||||
---
|
||||
[bottom_nav_slot_6]
|
||||
Eintrag 6
|
||||
---
|
||||
[bottom_nav_slot_7]
|
||||
Eintrag 7
|
||||
---
|
||||
[bottom_nav_slot_8]
|
||||
Eintrag 8
|
||||
---
|
||||
[reset_button]
|
||||
Zurücksetzen
|
||||
---
|
||||
[practice_guide_dropdown]
|
||||
Wahle hier deine Praxis aus.
|
||||
---
|
||||
[practice_guide_manual]
|
||||
Lies das Tutorial, bevor du eine Praxis startest, damit du die ganze Uebung verstehst.
|
||||
---
|
||||
[practice_guide_sun]
|
||||
Nutze den Sonnen-Tab, wenn du bereit bist, die Uebung zu starten.
|
||||
---
|
||||
[practice_guide_config]
|
||||
Passe die Konfiguration der Praxis an deine Anforderungen an.
|
||||
---
|
||||
@@ -25,6 +25,9 @@ Tutorial
|
||||
[tab_settings]
|
||||
Settings
|
||||
---
|
||||
[tab_statistics]
|
||||
Statistics
|
||||
---
|
||||
[play_button]
|
||||
PLAY
|
||||
---
|
||||
@@ -40,8 +43,11 @@ Meditation
|
||||
[meditation_manual_title]
|
||||
Meditation
|
||||
---
|
||||
[meditation_manual_intro_text]
|
||||
Settle into a quiet seat and let this session be simple: arrive, breathe, and begin.
|
||||
---
|
||||
[meditation_manual_text]
|
||||
Choose music if it helps the session feel steady, then sit comfortably. Let attention rest on the breath. When thoughts pull you away, notice that clearly and return without force. A gong marks the beginning and end.
|
||||
Choose music if you want it. A gong marks the beginning and end.
|
||||
---
|
||||
[meditation_music_settings_title]
|
||||
Meditation Music
|
||||
@@ -206,6 +212,42 @@ Theme mode
|
||||
[theme_system]
|
||||
System
|
||||
---
|
||||
[theme_sky]
|
||||
Sky
|
||||
---
|
||||
[theme_ocean]
|
||||
Ocean
|
||||
---
|
||||
[theme_forest]
|
||||
Forest
|
||||
---
|
||||
[theme_sunset]
|
||||
Sunset
|
||||
---
|
||||
[theme_lavender]
|
||||
Lavender
|
||||
---
|
||||
[theme_cherry]
|
||||
Cherry
|
||||
---
|
||||
[theme_dawn]
|
||||
Dawn
|
||||
---
|
||||
[theme_sage]
|
||||
Sage
|
||||
---
|
||||
[theme_sepia]
|
||||
Sepia
|
||||
---
|
||||
[theme_mono]
|
||||
Mono
|
||||
---
|
||||
[theme_mint]
|
||||
Mint
|
||||
---
|
||||
[theme_cobalt]
|
||||
Cobalt
|
||||
---
|
||||
[orientation_label]
|
||||
Orientation
|
||||
---
|
||||
@@ -272,6 +314,9 @@ Circle
|
||||
[volume_label]
|
||||
Volume
|
||||
---
|
||||
[show_session_volume_control_label]
|
||||
Show volume control in sessions
|
||||
---
|
||||
[reset_to_defaults_label]
|
||||
Reset to defaults
|
||||
---
|
||||
@@ -324,6 +369,9 @@ Import Data
|
||||
[import_failed]
|
||||
Import failed
|
||||
---
|
||||
[imported_data]
|
||||
Imported data
|
||||
---
|
||||
[imported_sessions]
|
||||
Imported %d sessions
|
||||
---
|
||||
@@ -333,6 +381,18 @@ Invalid export file
|
||||
[import_cancelled]
|
||||
Import cancelled
|
||||
---
|
||||
[import_choice_title]
|
||||
Import settings?
|
||||
---
|
||||
[import_choice_message]
|
||||
Data and settings found.
|
||||
---
|
||||
[import_data_only_button]
|
||||
Data
|
||||
---
|
||||
[import_data_settings_button]
|
||||
Data+Settings
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
@@ -400,21 +460,20 @@ Never use it while driving,
|
||||
standing, or in water.
|
||||
---
|
||||
[tutorial_step_method]
|
||||
Simply follow 4 steps:
|
||||
Simply follow 3 steps:
|
||||
|
||||
1. Breathe rhythmically.
|
||||
1. Breathe in and out 30 times.
|
||||
2. Exhale and hold.
|
||||
3. Inhale deeply and hold.
|
||||
4. Exhale and repeat.
|
||||
3. When you feel the urge to breathe, breathe in and hold for 15 seconds.
|
||||
|
||||
Exhale, then repeat the process.
|
||||
|
||||
Use the wrench icon %i to adjust rounds, breaths, speed, and pauses.
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
Fill your lungs fully, then let the breath flow out.
|
||||
Breathe in and out 30 times.
|
||||
|
||||
Use this slider to set the pace of the breathing circle.
|
||||
|
||||
Find a rhythm that feels natural for you.
|
||||
Find a rhythm that feels natural to you: steady and quick, while still breathing fully.
|
||||
---
|
||||
[tutorial_step_progressive_speed]
|
||||
Progressive speed makes the first round easier to enter.
|
||||
@@ -422,17 +481,14 @@ Progressive speed makes the first round easier to enter.
|
||||
When it is on, the first round starts slower, then gradually increases to your selected speed.
|
||||
---
|
||||
[tutorial_step_exhale_hold]
|
||||
Exhale normally and hold.
|
||||
After 30 breaths, exhale and hold as long as you can.
|
||||
|
||||
The center number keeps counting. Circle mode adds layered progress lines.
|
||||
|
||||
Release when your body asks for air.
|
||||
When you feel the urge to breathe, press the BREATH button.
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
Inhale fully and hold for about 15 seconds.
|
||||
Inhale fully and hold for 15 seconds.
|
||||
|
||||
Then exhale and begin the next round.
|
||||
Over time, each round may feel deeper.
|
||||
Exhale, and the next round will begin.
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
SKIP
|
||||
@@ -476,3 +532,247 @@ Delete this round? This cannot be undone.
|
||||
[delete_button]
|
||||
Delete
|
||||
---
|
||||
[back_button]
|
||||
Back
|
||||
---
|
||||
[close_button]
|
||||
Close
|
||||
---
|
||||
[sync_account_title]
|
||||
Account
|
||||
---
|
||||
[sync_configure_account_button]
|
||||
Configure Account
|
||||
---
|
||||
[sync_create_account_button]
|
||||
Create Account
|
||||
---
|
||||
[sync_account_created]
|
||||
Account created
|
||||
---
|
||||
[sync_account_create_failed]
|
||||
Could not create account
|
||||
---
|
||||
[sync_import_key_button]
|
||||
Import .key File
|
||||
---
|
||||
[sync_import_key_dialog_title]
|
||||
Import Account Key
|
||||
---
|
||||
[sync_private_key_imported]
|
||||
Account key imported
|
||||
---
|
||||
[sync_private_key_import_failed]
|
||||
Could not import account key
|
||||
---
|
||||
[sync_private_key_import_cancelled]
|
||||
Account key import cancelled
|
||||
---
|
||||
[sync_liboqs_unavailable]
|
||||
liboqs is not built for this target.
|
||||
---
|
||||
[sync_public_id_label]
|
||||
Public ID
|
||||
---
|
||||
[sync_copy_id_button]
|
||||
Copy ID
|
||||
---
|
||||
[sync_public_id_copied]
|
||||
Public ID copied
|
||||
---
|
||||
[sync_backup_key_button]
|
||||
Backup Key
|
||||
---
|
||||
[sync_remote_label]
|
||||
Remote
|
||||
---
|
||||
[sync_connect_button]
|
||||
Connect
|
||||
---
|
||||
[sync_connected_button]
|
||||
Connected
|
||||
---
|
||||
[sync_server_url_invalid]
|
||||
Use https:// or loopback like localhost:8080
|
||||
---
|
||||
[sync_server_saved]
|
||||
Sync server saved
|
||||
---
|
||||
[sync_connected]
|
||||
Remote sync complete
|
||||
---
|
||||
[sync_failed]
|
||||
Remote sync failed
|
||||
---
|
||||
[sync_unavailable]
|
||||
Remote sync is not available on this platform
|
||||
---
|
||||
[sync_no_account]
|
||||
Create an account before connecting
|
||||
---
|
||||
[sync_auth_failed]
|
||||
Remote rejected this account
|
||||
---
|
||||
[sync_backup_warning]
|
||||
Save this private key somewhere you control. Anyone with it can claim this account.
|
||||
---
|
||||
[sync_backup_title]
|
||||
Backup Account Key
|
||||
---
|
||||
[sync_save_key_file_button]
|
||||
Save .key File
|
||||
---
|
||||
[sync_save_key_dialog_title]
|
||||
Save Account Key
|
||||
---
|
||||
[sync_private_key_backup_saved]
|
||||
Account key backup saved
|
||||
---
|
||||
[sync_private_key_backup_failed]
|
||||
Could not save account key backup
|
||||
---
|
||||
[sync_private_key_backup_cancelled]
|
||||
Account key backup cancelled
|
||||
---
|
||||
[sync_delete_account_button]
|
||||
Delete Account
|
||||
---
|
||||
[sync_delete_account_title]
|
||||
Delete Account?
|
||||
---
|
||||
[sync_delete_account_message]
|
||||
Delete this account from the remote server and this device? This cannot be undone.
|
||||
|
||||
---
|
||||
[sync_account_deleted]
|
||||
Account deleted
|
||||
---
|
||||
[sync_account_delete_cancelled]
|
||||
Account deletion cancelled
|
||||
---
|
||||
[habit_new_default_name]
|
||||
New Habit
|
||||
---
|
||||
[habit_new_title]
|
||||
New Habit
|
||||
---
|
||||
[habit_edit_title]
|
||||
Edit Habit
|
||||
---
|
||||
[habit_name_label]
|
||||
Name
|
||||
---
|
||||
[habit_underline_label]
|
||||
Underline
|
||||
---
|
||||
[habit_practice_list_title]
|
||||
Practice list
|
||||
---
|
||||
[habit_practice_list_info]
|
||||
Link this habit to practice sessions. Days with matching sessions will show as completed and can open the session editor.
|
||||
---
|
||||
[habit_counting_title]
|
||||
Counting
|
||||
---
|
||||
[habit_counting_info]
|
||||
Multiple counts lets one day store more than one count. Leave it off for simple done or not done habit tracking.
|
||||
---
|
||||
[habit_multiple_counts_label]
|
||||
Multiple counts
|
||||
---
|
||||
[habit_delete_title]
|
||||
Delete habit?
|
||||
---
|
||||
[habit_delete_message]
|
||||
Delete this habit? This cannot be undone.
|
||||
---
|
||||
[habit_delete_button]
|
||||
Delete Habit
|
||||
---
|
||||
[habit_add_new_option]
|
||||
Add new habit
|
||||
---
|
||||
[habit_load_more_button]
|
||||
Load more
|
||||
---
|
||||
[habit_empty_title]
|
||||
No habits created
|
||||
---
|
||||
[habit_create_button]
|
||||
Create habit
|
||||
---
|
||||
[habit_stats_no_rounds_week]
|
||||
No rounds in the last week
|
||||
---
|
||||
[habit_stats_current_streak]
|
||||
Current streak
|
||||
---
|
||||
[habit_stats_last_30_days]
|
||||
Last 30 days
|
||||
---
|
||||
[habit_stats_wim_hof_hold_rounds]
|
||||
Wim Hof hold rounds
|
||||
---
|
||||
[habit_stats_weekday_pattern]
|
||||
Weekday pattern
|
||||
---
|
||||
[habit_stats_practice_time]
|
||||
Practice time
|
||||
---
|
||||
[habit_stats_best_hold]
|
||||
Best hold
|
||||
---
|
||||
[habit_stats_total_hold]
|
||||
Total hold
|
||||
---
|
||||
[habit_stats_best_streak]
|
||||
Best streak
|
||||
---
|
||||
[bottom_nav_customize_button]
|
||||
Customize bottom navigation
|
||||
---
|
||||
[bottom_nav_customize_title]
|
||||
Bottom Navigation
|
||||
---
|
||||
[bottom_nav_add_button]
|
||||
Add item
|
||||
---
|
||||
[bottom_nav_slot_1]
|
||||
Item 1
|
||||
---
|
||||
[bottom_nav_slot_2]
|
||||
Item 2
|
||||
---
|
||||
[bottom_nav_slot_3]
|
||||
Item 3
|
||||
---
|
||||
[bottom_nav_slot_4]
|
||||
Item 4
|
||||
---
|
||||
[bottom_nav_slot_5]
|
||||
Item 5
|
||||
---
|
||||
[bottom_nav_slot_6]
|
||||
Item 6
|
||||
---
|
||||
[bottom_nav_slot_7]
|
||||
Item 7
|
||||
---
|
||||
[bottom_nav_slot_8]
|
||||
Item 8
|
||||
---
|
||||
[reset_button]
|
||||
Reset
|
||||
---
|
||||
[practice_guide_dropdown]
|
||||
Choose your practice here.
|
||||
---
|
||||
[practice_guide_manual]
|
||||
Read the tutorial before starting a practice so you understand the full exercise.
|
||||
---
|
||||
[practice_guide_sun]
|
||||
Use the sun tab when you are ready to start the exercise.
|
||||
---
|
||||
[practice_guide_config]
|
||||
Change the practice configuration to meet your standards.
|
||||
---
|
||||