Add themes and fullscreen scaling
No files matched your search
@@ -0,0 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [waozixyz]
|
||||
liberapay: waozi
|
||||
@@ -0,0 +1,168 @@
|
||||
name: Android Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
unsigned-release:
|
||||
name: Build Unsigned Release APK (F-Droid)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x droid/gradlew
|
||||
|
||||
- name: Build Release APK (unsigned)
|
||||
working-directory: ./droid
|
||||
run: ./gradlew assembleRelease --stacktrace
|
||||
|
||||
- name: Rename APKs
|
||||
run: |
|
||||
# Get universal APK
|
||||
find droid/app/build/outputs/apk/release -name "*-universal-release.apk" -exec cp {} inbe-release-universal.apk \; 2>/dev/null || true
|
||||
# Get any release APK as fallback
|
||||
find droid/app/build/outputs/apk/release -name "*.apk" -exec cp {} inbe-release.apk \; 2>/dev/null || true
|
||||
|
||||
- name: Upload Unsigned APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: unsigned-release-apk
|
||||
path: |
|
||||
inbe-release-universal.apk
|
||||
inbe-release.apk
|
||||
if-no-files-found: warn
|
||||
|
||||
signed-release:
|
||||
name: Build Signed Release APK
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
|
||||
- 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: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "KEYSTORE_BASE64 secret not set"
|
||||
exit 1
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
|
||||
echo "Keystore decoded successfully"
|
||||
|
||||
- name: Build Signed 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 Signed APK
|
||||
run: |
|
||||
# Get universal signed APK
|
||||
find droid/app/build/outputs/apk/release -name "*-universal-release.apk" -exec cp {} inbe-signed-release-universal.apk \; 2>/dev/null || true
|
||||
# Get any signed APK as fallback
|
||||
find droid/app/build/outputs/apk/release -name "*.apk" ! -name "*unsigned*" -exec cp {} inbe-signed-release.apk \; 2>/dev/null || true
|
||||
|
||||
- name: Verify APK Signature
|
||||
run: |
|
||||
if [ -f inbe-signed-release.apk ]; then
|
||||
echo "APK exists, checking signature..."
|
||||
# Check if APK is signed using apksigner (available in Android SDK)
|
||||
$ANDROID_HOME/build-tools/34.0.0/apksigner verify --print-certs inbe-signed-release.apk || echo "apksigner not available, skipping verification"
|
||||
else
|
||||
echo "No signed APK found"
|
||||
ls -la droid/app/build/outputs/apk/release/
|
||||
fi
|
||||
|
||||
- name: Upload Signed APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: signed-release-apk
|
||||
path: |
|
||||
inbe-signed-release-universal.apk
|
||||
inbe-signed-release.apk
|
||||
if-no-files-found: warn
|
||||
|
||||
release:
|
||||
name: Create GitHub Release
|
||||
needs: [unsigned-release, signed-release]
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Unsigned APK
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: unsigned-release-apk
|
||||
path: .
|
||||
|
||||
- name: Download Signed APK
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: signed-release-apk
|
||||
path: .
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
inbe-release*.apk
|
||||
inbe-signed*.apk
|
||||
draft: false
|
||||
prerelease: false
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,52 @@
|
||||
*.sym
|
||||
*.tar.gz
|
||||
*.zip
|
||||
*~
|
||||
*.love
|
||||
.raylib*
|
||||
.claude/
|
||||
.local/
|
||||
.codex/
|
||||
.agents/
|
||||
.cache/
|
||||
*.wasm
|
||||
build/
|
||||
node_modules
|
||||
*.nix-defexpr
|
||||
*.npm
|
||||
*.nix-profile
|
||||
.claude.json
|
||||
.bash_history
|
||||
|
||||
|
||||
*.exe
|
||||
*_x86_64
|
||||
*.xdp*
|
||||
/main
|
||||
!droid/app/src/main
|
||||
droid/app/src/main/assets
|
||||
|
||||
.direnv/
|
||||
.node-repl-history
|
||||
result
|
||||
result-*
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
.gradle/
|
||||
local.properties
|
||||
Captures/
|
||||
.externalNativeBuild/
|
||||
.cxx/
|
||||
|
||||
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
*.bak
|
||||
*.swp
|
||||
|
||||
local.properties
|
||||
*.o
|
||||
*.9
|
||||
*.8
|
||||
*.a
|
||||
@@ -0,0 +1,6 @@
|
||||
[submodule "vendor/raylib"]
|
||||
path = vendor/raylib
|
||||
url = https://github.com/raysan5/raylib.git
|
||||
[submodule "vendor/rini"]
|
||||
path = vendor/rini
|
||||
url = https://github.com/raysan5/rini.git
|
||||
@@ -1,6 +1,57 @@
|
||||
# Changelog
|
||||
## [1.0.6] - 2026-05-27
|
||||
### Fixed
|
||||
- Bell now plays before the last breath (at maxbreaths - 1) instead of after
|
||||
- Session history not loading and potential segfault due to path buffer overflow (increased HISTORY_PATH_SIZE from 96 to 256)
|
||||
- Tutorial text clarified to explicitly mention Wim Hof Method
|
||||
|
||||
## [1.0.0] - 2025-01-25
|
||||
## [1.0.5] - 2026-05-27
|
||||
### Added
|
||||
- Theme system with 8 color themes (Forest, Ocean, Sky, Sunset, Lavender - each with light/dark variants)
|
||||
- Settings dropdown menu for easier navigation
|
||||
- Improved fullscreen mode with better DPI scaling
|
||||
### Fixed
|
||||
- Touch input scaling for dropdown menus and toggle switches
|
||||
- Tab bar positioning on Android (now accounts for system navbar)
|
||||
- Removed toggle switch circle indicator for cleaner UI
|
||||
|
||||
## [1.0.4] - 2026-05-26
|
||||
### Added
|
||||
- Centralized icon size management system (SMALL, MEDIUM, LARGE)
|
||||
- Standardized icon button functions for consistent sizing
|
||||
### Fixed
|
||||
- Improved accessibility with larger icons for older users (+25-37%)
|
||||
- DPI scaling for all button padding and bevel borders on mobile
|
||||
- X button positioning and scaling on high DPI screens
|
||||
- Button dimensions and icon centering across all screens
|
||||
- Missing icons (telegram, globe, stripe, monero, home, trash) in WebAssembly build
|
||||
|
||||
## [1.0.3] - 2026-05-26
|
||||
### Fixed
|
||||
- Improved DPI scaling for scrollbars (width and thumb height now scale properly)
|
||||
- Fixed scrollbar not appearing on tall viewports/settings screens (content height now scales correctly)
|
||||
- Fixed X icon too small on mobile (increased max size from 18px to 28px for better touch targets)
|
||||
- Improved scrollbar thumb touch hit area for easier grabbing
|
||||
- Fixed missing breath sounds during recovery phase (breath in at start, breath out after 15-second hold)
|
||||
### Added
|
||||
- Added external links in settings (Telegram, Website, Monero, Stripe donation)
|
||||
- Added content-area drag scrolling for mobile (click and drag anywhere to scroll)
|
||||
|
||||
## [1.0.2] - 2026-05-26
|
||||
### Fixed
|
||||
- Fixed "Starting in" countdown text positioning (now displays above circle)
|
||||
- Fixed first round to always use 3-second countdown regardless of settings
|
||||
- Fixed slider knob vertical centering (DPI scaling issue)
|
||||
- Fixed slider touch hit area scaling for better mobile interaction
|
||||
- Fixed speed meter position in tutorial (removed double DPI scaling)
|
||||
- Fixed results screen DPI scaling for consistent appearance
|
||||
|
||||
## [1.0.1] - 2026-05-26
|
||||
### Fixed
|
||||
- Fixed WebAssembly local storage persistence
|
||||
- Updated Android target SDK version
|
||||
|
||||
## [1.0.0] - 2026-05-25
|
||||
### Added
|
||||
- Initial release
|
||||
- Breathing exercise tutorial with 5 steps
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
CC = gcc
|
||||
WINDRES = windres
|
||||
|
||||
SRC = src/main.c src/app.c ../liblotus/src/theme.c
|
||||
SRC = src/main.c src/app.c src/ui.c src/theme_meta.c src/theme.c
|
||||
INBE_DIR = libinbe
|
||||
INBE_A = $(INBE_DIR)/libinbe.a
|
||||
|
||||
RAYLIB_DIR = ../vendor/raylib/src
|
||||
RAYLIB_BUILD_DIR = ../vendor/raylib/build/sdl
|
||||
RAYLIB_DIR = vendor/raylib/src
|
||||
RAYLIB_BUILD_DIR = vendor/raylib/build/sdl
|
||||
RAYLIB_A = $(RAYLIB_BUILD_DIR)/libraylib.a
|
||||
|
||||
ANDROID_DIR = droid
|
||||
@@ -79,7 +79,7 @@ WEB_RAYLIB_OBJS = \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/raudio.o
|
||||
WEB_CFLAGS = -Wall -Wextra -std=gnu99 -Os -DPLATFORM_WEB -DGRAPHICS_API_OPENGL_ES2 -D_DEFAULT_SOURCE -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1
|
||||
WEB_SHELL = src/web_shell.html
|
||||
WEB_LDFLAGS = -sUSE_GLFW=3 -sASYNCIFY -sALLOW_MEMORY_GROWTH=1 --shell-file $(WEB_SHELL) --preload-file [email protected] --preload-file [email protected] --preload-file ../icons/gear.png@icons/gear.png --preload-file ../icons/x.png@icons/x.png --preload-file ../icons/manual.png@icons/manual.png --preload-file ../icons/return.png@icons/return.png --preload-file ../icons/backward.png@icons/backward.png --preload-file ../icons/forward.png@icons/forward.png --preload-file ../icons/play.png@icons/play.png --preload-file ../icons/pause.png@icons/pause.png --preload-file ../icons/stat.png@icons/stat.png --preload-file assets/angel.jpg@assets/angel.jpg --preload-file assets/begin.jpg@assets/begin.jpg --preload-file assets/sounds/breath-in.ogg@assets/sounds/breath-in.ogg --preload-file assets/sounds/breath-out.ogg@assets/sounds/breath-out.ogg --preload-file assets/sounds/bell.ogg@assets/sounds/bell.ogg
|
||||
WEB_LDFLAGS = -sUSE_GLFW=3 -sASYNCIFY -sALLOW_MEMORY_GROWTH=1 --shell-file $(WEB_SHELL) --preload-file [email protected] --preload-file [email protected] --preload-file themes/sky.ini@themes/sky.ini --preload-file themes/sky_dark.ini@themes/sky_dark.ini --preload-file themes/ocean.ini@themes/ocean.ini --preload-file themes/ocean_dark.ini@themes/ocean_dark.ini --preload-file themes/forest.ini@themes/forest.ini --preload-file themes/forest_dark.ini@themes/forest_dark.ini --preload-file themes/sunset.ini@themes/sunset.ini --preload-file themes/sunset_dark.ini@themes/sunset_dark.ini --preload-file themes/lavender.ini@themes/lavender.ini --preload-file themes/lavender_dark.ini@themes/lavender_dark.ini --preload-file themes/cherry.ini@themes/cherry.ini --preload-file themes/cherry_dark.ini@themes/cherry_dark.ini --preload-file icons/gear.png@icons/gear.png --preload-file icons/x.png@icons/x.png --preload-file icons/manual.png@icons/manual.png --preload-file icons/return.png@icons/return.png --preload-file icons/backward.png@icons/backward.png --preload-file icons/forward.png@icons/forward.png --preload-file icons/play.png@icons/play.png --preload-file icons/pause.png@icons/pause.png --preload-file icons/stat.png@icons/stat.png --preload-file icons/home.png@icons/home.png --preload-file icons/trash.png@icons/trash.png --preload-file icons/telegram.png@icons/telegram.png --preload-file icons/globe.png@icons/globe.png --preload-file icons/stripe.png@icons/stripe.png --preload-file icons/monero.png@icons/monero.png --preload-file assets/angel.jpg@assets/angel.jpg --preload-file assets/begin.jpg@assets/begin.jpg --preload-file assets/sounds/breath-in.ogg@assets/sounds/breath-in.ogg --preload-file assets/sounds/breath-out.ogg@assets/sounds/breath-out.ogg --preload-file assets/sounds/bell.ogg@assets/sounds/bell.ogg
|
||||
INBE_RAYLIB_CONFIG = $(filter-out -DSUPPORT_MODULE_RAUDIO=0 -DSUPPORT_FILEFORMAT_PNG=0 -DSUPPORT_FILEFORMAT_JPG=0 -DSUPPORT_FILEFORMAT_OGG=0,$(RAY_RAYLIB_CONFIG)) -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1
|
||||
|
||||
CFLAGS = -Wall -Wextra -std=c99 -Os -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1
|
||||
@@ -156,7 +156,7 @@ $(TARGET): $(SRC) theme.ini inbe.ini $(RAYLIB_A) $(LINUX_INBE_A) | $(LINUX_BUILD
|
||||
$(CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
-I../liblotus/include \
|
||||
-Isrc \
|
||||
$(RAY_CFLAGS) \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
@@ -198,7 +198,7 @@ linux-aarch64: | $(LINUX_BUILD_DIR)
|
||||
LINUX_RAY_SDL_INCLUDE_DIR="$(AARCH64_RAY_SDL_INCLUDE_DIR)"
|
||||
|
||||
build-linux-arch:
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME) ../vendor/raylib/build/sdl-$(ARCH_NAME)
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME) vendor/raylib/build/sdl-$(ARCH_NAME)
|
||||
$(MAKE) -C $(RAYLIB_DIR) clean
|
||||
$(MAKE) -j1 -C $(RAYLIB_DIR) \
|
||||
CC="$(LINUX_CC)" \
|
||||
@@ -218,14 +218,14 @@ build-linux-arch:
|
||||
$(LINUX_CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
-I../liblotus/include \
|
||||
-Isrc \
|
||||
$(LINUX_RAY_CFLAGS) \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-o $(LINUX_BUILD_DIR)/inbe-linux-$(ARCH_NAME) \
|
||||
$(SRC) \
|
||||
$(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/libinbe.a \
|
||||
../vendor/raylib/build/sdl-$(ARCH_NAME)/libraylib.a \
|
||||
vendor/raylib/build/sdl-$(ARCH_NAME)/libraylib.a \
|
||||
$(LINUX_RAY_LDLIBS) \
|
||||
-lm -lpthread -ldl -lrt \
|
||||
$(LDFLAGS)
|
||||
@@ -287,7 +287,7 @@ $(WEB_TARGET): $(SRC) $(INBE_DIR)/inbe.c $(WEB_SHELL) $(WEB_RAYLIB_A) | $(WEB_BU
|
||||
$(WEB_CC) $(WEB_CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
-I../liblotus/include \
|
||||
-Isrc \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(INBE_DIR)/inbe.c \
|
||||
@@ -305,7 +305,7 @@ $(WIN_TARGET): $(SRC) $(WIN_RAYLIB_A) $(WIN_INBE_A) | $(WINDOWS_BUILD_DIR)
|
||||
$(WIN_CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
-I../liblotus/include \
|
||||
-Isrc \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(WIN_INBE_A) \
|
||||
@@ -333,7 +333,7 @@ clean-web:
|
||||
|
||||
clean-raylib:
|
||||
$(MAKE) -C $(RAYLIB_DIR) clean
|
||||
rm -rf ../vendor/raylib/build
|
||||
rm -rf vendor/raylib/build
|
||||
|
||||
# Distribution targets
|
||||
#
|
||||
@@ -350,6 +350,7 @@ dist:
|
||||
$(MAKE) windows
|
||||
$(MAKE) web
|
||||
$(MAKE) android-$(ANDROID_DIST)
|
||||
$(MAKE) android-bundle
|
||||
$(MAKE) dist-linux
|
||||
$(MAKE) dist-windows
|
||||
|
||||
@@ -367,8 +368,10 @@ dist-linux: linux
|
||||
exit 1; \
|
||||
fi
|
||||
@cp inbe.ini theme.ini $(LINUX_BUILD_DIR)/dist/inbe-linux/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/themes
|
||||
@cp themes/*.ini $(LINUX_BUILD_DIR)/dist/inbe-linux/themes/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/icons
|
||||
@cp ../icons/gear.png ../icons/x.png ../icons/manual.png ../icons/return.png ../icons/backward.png ../icons/forward.png ../icons/play.png ../icons/pause.png ../icons/stat.png $(LINUX_BUILD_DIR)/dist/inbe-linux/icons/
|
||||
@cp icons/gear.png icons/x.png icons/manual.png icons/return.png icons/backward.png icons/forward.png icons/play.png icons/pause.png icons/stat.png $(LINUX_BUILD_DIR)/dist/inbe-linux/icons/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/assets
|
||||
@cp assets/angel.jpg assets/begin.jpg $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/sounds
|
||||
@@ -391,8 +394,10 @@ dist-windows:
|
||||
exit 1; \
|
||||
fi
|
||||
@cp inbe.ini theme.ini $(WINDOWS_BUILD_DIR)/dist/inbe-windows/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/themes
|
||||
@cp themes/*.ini $(WINDOWS_BUILD_DIR)/dist/inbe-windows/themes/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/icons
|
||||
@cp ../icons/gear.png ../icons/x.png ../icons/manual.png ../icons/return.png ../icons/backward.png ../icons/forward.png ../icons/play.png ../icons/pause.png ../icons/stat.png $(WINDOWS_BUILD_DIR)/dist/inbe-windows/icons/
|
||||
@cp icons/gear.png icons/x.png icons/manual.png icons/return.png icons/backward.png icons/forward.png icons/play.png icons/pause.png icons/stat.png $(WINDOWS_BUILD_DIR)/dist/inbe-windows/icons/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets
|
||||
@cp assets/angel.jpg assets/begin.jpg $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/sounds
|
||||
@@ -422,8 +427,10 @@ android-copy-assets:
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets
|
||||
cp inbe.ini $(ANDROID_DIR)/app/src/main/assets/inbe.ini
|
||||
cp theme.ini $(ANDROID_DIR)/app/src/main/assets/theme.ini
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/themes
|
||||
cp themes/*.ini $(ANDROID_DIR)/app/src/main/assets/themes/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/icons
|
||||
@for icon in ../icons/*.png; do \
|
||||
@for icon in icons/*.png; do \
|
||||
base=$$(basename "$$icon"); \
|
||||
size=$$(identify -format '%wx%h' "$$icon"); \
|
||||
magick "$$icon" -filter point -resize "$$size!" "$(ANDROID_DIR)/app/src/main/assets/icons/$$base"; \
|
||||
@@ -435,7 +442,7 @@ android-copy-assets:
|
||||
|
||||
android-debug:
|
||||
$(MAKE) android-copy-assets
|
||||
$(GRADLE) -p $(ANDROID_DIR) assembleDebug
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) assembleDebug
|
||||
$(MAKE) android-copy-debug-apks
|
||||
|
||||
android-release:
|
||||
@@ -453,13 +460,49 @@ android-release:
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ -n "$$PASSWORD_VALUE" ]; then \
|
||||
$(GRADLE) -p $(ANDROID_DIR) assembleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) assembleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
$(MAKE) android-copy-release-apks; \
|
||||
else \
|
||||
echo "Keystore password is required"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-bundle:
|
||||
$(MAKE) android-copy-assets
|
||||
@if [ -n "$(PASSWORD)" ]; then \
|
||||
PASSWORD_VALUE="$(PASSWORD)"; \
|
||||
elif [ -t 0 ]; then \
|
||||
printf "Keystore password: "; \
|
||||
stty -echo; \
|
||||
read PASSWORD_VALUE; \
|
||||
stty echo; \
|
||||
printf "\n"; \
|
||||
else \
|
||||
echo "Keystore password is required. Run from a terminal or use PASSWORD=your-password."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ -n "$$PASSWORD_VALUE" ]; then \
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) bundleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
$(MAKE) android-copy-bundle; \
|
||||
else \
|
||||
echo "Keystore password is required"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-copy-bundle: | $(ANDROID_BUILD_DIR)
|
||||
@VERSION=$$(grep -m1 '^## \[' CHANGELOG.md | sed 's/^## \[\([^]]*\)\].*/\1/'); \
|
||||
BUNDLE=$$(find $(ANDROID_DIR)/app/build/outputs/bundle/release -name "*.aab" 2>/dev/null | head -1); \
|
||||
if [ -n "$$BUNDLE" ] && [ -f "$$BUNDLE" ]; then \
|
||||
VERSIONED_BUNDLE="$(ANDROID_BUILD_DIR)/inbe-$$VERSION.aab"; \
|
||||
echo "Copying and renaming $$BUNDLE to $$VERSIONED_BUNDLE"; \
|
||||
cp "$$BUNDLE" "$$VERSIONED_BUNDLE"; \
|
||||
ln -sf "$$(basename "$$VERSIONED_BUNDLE")" "$(ANDROID_BUILD_DIR)/inbe-latest.aab"; \
|
||||
echo "Created symlink: inbe-latest.aab → $$(basename "$$VERSIONED_BUNDLE")"; \
|
||||
else \
|
||||
echo "Bundle not found in $(ANDROID_DIR)/app/build/outputs/bundle/release/"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-copy-apks: android-copy-debug-apks android-copy-release-apks
|
||||
|
||||
android-copy-debug-apks: | $(ANDROID_BUILD_DIR)
|
||||
@@ -538,10 +581,12 @@ FORCE:
|
||||
android-init-signing \
|
||||
android-debug \
|
||||
android-release \
|
||||
android-bundle \
|
||||
android-copy-assets \
|
||||
android-copy-apks \
|
||||
android-copy-debug-apks \
|
||||
android-copy-release-apks \
|
||||
android-copy-bundle \
|
||||
android-install \
|
||||
android-install-release \
|
||||
android-clean \
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# inbe
|
||||
|
||||
Inner Breeze - A free, open-source guided breathing meditation app based on the Wim Hof method.
|
||||
|
||||
## Features
|
||||
|
||||
- Guided breathing sessions with visual and audio cues
|
||||
- Configurable breath counts and hold times
|
||||
- Session history with local storage
|
||||
- 8 color themes (Forest, Ocean, Sky, Sunset, Lavender - each with light/dark variants)
|
||||
- Sound effects (breath in/out, bell)
|
||||
- Fullscreen mode with proper DPI scaling
|
||||
- Touch-optimized UI for mobile devices
|
||||
|
||||
## Building
|
||||
|
||||
inbe uses [raylib](https://github.com/raysan5/raylib) and requires a Nix development environment.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- [Nix](https://nixos.org/download.html) with flakes enabled
|
||||
- For Android builds: Java 17+ JDK
|
||||
|
||||
### Native Build
|
||||
|
||||
```bash
|
||||
# Enter the development shell
|
||||
nix develop
|
||||
|
||||
# Build for your current platform (Linux x86_64/aarch64)
|
||||
make
|
||||
|
||||
# Run
|
||||
./build/linux/inbe-linux-$(uname -m)
|
||||
```
|
||||
|
||||
### Cross-Platform Builds
|
||||
|
||||
```bash
|
||||
# Linux (both architectures)
|
||||
make linux
|
||||
|
||||
# Windows (from Linux)
|
||||
make windows
|
||||
|
||||
# Android APK
|
||||
make android
|
||||
|
||||
# WebAssembly
|
||||
make web
|
||||
```
|
||||
|
||||
### Platform-Specific Notes
|
||||
|
||||
- **Linux**: Requires SDL2 runtime libraries
|
||||
- **Windows**: Standalone executable, no dependencies
|
||||
- **Android**: Requires Android NDK in the development shell
|
||||
- **Web**: Requires Emscripten toolchain
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `src/` - Main application code (raylib frontend)
|
||||
- `libinbe/` - Core meditation logic (platform-agnostic)
|
||||
- `assets/` - Images and sounds
|
||||
- `themes/` - Color theme definitions
|
||||
- `droid/` - Android build configuration
|
||||
- `vendor/raylib/` - raylib submodule
|
||||
|
||||
## License
|
||||
|
||||
MIT - see [LICENSE](LICENSE)
|
||||
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 142 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 144 B |
|
After Width: | Height: | Size: 148 B |
|
After Width: | Height: | Size: 172 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 198 B |
|
After Width: | Height: | Size: 177 B |
|
After Width: | Height: | Size: 176 B |
@@ -29,8 +29,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdk 19
|
||||
targetSdk 35
|
||||
versionCode 1
|
||||
versionName "1.0.0"
|
||||
versionCode 8
|
||||
versionName "1.0.7"
|
||||
}
|
||||
|
||||
|
||||
@@ -66,3 +66,6 @@ gradle.taskGraph.whenReady { taskGraph ->
|
||||
throw new GradleException("Use: make android-release PASSWORD=your-password")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application
|
||||
android:hasCode="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="Inner Breeze"
|
||||
android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<activity
|
||||
android:name="android.app.NativeActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
|
||||
android:windowLayoutInDisplayCutoutMode="shortEdges">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="main" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,99 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(Inbe C)
|
||||
|
||||
set(REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(SRC_DIR "${REPO_ROOT}/src")
|
||||
set(LIBINBE_DIR "${REPO_ROOT}/libinbe")
|
||||
set(RAYLIB_DIR "${REPO_ROOT}/vendor/raylib/src")
|
||||
set(NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
|
||||
add_library(raylib STATIC
|
||||
"${RAYLIB_DIR}/rcore.c"
|
||||
"${RAYLIB_DIR}/rshapes.c"
|
||||
"${RAYLIB_DIR}/rtextures.c"
|
||||
"${RAYLIB_DIR}/rtext.c"
|
||||
"${RAYLIB_DIR}/raudio.c"
|
||||
)
|
||||
|
||||
target_compile_definitions(raylib PRIVATE
|
||||
PLATFORM_ANDROID
|
||||
GRAPHICS_API_OPENGL_ES2
|
||||
SUPPORT_SCREEN_CAPTURE=0
|
||||
SUPPORT_COMPRESSION_API=0
|
||||
SUPPORT_AUTOMATION_EVENTS=0
|
||||
SUPPORT_CLIPBOARD_IMAGE=0
|
||||
SUPPORT_FILEFORMAT_BMP=0
|
||||
SUPPORT_FILEFORMAT_GIF=0
|
||||
SUPPORT_FILEFORMAT_QOI=0
|
||||
SUPPORT_FILEFORMAT_DDS=0
|
||||
SUPPORT_FILEFORMAT_TTF=0
|
||||
SUPPORT_FILEFORMAT_JPG=1
|
||||
SUPPORT_FILEFORMAT_PNG=1
|
||||
SUPPORT_FILEFORMAT_OGG=1
|
||||
SUPPORT_MODULE_RAUDIO=1
|
||||
)
|
||||
|
||||
target_compile_options(raylib PRIVATE
|
||||
-Os
|
||||
-ffunction-sections
|
||||
-fdata-sections
|
||||
)
|
||||
|
||||
target_include_directories(raylib PUBLIC
|
||||
"${RAYLIB_DIR}"
|
||||
"${NATIVE_APP_GLUE_DIR}"
|
||||
)
|
||||
|
||||
add_library(inbe STATIC
|
||||
"${LIBINBE_DIR}/inbe.c"
|
||||
)
|
||||
|
||||
target_include_directories(inbe PUBLIC
|
||||
"${LIBINBE_DIR}"
|
||||
)
|
||||
|
||||
add_library(main SHARED
|
||||
"${SRC_DIR}/main.c"
|
||||
"${SRC_DIR}/app.c"
|
||||
"${SRC_DIR}/ui.c"
|
||||
"${SRC_DIR}/theme_meta.c"
|
||||
"${SRC_DIR}/theme.c"
|
||||
"${SRC_DIR}/android_insets.c"
|
||||
"${NATIVE_APP_GLUE_DIR}/android_native_app_glue.c"
|
||||
)
|
||||
|
||||
target_include_directories(main PRIVATE
|
||||
"${SRC_DIR}"
|
||||
"${NATIVE_APP_GLUE_DIR}"
|
||||
"${LIBINBE_DIR}"
|
||||
)
|
||||
|
||||
target_compile_definitions(main PRIVATE
|
||||
PLATFORM_ANDROID
|
||||
SUPPORT_MODULE_RAUDIO=1
|
||||
SUPPORT_FILEFORMAT_OGG=1
|
||||
)
|
||||
|
||||
target_compile_options(main PRIVATE
|
||||
-Os
|
||||
-ffunction-sections
|
||||
-fdata-sections
|
||||
-fvisibility=hidden
|
||||
)
|
||||
|
||||
target_link_options(main PRIVATE
|
||||
-Wl,--gc-sections
|
||||
-Wl,--strip-all
|
||||
-Wl,--wrap=fopen
|
||||
)
|
||||
|
||||
target_link_libraries(main
|
||||
raylib
|
||||
inbe
|
||||
android
|
||||
log
|
||||
OpenSLES
|
||||
EGL
|
||||
GLESv2
|
||||
m
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#E2EEFC" />
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 638 B |
|
After Width: | Height: | Size: 638 B |
|
After Width: | Height: | Size: 554 B |
|
After Width: | Height: | Size: 554 B |
|
After Width: | Height: | Size: 670 B |
|
After Width: | Height: | Size: 670 B |
|
After Width: | Height: | Size: 766 B |
|
After Width: | Height: | Size: 766 B |
|
After Width: | Height: | Size: 670 B |
|
After Width: | Height: | Size: 670 B |
@@ -0,0 +1,2 @@
|
||||
android.useAndroidX=true
|
||||
android.suppressUnsupportedCompileSdk=35
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1779560665,
|
||||
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
{
|
||||
description = "Waozi raylib cross-build environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
|
||||
mkPkgs = system: import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnsupportedSystem = true;
|
||||
android_sdk.accept_license = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkShell = system:
|
||||
let
|
||||
pkgs = mkPkgs system;
|
||||
aarch64Pkgs = pkgs.pkgsCross.aarch64-multiplatform;
|
||||
|
||||
windowsCrossEnabled = system == "x86_64-linux";
|
||||
|
||||
mingwPkgs = import nixpkgs {
|
||||
inherit system;
|
||||
crossSystem = { config = "x86_64-w64-mingw32"; };
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnsupportedSystem = true;
|
||||
};
|
||||
};
|
||||
|
||||
mcfgthreads = pkgs.pkgsCross.mingwW64.windows.mcfgthreads;
|
||||
|
||||
androidComposition = pkgs.androidenv.composeAndroidPackages {
|
||||
cmdLineToolsVersion = "11.0";
|
||||
buildToolsVersions = [ "34.0.0" ];
|
||||
platformVersions = [ "35" ];
|
||||
includeNDK = true;
|
||||
ndkVersions = [ "25.1.8937393" ];
|
||||
cmakeVersions = [ "3.22.1" ];
|
||||
};
|
||||
|
||||
sdk = androidComposition.androidsdk;
|
||||
ndkPath = "${sdk}/libexec/android-sdk/ndk-bundle";
|
||||
|
||||
pkgConfigPath = pkgs.lib.makeSearchPath "lib/pkgconfig" [
|
||||
pkgs.SDL2.dev
|
||||
pkgs.libdrm.dev
|
||||
pkgs.libgbm
|
||||
pkgs.libglvnd.dev
|
||||
];
|
||||
|
||||
aarch64PkgConfigPath = pkgs.lib.makeSearchPath "lib/pkgconfig" [
|
||||
aarch64Pkgs.SDL2.dev
|
||||
aarch64Pkgs.libdrm.dev
|
||||
aarch64Pkgs.libgbm
|
||||
aarch64Pkgs.libglvnd.dev
|
||||
];
|
||||
|
||||
windowsTargetPkgs = pkgs.lib.optionals windowsCrossEnabled [
|
||||
mingwPkgs.buildPackages.gcc
|
||||
mingwPkgs.windows.mingw_w64
|
||||
mcfgthreads
|
||||
];
|
||||
|
||||
windowsProfile = pkgs.lib.optionalString windowsCrossEnabled ''
|
||||
export WIN_CC="x86_64-w64-mingw32-gcc"
|
||||
export WIN_CXX="x86_64-w64-mingw32-g++"
|
||||
export WIN_AR="x86_64-w64-mingw32-ar"
|
||||
export WIN_RANLIB="x86_64-w64-mingw32-ranlib"
|
||||
export WIN_WINDRES="x86_64-w64-mingw32-windres"
|
||||
export WIN_STRIP="x86_64-w64-mingw32-strip"
|
||||
|
||||
export MCFGTHREADS="${mcfgthreads}"
|
||||
export CPATH="$MCFGTHREADS/include:$CPATH"
|
||||
export LIBRARY_PATH="$MCFGTHREADS/lib:$LIBRARY_PATH"
|
||||
export LDFLAGS="-L$MCFGTHREADS/lib $LDFLAGS"
|
||||
'';
|
||||
in
|
||||
(pkgs.buildFHSEnv {
|
||||
name = "ray-waozi-env";
|
||||
extraOutputsToInstall = [ "dev" ];
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
SDL2
|
||||
SDL2.dev
|
||||
cmake
|
||||
emscripten
|
||||
gcc
|
||||
gnumake
|
||||
gradle
|
||||
imagemagick
|
||||
jdk17
|
||||
libdrm
|
||||
libdrm.dev
|
||||
libgbm
|
||||
libglvnd
|
||||
libglvnd.dev
|
||||
mesa
|
||||
ncurses
|
||||
ninja
|
||||
pkg-config
|
||||
rsync
|
||||
zlib
|
||||
zip
|
||||
aarch64Pkgs.stdenv.cc
|
||||
aarch64Pkgs.SDL2
|
||||
aarch64Pkgs.SDL2.dev
|
||||
aarch64Pkgs.libdrm
|
||||
aarch64Pkgs.libdrm.dev
|
||||
aarch64Pkgs.libgbm
|
||||
aarch64Pkgs.libglvnd
|
||||
aarch64Pkgs.libglvnd.dev
|
||||
] ++ windowsTargetPkgs;
|
||||
|
||||
profile = ''
|
||||
export JAVA_HOME="${pkgs.jdk17.home}"
|
||||
|
||||
# Android SDK - override any system ANDROID_HOME
|
||||
export ANDROID_HOME="${sdk}/libexec/android-sdk"
|
||||
export ANDROID_SDK_ROOT="${sdk}/libexec/android-sdk"
|
||||
export ANDROID_NDK_ROOT="${ndkPath}"
|
||||
|
||||
export PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:${pkgConfigPath}:$PKG_CONFIG_PATH"
|
||||
|
||||
export RAY_PKGS="sdl2 libdrm gbm egl glesv2"
|
||||
export RAY_SDL_CFLAGS="$(pkg-config --cflags sdl2)"
|
||||
export RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
|
||||
export RAY_GL_CFLAGS="$(pkg-config --cflags libdrm gbm egl glesv2)"
|
||||
export RAY_GL_LDLIBS="$(pkg-config --libs libdrm gbm egl glesv2)"
|
||||
export RAY_CFLAGS="$RAY_SDL_CFLAGS $RAY_GL_CFLAGS"
|
||||
export RAY_LDLIBS="$RAY_SDL_LDLIBS $RAY_GL_LDLIBS"
|
||||
export RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2 | sed 's,/SDL2$,,')"
|
||||
|
||||
export 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"
|
||||
|
||||
export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH"
|
||||
|
||||
export WEB_CC="emcc"
|
||||
export WEB_AR="emar"
|
||||
export WEB_RANLIB="emranlib"
|
||||
|
||||
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_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"
|
||||
export AARCH64_RAY_GL_CFLAGS="-I${aarch64Pkgs.libdrm.dev}/include -I${aarch64Pkgs.libdrm.dev}/include/libdrm -I${aarch64Pkgs.libgbm}/include -I${aarch64Pkgs.libglvnd.dev}/include"
|
||||
export AARCH64_RAY_GL_LDLIBS="-L${aarch64Pkgs.libdrm}/lib -L${aarch64Pkgs.libgbm}/lib -L${aarch64Pkgs.libglvnd}/lib -ldrm -lgbm -lEGL -lGLESv2"
|
||||
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"
|
||||
|
||||
${windowsProfile}
|
||||
|
||||
for project in inbe; do
|
||||
if [ -d "$project/droid" ]; then
|
||||
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
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
'';
|
||||
}).env;
|
||||
in {
|
||||
devShells = forAllSystems (system: {
|
||||
default = mkShell system;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
After Width: | Height: | Size: 155 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 153 B |
|
After Width: | Height: | Size: 222 B |
|
After Width: | Height: | Size: 192 B |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 832 B |
|
After Width: | Height: | Size: 213 B |
|
After Width: | Height: | Size: 332 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 151 B |
|
After Width: | Height: | Size: 152 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 325 B |
|
After Width: | Height: | Size: 182 B |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 376 B |
|
After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 205 B |
|
After Width: | Height: | Size: 184 B |
|
After Width: | Height: | Size: 357 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 182 B |
|
After Width: | Height: | Size: 164 B |
|
After Width: | Height: | Size: 159 B |
|
After Width: | Height: | Size: 157 B |
@@ -1,165 +0,0 @@
|
||||
:root {
|
||||
--page-bg: #000000;
|
||||
--page-tile: url('/icons/tile2.png');
|
||||
--page-tile-opacity: 0.32;
|
||||
--panel-bg: #eaeaff;
|
||||
--dark: #445588;
|
||||
--shadow: #334477;
|
||||
--light: #ccddee;
|
||||
--button-bg: #aabbdd;
|
||||
--button-highlight: #ccddee;
|
||||
--button-inset: #ddeeff;
|
||||
--link: #3355bb;
|
||||
--link-hover: #5577dd;
|
||||
--meter-panel-bg: rgba(85, 102, 170, 0.05);
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
color: var(--dark);
|
||||
}
|
||||
|
||||
.platform-section {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.platform-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.platform-header img {
|
||||
flex: 0 0 48px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
.platform-header p {
|
||||
margin: 4px 0 0 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.platform-header strong {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.downloads-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.download-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 8px 12px;
|
||||
background-color: var(--button-bg);
|
||||
border: 2px solid var(--button-highlight);
|
||||
border-right-color: var(--dark);
|
||||
border-bottom-color: var(--dark);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--shadow),
|
||||
inset 1px 1px 0 0 var(--button-inset);
|
||||
text-decoration: none;
|
||||
color: var(--dark);
|
||||
border-radius: 8px;
|
||||
transition: transform 0.1s, box-shadow 0.1s;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.download-item:active {
|
||||
border-color: var(--dark);
|
||||
border-right-color: var(--button-highlight);
|
||||
border-bottom-color: var(--button-highlight);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--button-highlight),
|
||||
inset 1px 1px 0 0 var(--shadow);
|
||||
transform: translate(1px, 1px);
|
||||
}
|
||||
|
||||
.download-item:hover {
|
||||
background-color: var(--button-highlight);
|
||||
}
|
||||
|
||||
.file-icon {
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.platform-icon {
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
.platform-buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
justify-content: center;
|
||||
margin: 24px 0;
|
||||
}
|
||||
|
||||
.platform-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 16px 12px;
|
||||
background-color: var(--button-bg);
|
||||
border: 2px solid var(--button-highlight);
|
||||
border-right-color: var(--dark);
|
||||
border-bottom-color: var(--dark);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--shadow),
|
||||
inset 1px 1px 0 0 var(--button-inset);
|
||||
text-decoration: none;
|
||||
color: var(--dark);
|
||||
border-radius: 8px;
|
||||
transition: transform 0.1s, box-shadow 0.1s;
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.platform-btn img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.platform-btn span {
|
||||
font-family: departure;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.platform-btn:active {
|
||||
border-color: var(--dark);
|
||||
border-right-color: var(--button-highlight);
|
||||
border-bottom-color: var(--button-highlight);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--button-highlight),
|
||||
inset 1px 1px 0 0 var(--shadow);
|
||||
transform: translate(1px, 1px);
|
||||
}
|
||||
|
||||
.platform-btn.web:hover {
|
||||
background-color: #ddeeff;
|
||||
}
|
||||
|
||||
.platform-btn.android:hover {
|
||||
background-color: #ddffdd;
|
||||
}
|
||||
|
||||
.platform-btn.windows:hover {
|
||||
background-color: #ffdddd;
|
||||
}
|
||||
|
||||
.platform-btn.linux:hover {
|
||||
background-color: #ffffdd;
|
||||
}
|
||||
|
||||
.donation-buttons {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
<head>
|
||||
<title>Inner Breeze - Guided Breathing Meditation</title>
|
||||
<link href="/style.css" rel="stylesheet" />
|
||||
<link href="inbe.css" rel="stylesheet" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Inner Breeze - A free, open-source guided breathing meditation app based on the Wim Hof method. Available for web, Android, Windows, and Linux.">
|
||||
|
||||
@@ -40,19 +39,19 @@
|
||||
<p>guided breathing meditation based on the Wim Hof method</p>
|
||||
|
||||
<div class="platform-buttons">
|
||||
<a href="/inbe/build/web/index.html" class="platform-btn web">
|
||||
<a href="/build/web/index.html" class="platform-btn web">
|
||||
<img src="/icons/wasm.png" alt="raylib"/>
|
||||
<span>Run Web</span>
|
||||
</a>
|
||||
<a href="/inbe/build/android/inbe-latest.apk" class="platform-btn android">
|
||||
<a href="/build/android/inbe-latest.apk" class="platform-btn android">
|
||||
<img src="/icons/droid.png" alt="android"/>
|
||||
<span>Download APK</span>
|
||||
</a>
|
||||
<a href="/inbe/build/windows/inbe-windows.zip" class="platform-btn windows">
|
||||
<a href="/build/windows/inbe-windows.zip" class="platform-btn windows">
|
||||
<img src="/icons/win.png" alt="windows"/>
|
||||
<span>Windows</span>
|
||||
</a>
|
||||
<a href="/inbe/build/linux/inbe-linux.tar.gz" class="platform-btn linux">
|
||||
<a href="/build/linux/inbe-linux.tar.gz" class="platform-btn linux">
|
||||
<img src="/icons/tux.png" alt="linux"/>
|
||||
<span>Linux</span>
|
||||
</a>
|
||||
@@ -71,10 +70,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<a href="/inbe/build/web/index.html" class="download-item">Web (WASM)</a>
|
||||
<a href="/inbe/build/linux/inbe-linux.tar.gz" class="download-item">Linux</a>
|
||||
<a href="/inbe/build/windows/inbe-windows.zip" class="download-item">Windows</a>
|
||||
<a href="/inbe/build/android/inbe-latest.apk" class="download-item">Android APK</a>
|
||||
<a href="/build/web/index.html" class="download-item">Web (WASM)</a>
|
||||
<a href="/build/linux/inbe-linux.tar.gz" class="download-item">Linux</a>
|
||||
<a href="/build/windows/inbe-windows.zip" class="download-item">Windows</a>
|
||||
<a href="/build/android/inbe-latest.apk" class="download-item">Android APK</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="platform-section">
|
||||
@@ -86,10 +85,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<a href="/inbe/wasm4/build/index.html" class="download-item">Web</a>
|
||||
<a href="/inbe/wasm4/build/cart.wasm" class="download-item">cart.wasm</a>
|
||||
<a href="/inbe/wasm4/build/inbe-windows.zip" class="download-item">Windows</a>
|
||||
<a href="/inbe/wasm4/build/inbe-linux.tar.gz" class="download-item">Linux</a>
|
||||
<a href="/wasm4/build/index.html" class="download-item">Web</a>
|
||||
<a href="/wasm4/build/cart.wasm" class="download-item">cart.wasm</a>
|
||||
<a href="/wasm4/build/inbe-windows.zip" class="download-item">Windows</a>
|
||||
<a href="/wasm4/build/inbe-linux.tar.gz" class="download-item">Linux</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="platform-section">
|
||||
@@ -101,8 +100,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<a href="/inbe/uxn/index.html" class="download-item">Web</a>
|
||||
<a href="/inbe/uxn/inbe.rom" class="download-item">inbe.rom</a>
|
||||
<a href="/uxn/index.html" class="download-item">Web</a>
|
||||
<a href="/uxn/inbe.rom" class="download-item">inbe.rom</a>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
@@ -126,7 +125,7 @@
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>© 2026 <a href="https://waozi.xyz">Waozi</a> | <a href="https://git.sr.ht/~waozi/waozi" target="_blank" rel="noopener">hosted on sr.ht</a></p>
|
||||
<p>© 2026 <a href="https://waozi.xyz">Waozi</a> | <a href="https://git.sr.ht/~waozi/inbe" target="_blank" rel="noopener">hosted on sr.ht</a></p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
#!/bin/bash
|
||||
# Publish inbe site to inbe.waozi.xyz
|
||||
|
||||
set -e
|
||||
SITE_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
cd "$SITE_DIR"
|
||||
|
||||
# Check if hut is installed
|
||||
if ! command -v hut &> /dev/null; then
|
||||
echo "Error: 'hut' command not found"
|
||||
echo "Install it with: nix-shell -p hut"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Publishing inbe.waozi.xyz..."
|
||||
|
||||
TMPDIR=$(mktemp -d -p /tmp)
|
||||
|
||||
# Base site files
|
||||
rsync -av --delete \
|
||||
--exclude='local.properties' \
|
||||
--exclude='*.sym' \
|
||||
--exclude='*.o' \
|
||||
--exclude='*.a' \
|
||||
--exclude='*.d' \
|
||||
--exclude='*.9' \
|
||||
--exclude='*.8' \
|
||||
--exclude='build' \
|
||||
--exclude='.gradle' \
|
||||
--exclude='.idea' \
|
||||
--exclude='node_modules' \
|
||||
--exclude='*.iml' \
|
||||
--exclude='.cxx' \
|
||||
--exclude='.externalNativeBuild' \
|
||||
--exclude='Captures' \
|
||||
--exclude='.DS_Store' \
|
||||
--exclude='Thumbs.db' \
|
||||
--exclude='.xdp-*' \
|
||||
--exclude='*.bak' \
|
||||
--exclude='*.swp' \
|
||||
--exclude='*.lock' \
|
||||
--exclude='gradlew' \
|
||||
--exclude='gradlew.bat' \
|
||||
--exclude='shell.nix' \
|
||||
--exclude='flake.nix' \
|
||||
--exclude='flake.lock' \
|
||||
--exclude='Makefile' \
|
||||
--exclude='gradle' \
|
||||
--exclude='codex' \
|
||||
--exclude='.codex' \
|
||||
--exclude='.npm' \
|
||||
--exclude='.local' \
|
||||
--exclude='vendor' \
|
||||
. "$TMPDIR/"
|
||||
|
||||
mkdir -p "$TMPDIR/rc"
|
||||
[ -f "rc/inbe.rc" ] && cp rc/inbe.rc "$TMPDIR/rc/"
|
||||
|
||||
mkdir -p "$TMPDIR/uxn/devices"
|
||||
[ -f "uxn/index.html" ] && cp uxn/index.html "$TMPDIR/uxn/"
|
||||
[ -f "uxn/inbe.rom" ] && cp uxn/inbe.* "$TMPDIR/uxn/"
|
||||
if [ -d "uxn/devices" ]; then
|
||||
rsync -av --exclude='*.sym' uxn/devices/*.js "$TMPDIR/uxn/devices/" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Raylib builds (primary implementation)
|
||||
mkdir -p "$TMPDIR/build/linux" "$TMPDIR/build/windows" "$TMPDIR/build/android"
|
||||
if [ -d "build/web" ]; then
|
||||
mkdir -p "$TMPDIR/build/web"
|
||||
for raylib_web_artifact in build/web/index.html build/web/index.js build/web/index.wasm build/web/index.data; do
|
||||
[ -f "$raylib_web_artifact" ] && cp "$raylib_web_artifact" "$TMPDIR/build/web/"
|
||||
done
|
||||
fi
|
||||
if [ -d "build/linux" ]; then
|
||||
for raylib_linux_artifact in build/linux/inbe-linux-* build/linux/inbe-linux.tar.gz; do
|
||||
[ -f "$raylib_linux_artifact" ] && cp "$raylib_linux_artifact" "$TMPDIR/build/linux/"
|
||||
done
|
||||
fi
|
||||
if [ -d "build/windows" ]; then
|
||||
for raylib_windows_artifact in build/windows/inbe-windows-* build/windows/inbe-windows.zip; do
|
||||
[ -f "$raylib_windows_artifact" ] && cp "$raylib_windows_artifact" "$TMPDIR/build/windows/"
|
||||
done
|
||||
fi
|
||||
if [ -d "build/android" ]; then
|
||||
for raylib_android_artifact in build/android/*.apk; do
|
||||
[ -f "$raylib_android_artifact" ] && cp "$raylib_android_artifact" "$TMPDIR/build/android/"
|
||||
done
|
||||
fi
|
||||
|
||||
mkdir -p "$TMPDIR/wasm4/build"
|
||||
[ -f "wasm4/build/index.html" ] && cp wasm4/build/index.html "$TMPDIR/wasm4/build/"
|
||||
[ -f "wasm4/build/inbe.wasm" ] && cp wasm4/build/inbe.wasm "$TMPDIR/wasm4/build/"
|
||||
for wasm4_artifact in wasm4/build/inbe-x86_64 wasm4/build/inbe-x86_64.exe wasm4/build/inbe-windows.zip wasm4/build/inbe-linux.tar.gz; do
|
||||
[ -f "$wasm4_artifact" ] && cp "$wasm4_artifact" "$TMPDIR/wasm4/build/"
|
||||
done
|
||||
[ -d "wasm4/src" ] && rsync -av --exclude='*.o' --exclude='*.d' --exclude='.npm' --exclude='.local' --exclude='.codex' wasm4/src/ "$TMPDIR/wasm4/src/"
|
||||
[ -f "wasm4/Makefile" ] && cp wasm4/Makefile "$TMPDIR/wasm4/"
|
||||
[ -f "wasm4/shell.nix" ] && cp wasm4/shell.nix "$TMPDIR/wasm4/"
|
||||
[ -f "wasm4/README.md" ] && cp wasm4/README.md "$TMPDIR/wasm4/"
|
||||
|
||||
mkdir -p "$TMPDIR/linux/build"
|
||||
if [ -d "linux/build" ]; then
|
||||
for linux_bin in linux/build/inbe-* linux/build/inbefb-* linux/build/inbe-linux.tar.gz; do
|
||||
[ -f "$linux_bin" ] && cp "$linux_bin" "$TMPDIR/linux/build/"
|
||||
done
|
||||
fi
|
||||
|
||||
mkdir -p "$TMPDIR/love2d"
|
||||
[ -f "love2d/inbe.html" ] && cp love2d/inbe.* "$TMPDIR/love2d/"
|
||||
[ -d "love2d/build/inbe" ] && mkdir -p "$TMPDIR/love2d/build" && rsync -av --exclude='*.o' --exclude='*.d' --exclude='.npm' --exclude='.local' --exclude='.codex' love2d/build/inbe/ "$TMPDIR/love2d/build/inbe/"
|
||||
|
||||
mkdir -p "$TMPDIR/tcl"
|
||||
[ -f "tcl/inbe.tcl" ] && cp tcl/inbe.tcl "$TMPDIR/tcl/"
|
||||
|
||||
# Compatibility copy for older Android links.
|
||||
mkdir -p "$TMPDIR/droid"
|
||||
[ -f "build/android/app-universal-release.apk" ] && cp build/android/app-universal-release.apk "$TMPDIR/droid/app-release.apk"
|
||||
|
||||
# Icons (cursors not used - deleted)
|
||||
rsync -av --exclude='.*' --exclude='*.sym' --exclude='*.o' --exclude='*.a' --exclude='build' --exclude='.gradle' --exclude='Makefile' --exclude='.npm' --exclude='.local' --exclude='.codex' icons/ "$TMPDIR/icons/"
|
||||
|
||||
rsync -av --exclude='*.sym' --exclude='*.o' --exclude='*.a' --exclude='build' --exclude='.gradle' --exclude='.npm' --exclude='.local' --exclude='.codex' cursors/ "$TMPDIR/cursors/"
|
||||
|
||||
cp style.css assets/DepartureMono-Regular.otf og.png "$TMPDIR/"
|
||||
cp -R assets "$TMPDIR/"
|
||||
|
||||
if [ -f "$TMPDIR/index.html" ]; then
|
||||
sed -e 's|/inbe/droid/app/build/outputs/apk/release/app-release.apk|/build/android/app-universal-release.apk|g' \
|
||||
-e 's|/inbe/|/|g' \
|
||||
"$TMPDIR/index.html" > "$TMPDIR/index_.html" && mv "$TMPDIR/index_.html" "$TMPDIR/index.html"
|
||||
fi
|
||||
|
||||
# Create tarball directly in SITE_DIR
|
||||
echo "Creating inbe.tar.gz..."
|
||||
tar -czf "$SITE_DIR/inbe.tar.gz" -C "$TMPDIR" .
|
||||
|
||||
if [ ! -f "$SITE_DIR/inbe.tar.gz" ]; then
|
||||
echo "Error: inbe.tar.gz was not created!"
|
||||
rm -rf "$TMPDIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$TMPDIR"
|
||||
hut pages publish -d inbe.waozi.xyz "$SITE_DIR/inbe.tar.gz"
|
||||
echo "✓ Published to https://inbe.waozi.xyz"
|
||||
rm -f "$SITE_DIR/inbe.tar.gz"
|
||||
|
||||
echo "✓ Done"
|
||||
@@ -6,8 +6,8 @@ set -e
|
||||
# 1. Define paths and package configuration
|
||||
APK_PATH="build/android/app-universal-debug.apk"
|
||||
# TODO: Replace with your actual Android package name from AndroidManifest.xml
|
||||
PACKAGE_NAME="xyz.waozi.inbe"
|
||||
LAUNCHER_ACTIVITY="xyz.waozi.inbe.MainActivity"
|
||||
PACKAGE_NAME="xyz.waozi.inbe"
|
||||
LAUNCHER_ACTIVITY="android.app.NativeActivity"
|
||||
|
||||
echo "🔄 Waiting for device..."
|
||||
adb wait-for-device
|
||||
|
||||
@@ -2,5 +2,8 @@ speed 6
|
||||
max_rounds 4
|
||||
max_breaths 30
|
||||
pause_seconds 2
|
||||
sound_volume 100
|
||||
sound_volume 36
|
||||
tutorial_seen 1
|
||||
theme 5
|
||||
dark_mode 0
|
||||
fullscreen 0
|
||||
@@ -1,7 +1,7 @@
|
||||
# Icon sizes for Inner Breeze
|
||||
# Run 'make' to regenerate from ../../icons/inbe.png
|
||||
# Run 'make' to regenerate from ../icons/inbe.png
|
||||
|
||||
SOURCE_PNG := ../../icons/lotus.png
|
||||
SOURCE_PNG := ../icons/lotus.png
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
Before Width: | Height: | Size: 983 B After Width: | Height: | Size: 983 B |
|
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 636 B |
|
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 839 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,69 @@
|
||||
#include "android_insets.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <raylib.h>
|
||||
#include <pthread.h>
|
||||
#include <android_native_app_glue.h>
|
||||
|
||||
extern struct android_app *GetAndroidApp(void);
|
||||
|
||||
static volatile struct {
|
||||
int status_bar;
|
||||
int nav_bar;
|
||||
int cutout_left;
|
||||
int cutout_top;
|
||||
int cutout_right;
|
||||
int cutout_bottom;
|
||||
} current_insets = {0};
|
||||
static pthread_mutex_t insets_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int insets_initialized = 0;
|
||||
|
||||
static void query_insets_ndk(void) {
|
||||
if (insets_initialized) return;
|
||||
|
||||
struct android_app *app = GetAndroidApp();
|
||||
if (!app || !app->window) {
|
||||
insets_initialized = 0;
|
||||
return;
|
||||
}
|
||||
insets_initialized = 1;
|
||||
|
||||
int density = AConfiguration_getDensity(app->config);
|
||||
|
||||
/* Status bar: ~24dp, Navbar: ~48dp */
|
||||
int status_height_px = (24 * density + 160) / 160;
|
||||
int nav_height_px = (48 * density + 160) / 160;
|
||||
|
||||
pthread_mutex_lock(&insets_mutex);
|
||||
current_insets.status_bar = status_height_px;
|
||||
current_insets.nav_bar = nav_height_px;
|
||||
current_insets.cutout_left = 0;
|
||||
current_insets.cutout_top = 0;
|
||||
current_insets.cutout_right = 0;
|
||||
current_insets.cutout_bottom = 0;
|
||||
pthread_mutex_unlock(&insets_mutex);
|
||||
}
|
||||
|
||||
void android_insets_init(void) {
|
||||
pthread_mutex_lock(&insets_mutex);
|
||||
memset((void *)¤t_insets, 0, sizeof(current_insets));
|
||||
pthread_mutex_unlock(&insets_mutex);
|
||||
insets_initialized = 0;
|
||||
}
|
||||
|
||||
void android_insets_get(AndroidInsets *out) {
|
||||
query_insets_ndk();
|
||||
|
||||
if (out) {
|
||||
pthread_mutex_lock(&insets_mutex);
|
||||
out->status_bar = current_insets.status_bar;
|
||||
out->nav_bar = current_insets.nav_bar;
|
||||
out->cutout_left = current_insets.cutout_left;
|
||||
out->cutout_top = current_insets.cutout_top;
|
||||
out->cutout_right = current_insets.cutout_right;
|
||||
out->cutout_bottom = current_insets.cutout_bottom;
|
||||
pthread_mutex_unlock(&insets_mutex);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef INBE_ANDROID_INSETS_H
|
||||
#define INBE_ANDROID_INSETS_H
|
||||
|
||||
#ifdef __ANDROID__
|
||||
typedef struct {
|
||||
int status_bar;
|
||||
int nav_bar;
|
||||
int cutout_left;
|
||||
int cutout_top;
|
||||
int cutout_right;
|
||||
int cutout_bottom;
|
||||
} AndroidInsets;
|
||||
|
||||
void android_insets_init(void);
|
||||
void android_insets_get(AndroidInsets *out);
|
||||
#else
|
||||
typedef struct {
|
||||
int status_bar;
|
||||
int nav_bar;
|
||||
int cutout_left;
|
||||
int cutout_top;
|
||||
int cutout_right;
|
||||
int cutout_bottom;
|
||||
} AndroidInsets;
|
||||
|
||||
static inline void android_insets_init(void) {}
|
||||
static inline void android_insets_get(AndroidInsets *out) { (void)out; }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -2,9 +2,17 @@
|
||||
#define INBE_APP_H
|
||||
|
||||
#include "raylib.h"
|
||||
#include "lotus_app.h"
|
||||
#include "../libinbe/inbe.h"
|
||||
|
||||
typedef struct LotusAppApi {
|
||||
const char *id;
|
||||
void *(*create)(void);
|
||||
void (*init)(void *state);
|
||||
void (*init_args)(void *state, int argc, char **argv);
|
||||
void (*update_draw)(void *state, Rectangle viewport);
|
||||
void (*destroy)(void *state);
|
||||
} LotusAppApi;
|
||||
|
||||
typedef struct InbeApp InbeApp;
|
||||
|
||||
struct InbeApp {
|
||||
@@ -23,6 +31,11 @@ struct InbeApp {
|
||||
Texture2D stat_icon;
|
||||
Texture2D home_icon;
|
||||
Texture2D trash_icon;
|
||||
Texture2D telegram_icon;
|
||||
Texture2D globe_icon;
|
||||
Texture2D stripe_icon;
|
||||
Texture2D monero_icon;
|
||||
|
||||
Texture2D angel_image;
|
||||
Texture2D begin_image;
|
||||
Sound breath_in_sound;
|
||||
@@ -37,11 +50,23 @@ struct InbeApp {
|
||||
int settings_scroll;
|
||||
int settings_drag_slider;
|
||||
int settings_drag_scrollbar;
|
||||
int settings_drag_content; /* Drag content area to scroll */
|
||||
int settings_drag_content_y; /* Initial Y position when drag starts */
|
||||
int settings_dirty;
|
||||
int settings_tab;
|
||||
int fullscreen_enabled; /* Fullscreen mode */
|
||||
int manual_scroll;
|
||||
int manual_drag_scrollbar;
|
||||
int manual_drag_content;
|
||||
int manual_drag_content_y;
|
||||
int tutorial_step;
|
||||
int tutorial_seen;
|
||||
int theme_id;
|
||||
int dark_mode;
|
||||
int history_scroll;
|
||||
int history_drag_scrollbar;
|
||||
int history_drag_content;
|
||||
int history_drag_content_y;
|
||||
int history_level;
|
||||
int history_year;
|
||||
int history_month;
|
||||
@@ -49,6 +74,7 @@ struct InbeApp {
|
||||
char history_record[16];
|
||||
int session_paused;
|
||||
int results_saved;
|
||||
int saved_pause_seconds;
|
||||
};
|
||||
|
||||
void inbe_app_init(void *app);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "raylib.h"
|
||||
#include "app.h"
|
||||
#include "android_insets.h"
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
#include <emscripten/emscripten.h>
|
||||
@@ -13,6 +14,8 @@ static InbeApp inbe_app;
|
||||
#define INBE_ANDROID_BUILD 0
|
||||
#endif
|
||||
|
||||
static AndroidInsets insets;
|
||||
|
||||
static void
|
||||
frame(void)
|
||||
{
|
||||
@@ -28,6 +31,38 @@ frame(void)
|
||||
height = render_height;
|
||||
#endif
|
||||
|
||||
#if INBE_ANDROID_BUILD
|
||||
android_insets_get(&insets);
|
||||
|
||||
int safe_top = insets.cutout_top > insets.status_bar ?
|
||||
insets.cutout_top : insets.status_bar;
|
||||
int safe_bottom = insets.cutout_bottom > insets.nav_bar ?
|
||||
insets.cutout_bottom : insets.nav_bar;
|
||||
int safe_left = insets.cutout_left;
|
||||
int safe_right = insets.cutout_right;
|
||||
|
||||
int content_x = safe_left;
|
||||
int content_y = safe_top;
|
||||
int content_width = width - safe_left - safe_right;
|
||||
int content_height = height - safe_top - safe_bottom;
|
||||
|
||||
TraceLog(LOG_INFO, "FRAME: screen=%dx%d safe=%d,%d,%d,%d content=%d,%d,%dx%d",
|
||||
width, height, safe_left, safe_top, safe_right, safe_bottom,
|
||||
content_x, content_y, content_width, content_height);
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
inbe_app_update_draw(&inbe_app, (Rectangle){
|
||||
(float)content_x,
|
||||
(float)content_y,
|
||||
(float)content_width,
|
||||
(float)content_height
|
||||
});
|
||||
if(inbe_app.cursor_clickable)
|
||||
SetMouseCursor(MOUSE_CURSOR_POINTING_HAND);
|
||||
else
|
||||
SetMouseCursor(MOUSE_CURSOR_DEFAULT);
|
||||
#else
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
inbe_app_update_draw(&inbe_app, (Rectangle){
|
||||
@@ -36,6 +71,11 @@ frame(void)
|
||||
(float)width,
|
||||
(float)height
|
||||
});
|
||||
if(inbe_app.cursor_clickable)
|
||||
SetMouseCursor(MOUSE_CURSOR_POINTING_HAND);
|
||||
else
|
||||
SetMouseCursor(MOUSE_CURSOR_DEFAULT);
|
||||
#endif
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
@@ -53,9 +93,15 @@ int main(int argc, char **argv) {
|
||||
#if INBE_ANDROID_BUILD
|
||||
if(!ChangeDirectory("/data/user/0/xyz.waozi.inbe/files"))
|
||||
TraceLog(LOG_WARNING, "INBE: failed to switch to Android files directory");
|
||||
android_insets_init();
|
||||
#endif
|
||||
|
||||
inbe_app_init(&inbe_app);
|
||||
|
||||
/* Apply fullscreen setting on startup */
|
||||
if(inbe_app.fullscreen_enabled && !IsWindowFullscreen())
|
||||
ToggleFullscreen();
|
||||
|
||||
SetTargetFPS(60);
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
#include "theme.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static LotusThemeScope scopes[LOTUS_THEME_MAX_SCOPES];
|
||||
static int scope_count = 0;
|
||||
|
||||
static void copy_text(char *dst, int size, const char *src)
|
||||
{
|
||||
snprintf(dst, (size_t)size, "%s", src ? src : "");
|
||||
}
|
||||
|
||||
static int hex_value(char c)
|
||||
{
|
||||
if(c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
if(c >= 'a' && c <= 'f')
|
||||
return c - 'a' + 10;
|
||||
if(c >= 'A' && c <= 'F')
|
||||
return c - 'A' + 10;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static unsigned char hex_byte(const char *text)
|
||||
{
|
||||
int hi = hex_value(text[0]);
|
||||
int lo = hex_value(text[1]);
|
||||
if(hi < 0 || lo < 0)
|
||||
return 0;
|
||||
return (unsigned char)(hi * 16 + lo);
|
||||
}
|
||||
|
||||
bool theme_parse_color(const char *text, Color *color)
|
||||
{
|
||||
int len;
|
||||
|
||||
if(text == NULL || color == NULL)
|
||||
return false;
|
||||
if(text[0] == '#')
|
||||
text++;
|
||||
|
||||
len = (int)strlen(text);
|
||||
if(len != 6 && len != 8)
|
||||
return false;
|
||||
|
||||
for(int i = 0; i < len; i++) {
|
||||
if(hex_value(text[i]) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
color->r = hex_byte(text);
|
||||
color->g = hex_byte(text + 2);
|
||||
color->b = hex_byte(text + 4);
|
||||
color->a = (len == 8) ? hex_byte(text + 6) : 255;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *theme_color_text(Color color, char *buffer, int size)
|
||||
{
|
||||
if(buffer == NULL || size <= 0)
|
||||
return "";
|
||||
|
||||
snprintf(buffer, (size_t)size, "#%02X%02X%02X%02X", color.r, color.g, color.b, color.a);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void theme_reset(void)
|
||||
{
|
||||
memset(scopes, 0, sizeof(scopes));
|
||||
scope_count = 0;
|
||||
}
|
||||
|
||||
LotusThemeScope *theme_scope(const char *name)
|
||||
{
|
||||
if(name == NULL)
|
||||
return NULL;
|
||||
|
||||
for(int i = 0; i < scope_count; i++) {
|
||||
if(strcmp(scopes[i].name, name) == 0)
|
||||
return &scopes[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const LotusThemeScope *theme_scope_at(int index)
|
||||
{
|
||||
if(index < 0 || index >= scope_count)
|
||||
return NULL;
|
||||
return &scopes[index];
|
||||
}
|
||||
|
||||
int theme_scope_count(void)
|
||||
{
|
||||
return scope_count;
|
||||
}
|
||||
|
||||
static LotusThemeValue *scope_value(LotusThemeScope *scope, const char *key)
|
||||
{
|
||||
if(scope == NULL || key == NULL)
|
||||
return NULL;
|
||||
|
||||
for(int i = 0; i < scope->count; i++) {
|
||||
if(strcmp(scope->values[i].key, key) == 0)
|
||||
return &scope->values[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static LotusThemeValue *scope_add_value(LotusThemeScope *scope, const char *key, Color color)
|
||||
{
|
||||
LotusThemeValue *value;
|
||||
|
||||
if(scope == NULL || key == NULL || key[0] == '\0')
|
||||
return NULL;
|
||||
|
||||
value = scope_value(scope, key);
|
||||
if(value != NULL) {
|
||||
value->value = color;
|
||||
return value;
|
||||
}
|
||||
|
||||
if(scope->count >= LOTUS_THEME_MAX_VALUES)
|
||||
return NULL;
|
||||
|
||||
value = &scope->values[scope->count++];
|
||||
memset(value, 0, sizeof(*value));
|
||||
copy_text(value->key, LOTUS_THEME_NAME_SIZE, key);
|
||||
value->value = color;
|
||||
return value;
|
||||
}
|
||||
|
||||
static void load_scope_file(LotusThemeScope *scope)
|
||||
{
|
||||
FILE *file;
|
||||
char line[256];
|
||||
|
||||
if(scope == NULL || scope->path[0] == '\0')
|
||||
return;
|
||||
|
||||
file = fopen(scope->path, "r");
|
||||
if(file == NULL)
|
||||
return;
|
||||
|
||||
while(fgets(line, sizeof(line), file) != NULL) {
|
||||
char key[LOTUS_THEME_NAME_SIZE];
|
||||
char value[32];
|
||||
char *cursor = line;
|
||||
int key_len = 0;
|
||||
Color color;
|
||||
|
||||
while(isspace((unsigned char)*cursor))
|
||||
cursor++;
|
||||
if(*cursor == '#' || *cursor == '\0')
|
||||
continue;
|
||||
|
||||
while(*cursor != '\0' && !isspace((unsigned char)*cursor) &&
|
||||
key_len < LOTUS_THEME_NAME_SIZE - 1) {
|
||||
key[key_len++] = *cursor++;
|
||||
}
|
||||
key[key_len] = '\0';
|
||||
|
||||
while(isspace((unsigned char)*cursor))
|
||||
cursor++;
|
||||
if(*cursor == '"')
|
||||
cursor++;
|
||||
|
||||
int value_len = 0;
|
||||
while(*cursor != '\0' && *cursor != '"' && *cursor != '\n' &&
|
||||
!isspace((unsigned char)*cursor) && value_len < (int)sizeof(value) - 1) {
|
||||
value[value_len++] = *cursor++;
|
||||
}
|
||||
value[value_len] = '\0';
|
||||
|
||||
if(theme_parse_color(value, &color))
|
||||
scope_add_value(scope, key, color);
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
LotusThemeScope *theme_register_scope(const char *name, const char *path)
|
||||
{
|
||||
LotusThemeScope *scope = theme_scope(name);
|
||||
if(scope == NULL) {
|
||||
if(scope_count >= LOTUS_THEME_MAX_SCOPES)
|
||||
return NULL;
|
||||
scope = &scopes[scope_count++];
|
||||
}
|
||||
|
||||
memset(scope, 0, sizeof(*scope));
|
||||
copy_text(scope->name, LOTUS_THEME_NAME_SIZE, name);
|
||||
copy_text(scope->path, LOTUS_THEME_PATH_SIZE, path);
|
||||
load_scope_file(scope);
|
||||
return scope;
|
||||
}
|
||||
|
||||
Color theme_get(const char *scope_name, const char *key)
|
||||
{
|
||||
LotusThemeValue *value = scope_value(theme_scope(scope_name), key);
|
||||
if(value != NULL)
|
||||
return value->value;
|
||||
|
||||
fprintf(stderr, "missing theme color: %s.%s\n",
|
||||
scope_name != NULL ? scope_name : "(null)",
|
||||
key != NULL ? key : "(null)");
|
||||
abort();
|
||||
}
|
||||
|
||||
bool theme_set_color(const char *scope_name, const char *key, Color color)
|
||||
{
|
||||
LotusThemeValue *value = scope_value(theme_scope(scope_name), key);
|
||||
if(value == NULL)
|
||||
return false;
|
||||
value->value = color;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool theme_save_scope(const char *scope_name)
|
||||
{
|
||||
LotusThemeScope *scope = theme_scope(scope_name);
|
||||
FILE *file;
|
||||
char text[16];
|
||||
const char *dir;
|
||||
|
||||
if(scope == NULL || scope->path[0] == '\0')
|
||||
return false;
|
||||
|
||||
dir = GetDirectoryPath(scope->path);
|
||||
if(dir != NULL && dir[0] != '\0' && !DirectoryExists(dir))
|
||||
MakeDirectory(dir);
|
||||
|
||||
file = fopen(scope->path, "w");
|
||||
if(file == NULL)
|
||||
return false;
|
||||
|
||||
fprintf(file, "# Lotus theme: %s\n", scope->name);
|
||||
for(int i = 0; i < scope->count; i++)
|
||||
fprintf(file, "%s \"%s\"\n", scope->values[i].key,
|
||||
theme_color_text(scope->values[i].value, text, sizeof(text)));
|
||||
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool theme_save_all(void)
|
||||
{
|
||||
bool ok = true;
|
||||
for(int i = 0; i < scope_count; i++) {
|
||||
if(scopes[i].path[0] != '\0' && !theme_save_scope(scopes[i].name))
|
||||
ok = false;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void theme_draw_tk_border(Rectangle rec, int borderWidth, bool raised)
|
||||
{
|
||||
Color highlight = theme_get("lotus", "border_light");
|
||||
Color shadow = theme_get("lotus", "border_shadow");
|
||||
Color topLeft = raised ? highlight : shadow;
|
||||
Color bottomRight = raised ? shadow : highlight;
|
||||
|
||||
int x = (int)rec.x;
|
||||
int y = (int)rec.y;
|
||||
int w = (int)rec.width;
|
||||
int h = (int)rec.height;
|
||||
|
||||
DrawRectangle(x, y, w, borderWidth, topLeft);
|
||||
DrawRectangle(x, y, borderWidth, h, topLeft);
|
||||
DrawRectangle(x, y + h - borderWidth, w, borderWidth, bottomRight);
|
||||
DrawRectangle(x + w - borderWidth, y, borderWidth, h, bottomRight);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef THEME_H
|
||||
#define THEME_H
|
||||
|
||||
#include "raylib.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define LOTUS_THEME_MAX_SCOPES 16
|
||||
#define LOTUS_THEME_MAX_VALUES 48
|
||||
#define LOTUS_THEME_NAME_SIZE 64
|
||||
#define LOTUS_THEME_PATH_SIZE 256
|
||||
|
||||
typedef struct LotusThemeValue {
|
||||
char key[LOTUS_THEME_NAME_SIZE];
|
||||
Color value;
|
||||
} LotusThemeValue;
|
||||
|
||||
typedef struct LotusThemeScope {
|
||||
char name[LOTUS_THEME_NAME_SIZE];
|
||||
char path[LOTUS_THEME_PATH_SIZE];
|
||||
LotusThemeValue values[LOTUS_THEME_MAX_VALUES];
|
||||
int count;
|
||||
} LotusThemeScope;
|
||||
|
||||
void theme_reset(void);
|
||||
LotusThemeScope *theme_register_scope(const char *name, const char *path);
|
||||
LotusThemeScope *theme_scope(const char *name);
|
||||
const LotusThemeScope *theme_scope_at(int index);
|
||||
int theme_scope_count(void);
|
||||
Color theme_get(const char *scope, const char *key);
|
||||
bool theme_set_color(const char *scope, const char *key, Color color);
|
||||
bool theme_save_scope(const char *scope);
|
||||
bool theme_save_all(void);
|
||||
const char *theme_color_text(Color color, char *buffer, int size);
|
||||
bool theme_parse_color(const char *text, Color *color);
|
||||
void theme_draw_tk_border(Rectangle rec, int borderWidth, bool raised);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "theme_meta.h"
|
||||
|
||||
const ThemeMeta g_themes[THEME_COUNT] = {
|
||||
[ThemeSky] = {"Sky", "sky_light", "sky_dark"},
|
||||
[ThemeOcean] = {"Ocean", "ocean_light", "ocean_dark"},
|
||||
[ThemeForest] = {"Forest", "forest_light", "forest_dark"},
|
||||
[ThemeSunset] = {"Sunset", "sunset_light", "sunset_dark"},
|
||||
[ThemeLavender] = {"Lavender", "lavender_light", "lavender_dark"},
|
||||
[ThemeCherry] = {"Cherry", "cherry_light", "cherry_dark"}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef THEME_META_H
|
||||
#define THEME_META_H
|
||||
|
||||
#define THEME_COUNT 6
|
||||
|
||||
typedef enum {
|
||||
ThemeSky = 0,
|
||||
ThemeOcean = 1,
|
||||
ThemeForest = 2,
|
||||
ThemeSunset = 3,
|
||||
ThemeLavender = 4,
|
||||
ThemeCherry = 5
|
||||
} ThemeId;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *light_scope;
|
||||
const char *dark_scope;
|
||||
} ThemeMeta;
|
||||
|
||||
extern const ThemeMeta g_themes[THEME_COUNT];
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,881 @@
|
||||
#include "ui.h"
|
||||
#include "android_insets.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Constants */
|
||||
enum {
|
||||
ICON_SIZE_SMALL = 22,
|
||||
ICON_SIZE_MEDIUM = 26,
|
||||
ICON_SIZE_LARGE = 30,
|
||||
ICON_SIZE_SMALL_MIN = 20,
|
||||
ICON_SIZE_SMALL_MAX = 36,
|
||||
ICON_SIZE_MEDIUM_MIN = 24,
|
||||
ICON_SIZE_MEDIUM_MAX = 40,
|
||||
ICON_SIZE_LARGE_MIN = 28,
|
||||
ICON_SIZE_LARGE_MAX = 44
|
||||
};
|
||||
|
||||
/* Global UI state */
|
||||
static float dpi_scale = 1.0f;
|
||||
static int view_width = 320;
|
||||
static int view_height = 560;
|
||||
static Color c_text, c_bg, c_circle, c_button, c_button_hover, c_icon;
|
||||
|
||||
void
|
||||
ui_init(int width, int height, float dpi)
|
||||
{
|
||||
view_width = width;
|
||||
view_height = height;
|
||||
dpi_scale = dpi;
|
||||
}
|
||||
|
||||
void
|
||||
ui_set_colors(Color text, Color bg, Color circle, Color button, Color button_hover, Color icon)
|
||||
{
|
||||
c_text = text;
|
||||
c_bg = bg;
|
||||
c_circle = circle;
|
||||
c_button = button;
|
||||
c_button_hover = button_hover;
|
||||
c_icon = icon;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* DPI SCALING
|
||||
* ================================================================ */
|
||||
|
||||
int
|
||||
ui_px(int px)
|
||||
{
|
||||
return (int)(px * dpi_scale + 0.5f);
|
||||
}
|
||||
|
||||
int
|
||||
ui_clamp_px(int px, int min_px, int max_px)
|
||||
{
|
||||
int value = (int)(px * dpi_scale + 0.5f);
|
||||
int min_value = (int)(min_px * dpi_scale + 0.5f);
|
||||
int max_value = (int)(max_px * dpi_scale + 0.5f);
|
||||
|
||||
if(value < min_value)
|
||||
value = min_value;
|
||||
if(value > max_value)
|
||||
value = max_value;
|
||||
return value;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* COLOR HELPERS
|
||||
* ================================================================ */
|
||||
|
||||
Color
|
||||
ui_lighten(Color c, int amount)
|
||||
{
|
||||
return (Color){
|
||||
(unsigned char)(c.r + amount > 255 ? 255 : c.r + amount),
|
||||
(unsigned char)(c.g + amount > 255 ? 255 : c.g + amount),
|
||||
(unsigned char)(c.b + amount > 255 ? 255 : c.b + amount),
|
||||
c.a
|
||||
};
|
||||
}
|
||||
|
||||
Color
|
||||
ui_darken(Color c, int amount)
|
||||
{
|
||||
return (Color){
|
||||
(unsigned char)(c.r < amount ? 0 : c.r - amount),
|
||||
(unsigned char)(c.g < amount ? 0 : c.g - amount),
|
||||
(unsigned char)(c.b < amount ? 0 : c.b - amount),
|
||||
c.a
|
||||
};
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* LAYOUT HELPERS
|
||||
* ================================================================ */
|
||||
|
||||
void
|
||||
ui_centered_column(int max_w, int side_pad, int *x, int *w)
|
||||
{
|
||||
max_w = (int)(max_w * dpi_scale + 0.5f);
|
||||
side_pad = (int)(side_pad * dpi_scale + 0.5f);
|
||||
|
||||
int available_w = view_width - side_pad * 2;
|
||||
|
||||
if(available_w < 0)
|
||||
available_w = 0;
|
||||
if(max_w > available_w)
|
||||
max_w = available_w;
|
||||
if(max_w < 0)
|
||||
max_w = 0;
|
||||
|
||||
if(x != NULL)
|
||||
*x = (view_width - max_w) / 2;
|
||||
if(w != NULL)
|
||||
*w = max_w;
|
||||
}
|
||||
|
||||
void
|
||||
ui_draw_bevel(int x, int y, int w, int h, Color light, Color dark)
|
||||
{
|
||||
int border = (int)(dpi_scale + 0.5f);
|
||||
if(border < 1) border = 1;
|
||||
|
||||
DrawRectangle(x, y, w, border, light);
|
||||
DrawRectangle(x, y, border, h, light);
|
||||
DrawRectangle(x + w - border, y, border, h, dark);
|
||||
DrawRectangle(x, y + h - border, w, border, dark);
|
||||
}
|
||||
|
||||
void
|
||||
ui_draw_text_lines(const char **lines, int count, int x, int *y, int font, int line_h)
|
||||
{
|
||||
for(int i = 0; i < count; i++) {
|
||||
DrawText(lines[i], x, *y, font, c_text);
|
||||
*y += line_h;
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* ICON BUTTONS
|
||||
* ================================================================ */
|
||||
|
||||
int
|
||||
ui_icon_btn_size(UIIconSize size)
|
||||
{
|
||||
switch(size) {
|
||||
case UI_ICON_SIZE_TINY: return ui_clamp_px(18, 16, 40);
|
||||
case UI_ICON_SIZE_SMALL: return ui_clamp_px(ICON_SIZE_SMALL, ICON_SIZE_SMALL_MIN, ICON_SIZE_SMALL_MAX);
|
||||
case UI_ICON_SIZE_MEDIUM: return ui_clamp_px(ICON_SIZE_MEDIUM, ICON_SIZE_MEDIUM_MIN, ICON_SIZE_MEDIUM_MAX);
|
||||
case UI_ICON_SIZE_LARGE: return ui_clamp_px(ICON_SIZE_LARGE, ICON_SIZE_LARGE_MIN, ICON_SIZE_LARGE_MAX);
|
||||
default: return ui_clamp_px(ICON_SIZE_SMALL, ICON_SIZE_SMALL_MIN, ICON_SIZE_SMALL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ui_icon_btn_padding(UIIconSize size)
|
||||
{
|
||||
switch(size) {
|
||||
case UI_ICON_SIZE_TINY: return ui_px(8);
|
||||
case UI_ICON_SIZE_SMALL: return ui_px(10);
|
||||
case UI_ICON_SIZE_MEDIUM: return ui_px(12);
|
||||
case UI_ICON_SIZE_LARGE: return ui_px(14);
|
||||
default: return ui_px(10);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_icon_btn(InbeApp *app, int x, int y, UIIconSize size, Texture2D icon, int *hover)
|
||||
{
|
||||
int btn_size = ui_icon_btn_size(size);
|
||||
int padding = ui_icon_btn_padding(size);
|
||||
int w = btn_size + padding * 2;
|
||||
int h = btn_size + padding * 2;
|
||||
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int mx = (int)mouse_world.x;
|
||||
int my = (int)mouse_world.y;
|
||||
int mb = IsMouseButtonDown(MOUSE_BUTTON_LEFT);
|
||||
int released = IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
|
||||
int pressed = 0;
|
||||
|
||||
if(mx > x && mx < x + w && my > y && my < y + h) {
|
||||
DrawRectangle(x, y, w, h, c_button_hover);
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_button_hover, 40), ui_lighten(c_button_hover, 40));
|
||||
*hover = 1;
|
||||
app->cursor_clickable = 1;
|
||||
if(mb) {
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button_hover, 40), ui_darken(c_button_hover, 40));
|
||||
}
|
||||
if(released) {
|
||||
pressed = 1;
|
||||
}
|
||||
} else {
|
||||
DrawRectangle(x, y, w, h, c_button);
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button, 40), ui_darken(c_button, 40));
|
||||
*hover = 0;
|
||||
}
|
||||
|
||||
if(icon.id != 0) {
|
||||
Rectangle src = {0, 0, icon.width, icon.height};
|
||||
Rectangle dst = {x + padding, y + padding, (float)btn_size, (float)btn_size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
}
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_icon_btn_small(InbeApp *app, int x, int y, Texture2D icon, int *hover)
|
||||
{
|
||||
return ui_draw_icon_btn(app, x, y, UI_ICON_SIZE_SMALL, icon, hover);
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_icon_btn_medium(InbeApp *app, int x, int y, Texture2D icon, int *hover)
|
||||
{
|
||||
return ui_draw_icon_btn(app, x, y, UI_ICON_SIZE_MEDIUM, icon, hover);
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_icon_btn_large(InbeApp *app, int x, int y, Texture2D icon, int *hover)
|
||||
{
|
||||
return ui_draw_icon_btn(app, x, y, UI_ICON_SIZE_LARGE, icon, hover);
|
||||
}
|
||||
|
||||
void
|
||||
ui_draw_icon_link(InbeApp *app, int x, int y, int icon_size, Texture2D icon, const char *url)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int mx = (int)mouse_world.x;
|
||||
int my = (int)mouse_world.y;
|
||||
int hover = 0;
|
||||
int padding = ui_px(4);
|
||||
int btn_w = icon_size + padding * 2;
|
||||
int btn_h = icon_size + padding * 2;
|
||||
int btn_x = x - padding;
|
||||
int btn_y = y - padding;
|
||||
|
||||
if(mx > btn_x && mx < btn_x + btn_w && my > btn_y && my < btn_y + btn_h) {
|
||||
hover = 1;
|
||||
app->cursor_clickable = 1;
|
||||
}
|
||||
|
||||
if(hover) {
|
||||
DrawRectangle(btn_x, btn_y, btn_w, btn_h, c_button_hover);
|
||||
ui_draw_bevel(btn_x, btn_y, btn_w, btn_h, ui_darken(c_button_hover, 40), ui_lighten(c_button_hover, 40));
|
||||
} else {
|
||||
DrawRectangle(btn_x, btn_y, btn_w, btn_h, c_button);
|
||||
ui_draw_bevel(btn_x, btn_y, btn_w, btn_h, ui_lighten(c_button, 40), ui_darken(c_button, 40));
|
||||
}
|
||||
|
||||
if(icon.id != 0) {
|
||||
Rectangle src = {0, 0, icon.width, icon.height};
|
||||
Rectangle dst = {x, y, (float)icon_size, (float)icon_size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
}
|
||||
|
||||
if(hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
|
||||
OpenURL(url);
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* CONTROLS
|
||||
* ================================================================ */
|
||||
|
||||
static int
|
||||
clampi(int value, int min, int max)
|
||||
{
|
||||
if(value < min)
|
||||
return min;
|
||||
if(value > max)
|
||||
return max;
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_slider(InbeApp *app, int id, int x, int y, int w, const char *label,
|
||||
int min, int max, int *value, const char *suffix)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int mx = (int)mouse_world.x;
|
||||
int label_font = ui_clamp_px(14, 12, 16);
|
||||
int value_font = ui_clamp_px(14, 12, 16);
|
||||
int track_y = y + ui_px(28);
|
||||
int track_h = ui_px(8);
|
||||
int knob_w = ui_px(12);
|
||||
int knob_h = ui_px(22);
|
||||
int knob_y = track_y - (knob_h - track_h) / 2;
|
||||
int hit_padding = ui_px(16);
|
||||
int changed = 0;
|
||||
char value_text[32];
|
||||
Rectangle hit = {(float)(x - hit_padding), (float)(knob_y - hit_padding), (float)(w + hit_padding * 2), (float)(knob_h + hit_padding * 2)};
|
||||
|
||||
snprintf(value_text, sizeof(value_text), "%d%s", *value, suffix != NULL ? suffix : "");
|
||||
DrawText(label, x, y, label_font, c_text);
|
||||
DrawText(value_text, x + w - MeasureText(value_text, value_font), y, value_font, c_text);
|
||||
|
||||
DrawRectangle(x, track_y, w, track_h, ui_darken(c_bg, 28));
|
||||
ui_draw_bevel(x, track_y, w, track_h, ui_darken(c_bg, 55), ui_lighten(c_bg, 35));
|
||||
|
||||
if(CheckCollisionPointRec(mouse_world, hit)) {
|
||||
app->cursor_clickable = 1;
|
||||
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
app->settings_drag_slider = id;
|
||||
}
|
||||
|
||||
if(app->settings_drag_slider == id && IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
|
||||
int old_value = *value;
|
||||
float t = (float)(mx - x) / (float)w;
|
||||
if(t < 0.0f)
|
||||
t = 0.0f;
|
||||
if(t > 1.0f)
|
||||
t = 1.0f;
|
||||
*value = min + (int)(t * (float)(max - min) + 0.5f);
|
||||
*value = clampi(*value, min, max);
|
||||
changed = (*value != old_value);
|
||||
}
|
||||
|
||||
float t = (float)(*value - min) / (float)(max - min);
|
||||
int knob_x = x + (int)(t * (float)w) - knob_w / 2;
|
||||
DrawRectangle(knob_x, knob_y, knob_w, knob_h, c_button);
|
||||
ui_draw_bevel(knob_x, knob_y, knob_w, knob_h, ui_lighten(c_button, 40), ui_darken(c_button, 40));
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_toggle_switch(InbeApp *app, int x, int y, int w, int h, int *value)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int hover = 0;
|
||||
Rectangle bounds = {x, y, w, h};
|
||||
|
||||
if(CheckCollisionPointRec(mouse_world, bounds)) {
|
||||
hover = 1;
|
||||
app->cursor_clickable = 1;
|
||||
}
|
||||
|
||||
int pressed = hover && IsMouseButtonPressed(MOUSE_BUTTON_LEFT);
|
||||
|
||||
if(pressed)
|
||||
*value = !(*value);
|
||||
|
||||
Color bg = ui_darken(c_bg, 8);
|
||||
DrawRectangle(x, y, w, h, bg);
|
||||
|
||||
int track_h = h - 6;
|
||||
int track_y = y + 3;
|
||||
DrawRectangleRounded((Rectangle){x + 3, track_y, w - 6, track_h}, 0.5f, 8, ui_darken(c_bg, 20));
|
||||
|
||||
int active_w = (w - 6) / 2;
|
||||
int active_x = *value ? x + w - active_w - 3 : x + 3;
|
||||
DrawRectangleRounded((Rectangle){active_x, track_y, active_w, track_h}, 0.5f, 8, c_circle);
|
||||
|
||||
int font = ui_clamp_px(12, 10, 14);
|
||||
const char *light_label = "Light";
|
||||
const char *dark_label = "Dark";
|
||||
int light_w = MeasureText(light_label, font);
|
||||
int dark_w = MeasureText(dark_label, font);
|
||||
|
||||
Color label_color = c_text;
|
||||
/* Center text in each half of the toggle */
|
||||
int light_x = x + w / 4 - light_w / 2;
|
||||
int dark_x = x + w * 3 / 4 - dark_w / 2;
|
||||
int text_y = y + h / 2 - font / 2;
|
||||
DrawText(light_label, light_x, text_y, font, label_color);
|
||||
DrawText(dark_label, dark_x, text_y, font, label_color);
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_checkbox_toggle(InbeApp *app, int x, int y, const char *label, int *value)
|
||||
{
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int box_size = ui_px(22);
|
||||
int hover = 0;
|
||||
Rectangle bounds = {x, y, box_size, box_size};
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
|
||||
if(CheckCollisionPointRec(mouse_world, bounds)) {
|
||||
hover = 1;
|
||||
app->cursor_clickable = 1;
|
||||
}
|
||||
|
||||
int pressed = hover && IsMouseButtonPressed(MOUSE_BUTTON_LEFT);
|
||||
if(pressed)
|
||||
*value = !(*value);
|
||||
|
||||
DrawRectangle(x, y, box_size, box_size, c_button);
|
||||
ui_draw_bevel(x, y, box_size, box_size, ui_darken(c_bg, 30), ui_lighten(c_bg, 20));
|
||||
|
||||
if(*value) {
|
||||
int padding = ui_px(4);
|
||||
DrawLine(x + padding, y + padding, x + box_size / 2, y + box_size - padding, c_text);
|
||||
DrawLine(x + box_size / 2, y + box_size - padding, x + box_size - padding, y + padding, c_text);
|
||||
}
|
||||
|
||||
DrawText(label, x + box_size + ui_px(10), y + (box_size - font) / 2, font, c_text);
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
/* Per-dropdown state to track open/closed and click handling */
|
||||
typedef struct UIDropdownState {
|
||||
int id;
|
||||
int open;
|
||||
int just_opened;
|
||||
int scroll_offset;
|
||||
int x, y, w, h;
|
||||
const char **options;
|
||||
int option_count;
|
||||
int *selected_index;
|
||||
} UIDropdownState;
|
||||
|
||||
#define MAX_DROPDOWNS 8
|
||||
static UIDropdownState dropdown_states[MAX_DROPDOWNS];
|
||||
static int dropdown_state_count = 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].options = NULL;
|
||||
dropdown_states[dropdown_state_count].option_count = 0;
|
||||
dropdown_states[dropdown_state_count].selected_index = NULL;
|
||||
return &dropdown_states[dropdown_state_count++];
|
||||
}
|
||||
|
||||
/* Fallback - use first slot */
|
||||
dropdown_states[0].id = id;
|
||||
return &dropdown_states[0];
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_dropdown_button(InbeApp *app, 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 = ui_clamp_px(14, 12, 16);
|
||||
int arrow_pad = ui_px(24);
|
||||
int arrow_size = ui_px(6);
|
||||
int changed = 0;
|
||||
Rectangle btn_bounds = {x, y, w, h};
|
||||
Vector2 mouse = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int hover = CheckCollisionPointRec(mouse, btn_bounds);
|
||||
|
||||
/* 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->options = options;
|
||||
state->option_count = option_count;
|
||||
state->selected_index = selected_index;
|
||||
|
||||
if(hover)
|
||||
app->cursor_clickable = 1;
|
||||
|
||||
/* Handle click on button */
|
||||
if(hover && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
|
||||
state->open = !state->open;
|
||||
if(state->open)
|
||||
state->just_opened = 1;
|
||||
}
|
||||
|
||||
/* Mouse wheel to cycle through options */
|
||||
float wheel = GetMouseWheelMove();
|
||||
if(hover && wheel != 0 && !state->open) {
|
||||
if(wheel > 0)
|
||||
*selected_index = (*selected_index + 1) % option_count;
|
||||
else
|
||||
*selected_index = (*selected_index - 1 + option_count) % option_count;
|
||||
state->open = 0;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
/* Draw button background */
|
||||
DrawRectangleRounded(btn_bounds, 0.3f, 8, ui_darken(c_bg, 8));
|
||||
|
||||
/* Draw current selection text */
|
||||
const char *current_name = options[*selected_index];
|
||||
DrawText(current_name, x + ui_px(12), y + h / 2 - font / 2 - 1, font, c_text);
|
||||
|
||||
/* 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, BLACK);
|
||||
DrawLine(x1, y2, x2, y1, BLACK);
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
void
|
||||
ui_draw_dropdown_menu(InbeApp *app, int id)
|
||||
{
|
||||
UIDropdownState *state = get_or_create_dropdown_state(id);
|
||||
|
||||
if(!state->open || state->options == NULL || state->selected_index == NULL)
|
||||
return;
|
||||
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int x = state->x;
|
||||
int y = state->y;
|
||||
int w = state->w;
|
||||
int h = state->h;
|
||||
int option_count = state->option_count;
|
||||
int *selected_index = state->selected_index;
|
||||
const char **options = state->options;
|
||||
|
||||
int option_h = h;
|
||||
int menu_gap = ui_px(4);
|
||||
int dropdown_y = y + h + menu_gap;
|
||||
int dropdown_h = option_h * option_count + ui_px(8);
|
||||
int max_visible_h = view_height - dropdown_y - ui_px(16);
|
||||
int need_scroll = dropdown_h > max_visible_h;
|
||||
int visible_options = option_count;
|
||||
|
||||
if(need_scroll) {
|
||||
visible_options = (max_visible_h - ui_px(8)) / option_h;
|
||||
if(visible_options < 1)
|
||||
visible_options = 1;
|
||||
dropdown_h = visible_options * option_h + ui_px(8);
|
||||
}
|
||||
|
||||
Rectangle menu_bounds = {x, dropdown_y, w, dropdown_h};
|
||||
Rectangle btn_bounds = {x, y, w, h};
|
||||
Vector2 mouse = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
|
||||
/* Click outside closes dropdown */
|
||||
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
|
||||
if(!state->just_opened &&
|
||||
!CheckCollisionPointRec(mouse, btn_bounds) &&
|
||||
!CheckCollisionPointRec(mouse, menu_bounds)) {
|
||||
state->open = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(state->just_opened && !IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
state->just_opened = 0;
|
||||
|
||||
/* Draw dropdown background */
|
||||
DrawRectangle(x, dropdown_y, w, dropdown_h, c_button);
|
||||
ui_draw_bevel(x, dropdown_y, w, dropdown_h, ui_darken(c_bg, 30), ui_lighten(c_bg, 20));
|
||||
|
||||
/* Clip to menu area */
|
||||
BeginScissorMode(x, dropdown_y, w, dropdown_h);
|
||||
|
||||
/* Draw options */
|
||||
for(int i = 0; i < option_count; i++) {
|
||||
int option_y = dropdown_y + ui_px(4) + (i - state->scroll_offset) * option_h;
|
||||
Rectangle option_bounds = {x, option_y, w, option_h};
|
||||
|
||||
/* Skip if outside visible area */
|
||||
if(option_y + option_h < dropdown_y || option_y > dropdown_y + dropdown_h)
|
||||
continue;
|
||||
|
||||
int option_hover = CheckCollisionPointRec(mouse, option_bounds);
|
||||
|
||||
if(option_hover) {
|
||||
DrawRectangle(x, option_y, w, option_h, c_button_hover);
|
||||
app->cursor_clickable = 1;
|
||||
|
||||
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT) && !state->just_opened) {
|
||||
*selected_index = i;
|
||||
state->open = 0;
|
||||
state->just_opened = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DrawText(options[i], x + ui_px(12), option_y + option_h / 2 - font / 2 - 1, font, c_text);
|
||||
}
|
||||
|
||||
EndScissorMode();
|
||||
|
||||
/* Redraw arrow on top of everything */
|
||||
int arrow_pad = ui_px(24);
|
||||
int arrow_size = ui_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);
|
||||
}
|
||||
|
||||
void
|
||||
ui_draw_scrollbar(InbeApp *app, int *scroll, int content_h, int viewport_h,
|
||||
int *drag_scrollbar, int *drag_content, int *drag_content_y)
|
||||
{
|
||||
if(content_h <= viewport_h)
|
||||
return;
|
||||
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int bar_w = ui_px(8);
|
||||
int bar_x = view_width - bar_w;
|
||||
int bar_y = 0;
|
||||
int bar_h = viewport_h;
|
||||
int thumb_h = (viewport_h * bar_h) / content_h;
|
||||
int min_thumb_h = ui_px(32);
|
||||
if(thumb_h < min_thumb_h)
|
||||
thumb_h = min_thumb_h;
|
||||
int max_scroll = content_h - viewport_h;
|
||||
int thumb_y = bar_y + (*scroll * (bar_h - thumb_h)) / max_scroll;
|
||||
int hit_w = ui_px(16);
|
||||
Rectangle thumb = {(float)(bar_x - (hit_w - bar_w) / 2), (float)thumb_y, (float)hit_w, (float)thumb_h};
|
||||
Rectangle content_area = {(float)0, (float)bar_y, (float)bar_x, (float)bar_h};
|
||||
|
||||
DrawRectangle(bar_x, bar_y, bar_w, bar_h, ui_darken(c_bg, 18));
|
||||
DrawRectangle(bar_x, thumb_y, bar_w, thumb_h, c_button_hover);
|
||||
|
||||
if(CheckCollisionPointRec(mouse_world, thumb)) {
|
||||
app->cursor_clickable = 1;
|
||||
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
*drag_scrollbar = 1;
|
||||
}
|
||||
|
||||
if(*drag_scrollbar && IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
|
||||
int usable = bar_h - thumb_h;
|
||||
int y = (int)mouse_world.y - bar_y - thumb_h / 2;
|
||||
y = clampi(y, 0, usable);
|
||||
*scroll = (y * max_scroll) / usable;
|
||||
return;
|
||||
}
|
||||
|
||||
if(CheckCollisionPointRec(mouse_world, content_area)) {
|
||||
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
|
||||
*drag_content = 1;
|
||||
*drag_content_y = (int)mouse_world.y;
|
||||
}
|
||||
}
|
||||
|
||||
if(*drag_content && IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
|
||||
int delta = *drag_content_y - (int)mouse_world.y;
|
||||
*scroll += delta;
|
||||
*scroll = clampi(*scroll, 0, max_scroll);
|
||||
*drag_content_y = (int)mouse_world.y;
|
||||
}
|
||||
|
||||
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
|
||||
*drag_scrollbar = 0;
|
||||
*drag_content = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* NAVIGATION
|
||||
* ================================================================ */
|
||||
|
||||
int
|
||||
ui_nav_button_width(const char *label, int icon_size, int show_label, int font)
|
||||
{
|
||||
int padding = ui_px(6);
|
||||
int width = icon_size + padding * 2;
|
||||
|
||||
if(show_label && label != NULL && label[0] != '\0')
|
||||
width += ui_px(10) + MeasureText(label, font);
|
||||
return width;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon,
|
||||
const char *label, int show_label, int *hover)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int mx = (int)mouse_world.x;
|
||||
int my = (int)mouse_world.y;
|
||||
int mb = IsMouseButtonDown(MOUSE_BUTTON_LEFT);
|
||||
int released = IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int padding = ui_px(6);
|
||||
int w = ui_nav_button_width(label, icon_size, show_label, font);
|
||||
int h = icon_size + padding * 2;
|
||||
int pressed = 0;
|
||||
|
||||
if(mx > x && mx < x + w && my > y && my < y + h) {
|
||||
DrawRectangle(x, y, w, h, c_button_hover);
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_button_hover, 40), ui_lighten(c_button_hover, 40));
|
||||
*hover = 1;
|
||||
app->cursor_clickable = 1;
|
||||
if(mb)
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button_hover, 40), ui_darken(c_button_hover, 40));
|
||||
if(released)
|
||||
pressed = 1;
|
||||
} else {
|
||||
DrawRectangle(x, y, w, h, c_button);
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button, 40), ui_darken(c_button, 40));
|
||||
*hover = 0;
|
||||
}
|
||||
|
||||
if(icon.id != 0) {
|
||||
Rectangle src = {0, 0, icon.width, icon.height};
|
||||
/* Center icon horizontally when no label, otherwise align left */
|
||||
int icon_x = show_label && label && label[0] ? x + padding : x + (w - icon_size) / 2;
|
||||
Rectangle dst = {icon_x, y + padding, (float)icon_size, (float)icon_size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
}
|
||||
|
||||
if(show_label && label != NULL && label[0] != '\0') {
|
||||
int text_x = x + icon_size + padding * 2 + ui_px(10);
|
||||
int text_y = y + (h - font) / 2;
|
||||
DrawText(label, text_x, text_y, font, c_text);
|
||||
}
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_nav_button_expand(InbeApp *app, int x, int y, int icon_size, int w, Texture2D icon,
|
||||
const char *label, int show_label, int *hover)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int mx = (int)mouse_world.x;
|
||||
int my = (int)mouse_world.y;
|
||||
int mb = IsMouseButtonDown(MOUSE_BUTTON_LEFT);
|
||||
int released = IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int padding = ui_px(6);
|
||||
int h = icon_size + padding * 2;
|
||||
int pressed = 0;
|
||||
|
||||
if(mx > x && mx < x + w && my > y && my < y + h) {
|
||||
DrawRectangle(x, y, w, h, c_button_hover);
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_button_hover, 40), ui_lighten(c_button_hover, 40));
|
||||
*hover = 1;
|
||||
app->cursor_clickable = 1;
|
||||
if(mb)
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button_hover, 40), ui_darken(c_button_hover, 40));
|
||||
if(released)
|
||||
pressed = 1;
|
||||
} else {
|
||||
DrawRectangle(x, y, w, h, c_button);
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button, 40), ui_darken(c_button, 40));
|
||||
*hover = 0;
|
||||
}
|
||||
|
||||
if(icon.id != 0) {
|
||||
Rectangle src = {0, 0, icon.width, icon.height};
|
||||
/* Center icon horizontally when no label, otherwise align left */
|
||||
int icon_x = show_label && label && label[0] ? x + padding : x + (w - icon_size) / 2;
|
||||
Rectangle dst = {icon_x, y + padding, (float)icon_size, (float)icon_size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
}
|
||||
|
||||
if(show_label && label != NULL && label[0] != '\0') {
|
||||
int text_x = x + icon_size + padding * 2 + ui_px(10);
|
||||
int text_y = y + (h - font) / 2;
|
||||
DrawText(label, text_x, text_y, font, c_text);
|
||||
}
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* TAB BAR
|
||||
* ================================================================ */
|
||||
|
||||
void
|
||||
ui_draw_tab_bar(UITab *tabs, int count, InbeApp *app)
|
||||
{
|
||||
int bar_h = ui_clamp_px(58, 54, 66);
|
||||
AndroidInsets insets = {0};
|
||||
android_insets_get(&insets);
|
||||
int bar_y = view_height - bar_h;
|
||||
int button_size = ui_clamp_px(ICON_SIZE_LARGE, ICON_SIZE_LARGE_MIN, ICON_SIZE_LARGE_MAX);
|
||||
int button_h = button_size + ui_px(12);
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int side_margin = ui_px(16);
|
||||
int group_gap = ui_px(10);
|
||||
int available_w = view_width - side_margin * 2;
|
||||
|
||||
/* Calculate widths with labels */
|
||||
int group_w_label = 0;
|
||||
for(int i = 0; i < count; i++) {
|
||||
group_w_label += ui_nav_button_width(tabs[i].label, button_size, 1, font);
|
||||
if(i < count - 1)
|
||||
group_w_label += group_gap;
|
||||
}
|
||||
|
||||
/* Calculate widths without labels */
|
||||
int group_w_no_label = 0;
|
||||
for(int i = 0; i < count; i++) {
|
||||
group_w_no_label += ui_nav_button_width(tabs[i].label, button_size, 0, font);
|
||||
if(i < count - 1)
|
||||
group_w_no_label += group_gap;
|
||||
}
|
||||
|
||||
/* Only show labels if all buttons with labels fit */
|
||||
int show_labels = group_w_label <= available_w;
|
||||
int base_group_w = show_labels ? group_w_label : group_w_no_label;
|
||||
|
||||
/* Calculate extra space to distribute among buttons */
|
||||
int extra_w = available_w - base_group_w;
|
||||
int extra_per_button = count > 0 ? extra_w / count : 0;
|
||||
|
||||
int group_x = side_margin;
|
||||
int button_y = bar_y + (bar_h - button_h) / 2;
|
||||
int tab_hover = 0;
|
||||
|
||||
DrawRectangle(0, bar_y, view_width, bar_h, ui_darken(c_bg, 10));
|
||||
DrawLine(0, bar_y, view_width, bar_y, ui_darken(c_bg, 42));
|
||||
|
||||
int x = group_x;
|
||||
for(int i = 0; i < count; i++) {
|
||||
int base_w = ui_nav_button_width(tabs[i].label, button_size, show_labels, font);
|
||||
int w = base_w + extra_per_button;
|
||||
|
||||
if(tabs[i].icon.id != 0) {
|
||||
if(ui_draw_nav_button_expand(app, x, button_y, button_size, w, tabs[i].icon,
|
||||
tabs[i].label, show_labels, &tab_hover)) {
|
||||
if(tabs[i].on_click)
|
||||
tabs[i].on_click(tabs[i].user_data);
|
||||
}
|
||||
}
|
||||
|
||||
x += w + group_gap;
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* TUTORIAL HELPERS
|
||||
* ================================================================ */
|
||||
|
||||
void
|
||||
ui_draw_tutorial_image_placeholder(const char *label, int x, int y, int w, int h)
|
||||
{
|
||||
DrawRectangle(x, y, w, h, ui_darken(c_bg, 12));
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_bg, 45), ui_lighten(c_bg, 35));
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int tw = MeasureText(label, font);
|
||||
DrawText(label, x + w / 2 - tw / 2, y + h / 2 - ui_px(7), 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};
|
||||
|
||||
DrawRectangle(x, y, w, h, ui_darken(c_bg, 12));
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_bg, 45), ui_lighten(c_bg, 35));
|
||||
DrawTexturePro(texture, src, dst, (Vector2){0}, 0, WHITE);
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
#ifndef INBE_UI_H
|
||||
#define INBE_UI_H
|
||||
|
||||
#include "raylib.h"
|
||||
#include "app.h"
|
||||
|
||||
/* Icon Size Enum */
|
||||
typedef enum {
|
||||
UI_ICON_SIZE_TINY,
|
||||
UI_ICON_SIZE_SMALL,
|
||||
UI_ICON_SIZE_MEDIUM,
|
||||
UI_ICON_SIZE_LARGE
|
||||
} UIIconSize;
|
||||
|
||||
/* ================================================================
|
||||
* INITIALIZATION
|
||||
* ================================================================ */
|
||||
|
||||
/* Initialize UI library with viewport dimensions and DPI scale */
|
||||
void ui_init(int width, int height, float dpi);
|
||||
|
||||
/* Update theme colors used by UI library */
|
||||
void ui_set_colors(Color text, Color bg, Color circle, Color button, Color button_hover, Color icon);
|
||||
|
||||
/* ================================================================
|
||||
* DPI SCALING
|
||||
* ================================================================ */
|
||||
|
||||
/* Convert logical pixels to physical pixels based on DPI scaling */
|
||||
int ui_px(int px);
|
||||
|
||||
/* Convert logical pixels to physical pixels with min/max clamping */
|
||||
int ui_clamp_px(int px, int min_px, int max_px);
|
||||
|
||||
/* ================================================================
|
||||
* COLOR HELPERS
|
||||
* ================================================================ */
|
||||
|
||||
/* Lighten a color by a specified amount */
|
||||
Color ui_lighten(Color c, int amount);
|
||||
|
||||
/* Darken a color by a specified amount */
|
||||
Color ui_darken(Color c, int amount);
|
||||
|
||||
/* ================================================================
|
||||
* LAYOUT HELPERS
|
||||
* ================================================================ */
|
||||
|
||||
/* Calculate centered column position and width */
|
||||
void ui_centered_column(int max_w, int side_pad, int *x, int *w);
|
||||
|
||||
/* Draw a bevel border effect using rectangles */
|
||||
void ui_draw_bevel(int x, int y, int w, int h, Color light, Color dark);
|
||||
|
||||
/* Draw multiple text lines with incremental y position */
|
||||
void ui_draw_text_lines(const char **lines, int count, int x, int *y, int font, int line_h);
|
||||
|
||||
/* ================================================================
|
||||
* ICON BUTTONS
|
||||
* ================================================================ */
|
||||
|
||||
/* Get icon button size with DPI scaling */
|
||||
int ui_icon_btn_size(UIIconSize size);
|
||||
|
||||
/* Get icon button padding */
|
||||
int ui_icon_btn_padding(UIIconSize size);
|
||||
|
||||
/* Draw a standard icon button with consistent sizing */
|
||||
int ui_draw_icon_btn(InbeApp *app, int x, int y, UIIconSize size, Texture2D icon, int *hover);
|
||||
|
||||
/* Convenience wrapper for small icon buttons */
|
||||
int ui_draw_icon_btn_small(InbeApp *app, int x, int y, Texture2D icon, int *hover);
|
||||
|
||||
/* Convenience wrapper for medium icon buttons */
|
||||
int ui_draw_icon_btn_medium(InbeApp *app, int x, int y, Texture2D icon, int *hover);
|
||||
|
||||
/* Convenience wrapper for large icon buttons */
|
||||
int ui_draw_icon_btn_large(InbeApp *app, int x, int y, Texture2D icon, int *hover);
|
||||
|
||||
/* Draw an icon link button that opens a URL when clicked */
|
||||
void ui_draw_icon_link(InbeApp *app, int x, int y, int icon_size, Texture2D icon, const char *url);
|
||||
|
||||
/* ================================================================
|
||||
* CONTROLS
|
||||
* ================================================================ */
|
||||
|
||||
/* Draw a slider control with label and value display */
|
||||
int ui_draw_slider(InbeApp *app, int id, int x, int y, int w, const char *label,
|
||||
int min, int max, int *value, const char *suffix);
|
||||
|
||||
/* Draw a toggle switch (typically for light/dark mode) */
|
||||
int ui_draw_toggle_switch(InbeApp *app, int x, int y, int w, int h, int *value);
|
||||
|
||||
/* Draw a checkbox toggle with label */
|
||||
int ui_draw_checkbox_toggle(InbeApp *app, int x, int y, const char *label, int *value);
|
||||
|
||||
/* Draw a dropdown button only (call inside scissor mode) */
|
||||
int ui_draw_dropdown_button(InbeApp *app, int id, int x, int y, int w, int h,
|
||||
const char **options, int option_count, int *selected_index);
|
||||
|
||||
/* Draw a dropdown menu (call outside scissor mode, after button) */
|
||||
void ui_draw_dropdown_menu(InbeApp *app, int id);
|
||||
|
||||
/* Draw a scrollbar with thumb and handle content dragging */
|
||||
void ui_draw_scrollbar(InbeApp *app, int *scroll, int content_h, int viewport_h,
|
||||
int *drag_scrollbar, int *drag_content, int *drag_content_y);
|
||||
|
||||
/* ================================================================
|
||||
* NAVIGATION
|
||||
* ================================================================ */
|
||||
|
||||
/* Tab definition for tab bar */
|
||||
typedef struct UITab {
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
void (*on_click)(void *user_data);
|
||||
void *user_data;
|
||||
} UITab;
|
||||
|
||||
typedef struct UITabBar {
|
||||
UITab *tabs;
|
||||
int count;
|
||||
} UITabBar;
|
||||
|
||||
/* Calculate width of navigation buttons with optional label */
|
||||
int ui_nav_button_width(const char *label, int icon_size, int show_label, int font);
|
||||
|
||||
/* Draw a navigation button with icon and optional label */
|
||||
int ui_draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon,
|
||||
const char *label, int show_label, int *hover);
|
||||
|
||||
/* Draw a navigation button with explicit width (expands to fill space) */
|
||||
int ui_draw_nav_button_expand(InbeApp *app, int x, int y, int icon_size, int w, Texture2D icon,
|
||||
const char *label, int show_label, int *hover);
|
||||
|
||||
/* Draw the bottom tab bar - automatic, data-driven */
|
||||
void ui_draw_tab_bar(UITab *tabs, int count, InbeApp *app);
|
||||
|
||||
/* ================================================================
|
||||
* TUTORIAL HELPERS
|
||||
* ================================================================ */
|
||||
|
||||
/* Draw a placeholder for tutorial images */
|
||||
void ui_draw_tutorial_image_placeholder(const char *label, int x, int y, int w, int h);
|
||||
|
||||
/* Draw tutorial images with fallback to placeholder */
|
||||
void ui_draw_tutorial_image(Texture2D texture, const char *fallback, int x, int y, int w, int h);
|
||||
|
||||
#endif
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#define INBE_VERSION_MAJOR 1
|
||||
#define INBE_VERSION_MINOR 0
|
||||
#define INBE_VERSION_PATCH 0
|
||||
#define INBE_VERSION_STRING "1.0.0"
|
||||
#define INBE_VERSION_PATCH 4
|
||||
#define INBE_VERSION_STRING "1.0.4"
|
||||
|
||||
#endif
|
||||
@@ -21,21 +21,10 @@
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/site-icons/apple-icon-180x180.png">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<meta name="theme-color" content="#779999">
|
||||
<link href="/style.css" rel="stylesheet">
|
||||
<link href="../../inbe.css" rel="stylesheet">
|
||||
<style>
|
||||
.web-shell {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 8px;
|
||||
padding: 16px 12px;
|
||||
font-family: departure;
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#status,
|
||||
@@ -43,141 +32,55 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.canvas-stage {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #1a1a2e;
|
||||
}
|
||||
|
||||
.canvas-frame {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: min(calc(100vw - 24px), calc((100vh - 96px) * 4 / 7));
|
||||
max-width: calc(100vw - 24px);
|
||||
width: min(100vw, calc(100vh * 4 / 7));
|
||||
aspect-ratio: 4 / 7;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
canvas.emscripten {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: block;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
max-width: none !important;
|
||||
max-height: none !important;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
image-rendering: auto;
|
||||
}
|
||||
|
||||
.canvas-stage {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
display: grid;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.canvas-stage:fullscreen {
|
||||
display: grid;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.canvas-stage:-webkit-full-screen {
|
||||
display: grid;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.canvas-stage:fullscreen .canvas-frame {
|
||||
.canvas-frame:fullscreen,
|
||||
.canvas-frame:-webkit-full-screen {
|
||||
width: min(100vw, calc(100vh * 4 / 7));
|
||||
max-width: none;
|
||||
max-height: 100vh;
|
||||
}
|
||||
|
||||
.canvas-stage:-webkit-full-screen .canvas-frame {
|
||||
width: min(100vw, calc(100vh * 4 / 7));
|
||||
max-width: none;
|
||||
max-height: 100vh;
|
||||
}
|
||||
|
||||
.web-actions {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.web-actions button.platform-btn {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.web-back {
|
||||
position: relative;
|
||||
flex-direction: row;
|
||||
min-width: 0;
|
||||
padding: 10px 16px;
|
||||
}
|
||||
|
||||
.web-fullscreen {
|
||||
position: relative;
|
||||
flex-direction: row;
|
||||
min-width: 0;
|
||||
padding: 10px 16px;
|
||||
height: min(100vh, calc(100vw * 7 / 4));
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="web-shell">
|
||||
<div id="status">Downloading...</div>
|
||||
<progress value="0" max="100" id="progress" hidden></progress>
|
||||
<div class="canvas-stage" id="canvas-stage">
|
||||
<div class="canvas-frame">
|
||||
<canvas class="emscripten" id="canvas" width="320" height="560" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="web-actions">
|
||||
<a class="platform-btn web web-back" href="https://inbe.waozi.xyz/">
|
||||
<span>Back to Inner Breeze</span>
|
||||
</a>
|
||||
<button class="platform-btn web web-back web-fullscreen" id="fullscreen-btn" type="button">
|
||||
<span>Fullscreen</span>
|
||||
</button>
|
||||
<div id="status">Downloading...</div>
|
||||
<progress value="0" max="100" id="progress" hidden></progress>
|
||||
<div class="canvas-stage">
|
||||
<div class="canvas-frame" id="canvas-frame">
|
||||
<canvas class="emscripten" id="canvas" width="320" height="560" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var statusElement = document.querySelector('#status');
|
||||
var progressElement = document.querySelector('#progress');
|
||||
var fullscreenButton = document.querySelector('#fullscreen-btn');
|
||||
var canvasStage = document.querySelector('#canvas-stage');
|
||||
|
||||
function fullscreenElement() {
|
||||
return document.fullscreenElement || document.webkitFullscreenElement || null;
|
||||
}
|
||||
|
||||
function updateFullscreenButton() {
|
||||
fullscreenButton.textContent = fullscreenElement() ? 'Exit fullscreen' : 'Fullscreen';
|
||||
}
|
||||
|
||||
fullscreenButton.addEventListener('click', function() {
|
||||
if (fullscreenElement()) {
|
||||
var exitFullscreen = document.exitFullscreen || document.webkitExitFullscreen;
|
||||
if (exitFullscreen) exitFullscreen.call(document);
|
||||
} else {
|
||||
var requestFullscreen = canvasStage.requestFullscreen || canvasStage.webkitRequestFullscreen;
|
||||
if (requestFullscreen) requestFullscreen.call(canvasStage);
|
||||
}
|
||||
});
|
||||
document.addEventListener('fullscreenchange', updateFullscreenButton);
|
||||
document.addEventListener('webkitfullscreenchange', updateFullscreenButton);
|
||||
|
||||
var Module = {
|
||||
preRun: [],
|
||||
|
||||
@@ -0,0 +1,369 @@
|
||||
@font-face {
|
||||
font-family: departure;
|
||||
src: url('/assets/DepartureMono-Regular.otf');
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
:root {
|
||||
--page-bg: #000000;
|
||||
--page-tile: url('/icons/tile.png');
|
||||
--page-tile-opacity: 0.32;
|
||||
--panel-bg: #ffffea;
|
||||
--dark: #557777;
|
||||
--shadow: #000000;
|
||||
--light: #ffffff;
|
||||
--button-bg: #d9d9d9;
|
||||
--button-highlight: #ffffff;
|
||||
--button-inset: #ffffff;
|
||||
--link: #1133aa;
|
||||
--link-hover: #0044cc;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--page-bg);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
cursor: url('cursors/arrow.png') 0 0, auto;
|
||||
}
|
||||
|
||||
body::before {
|
||||
content: "";
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
background-image: var(--page-tile);
|
||||
background-repeat: repeat;
|
||||
background-size: 128px 128px;
|
||||
image-rendering: pixelated;
|
||||
opacity: var(--page-tile-opacity);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
line-height: calc(1ex / 0.32);
|
||||
margin: 16px auto;
|
||||
padding: 16px 32px;
|
||||
font-family: departure;
|
||||
font-size: 16px;
|
||||
background-color: var(--panel-bg);
|
||||
max-width: 1028px;
|
||||
box-sizing: border-box;
|
||||
border: 2px solid var(--dark);
|
||||
box-shadow:
|
||||
inset 2px 2px 0 0 var(--dark),
|
||||
2px 2px 0 0 var(--light);
|
||||
}
|
||||
|
||||
section {
|
||||
margin-bottom: 80px;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
color: var(--dark);
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
.tk-img {
|
||||
border: 2px solid var(--dark);
|
||||
border-right-color: var(--button-highlight);
|
||||
border-bottom-color: var(--button-highlight);
|
||||
box-shadow:
|
||||
inset 1px 1px 0 0 var(--shadow),
|
||||
1px 1px 0 0 var(--button-highlight);
|
||||
}
|
||||
|
||||
a {
|
||||
font-family: departure;
|
||||
color: var(--link);
|
||||
text-decoration: none;
|
||||
cursor: url('cursors/sight.png') 0 0, pointer;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--link-hover);
|
||||
}
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
color: #000000;
|
||||
font-family: departure;
|
||||
font-size: 14px;
|
||||
padding: 6px 12px;
|
||||
cursor: url('cursors/sight.png') 0 0, pointer;
|
||||
outline: none;
|
||||
background-color: var(--button-bg);
|
||||
border: 2px solid var(--button-highlight);
|
||||
border-right-color: var(--dark);
|
||||
border-bottom-color: var(--dark);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--shadow),
|
||||
inset 1px 1px 0 0 var(--button-inset);
|
||||
}
|
||||
|
||||
button:active {
|
||||
border-color: var(--dark);
|
||||
border-right-color: var(--button-highlight);
|
||||
border-bottom-color: var(--button-highlight);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--button-highlight),
|
||||
inset 1px 1px 0 0 var(--shadow);
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
font-family: departure;
|
||||
font-size: 14px;
|
||||
padding: 6px 8px;
|
||||
outline: none;
|
||||
border: 2px solid var(--dark);
|
||||
border-right-color: var(--button-highlight);
|
||||
border-bottom-color: var(--button-highlight);
|
||||
box-shadow:
|
||||
inset 1px 1px 0 0 var(--shadow),
|
||||
1px 1px 0 0 var(--button-highlight);
|
||||
cursor: url('cursors/reading.png') 8 8, text;
|
||||
}
|
||||
|
||||
.platform-buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
justify-content: center;
|
||||
margin: 24px 0;
|
||||
}
|
||||
|
||||
.platform-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 16px 12px;
|
||||
background-color: var(--button-bg);
|
||||
border: 2px solid var(--button-highlight);
|
||||
border-right-color: var(--dark);
|
||||
border-bottom-color: var(--dark);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--shadow),
|
||||
inset 1px 1px 0 0 var(--button-inset);
|
||||
text-decoration: none;
|
||||
color: var(--dark);
|
||||
border-radius: 8px;
|
||||
transition: transform 0.1s, box-shadow 0.1s;
|
||||
width: 110px;
|
||||
cursor: url('cursors/sight.png') 0 0, pointer;
|
||||
}
|
||||
|
||||
.platform-btn img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.platform-btn span {
|
||||
font-family: departure;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.platform-btn:active {
|
||||
border-color: var(--dark);
|
||||
border-right-color: var(--button-highlight);
|
||||
border-bottom-color: var(--button-highlight);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--button-highlight),
|
||||
inset 1px 1px 0 0 var(--shadow);
|
||||
transform: translate(1px, 1px);
|
||||
}
|
||||
|
||||
.platform-btn.web:hover {
|
||||
background-color: #ddeeff;
|
||||
}
|
||||
|
||||
.platform-btn.android:hover {
|
||||
background-color: #ddffdd;
|
||||
}
|
||||
|
||||
.platform-btn.windows:hover {
|
||||
background-color: #ffdddd;
|
||||
}
|
||||
|
||||
.platform-btn.linux:hover {
|
||||
background-color: #ffffdd;
|
||||
}
|
||||
|
||||
.platform-section {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.platform-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.platform-header img {
|
||||
flex: 0 0 48px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
.platform-header p {
|
||||
margin: 4px 0 0 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.platform-header strong {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.downloads-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.download-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 8px 12px;
|
||||
background-color: var(--button-bg);
|
||||
border: 2px solid var(--button-highlight);
|
||||
border-right-color: var(--dark);
|
||||
border-bottom-color: var(--dark);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--shadow),
|
||||
inset 1px 1px 0 0 var(--button-inset);
|
||||
text-decoration: none;
|
||||
color: var(--dark);
|
||||
border-radius: 8px;
|
||||
transition: transform 0.1s, box-shadow 0.1s;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
min-height: 40px;
|
||||
cursor: url('cursors/sight.png') 0 0, pointer;
|
||||
}
|
||||
|
||||
.download-item:active {
|
||||
border-color: var(--dark);
|
||||
border-right-color: var(--button-highlight);
|
||||
border-bottom-color: var(--button-highlight);
|
||||
box-shadow:
|
||||
1px 1px 0 0 var(--button-highlight),
|
||||
inset 1px 1px 0 0 var(--shadow);
|
||||
transform: translate(1px, 1px);
|
||||
}
|
||||
|
||||
.download-item:hover {
|
||||
background-color: var(--button-highlight);
|
||||
}
|
||||
|
||||
.donation-buttons {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* Uxn emulator styles */
|
||||
#display {
|
||||
image-rendering: pixelated;
|
||||
image-rendering: crisp-edges;
|
||||
touch-action: none;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
cursor: none;
|
||||
}
|
||||
|
||||
#metadata {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
#metadata ul {
|
||||
margin-left: 25px;
|
||||
padding: 0;
|
||||
float: left;
|
||||
line-height: 24px;
|
||||
margin-bottom: 45px;
|
||||
}
|
||||
|
||||
#metadata ul li {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#metadata button {
|
||||
display: inline-block;
|
||||
border: 0;
|
||||
font-size: 12px;
|
||||
border-radius: 30px;
|
||||
padding: 2px 10px;
|
||||
line-height: 20px;
|
||||
margin-bottom: 1px;
|
||||
vertical-align: center;
|
||||
}
|
||||
|
||||
#metadata kbd {
|
||||
border: 0;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
padding: 2px 2px;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
||||
#console {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#console > * {
|
||||
border: 0;
|
||||
font-family: mono;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.noscript {
|
||||
display: block;
|
||||
padding: 15px;
|
||||
margin: 30px auto;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
div.noscript img {
|
||||
float: left;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
div.noscript a {
|
||||
text-decoration: underline;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -4,4 +4,4 @@ text "#24487CFF"
|
||||
circle "#7EB7E6FF"
|
||||
button "#A6CFF2FF"
|
||||
button_hover "#689ED7FF"
|
||||
icon "#E2EEFCFF"
|
||||
icon "#24487CFF"
|
||||
@@ -0,0 +1,8 @@
|
||||
# Lotus theme: cherry (light)
|
||||
background "#FFF0F5FF"
|
||||
text "#C13460FF"
|
||||
circle "#F4A6C3FF"
|
||||
button "#FFD6E7FF"
|
||||
button_hover "#FFB6D1FF"
|
||||
icon "#FFF0F5FF"
|
||||
link "#FFF0F5FF"
|
||||
@@ -0,0 +1,8 @@
|
||||
# Lotus theme: cherry (dark)
|
||||
background "#2D1A24FF"
|
||||
text "#FFB6D1FF"
|
||||
circle "#E55B8CFF"
|
||||
button "#4D2C3CFF"
|
||||
button_hover "#6D3C54FF"
|
||||
icon "#FFB6D1FF"
|
||||
link "#FF69B4FF"
|
||||
@@ -0,0 +1,8 @@
|
||||
# Lotus theme: forest (light)
|
||||
background "#E8F5E9FF"
|
||||
text "#2E5C38FF"
|
||||
circle "#66BB6AFF"
|
||||
button "#81C784FF"
|
||||
button_hover "#4CAF50FF"
|
||||
icon "#E8F5E9FF"
|
||||
link "#4A90E2FF"
|
||||
@@ -0,0 +1,8 @@
|
||||
# Lotus theme: forest (dark)
|
||||
background "#1A2F1AFF"
|
||||
text "#A5D6A7FF"
|
||||
circle "#43A047FF"
|
||||
button "#2A3F2AFF"
|
||||
button_hover "#3A4F3AFF"
|
||||
icon "#A5D6A7FF"
|
||||
link "#4A90E2FF"
|
||||
@@ -0,0 +1,8 @@
|
||||
# Lotus theme: lavender (light)
|
||||
background "#F3E5F5FF"
|
||||
text "#4A235AFF"
|
||||
circle "#BA68C8FF"
|
||||
button "#CE93D8FF"
|
||||
button_hover "#AB47BCFF"
|
||||
icon "#F3E5F5FF"
|
||||
link "#4A90E2FF"
|
||||
@@ -0,0 +1,8 @@
|
||||
# Lotus theme: lavender (dark)
|
||||
background "#1A0A2EFF"
|
||||
text "#E1BEE7FF"
|
||||
circle "#7B1FA2FF"
|
||||
button "#3A2A4EFF"
|
||||
button_hover "#4A3A5EFF"
|
||||
icon "#E1BEE7FF"
|
||||
link "#4A90E2FF"
|
||||