Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47ff302a0f | ||
|
|
dbe2e2fc6a | ||
|
|
ab662be647 | ||
|
|
0341d983d1 | ||
|
|
b2a8b34df1 | ||
|
|
3b73ae0cb4 | ||
|
|
ddf4671297 | ||
|
|
83489725ed | ||
|
|
7fb258f5d5 | ||
|
|
fff3469944 | ||
|
|
731abd410b | ||
|
|
8fd4efb642 | ||
|
|
adf8352e92 | ||
|
|
706a8a0797 | ||
|
|
d068a8b8e0 | ||
|
|
024b16e36b | ||
|
|
16e4ec2711 | ||
|
|
7ce19c045f | ||
|
|
a2e5a594cd | ||
|
|
ec53dd02af | ||
|
|
8d92924849 | ||
|
|
407681fada | ||
|
|
6a3d3f3559 | ||
|
|
ab59ab6b83 | ||
|
|
321afdd465 | ||
|
|
c2f7d75258 | ||
|
|
eba69651a9 | ||
|
|
8fe47c8a32 | ||
|
|
81032a9dcc | ||
|
|
2be97ca801 | ||
|
|
324d18fdfb | ||
|
|
6889777cff | ||
|
|
ea78b73c86 | ||
|
|
1e5768f6b4 | ||
|
|
612f431376 | ||
|
|
f13a88b94e | ||
|
|
e7d9843e94 | ||
|
|
ae438d7c14 | ||
|
|
879f058d7a | ||
|
|
f208429e08 | ||
|
|
827780347b | ||
|
|
791ca2eba9 | ||
|
|
7d3d4d588b | ||
|
|
eec36173c8 | ||
|
|
a21bc16bcd | ||
|
|
79a9f92e35 | ||
|
|
fc77fa2aea | ||
|
|
e21f49cf4d | ||
|
|
a9f2cbb464 | ||
|
|
a0b86526a2 | ||
|
|
d39f908ddb | ||
|
|
cb8cbf4ca7 | ||
|
|
077e400e38 | ||
|
|
050eee00ae | ||
|
|
212160a48a | ||
|
|
96b479b99f | ||
|
|
19570e4b1c | ||
|
|
fc8c583eee | ||
|
|
2612192889 | ||
|
|
ce26a3d2a3 | ||
|
|
b8b1bc9989 | ||
|
|
16a5a33091 | ||
|
|
dac27ce0d8 | ||
|
|
44e70de7d1 | ||
|
|
7c3318ff72 | ||
|
|
170ecc851a | ||
|
|
c0a9484d7e | ||
|
|
310a822ea5 | ||
|
|
f3a437a165 | ||
|
|
f2dbd32df4 | ||
|
|
66cb62b4d3 | ||
|
|
e9c1945511 | ||
|
|
dd7d05fa28 | ||
|
|
ace95aa97c | ||
|
|
b2cca9395c | ||
|
|
548217c10d | ||
|
|
d674586fe9 | ||
|
|
7f48edf8f6 | ||
|
|
18bff54ec5 | ||
|
|
764a652e1c | ||
|
|
d41a12503e | ||
|
|
8f728d97bb | ||
|
|
e43973882e | ||
|
|
1e8976c0d4 | ||
|
|
90adc96782 | ||
|
|
4f1950c488 | ||
|
|
bc27c72034 | ||
|
|
3f7054fe40 | ||
|
|
48a3a78049 | ||
|
|
b9ee0287f5 | ||
|
|
dec0a05dd0 | ||
|
|
6ad78bd288 | ||
|
|
bb40a2822d | ||
|
|
f189300079 | ||
|
|
77f880f3ed | ||
|
|
163bbeaa8c | ||
|
|
54a6016976 | ||
|
|
11add452e2 | ||
|
|
aaf7019067 | ||
|
|
2829f237a1 |
No files matched your search
@@ -1 +0,0 @@
|
||||
unpackaged_assets/**/*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -0,0 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [waozixyz]
|
||||
liberapay: waozi
|
||||
@@ -49,9 +49,6 @@ jobs:
|
||||
- name: Copy Assets to Android Project
|
||||
run: ./scripts/copy-android-assets.sh
|
||||
|
||||
- name: Run Tests
|
||||
run: make test
|
||||
|
||||
- name: Build Release APK
|
||||
working-directory: ./droid
|
||||
env:
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
*.sym
|
||||
*.backup
|
||||
*.tar.gz
|
||||
*.zip
|
||||
*~
|
||||
@@ -26,8 +25,6 @@ node_modules
|
||||
/main
|
||||
!droid/app/src/main
|
||||
droid/app/src/main/assets
|
||||
droid/*.apk
|
||||
droid/*.aab
|
||||
|
||||
.direnv/
|
||||
.node-repl-history
|
||||
@@ -53,5 +50,3 @@ local.properties
|
||||
*.9
|
||||
*.8
|
||||
*.a
|
||||
|
||||
/pro/
|
||||
@@ -4,9 +4,3 @@
|
||||
[submodule "vendor/rini"]
|
||||
path = vendor/rini
|
||||
url = https://github.com/raysan5/rini.git
|
||||
[submodule "vendor/otfchop"]
|
||||
path = vendor/otfchop
|
||||
url = https://github.com/waozixyz/otfchop
|
||||
[submodule "vendor/sqlite"]
|
||||
path = vendor/sqlite
|
||||
url = https://github.com/sqlite/sqlite
|
||||
@@ -1,65 +1,4 @@
|
||||
# Changelog
|
||||
## [1.3.2] - 2026-06-17
|
||||
### Fixed
|
||||
- Unified scroll containers so content stays out of scrollbar tracks and scroll positions clamp cleanly at the bottom.
|
||||
- Android meditation audio downloads now show a localized network-permission/connectivity modal when the host cannot be resolved.
|
||||
|
||||
## [1.3.1] - 2026-06-17
|
||||
### Fixed
|
||||
- Fixed Android orientation resizing and habit import merging by name.
|
||||
|
||||
## [1.3.0] - 2026-06-14
|
||||
### Added
|
||||
- Implemented 1-bit habit tracker synced with practice data
|
||||
- Habit editing, custom colors, sync options, and deletion.
|
||||
- Add monochrome theme
|
||||
- Add simple meditation exercise with background music
|
||||
|
||||
## [1.2.6] - 2026-06-12
|
||||
### Fixed
|
||||
- Import now replaces only matching session files from the ZIP and never removes local sessions missing from the import.
|
||||
- Fixed web scaling behavior.
|
||||
|
||||
## [1.2.5] - 2026-06-12
|
||||
### Added
|
||||
- BTC address for donations
|
||||
|
||||
## [1.2.4] - 2026-06-11
|
||||
### Fixed
|
||||
- Android sessions continue correctly when the notification shade causes focus loss with background playback enabled.
|
||||
- Android safe-area insets now offset the viewport at the top instead of creating bottom-only padding.
|
||||
- Progressive start speed defaults to 3, normal speed defaults to 6, and the start speed editor preview animates at the exact selected speed.
|
||||
- Dropdown menu text is clipped cleanly while scrolling.
|
||||
|
||||
## [1.2.3] - 2026-06-10
|
||||
### Fixed
|
||||
- History editing now scrolls to the active field once and keeps 16px Unifont row text aligned without clipping.
|
||||
|
||||
## [1.2.2] - 2026-06-10
|
||||
### Fixed
|
||||
- Android touch targets now align correctly on devices with navigation bar window insets.
|
||||
|
||||
## [1.2.1] - 2026-06-10
|
||||
### Added
|
||||
- Breath hold display mode setting with circle progress or stopwatch display
|
||||
- Slower speed scale and progressive start speed control
|
||||
|
||||
## [1.2.0] - 2026-06-08
|
||||
### Added
|
||||
- Flint-based UI and theme system
|
||||
- Session volume slider with immediate persistence
|
||||
- Additional language support: Czech (Čeština), Indonesian (Bahasa Indonesia), Japanese (日本語), Korean (한국어), and Chinese (中文)
|
||||
- Proper font glyphs
|
||||
- File picker for import
|
||||
|
||||
## [1.1.9] - 2026-06-04
|
||||
### Added
|
||||
- Hierarchical settings organization with 3 main categories
|
||||
- Category selection screen with card-based navigation
|
||||
- Back button for hierarchical navigation
|
||||
### Fixed
|
||||
- Settings navigation state and Android back button behavior
|
||||
|
||||
## [1.1.8] - 2026-06-01
|
||||
### Added
|
||||
- Editable history days with pencil actions for sessions and rounds
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# Inner Breeze
|
||||
|
||||
Inner Breeze is a free, open-source practice app for breathing, meditation, and habit tracking.
|
||||
Inner Breeze - A free, open-source guided breathing meditation app based on the Wim Hof method.
|
||||
|
||||
## Features
|
||||
|
||||
- Guided practice sessions with visual and audio cues
|
||||
- Mind, Yoga, and Fitness organization for habits and practice views
|
||||
- Configurable breathing sessions and meditation timers
|
||||
- Habit tracking with session history
|
||||
- Local SQLite storage with import/export support
|
||||
- Theme customization with light and dark variants
|
||||
- Touch-optimized UI for desktop and mobile
|
||||
- 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
|
||||
|
||||
@@ -27,21 +27,27 @@ inbe uses [raylib](https://github.com/raysan5/raylib) and requires a Nix develop
|
||||
# Enter the development shell
|
||||
nix develop
|
||||
|
||||
# Build for your current platform
|
||||
make native
|
||||
# Build for your current platform (Linux x86_64/aarch64)
|
||||
make
|
||||
|
||||
# Run
|
||||
make run
|
||||
./build/linux/inbe-linux-$(uname -m)
|
||||
```
|
||||
|
||||
### Cross-Platform Builds
|
||||
|
||||
```bash
|
||||
# Android debug APK
|
||||
make android-debug
|
||||
# Linux (both architectures)
|
||||
make linux
|
||||
|
||||
# Android release APK
|
||||
make android-release PASSWORD=your-keystore-password
|
||||
# Windows (from Linux)
|
||||
make windows
|
||||
|
||||
# Android APK
|
||||
make android
|
||||
|
||||
# WebAssembly
|
||||
make web
|
||||
```
|
||||
|
||||
### Android Emulator Testing
|
||||
@@ -51,8 +57,7 @@ For automated testing with camera notch (cutout) support:
|
||||
```bash
|
||||
# Enter the development shell and run everything automatically
|
||||
nix develop
|
||||
./scripts/emulator.sh # Creates and launches the test AVD
|
||||
make android-install # Builds, installs, and launches the app
|
||||
./scripts/emulator.sh # Creates AVD, launches emulator, builds & runs app
|
||||
```
|
||||
|
||||
This single script handles:
|
||||
@@ -76,12 +81,12 @@ The AVD is configured with:
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `src/` - Inbe application code
|
||||
- `flint/` - first-party UI/runtime support code used directly by Inbe
|
||||
- `vendor/` - external third-party dependencies
|
||||
- `wasm4/` - Standalone WASM-4 version
|
||||
- `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
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 56 KiB |
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8" />
|
||||
<head>
|
||||
<title>Inner Breeze - All Builds</title>
|
||||
<link href="/style.css" rel="stylesheet" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Inner Breeze - All available builds and implementations.">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
|
||||
<meta name="theme-color" content="#5566aa">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<section>
|
||||
<h1>All Builds</h1>
|
||||
<p><a href="/">← Back to Inner Breeze</a></p>
|
||||
</section>
|
||||
<section>
|
||||
<div class="platform-section">
|
||||
<div class="platform-header">
|
||||
<img src="/icons/ray.png" alt="raylib"/>
|
||||
<div>
|
||||
<strong><a href="https://raylib.com">Raylib</a></strong>
|
||||
<p>A C library for video game programming - the primary implementation.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<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">
|
||||
<div class="platform-header">
|
||||
<img src="/icons/wasm4.png" alt="wasm4"/>
|
||||
<div>
|
||||
<strong><a href="https://wasm4.org">WASM-4</a></strong>
|
||||
<p>A tiny fantasy console that runs WebAssembly cartridges.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<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">
|
||||
<div class="platform-header">
|
||||
<img src="/icons/uxn.png" alt="uxn"/>
|
||||
<div>
|
||||
<strong><a href="https://100r.co/site/uxn.html">Uxn</a></strong>
|
||||
<p>A small virtual computer; <code>.rom</code> runs in a Uxn emulator.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<a href="/uxn/index.html" class="download-item">Web</a>
|
||||
<a href="/uxn/inbe.rom" class="download-item">inbe.rom</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>© 2026 <a href="https://waozi.xyz">Waozi</a> | <a href="/privacy.html">Privacy Policy</a></p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 148 B |
|
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 176 B |
@@ -18,8 +18,7 @@ android {
|
||||
keystoreProps.load(new FileInputStream(keystorePropsFile))
|
||||
}
|
||||
|
||||
def getKeystorePath = { -> project.findProperty('keystore.path') ?: keystoreProps['keystore.path'] ?: System.getenv("HOME") + "/.android/flint-release.keystore" }
|
||||
def getKeystoreAlias = { -> project.findProperty('keystore.alias') ?: keystoreProps['keystore.alias'] ?: "inbe-key" }
|
||||
def getKeystorePath = { -> keystoreProps['keystore.path'] ?: System.getenv("HOME") + "/.android/inbe-release.keystore" }
|
||||
|
||||
def releasePassword = project.findProperty('keystore.password') ?: ""
|
||||
|
||||
@@ -27,7 +26,7 @@ android {
|
||||
release {
|
||||
storeFile getKeystorePath() ? file(getKeystorePath()) : null
|
||||
storePassword releasePassword
|
||||
keyAlias getKeystoreAlias()
|
||||
keyAlias "inbe-key"
|
||||
keyPassword releasePassword
|
||||
}
|
||||
}
|
||||
@@ -35,8 +34,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdk 19
|
||||
targetSdk 35
|
||||
versionCode 30
|
||||
versionName "1.3.2"
|
||||
versionCode 19
|
||||
versionName "1.1.8"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<application
|
||||
android:hasCode="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@@ -10,8 +8,9 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<activity
|
||||
android:name="xyz.waozi.inbe.MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|uiMode"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
|
||||
android:windowLayoutInDisplayCutoutMode="never">
|
||||
<meta-data
|
||||
|
||||
@@ -3,49 +3,9 @@ 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(FLINT_DIR "${REPO_ROOT}/flint")
|
||||
set(SQLITE_DIR "${REPO_ROOT}/vendor/sqlite")
|
||||
set(SQLITE_BUILD_DIR "${CMAKE_BINARY_DIR}/sqlite")
|
||||
set(SQLITE_AMALGAMATION_C "${SQLITE_BUILD_DIR}/sqlite3.c")
|
||||
set(SQLITE_AMALGAMATION_H "${SQLITE_BUILD_DIR}/sqlite3.h")
|
||||
set(NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
file(GLOB FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c")
|
||||
list(REMOVE_ITEM FLINT_SOURCES "${FLINT_DIR}/src/flint_file_dialog.c")
|
||||
file(GLOB INBE_LOCALE_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/locales/*.txt")
|
||||
file(GLOB INBE_SOUND_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/assets/sounds/*.ogg")
|
||||
set(INBE_EMBEDDED_INPUTS
|
||||
${INBE_LOCALE_ASSETS}
|
||||
assets/whm/1.jpg
|
||||
assets/whm/2.jpg
|
||||
assets/fonts/locales.png
|
||||
assets/fonts/locales.dat
|
||||
assets/fonts/locales-8.png
|
||||
assets/fonts/locales-8.dat
|
||||
${INBE_SOUND_ASSETS}
|
||||
)
|
||||
set(INBE_EMBEDDED_DEPS)
|
||||
foreach(asset ${INBE_EMBEDDED_INPUTS})
|
||||
list(APPEND INBE_EMBEDDED_DEPS "${REPO_ROOT}/${asset}")
|
||||
endforeach()
|
||||
set(INBE_EMBEDDED_ASSETS_C "${CMAKE_BINARY_DIR}/inbe_embedded_assets.c")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${INBE_EMBEDDED_ASSETS_C}"
|
||||
COMMAND sh "${FLINT_DIR}/scripts/embed-assets.sh" "${INBE_EMBEDDED_ASSETS_C}" ${INBE_EMBEDDED_INPUTS}
|
||||
DEPENDS "${FLINT_DIR}/scripts/embed-assets.sh" ${INBE_EMBEDDED_DEPS}
|
||||
WORKING_DIRECTORY "${REPO_ROOT}"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${SQLITE_AMALGAMATION_C}" "${SQLITE_AMALGAMATION_H}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${SQLITE_BUILD_DIR}"
|
||||
COMMAND sh -c "cd '${SQLITE_BUILD_DIR}' && '${SQLITE_DIR}/configure'"
|
||||
COMMAND make -C "${SQLITE_BUILD_DIR}" sqlite3.c sqlite3.h
|
||||
DEPENDS "${SQLITE_DIR}/configure" "${SQLITE_DIR}/manifest"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_library(raylib STATIC
|
||||
"${RAYLIB_DIR}/rcore.c"
|
||||
@@ -84,63 +44,48 @@ target_include_directories(raylib PUBLIC
|
||||
"${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}/core/breath_engine.c"
|
||||
"${SRC_DIR}/app/app.c"
|
||||
"${SRC_DIR}/app/device_preferences.c"
|
||||
"${SRC_DIR}/session/session.c"
|
||||
"${SRC_DIR}/screens/habits_screen.c"
|
||||
"${SRC_DIR}/session/meditation_music.c"
|
||||
"${SRC_DIR}/core/locale.c"
|
||||
"${SRC_DIR}/core/theme.c"
|
||||
"${SRC_DIR}/storage/data.c"
|
||||
"${SRC_DIR}/storage/storage.c"
|
||||
"${SRC_DIR}/third_party/miniz.c"
|
||||
"${SQLITE_AMALGAMATION_C}"
|
||||
"${SRC_DIR}/platform/android/android_device.c"
|
||||
"${SRC_DIR}/platform/android/android_import.c"
|
||||
"${SRC_DIR}/platform/android/android_runtime_assets.c"
|
||||
"${SRC_DIR}/platform/android/android_share.c"
|
||||
"${SRC_DIR}/screens/practice_screen.c"
|
||||
"${SRC_DIR}/screens/language_screen.c"
|
||||
"${SRC_DIR}/screens/manual_screen.c"
|
||||
"${SRC_DIR}/screens/settings/settings_screen.c"
|
||||
"${INBE_EMBEDDED_ASSETS_C}"
|
||||
${FLINT_SOURCES}
|
||||
"${SRC_DIR}/platform/android/android_insets.c"
|
||||
"${SRC_DIR}/platform/android/android_wakelock.c"
|
||||
"${SRC_DIR}/platform/android/android_timer.c"
|
||||
"${SRC_DIR}/app.c"
|
||||
"${SRC_DIR}/locale.c"
|
||||
"${SRC_DIR}/ui/ui.c"
|
||||
"${SRC_DIR}/ui/text_layout.c"
|
||||
"${SRC_DIR}/ui/dpi.c"
|
||||
"${SRC_DIR}/theme_meta.c"
|
||||
"${SRC_DIR}/theme.c"
|
||||
"${SRC_DIR}/data.c"
|
||||
"${SRC_DIR}/miniz.c"
|
||||
"${SRC_DIR}/file_dialog.c"
|
||||
"${SRC_DIR}/android/android_share.c"
|
||||
"${SRC_DIR}/tabs/history_tab.c"
|
||||
"${SRC_DIR}/tabs/language_tab.c"
|
||||
"${SRC_DIR}/tabs/manual_tab.c"
|
||||
"${SRC_DIR}/tabs/settings_tab.c"
|
||||
"${SRC_DIR}/android/android_insets.c"
|
||||
"${SRC_DIR}/android/android_wakelock.c"
|
||||
"${SRC_DIR}/android/android_timer.c"
|
||||
"${NATIVE_APP_GLUE_DIR}/android_native_app_glue.c"
|
||||
)
|
||||
|
||||
target_include_directories(main PRIVATE
|
||||
"${SRC_DIR}"
|
||||
"${SRC_DIR}/app"
|
||||
"${SRC_DIR}/core"
|
||||
"${SRC_DIR}/screens"
|
||||
"${SRC_DIR}/screens/settings"
|
||||
"${SRC_DIR}/session"
|
||||
"${SRC_DIR}/storage"
|
||||
"${SRC_DIR}/platform/android"
|
||||
"${SRC_DIR}/third_party"
|
||||
"${SRC_DIR}/android"
|
||||
"${NATIVE_APP_GLUE_DIR}"
|
||||
"${FLINT_DIR}/include"
|
||||
"${SQLITE_BUILD_DIR}"
|
||||
"${LIBINBE_DIR}"
|
||||
)
|
||||
|
||||
target_compile_definitions(main PRIVATE
|
||||
PLATFORM_ANDROID
|
||||
_DEFAULT_SOURCE
|
||||
_GNU_SOURCE
|
||||
_FILE_OFFSET_BITS=64
|
||||
MG_TLS=MG_TLS_BUILTIN
|
||||
MG_ENABLE_EPOLL=0
|
||||
MG_ENABLE_POLL=1
|
||||
MG_ENABLE_POSIX_FS=0
|
||||
SUPPORT_MODULE_RAUDIO=1
|
||||
SUPPORT_FILEFORMAT_OGG=1
|
||||
FLINT_EMBEDDED_ONLY=1
|
||||
)
|
||||
|
||||
target_compile_options(main PRIVATE
|
||||
@@ -158,6 +103,7 @@ target_link_options(main PRIVATE
|
||||
|
||||
target_link_libraries(main
|
||||
raylib
|
||||
inbe
|
||||
android
|
||||
log
|
||||
OpenSLES
|
||||
|
||||
@@ -1,43 +1,19 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Insets;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URL;
|
||||
|
||||
public class MainActivity extends NativeActivity {
|
||||
private static final String TAG = "InbeMainActivity";
|
||||
private static final int REQUEST_IMPORT_ZIP = 1001;
|
||||
private static final int REQUEST_POST_NOTIFICATIONS = 1002;
|
||||
private static final String DOWNLOAD_CHANNEL_ID = "runtime_downloads";
|
||||
private static final int DOWNLOAD_NOTIFICATION_ID = 2001;
|
||||
|
||||
static {
|
||||
System.loadLibrary("main");
|
||||
@@ -47,292 +23,15 @@ public class MainActivity extends NativeActivity {
|
||||
private final int[] cachedInsets = new int[6];
|
||||
private boolean insetsInitialized = false;
|
||||
private PowerManager.WakeLock wakeLock = null;
|
||||
private boolean activityPaused = false;
|
||||
private boolean windowFocused = true;
|
||||
private boolean backgroundExecutionActive = false;
|
||||
private boolean autoPausedForLifecycle = false;
|
||||
|
||||
private native void nativeSetInsets(int status, int nav,
|
||||
int cutoutLeft, int cutoutTop, int cutoutRight, int cutoutBottom);
|
||||
private native void nativeSetSystemDark(int dark);
|
||||
private native void nativeSetOrientation(int orientation);
|
||||
private native void nativeWakeLockReady();
|
||||
private native void nativeSetBackgroundActive(boolean active);
|
||||
private native void nativeTimerActivate();
|
||||
private native void nativeTimerDeactivate();
|
||||
private native int nativeGetPlayInBackground();
|
||||
private native int nativePauseSession();
|
||||
private native void nativePauseSession();
|
||||
private native void nativeResumeSession();
|
||||
private native void nativeImportSelectedFile(String path);
|
||||
private native void nativeImportCancelled();
|
||||
private native void nativeRuntimeAssetDownloadSucceeded(long handle, long bytes, int httpStatus);
|
||||
private native void nativeRuntimeAssetDownloadProgress(long handle, long bytes, long totalBytes);
|
||||
private native void nativeRuntimeAssetDownloadFailed(long handle, int httpStatus, String error);
|
||||
private native void nativeTextInputCommit(int codepoint);
|
||||
private native void nativeTextInputBackspace();
|
||||
private native void nativeTextInputEnter();
|
||||
|
||||
private void requestDownloadNotificationPermissionIfNeeded() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
|
||||
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
|
||||
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[] { Manifest.permission.POST_NOTIFICATIONS },
|
||||
REQUEST_POST_NOTIFICATIONS);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private NotificationManager getDownloadNotificationManager() {
|
||||
requestDownloadNotificationPermissionIfNeeded();
|
||||
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (manager != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
DOWNLOAD_CHANNEL_ID,
|
||||
"Downloads",
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
);
|
||||
manager.createNotificationChannel(channel);
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
private void showDownloadNotification(NotificationManager manager, long written, long total) {
|
||||
if (manager == null) return;
|
||||
|
||||
Notification.Builder builder = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
? new Notification.Builder(this, DOWNLOAD_CHANNEL_ID)
|
||||
: new Notification.Builder(this);
|
||||
builder.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
.setContentTitle("Downloading audio")
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true);
|
||||
if (total > 0) {
|
||||
int progress = (int)Math.max(0, Math.min(100, (written * 100) / total));
|
||||
builder.setProgress(100, progress, false)
|
||||
.setContentText(progress + "%");
|
||||
} else {
|
||||
builder.setProgress(0, 0, true);
|
||||
}
|
||||
manager.notify(DOWNLOAD_NOTIFICATION_ID, builder.build());
|
||||
}
|
||||
|
||||
private void clearDownloadNotification(NotificationManager manager) {
|
||||
if (manager != null) {
|
||||
manager.cancel(DOWNLOAD_NOTIFICATION_ID);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSoftKeyboardVisible(final boolean visible) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
View view = getWindow() != null ? getWindow().getDecorView() : null;
|
||||
if (imm == null || view == null) return;
|
||||
|
||||
if (visible) {
|
||||
view.requestFocus();
|
||||
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
|
||||
} else {
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event != null && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
int keyCode = event.getKeyCode();
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL) {
|
||||
nativeTextInputBackspace();
|
||||
} else if (keyCode == KeyEvent.KEYCODE_ENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) {
|
||||
nativeTextInputEnter();
|
||||
} else {
|
||||
int unicode = event.getUnicodeChar();
|
||||
if (unicode >= 32) {
|
||||
nativeTextInputCommit(unicode);
|
||||
}
|
||||
}
|
||||
} else if (event != null && event.getAction() == KeyEvent.ACTION_MULTIPLE &&
|
||||
event.getCharacters() != null) {
|
||||
String chars = event.getCharacters();
|
||||
for (int i = 0; i < chars.length();) {
|
||||
int codepoint = chars.codePointAt(i);
|
||||
if (codepoint >= 32) {
|
||||
nativeTextInputCommit(codepoint);
|
||||
}
|
||||
i += Character.charCount(codepoint);
|
||||
}
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
public void applyOrientationMode(final int mode) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int requested = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
requested = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||
break;
|
||||
case 2:
|
||||
requested = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
||||
break;
|
||||
case 3:
|
||||
requested = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
|
||||
break;
|
||||
default:
|
||||
requested = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
break;
|
||||
}
|
||||
setRequestedOrientation(requested);
|
||||
pushDeviceConfiguration();
|
||||
requestInsetRefresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startRuntimeAssetDownload(final String url, final String path, final long handle) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
HttpURLConnection connection = null;
|
||||
int status = 0;
|
||||
long written = 0;
|
||||
long total = 0;
|
||||
long lastNotify = 0;
|
||||
File outputFile = new File(path);
|
||||
File parent = outputFile.getParentFile();
|
||||
NotificationManager notificationManager = getDownloadNotificationManager();
|
||||
|
||||
try {
|
||||
if (parent != null && !parent.exists() && !parent.mkdirs()) {
|
||||
nativeRuntimeAssetDownloadFailed(handle, status, "failed to create download directory");
|
||||
return;
|
||||
}
|
||||
|
||||
connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setInstanceFollowRedirects(true);
|
||||
connection.setConnectTimeout(15000);
|
||||
connection.setReadTimeout(30000);
|
||||
connection.setRequestProperty("User-Agent", "flint-runtime-assets/1");
|
||||
status = connection.getResponseCode();
|
||||
|
||||
if (status < 200 || status >= 300) {
|
||||
outputFile.delete();
|
||||
nativeRuntimeAssetDownloadFailed(handle, status, "HTTP " + status);
|
||||
return;
|
||||
}
|
||||
|
||||
total = connection.getContentLengthLong();
|
||||
nativeRuntimeAssetDownloadProgress(handle, written, total);
|
||||
showDownloadNotification(notificationManager, written, total);
|
||||
|
||||
try (InputStream input = connection.getInputStream();
|
||||
FileOutputStream output = new FileOutputStream(outputFile)) {
|
||||
byte[] buffer = new byte[32768];
|
||||
int read;
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
written += read;
|
||||
nativeRuntimeAssetDownloadProgress(handle, written, total);
|
||||
long now = android.os.SystemClock.uptimeMillis();
|
||||
if (now - lastNotify > 250 || (total > 0 && written >= total)) {
|
||||
showDownloadNotification(notificationManager, written, total);
|
||||
lastNotify = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nativeRuntimeAssetDownloadSucceeded(handle, written, status);
|
||||
} catch (UnknownHostException | SocketException | SocketTimeoutException e) {
|
||||
outputFile.delete();
|
||||
nativeRuntimeAssetDownloadFailed(handle, status, "NETWORK_UNAVAILABLE");
|
||||
} catch (Exception e) {
|
||||
outputFile.delete();
|
||||
nativeRuntimeAssetDownloadFailed(handle, status, e.getMessage());
|
||||
} finally {
|
||||
clearDownloadNotification(notificationManager);
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "inbe-runtime-asset-download").start();
|
||||
}
|
||||
|
||||
public void openImportPicker() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("*/*");
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[] {
|
||||
"application/zip",
|
||||
"application/x-zip-compressed",
|
||||
"application/vnd.sqlite3",
|
||||
"application/x-sqlite",
|
||||
"application/x-sqlite3"
|
||||
});
|
||||
startActivityForResult(intent, REQUEST_IMPORT_ZIP);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to open import picker", e);
|
||||
nativeImportCancelled();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (requestCode != REQUEST_IMPORT_ZIP) return;
|
||||
|
||||
if (resultCode != RESULT_OK || data == null || data.getData() == null) {
|
||||
nativeImportCancelled();
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = data.getData();
|
||||
File importDir = new File(getCacheDir(), "imports");
|
||||
File importFile = new File(importDir, "inbe-import");
|
||||
|
||||
try {
|
||||
if (!importDir.exists() && !importDir.mkdirs()) {
|
||||
nativeImportSelectedFile("");
|
||||
return;
|
||||
}
|
||||
|
||||
try (InputStream input = getContentResolver().openInputStream(uri);
|
||||
FileOutputStream output = new FileOutputStream(importFile)) {
|
||||
if (input == null) {
|
||||
nativeImportSelectedFile("");
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
int read;
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
}
|
||||
}
|
||||
|
||||
nativeImportSelectedFile(importFile.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to import selected file", e);
|
||||
nativeImportSelectedFile("");
|
||||
}
|
||||
}
|
||||
|
||||
public void acquireWakeLock() {
|
||||
Log.d(TAG, "acquireWakeLock called - wakeLock=" + wakeLock);
|
||||
@@ -362,26 +61,6 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void keepScreenOn() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
Log.d(TAG, "Screen lock timeout disabled for active session");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void allowScreenOff() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
Log.d(TAG, "Screen lock timeout restored");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -393,49 +72,11 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
|
||||
setupInsetsListener();
|
||||
pushDeviceConfiguration();
|
||||
|
||||
// Notify native code that activity is ready for wake lock
|
||||
nativeWakeLockReady();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
pushDeviceConfiguration();
|
||||
requestInsetRefresh();
|
||||
}
|
||||
|
||||
private void pushDeviceConfiguration() {
|
||||
Configuration config = getResources().getConfiguration();
|
||||
int nightMask = config.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
int dark = nightMask == Configuration.UI_MODE_NIGHT_YES ? 1 : 0;
|
||||
int orientation = 0;
|
||||
|
||||
if (config.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
orientation = 1;
|
||||
} else if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
orientation = 2;
|
||||
}
|
||||
|
||||
nativeSetSystemDark(dark);
|
||||
nativeSetOrientation(orientation);
|
||||
}
|
||||
|
||||
private void requestInsetRefresh() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
final View decorView = getWindow().getDecorView();
|
||||
decorView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
decorView.requestApplyInsets();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void setupInsetsListener() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
final View decorView = getWindow().getDecorView();
|
||||
@@ -562,59 +203,42 @@ public class MainActivity extends NativeActivity {
|
||||
return result;
|
||||
}
|
||||
|
||||
private void syncLifecycleState(String reason) {
|
||||
int playInBackground = nativeGetPlayInBackground();
|
||||
boolean shouldRunInBackground = playInBackground != 0 && (activityPaused || !windowFocused);
|
||||
|
||||
Log.d(TAG, reason + ": play_in_background=" + playInBackground
|
||||
+ " activityPaused=" + activityPaused
|
||||
+ " windowFocused=" + windowFocused
|
||||
+ " backgroundActive=" + backgroundExecutionActive);
|
||||
|
||||
if (backgroundExecutionActive != shouldRunInBackground) {
|
||||
nativeSetBackgroundActive(shouldRunInBackground);
|
||||
backgroundExecutionActive = shouldRunInBackground;
|
||||
}
|
||||
|
||||
if (playInBackground == 0) {
|
||||
if (activityPaused && !autoPausedForLifecycle) {
|
||||
autoPausedForLifecycle = nativePauseSession() != 0;
|
||||
} else if (!activityPaused && autoPausedForLifecycle) {
|
||||
nativeResumeSession();
|
||||
autoPausedForLifecycle = false;
|
||||
}
|
||||
} else if (autoPausedForLifecycle) {
|
||||
nativeResumeSession();
|
||||
autoPausedForLifecycle = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
activityPaused = true;
|
||||
syncLifecycleState("onPause");
|
||||
int playInBackground = nativeGetPlayInBackground();
|
||||
Log.d(TAG, "onPause: play_in_background = " + playInBackground);
|
||||
if (playInBackground == 0) {
|
||||
// Auto-pause if play in background is disabled
|
||||
Log.d(TAG, "onPause: Auto-pausing session (play in background disabled)");
|
||||
nativePauseSession();
|
||||
} else {
|
||||
// Continue in background
|
||||
Log.d(TAG, "onPause: Continuing in background (play in background enabled)");
|
||||
nativeTimerActivate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
activityPaused = false;
|
||||
syncLifecycleState("onResume");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
windowFocused = hasFocus;
|
||||
syncLifecycleState("onWindowFocusChanged");
|
||||
int playInBackground = nativeGetPlayInBackground();
|
||||
Log.d(TAG, "onResume: play_in_background = " + playInBackground);
|
||||
if (playInBackground == 0) {
|
||||
// Auto-resume if play in background is disabled
|
||||
Log.d(TAG, "onResume: Auto-resuming session (play in background disabled)");
|
||||
nativeResumeSession();
|
||||
} else {
|
||||
// Just deactivate timer (session continued in background)
|
||||
Log.d(TAG, "onResume: Deactivating background timer");
|
||||
nativeTimerDeactivate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.d(TAG, "onDestroy called - releasing wake lock");
|
||||
allowScreenOff();
|
||||
releaseWakeLock();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
Eine freie, quelloffene App für Atmung, Meditation und Gewohnheiten.
|
||||
Eine freie, quelloffene App für geführte Atemmeditation nach der Wim-Hof-Methode.
|
||||
|
||||
Funktionen:
|
||||
- Geführte Übungen mit visuellen und akustischen Hinweisen
|
||||
- Mind, Yoga und Fitness für Gewohnheiten und Übungen
|
||||
- Anpassbare Atemsitzungen und Meditationstimer
|
||||
- Gewohnheitstracking mit Sitzungsverlauf
|
||||
- Lokale Speicherung mit Import und Export
|
||||
- Anpassbare Designs mit hellen und dunklen Varianten
|
||||
- Geführte Atemsitzungen mit visuellen und akustischen Hinweisen
|
||||
- Anpassbare Atemanzahl und Haltezeiten
|
||||
- Sitzungsverlauf mit lokaler Speicherung
|
||||
- 8 Farbthemen (Forest, Ocean, Sky, Sunset, Lavender - jeweils hell/dunkel)
|
||||
- Soundeffekte (Einatmen/Ausatmen, Glocke)
|
||||
- Vollbildmodus mit korrekter DPI-Skalierung
|
||||
- Touch-optimierte Oberfläche für Mobilgeräte
|
||||
|
||||
Verfügbare Plattformen: Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
Eine freie App für Atmung, Meditation und Gewohnheiten.
|
||||
Eine freie, quelloffene Atemmeditations-App nach der Wim-Hof-Methode.
|
||||
@@ -1,6 +0,0 @@
|
||||
### Added
|
||||
- Hierarchical settings organization with 3 main categories
|
||||
- Category selection screen with card-based navigation
|
||||
- Back button for hierarchical navigation
|
||||
### Fixed
|
||||
- Settings navigation state and Android back button behavior
|
||||
@@ -1,5 +0,0 @@
|
||||
### Added
|
||||
- Flint-based UI and theme system
|
||||
- Session volume slider with immediate persistence
|
||||
- Additional language support: Czech (Čeština), Indonesian (Bahasa Indonesia), Japanese (日本語), Korean (한국어), and Chinese (中文)
|
||||
- Proper font glyphs
|
||||
@@ -1,2 +0,0 @@
|
||||
### Added
|
||||
- Breath hold display mode setting with circle progress or stopwatch display
|
||||
@@ -1,2 +0,0 @@
|
||||
### Fixed
|
||||
- Android touch targets now align correctly on devices with navigation bar window insets.
|
||||
@@ -1,2 +0,0 @@
|
||||
### Fixed
|
||||
- History editing now scrolls to the active field once and keeps 16px Unifont row text aligned without clipping.
|
||||
@@ -1,5 +0,0 @@
|
||||
### Fixed
|
||||
- Android sessions continue correctly when the notification shade causes focus loss with background playback enabled.
|
||||
- Android safe-area insets now offset the viewport at the top instead of creating bottom-only padding.
|
||||
- Progressive start speed defaults to 3, normal speed defaults to 6, and the start speed editor preview animates at the exact selected speed.
|
||||
- Dropdown menu text is clipped cleanly while scrolling.
|
||||
@@ -1,2 +0,0 @@
|
||||
### Added
|
||||
- BTC address for donations
|
||||
@@ -1,3 +0,0 @@
|
||||
### Fixed
|
||||
- Import now replaces only matching session files from the ZIP and never removes local sessions missing from the import.
|
||||
- Fixed web scaling behavior.
|
||||
@@ -1,6 +0,0 @@
|
||||
### Added
|
||||
- Habit tracking with default Mind, Yoga, and Fitness habits.
|
||||
- Habit editing, custom colors, sync options, and deletion.
|
||||
- Practice tabs with configurable themes.
|
||||
### Changed
|
||||
- App theme now follows the active practice theme globally.
|
||||
@@ -1,2 +0,0 @@
|
||||
### Fixed
|
||||
- Fixed Android orientation changes so forced landscape and portrait resize the app viewport correctly.
|
||||
@@ -1,3 +0,0 @@
|
||||
### Fixed
|
||||
- Unified scroll containers so content stays out of scrollbar tracks and scroll positions clamp cleanly at the bottom.
|
||||
- Android meditation audio downloads now show a localized network-permission/connectivity modal when the host cannot be resolved.
|
||||
@@ -1,12 +1,12 @@
|
||||
A free, open-source practice app for breathing, meditation, and habit tracking.
|
||||
A free, open-source guided breathing meditation app based on the Wim Hof method.
|
||||
|
||||
Features:
|
||||
- Guided practice sessions with visual and audio cues
|
||||
- Mind, Yoga, and Fitness organization for habits and practice views
|
||||
- Configurable breathing sessions and meditation timers
|
||||
- Habit tracking with session history
|
||||
- Local storage with import/export support
|
||||
- Theme customization with light and dark variants
|
||||
- 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
|
||||
|
||||
Available platforms: Linux, Windows, Android, WebAssembly.
|
||||
Available platforms: Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
A free, open-source app for breathing, meditation, and habit tracking.
|
||||
A free, open-source guided breathing meditation app based on the Wim Hof method.
|
||||
@@ -1,12 +1,12 @@
|
||||
Una app libre y de código abierto para respiración, meditación y hábitos.
|
||||
Una app libre y de código abierto de meditación respiratoria guiada basada en el método Wim Hof.
|
||||
|
||||
Funciones:
|
||||
- Prácticas guiadas con señales visuales y de audio
|
||||
- Organización Mind, Yoga y Fitness para hábitos y prácticas
|
||||
- Sesiones de respiración y temporizadores de meditación configurables
|
||||
- Seguimiento de hábitos con historial de sesiones
|
||||
- Almacenamiento local con importación y exportación
|
||||
- Temas personalizables con variantes claras y oscuras
|
||||
- Sesiones de respiración guiadas con señales visuales y de audio
|
||||
- Cantidad de respiraciones y tiempos de retención configurables
|
||||
- Historial de sesiones con almacenamiento local
|
||||
- 8 temas de color (Forest, Ocean, Sky, Sunset, Lavender, cada uno con variante clara/oscura)
|
||||
- Efectos de sonido (inhalar/exhalar, campana)
|
||||
- Modo de pantalla completa con escalado DPI correcto
|
||||
- Interfaz optimizada para pantallas táctiles
|
||||
|
||||
Plataformas disponibles: Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
Una app libre para respiración, meditación y hábitos.
|
||||
Una app libre y de código abierto de meditación respiratoria guiada basada en el método Wim Hof.
|
||||
@@ -1,12 +1,12 @@
|
||||
Une app libre et open source pour respiration, méditation et habitudes.
|
||||
Une app libre et open source de méditation respiratoire guidée basée sur la méthode Wim Hof.
|
||||
|
||||
Fonctionnalités :
|
||||
- Pratiques guidées avec repères visuels et audio
|
||||
- Organisation Mind, Yoga et Fitness pour habitudes et pratiques
|
||||
- Séances de respiration et minuteries de méditation configurables
|
||||
- Suivi des habitudes avec historique des séances
|
||||
- Stockage local avec import et export
|
||||
- Thèmes personnalisables avec variantes claires et sombres
|
||||
- Séances de respiration guidées avec repères visuels et audio
|
||||
- Nombre de respirations et temps de rétention configurables
|
||||
- Historique des séances avec stockage local
|
||||
- 8 thèmes de couleur (Forest, Ocean, Sky, Sunset, Lavender, chacun en clair/sombre)
|
||||
- Effets sonores (inspiration/expiration, cloche)
|
||||
- Mode plein écran avec mise à l'échelle DPI correcte
|
||||
- Interface optimisée pour les écrans tactiles
|
||||
|
||||
Plateformes disponibles : Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
Une app libre pour respiration, méditation et habitudes.
|
||||
Une app libre de méditation respiratoire guidée basée sur la méthode Wim Hof.
|
||||
@@ -1,12 +1,12 @@
|
||||
Um app livre e de código aberto para respiração, meditação e hábitos.
|
||||
Um app livre e de código aberto de meditação respiratória guiada baseada no método Wim Hof.
|
||||
|
||||
Recursos:
|
||||
- Práticas guiadas com sinais visuais e sonoros
|
||||
- Organização Mind, Yoga e Fitness para hábitos e práticas
|
||||
- Sessões de respiração e timers de meditação configuráveis
|
||||
- Acompanhamento de hábitos com histórico de sessões
|
||||
- Armazenamento local com importação e exportação
|
||||
- Temas personalizáveis com variantes claras e escuras
|
||||
- Sessões de respiração guiadas com sinais visuais e sonoros
|
||||
- Quantidade de respirações e tempos de retenção configuráveis
|
||||
- Histórico de sessões com armazenamento local
|
||||
- 8 temas de cores (Forest, Ocean, Sky, Sunset, Lavender, cada um com claro/escuro)
|
||||
- Efeitos sonoros (inspirar/expirar, sino)
|
||||
- Modo de tela cheia com escala DPI correta
|
||||
- Interface otimizada para toque em dispositivos móveis
|
||||
|
||||
Plataformas disponíveis: Linux, Windows, Android, WebAssembly.
|
||||
@@ -1 +1 @@
|
||||
Um app livre para respiração, meditação e hábitos.
|
||||
Um app livre de meditação respiratória guiada baseada no método Wim Hof.
|
||||
@@ -16,26 +16,9 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-sdl2": {
|
||||
"locked": {
|
||||
"lastModified": 1751274312,
|
||||
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-sdl2": "nixpkgs-sdl2"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-sdl2.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-sdl2 }:
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
@@ -27,13 +26,6 @@
|
||||
mkShell = system:
|
||||
let
|
||||
pkgs = mkPkgs system;
|
||||
sdl2Pkgs = import nixpkgs-sdl2 {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnsupportedSystem = true;
|
||||
};
|
||||
};
|
||||
aarch64Pkgs = pkgs.pkgsCross.aarch64-multiplatform;
|
||||
|
||||
windowsCrossEnabled = system == "x86_64-linux";
|
||||
@@ -47,17 +39,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
mingw32Pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
crossSystem = { config = "i686-w64-mingw32"; };
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnsupportedSystem = true;
|
||||
};
|
||||
};
|
||||
|
||||
mcfgthreads = pkgs.pkgsCross.mingwW64.windows.mcfgthreads;
|
||||
mcfgthreads32 = pkgs.pkgsCross.mingw32.windows.mcfgthreads;
|
||||
|
||||
androidComposition = pkgs.androidenv.composeAndroidPackages {
|
||||
cmdLineToolsVersion = "11.0";
|
||||
@@ -76,8 +58,7 @@
|
||||
ndkPath = "${sdk}/libexec/android-sdk/ndk-bundle";
|
||||
|
||||
pkgConfigPath = pkgs.lib.makeSearchPath "lib/pkgconfig" [
|
||||
sdl2Pkgs.SDL2.dev
|
||||
pkgs.curl.dev
|
||||
pkgs.SDL2.dev
|
||||
pkgs.libdrm.dev
|
||||
pkgs.libgbm
|
||||
pkgs.libglvnd.dev
|
||||
@@ -94,71 +75,8 @@
|
||||
mingwPkgs.buildPackages.gcc
|
||||
mingwPkgs.windows.mingw_w64
|
||||
mcfgthreads
|
||||
mingw32Pkgs.buildPackages.gcc
|
||||
mingw32Pkgs.windows.mingw_w64
|
||||
mcfgthreads32
|
||||
];
|
||||
|
||||
linuxdeployPluginAppImage = pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "linuxdeploy-plugin-appimage";
|
||||
version = "1-alpha-20250213-1";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-appimage-x86_64.AppImage";
|
||||
hash = "sha256-mS1QKiSOFKsYVEjd9vbn0lVYy4TUYjw1TDrzUMJfzLM=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp "$src" linuxdeploy-plugin-appimage.AppImage
|
||||
chmod +x linuxdeploy-plugin-appimage.AppImage
|
||||
./linuxdeploy-plugin-appimage.AppImage --appimage-extract >/dev/null
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
cp squashfs-root/AppRun "$out/bin/linuxdeploy-plugin-appimage"
|
||||
chmod +x "$out/bin/linuxdeploy-plugin-appimage"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
appimagetool = pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "appimagetool";
|
||||
version = "continuous";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage";
|
||||
hash = "sha256-uQ9KixiWdUX9p4pEWydoChZC8e+UiM7Si2U5jyvnrdI=";
|
||||
};
|
||||
|
||||
extracted = pkgs.appimageTools.extract {
|
||||
pname = "appimagetool";
|
||||
version = "continuous";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage";
|
||||
hash = "sha256-uQ9KixiWdUX9p4pEWydoChZC8e+UiM7Si2U5jyvnrdI=";
|
||||
};
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
cat > "$out/bin/appimagetool" <<EOF
|
||||
#!${pkgs.runtimeShell}
|
||||
exec "$extracted/AppRun" "\$@"
|
||||
EOF
|
||||
chmod +x "$out/bin/appimagetool"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
windowsProfile = pkgs.lib.optionalString windowsCrossEnabled ''
|
||||
export WIN_CC="x86_64-w64-mingw32-gcc"
|
||||
export WIN_CXX="x86_64-w64-mingw32-g++"
|
||||
@@ -167,15 +85,7 @@ EOF
|
||||
export WIN_WINDRES="x86_64-w64-mingw32-windres"
|
||||
export WIN_STRIP="x86_64-w64-mingw32-strip"
|
||||
|
||||
export WIN32_CC="i686-w64-mingw32-gcc"
|
||||
export WIN32_CXX="i686-w64-mingw32-g++"
|
||||
export WIN32_AR="i686-w64-mingw32-ar"
|
||||
export WIN32_RANLIB="i686-w64-mingw32-ranlib"
|
||||
export WIN32_WINDRES="i686-w64-mingw32-windres"
|
||||
export WIN32_STRIP="i686-w64-mingw32-strip"
|
||||
|
||||
export MCFGTHREADS="${mcfgthreads}"
|
||||
export WIN32_MCFGTHREADS="${mcfgthreads32}"
|
||||
export CPATH="$MCFGTHREADS/include:$CPATH"
|
||||
export LIBRARY_PATH="$MCFGTHREADS/lib:$LIBRARY_PATH"
|
||||
export LDFLAGS="-L$MCFGTHREADS/lib $LDFLAGS"
|
||||
@@ -186,15 +96,12 @@ EOF
|
||||
extraOutputsToInstall = [ "dev" ];
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
sdl2Pkgs.SDL2
|
||||
sdl2Pkgs.SDL2.dev
|
||||
SDL2
|
||||
SDL2.dev
|
||||
butler
|
||||
cmake
|
||||
curl
|
||||
curl.dev
|
||||
emscripten
|
||||
gcc
|
||||
git-lfs
|
||||
gnumake
|
||||
gradle
|
||||
imagemagick
|
||||
@@ -204,9 +111,6 @@ EOF
|
||||
libgbm
|
||||
libglvnd
|
||||
libglvnd.dev
|
||||
appimagetool
|
||||
linuxdeploy
|
||||
linuxdeployPluginAppImage
|
||||
mesa
|
||||
ncurses
|
||||
ninja
|
||||
@@ -251,8 +155,6 @@ EOF
|
||||
export WEB_AR="emar"
|
||||
export WEB_RANLIB="emranlib"
|
||||
|
||||
export LINUXDEPLOY="linuxdeploy"
|
||||
|
||||
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}"
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Waozi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,14 +0,0 @@
|
||||
# Inbe Flint UI
|
||||
|
||||
This directory is first-party Inbe UI/runtime support code. It was merged from
|
||||
the old Flint project so Inbe can extend the UI system directly without a
|
||||
vendored submodule, project manifest, CLI, or separate library target.
|
||||
|
||||
## Layout
|
||||
|
||||
- `include/` - public headers used by Inbe source files
|
||||
- `src/` - C implementation files compiled directly into Inbe
|
||||
- `icons/` - icon bitmaps embedded by the Flint icon asset source
|
||||
- `scripts/` - small build helpers, currently asset embedding
|
||||
|
||||
The root `Makefile` and Android CMake project compile these files directly.
|
||||
|
Before Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 187 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 208 B |
|
Before Width: | Height: | Size: 179 B |
|
Before Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 197 B |
|
Before Width: | Height: | Size: 117 B |
|
Before Width: | Height: | Size: 224 B |
|
Before Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 245 B |
|
Before Width: | Height: | Size: 266 B |
|
Before Width: | Height: | Size: 278 B |
|
Before Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 174 B |
|
Before Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 157 B |
@@ -1,19 +0,0 @@
|
||||
#ifndef FLINT_H
|
||||
#define FLINT_H
|
||||
|
||||
#include "flint_color.h"
|
||||
#include "flint_scaling.h"
|
||||
#include "flint_dpi.h"
|
||||
#include "flint_layout.h"
|
||||
#include "flint_clip.h"
|
||||
#include "flint_icons.h"
|
||||
#include "flint_text.h"
|
||||
#include "flint_ui.h"
|
||||
#include "flint_text_layout.h"
|
||||
#include "flint_locale.h"
|
||||
#include "flint_theme.h"
|
||||
#include "flint_theme_meta.h"
|
||||
#include "flint_web.h"
|
||||
#include "flint_runtime_assets.h"
|
||||
|
||||
#endif // FLINT_H
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef FLINT_CLIP_H
|
||||
#define FLINT_CLIP_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
Rectangle flint_clip_intersection(Rectangle a, Rectangle b);
|
||||
Rectangle flint_clip_effective(Rectangle bounds);
|
||||
void flint_clip_begin(int x, int y, int w, int h);
|
||||
void flint_clip_end(void);
|
||||
void flint_clip_reset(void);
|
||||
|
||||
#endif
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef FLINT_COLOR_H
|
||||
#define FLINT_COLOR_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Lighten a color by adding to each RGB component
|
||||
Color flint_lighten(Color c, int amount);
|
||||
|
||||
// Darken a color by subtracting from each RGB component
|
||||
Color flint_darken(Color c, int amount);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // FLINT_COLOR_H
|
||||
@@ -1,38 +0,0 @@
|
||||
#ifndef FLINT_DPI_H
|
||||
#define FLINT_DPI_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FLINT_DPI_BASE_WIDTH 320
|
||||
#define FLINT_DPI_BASE_HEIGHT 560
|
||||
|
||||
typedef struct FlintDpiState {
|
||||
int view_width;
|
||||
int view_height;
|
||||
float ui_scale;
|
||||
float ui_scale_clamped;
|
||||
float camera_zoom;
|
||||
int base_width;
|
||||
int base_height;
|
||||
int needs_update;
|
||||
} FlintDpiState;
|
||||
|
||||
extern FlintDpiState flint_dpi_state;
|
||||
|
||||
void flint_dpi_init(void);
|
||||
void flint_dpi_update(int view_width, int view_height);
|
||||
int flint_dpi_is_dirty(void);
|
||||
static inline float flint_dpi_scale(void) { return flint_dpi_state.ui_scale_clamped; }
|
||||
static inline int flint_dpi_view_width(void) { return flint_dpi_state.view_width; }
|
||||
static inline int flint_dpi_view_height(void) { return flint_dpi_state.view_height; }
|
||||
static inline float flint_dpi_camera_zoom(void) { return flint_dpi_state.camera_zoom; }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef FLINT_EMBEDDED_ASSETS_H
|
||||
#define FLINT_EMBEDDED_ASSETS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct FlintEmbeddedAsset {
|
||||
const char *path;
|
||||
const char *mime;
|
||||
const unsigned char *data;
|
||||
unsigned int size;
|
||||
} FlintEmbeddedAsset;
|
||||
|
||||
extern const FlintEmbeddedAsset flint_embedded_assets[];
|
||||
extern const unsigned int flint_embedded_asset_count;
|
||||
|
||||
const FlintEmbeddedAsset *flint_embedded_asset(const char *path);
|
||||
char *flint_embedded_asset_text(const char *path);
|
||||
const char *flint_embedded_asset_extension(const char *path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,61 +0,0 @@
|
||||
#ifndef FLINT_FILE_DIALOG_H
|
||||
#define FLINT_FILE_DIALOG_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FLINT_FILE_DIALOG_PATH_MAX 512
|
||||
|
||||
typedef enum {
|
||||
FLINT_FILE_DIALOG_SAVE,
|
||||
FLINT_FILE_DIALOG_LOAD,
|
||||
FLINT_FILE_DIALOG_SELECT_FOLDER
|
||||
} FlintFileDialogMode;
|
||||
|
||||
typedef struct {
|
||||
int active;
|
||||
FlintFileDialogMode mode;
|
||||
char title[128];
|
||||
char result_path[FLINT_FILE_DIALOG_PATH_MAX];
|
||||
char default_name[128];
|
||||
char filter[64];
|
||||
int confirmed;
|
||||
void *_internal;
|
||||
} FlintFileDialog;
|
||||
|
||||
/* Initialize file dialog */
|
||||
void flint_file_dialog_init(FlintFileDialog *dlg);
|
||||
|
||||
/* Set the theme scope used by the blocking desktop dialog. */
|
||||
void flint_file_dialog_set_theme_scope(const char *scope);
|
||||
|
||||
/* Save file dialog - returns 1 if file selected, 0 if cancelled */
|
||||
int flint_file_dialog_save(FlintFileDialog *dlg, const char *title, const char *default_filename);
|
||||
|
||||
/* Load file dialog - returns 1 if file selected, 0 if cancelled */
|
||||
int flint_file_dialog_load(FlintFileDialog *dlg, const char *title);
|
||||
|
||||
/* Select folder dialog - returns 1 if folder selected, 0 if cancelled */
|
||||
int flint_file_dialog_select_folder(FlintFileDialog *dlg, const char *title);
|
||||
|
||||
/* Begin non-blocking dialogs. Call flint_file_dialog_update() each frame while active. */
|
||||
void flint_file_dialog_begin_load(FlintFileDialog *dlg, const char *title);
|
||||
void flint_file_dialog_begin_save(FlintFileDialog *dlg, const char *title, const char *default_filename);
|
||||
|
||||
/* Draw/update active dialog: 1 confirmed, 0 cancelled, -1 still active. */
|
||||
int flint_file_dialog_update(FlintFileDialog *dlg);
|
||||
|
||||
/* Get selected file path */
|
||||
const char *flint_file_dialog_get_path(FlintFileDialog *dlg);
|
||||
|
||||
/* Cleanup dialog resources */
|
||||
void flint_file_dialog_cleanup(FlintFileDialog *dlg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FLINT_FILE_DIALOG_H */
|
||||
@@ -1,29 +0,0 @@
|
||||
#ifndef FLINT_ICONS_H
|
||||
#define FLINT_ICONS_H
|
||||
|
||||
#include "raylib.h"
|
||||
#include "ui_icon_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct FlintIconAsset {
|
||||
UIIconType type;
|
||||
const char *name;
|
||||
const unsigned char *data;
|
||||
unsigned int size;
|
||||
} FlintIconAsset;
|
||||
|
||||
const FlintIconAsset *flint_icon_asset(UIIconType type);
|
||||
const FlintIconAsset *flint_icon_asset_by_name(const char *name);
|
||||
Texture2D flint_load_icon_texture(UIIconType type);
|
||||
Texture2D flint_load_icon_texture_by_name(const char *name);
|
||||
void flint_load_all_icons(Texture2D *icons);
|
||||
void flint_unload_all_icons(Texture2D *icons);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // FLINT_ICONS_H
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef FLINT_LAYOUT_H
|
||||
#define FLINT_LAYOUT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Set the view dimensions (should be called when window/viewport changes)
|
||||
void flint_set_view_size(int width, int height);
|
||||
|
||||
// Get the current view width
|
||||
int flint_view_width(void);
|
||||
|
||||
// Get the current view height
|
||||
int flint_view_height(void);
|
||||
|
||||
// Calculate centered column dimensions
|
||||
// Returns x position and width via pointers if not NULL
|
||||
void flint_centered_column(int max_w, int side_pad, int *x, int *w);
|
||||
|
||||
// Calculate page side padding based on current view width
|
||||
int flint_page_side_padding(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // FLINT_LAYOUT_H
|
||||
@@ -1,38 +0,0 @@
|
||||
#ifndef FLINT_RUNTIME_ASSETS_H
|
||||
#define FLINT_RUNTIME_ASSETS_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum FlintRuntimeAssetStatus {
|
||||
FLINT_RUNTIME_ASSET_IDLE = 0,
|
||||
FLINT_RUNTIME_ASSET_DOWNLOADING,
|
||||
FLINT_RUNTIME_ASSET_READY,
|
||||
FLINT_RUNTIME_ASSET_ERROR,
|
||||
FLINT_RUNTIME_ASSET_UNSUPPORTED
|
||||
} FlintRuntimeAssetStatus;
|
||||
|
||||
typedef struct FlintRuntimeAssetDownload {
|
||||
volatile FlintRuntimeAssetStatus status;
|
||||
char url[1024];
|
||||
char path[512];
|
||||
char error[256];
|
||||
long http_status;
|
||||
volatile size_t bytes;
|
||||
volatile size_t total_bytes;
|
||||
void *platform;
|
||||
} FlintRuntimeAssetDownload;
|
||||
|
||||
typedef int (*FlintRuntimeAssetDownloadBackend)(FlintRuntimeAssetDownload *download,
|
||||
const char *url,
|
||||
const char *path);
|
||||
|
||||
int flint_runtime_assets_init(const char *app_id);
|
||||
int flint_runtime_asset_cache_root(const char *app_id, char *out, size_t out_size);
|
||||
int flint_runtime_asset_ensure_dir(const char *path);
|
||||
void flint_runtime_asset_set_download_backend(FlintRuntimeAssetDownloadBackend backend);
|
||||
int flint_runtime_asset_download(FlintRuntimeAssetDownload *download,
|
||||
const char *url,
|
||||
const char *path);
|
||||
const char *flint_runtime_asset_status_text(FlintRuntimeAssetStatus status);
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef FLINT_SCALING_H
|
||||
#define FLINT_SCALING_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Set the DPI scale factor (should be called once at startup)
|
||||
void flint_set_dpi_scale(float scale);
|
||||
|
||||
// Get the current DPI scale factor
|
||||
float flint_get_dpi_scale(void);
|
||||
|
||||
// Scale a pixel value by the DPI factor
|
||||
int flint_px(int px);
|
||||
|
||||
// Scale and clamp a pixel value between min and max
|
||||
int flint_clamp_px(int px, int min_px, int max_px);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // FLINT_SCALING_H
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef FLINT_TEXT_H
|
||||
#define FLINT_TEXT_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define FLINT_TEXT_8 8
|
||||
#define FLINT_TEXT_12 12
|
||||
#define FLINT_TEXT_14 14
|
||||
#define FLINT_TEXT_16 16
|
||||
#define FLINT_TEXT_18 18
|
||||
#define FLINT_TEXT_20 20
|
||||
#define FLINT_TEXT_24 24
|
||||
#define FLINT_TEXT_32 32
|
||||
#define FLINT_TEXT_BASE_SIZE 16
|
||||
|
||||
void flint_text_set_font(Font font);
|
||||
void flint_text_set_small_font(Font font);
|
||||
Font flint_text_font(void);
|
||||
Font flint_text_load_chopped_font(const char *png_path, const char *dat_path, int base_size);
|
||||
Font flint_text_load_chopped_font_from_memory(const unsigned char *png_data, unsigned int png_size, const unsigned char *dat_data, unsigned int dat_size, int base_size);
|
||||
void flint_text_unload_font(Font *font);
|
||||
int flint_text_size(int preferred_size);
|
||||
int flint_text_dpi_size(int base_size);
|
||||
int flint_text_measure(const char *text, int font_size);
|
||||
int flint_text_height(const char *text, int font_size);
|
||||
int flint_text_measure_scaled(const char *text, int scale);
|
||||
void flint_text_draw(const char *text, int x, int y, int font_size, Color color);
|
||||
void flint_text_draw_scaled(const char *text, int x, int y, int scale, Color color);
|
||||
void flint_text_draw_centered(const char *text, int center_x, int center_y, int font_size, Color color);
|
||||
void flint_text_draw_in_rect(const char *text, Rectangle rect, int font_size, Color color);
|
||||
void flint_text_draw_fitted_in_rect(const char *text, Rectangle rect, int preferred_size, int min_size, Color color);
|
||||
int flint_text_y(const char *text, int box_y, int box_h, int font_size);
|
||||
int flint_text_y_scaled(const char *text, int box_y, int box_h, int scale);
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef FLINT_TEXT_LAYOUT_H
|
||||
#define FLINT_TEXT_LAYOUT_H
|
||||
|
||||
#include "raylib.h"
|
||||
#include "ui_icon_types.h"
|
||||
#include "flint_text.h"
|
||||
|
||||
typedef enum {
|
||||
FLINT_TEXT_ELEMENT_TYPE_TEXT,
|
||||
FLINT_TEXT_ELEMENT_TYPE_ICON,
|
||||
FLINT_TEXT_ELEMENT_TYPE_LINE_BREAK
|
||||
} FlintTextElementType;
|
||||
|
||||
typedef struct {
|
||||
FlintTextElementType type;
|
||||
const char *text;
|
||||
Texture2D icon;
|
||||
UIIconType icon_type;
|
||||
int icon_size;
|
||||
int text_width;
|
||||
} FlintTextElement;
|
||||
|
||||
typedef struct FlintTextLayout {
|
||||
FlintTextElement *elements;
|
||||
int element_count;
|
||||
int *line_breaks;
|
||||
int line_count;
|
||||
int *line_widths;
|
||||
int total_height;
|
||||
int line_height; /* Store line height from reflow for use in draw */
|
||||
int last_reflow_width;
|
||||
} FlintTextLayout;
|
||||
|
||||
FlintTextLayout flint_text_layout_parse(const char *input, Texture2D icon, UIIconType icon_type, int icon_size);
|
||||
void flint_text_layout_reflow(FlintTextLayout *layout, int max_width, int font_size, int line_height);
|
||||
void flint_text_layout_draw(FlintTextLayout *layout, int x, int *y, int font_size, Color color);
|
||||
int flint_text_layout_get_height(FlintTextLayout *layout);
|
||||
void flint_text_layout_free(FlintTextLayout *layout);
|
||||
|
||||
#endif
|
||||
@@ -1,60 +0,0 @@
|
||||
#ifndef FLINT_THEME_H
|
||||
#define FLINT_THEME_H
|
||||
|
||||
#include "raylib.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define FLINT_THEME_MAX_SCOPES 24
|
||||
#define FLINT_THEME_MAX_VALUES 64
|
||||
#define FLINT_THEME_NAME_SIZE 64
|
||||
#define FLINT_THEME_PATH_SIZE 256
|
||||
#define FLINT_THEME_MAX_VARS 64
|
||||
|
||||
typedef struct FlintThemeValue {
|
||||
char key[FLINT_THEME_NAME_SIZE];
|
||||
Color value;
|
||||
} FlintThemeValue;
|
||||
|
||||
typedef struct FlintThemeScope {
|
||||
char name[FLINT_THEME_NAME_SIZE];
|
||||
char path[FLINT_THEME_PATH_SIZE];
|
||||
char dark_path[FLINT_THEME_PATH_SIZE];
|
||||
FlintThemeValue values[FLINT_THEME_MAX_VALUES];
|
||||
int count;
|
||||
} FlintThemeScope;
|
||||
|
||||
typedef struct {
|
||||
char key[FLINT_THEME_NAME_SIZE];
|
||||
Color value;
|
||||
bool scopes[FLINT_THEME_MAX_SCOPES];
|
||||
int scope_count;
|
||||
} FlintThemeAggregateVariable;
|
||||
|
||||
void flint_theme_reset(void);
|
||||
FlintThemeScope *flint_theme_register_scope(const char *name, const char *path);
|
||||
FlintThemeScope *flint_theme_register_scope_dark(const char *name, const char *path, const char *dark_path);
|
||||
FlintThemeScope *flint_theme_scope(const char *name);
|
||||
const FlintThemeScope *flint_theme_scope_at(int index);
|
||||
int flint_theme_scope_count(void);
|
||||
Color flint_theme_get(const char *scope, const char *key);
|
||||
bool flint_theme_set_color(const char *scope, const char *key, Color color);
|
||||
bool flint_theme_save_scope(const char *scope);
|
||||
bool flint_theme_save_all(void);
|
||||
const char *flint_theme_color_text(Color color, char *buffer, int size);
|
||||
bool flint_theme_parse_color(const char *text, Color *color);
|
||||
void flint_theme_draw_tk_border(Rectangle rec, int borderWidth, bool raised);
|
||||
|
||||
void flint_theme_aggregate_all(void);
|
||||
FlintThemeAggregateVariable* flint_theme_aggregate_vars(void);
|
||||
int flint_theme_aggregate_count(void);
|
||||
void flint_theme_apply_aggregate(const char *key, Color color);
|
||||
bool flint_theme_sync_from_scope(const char *src_scope);
|
||||
bool flint_theme_sync_to_apps(const char *src_scope);
|
||||
bool flint_theme_export_theme(const char *path);
|
||||
bool flint_theme_import_theme(const char *path);
|
||||
|
||||
void flint_theme_set_dark_mode(bool dark);
|
||||
bool flint_theme_get_dark_mode(void);
|
||||
void flint_theme_reload_themes(void);
|
||||
|
||||
#endif
|
||||
@@ -1,38 +0,0 @@
|
||||
#ifndef FLINT_THEME_META_H
|
||||
#define FLINT_THEME_META_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define FLINT_THEME_COUNT 10
|
||||
|
||||
typedef enum {
|
||||
FLINT_THEME_SKY = 0,
|
||||
FLINT_THEME_OCEAN = 1,
|
||||
FLINT_THEME_FOREST = 2,
|
||||
FLINT_THEME_SUNSET = 3,
|
||||
FLINT_THEME_LAVENDER = 4,
|
||||
FLINT_THEME_CHERRY = 5,
|
||||
FLINT_THEME_DAWN = 6,
|
||||
FLINT_THEME_SAGE = 7,
|
||||
FLINT_THEME_INK = 8,
|
||||
FLINT_THEME_MONO = 9
|
||||
} FlintThemeId;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *light_scope;
|
||||
const char *dark_scope;
|
||||
} FlintThemeMeta;
|
||||
|
||||
extern const FlintThemeMeta flint_themes[FLINT_THEME_COUNT];
|
||||
|
||||
const FlintThemeMeta *flint_theme_meta(FlintThemeId theme);
|
||||
FlintThemeId flint_theme_normalize(int theme);
|
||||
const char *flint_theme_label(FlintThemeId theme);
|
||||
const char *flint_theme_scope_for(FlintThemeId theme, bool dark_mode);
|
||||
bool flint_theme_catalog_color(FlintThemeId theme, bool dark_mode, const char *key, Color *color);
|
||||
bool flint_theme_catalog_scope_color(const char *scope, const char *key, Color *color);
|
||||
|
||||
#endif
|
||||
@@ -1,280 +0,0 @@
|
||||
#ifndef FLINT_UI_H
|
||||
#define FLINT_UI_H
|
||||
|
||||
#include "raylib.h"
|
||||
#include "flint.h"
|
||||
#include "flint_text.h"
|
||||
#include "ui_icon_types.h"
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum {
|
||||
UI_ICON_SIZE_TINY,
|
||||
UI_ICON_SIZE_SMALL,
|
||||
UI_ICON_SIZE_MEDIUM,
|
||||
UI_ICON_SIZE_LARGE
|
||||
} UIIconSize;
|
||||
|
||||
typedef enum {
|
||||
UI_BUTTON_STYLE_PRIMARY,
|
||||
UI_BUTTON_STYLE_SECONDARY,
|
||||
UI_BUTTON_STYLE_DANGER,
|
||||
UI_BUTTON_STYLE_TAB,
|
||||
UI_BUTTON_STYLE_TAB_SELECTED
|
||||
} UIButtonStyle;
|
||||
|
||||
typedef struct {
|
||||
Color background;
|
||||
Color border;
|
||||
Color focus_border;
|
||||
Color text;
|
||||
Color cursor;
|
||||
float radius;
|
||||
int padding_x;
|
||||
} FlintUITextInputStyle;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
const char *label;
|
||||
int font;
|
||||
int focus_id;
|
||||
int disabled;
|
||||
Color background;
|
||||
Color hover_background;
|
||||
Color text;
|
||||
Color border;
|
||||
float radius;
|
||||
} FlintUIButton;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
Texture2D icon;
|
||||
UIIconType icon_type;
|
||||
int icon_size;
|
||||
int icon_padding;
|
||||
int focus_id;
|
||||
int disabled;
|
||||
Color background;
|
||||
Color hover_background;
|
||||
Color icon_color;
|
||||
Color border;
|
||||
float radius;
|
||||
} FlintUIIconButton;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
const char *text;
|
||||
int cursor_position;
|
||||
int focused;
|
||||
int cursor_visible;
|
||||
int font;
|
||||
int focus_id;
|
||||
FlintUITextInputStyle style;
|
||||
} FlintUITextInput;
|
||||
|
||||
typedef int (*FlintUITextInputFilter)(int codepoint, void *user_data);
|
||||
|
||||
typedef struct {
|
||||
char *text;
|
||||
size_t text_size;
|
||||
int *cursor_position;
|
||||
int max_codepoints;
|
||||
FlintUITextInputFilter filter;
|
||||
void *filter_user_data;
|
||||
int *commit_pressed;
|
||||
} FlintUITextEdit;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
char *text;
|
||||
size_t text_size;
|
||||
int *cursor_position;
|
||||
int *focused;
|
||||
int max_codepoints;
|
||||
int font;
|
||||
int focus_id;
|
||||
FlintUITextInputStyle style;
|
||||
FlintUITextInputFilter filter;
|
||||
void *filter_user_data;
|
||||
int *commit_pressed;
|
||||
} FlintUITextField;
|
||||
|
||||
typedef struct {
|
||||
const char *text;
|
||||
Texture2D icon;
|
||||
UIIconType icon_type;
|
||||
int icon_size;
|
||||
int width;
|
||||
int font;
|
||||
int line_gap;
|
||||
Color color;
|
||||
} FlintUIParagraph;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
int disabled;
|
||||
Color accent;
|
||||
} FlintUISubtab;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
const FlintUISubtab *tabs;
|
||||
int count;
|
||||
int selected_index;
|
||||
int font;
|
||||
} FlintUISubtabBar;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
int content_height;
|
||||
int content_x;
|
||||
int content_width;
|
||||
int *scroll_offset;
|
||||
int wheel_step;
|
||||
int scrollbar_x;
|
||||
} FlintUIScrollArea;
|
||||
|
||||
typedef struct {
|
||||
int content_x;
|
||||
int content_y;
|
||||
int content_w;
|
||||
int viewport_h;
|
||||
int content_h;
|
||||
int max_scroll;
|
||||
} FlintUIScrollView;
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
int content_x;
|
||||
int content_y;
|
||||
int content_w;
|
||||
int content_h;
|
||||
int left_clicked;
|
||||
int right_clicked;
|
||||
} FlintUIPanelFrame;
|
||||
|
||||
typedef struct {
|
||||
int height;
|
||||
int left_clicked;
|
||||
int right_clicked;
|
||||
} FlintUIHeader;
|
||||
|
||||
typedef void (*FlintUITextInputPlatformCallback)(int active);
|
||||
|
||||
void ui_init(int width, int height, float dpi);
|
||||
void ui_set_colors(Color text, Color bg, Color surface, Color circle, Color button, Color button_hover, Color icon);
|
||||
void ui_set_frame(Camera2D camera);
|
||||
void flint_ui_set_text_input_platform_callback(FlintUITextInputPlatformCallback callback);
|
||||
void ui_set_cursor_clickable(int *cursor_clickable);
|
||||
void ui_set_cursor_disabled(int *cursor_disabled);
|
||||
void ui_set_icons(Texture2D gear_icon, Texture2D x_icon);
|
||||
void ui_set_input_blocked(int blocked);
|
||||
int ui_input_captures_click(Vector2 point);
|
||||
/* DPI scaling, color, and layout functions now from Flint: flint_px, flint_clamp_px, flint_lighten, flint_darken, flint_centered_column, flint_page_side_padding */
|
||||
int flint_ui_font(void);
|
||||
int flint_ui_font_small(void);
|
||||
int flint_ui_text_y(const char *text, int box_y, int box_h, int font);
|
||||
void flint_ui_draw_text_centered(const char *text, int center_x, int center_y, int font, Color color);
|
||||
void flint_ui_draw_text_left_in_rect(const char *text, Rectangle rect, int font_size, Color color);
|
||||
void flint_ui_draw_text_input(Rectangle bounds, const char *text, int cursor_position,
|
||||
int focused, int cursor_visible, int font,
|
||||
FlintUITextInputStyle style);
|
||||
int flint_ui_text_edit(FlintUITextEdit edit);
|
||||
void flint_ui_text_input_queue_codepoint(int codepoint);
|
||||
void flint_ui_text_input_queue_backspace(void);
|
||||
void flint_ui_text_input_queue_enter(void);
|
||||
int flint_ui_button(FlintUIButton button);
|
||||
int flint_ui_icon_button(FlintUIIconButton button);
|
||||
int flint_ui_text_input(FlintUITextInput input);
|
||||
int flint_ui_text_field(FlintUITextField field);
|
||||
int flint_ui_paragraph_height(FlintUIParagraph paragraph);
|
||||
void flint_ui_paragraph_draw(FlintUIParagraph paragraph, int x, int *y);
|
||||
void ui_draw_bevel(int x, int y, int w, int h, Color light, Color dark);
|
||||
void ui_draw_text_lines(const char **lines, int count, int x, int *y, int font, int line_h, Color color);
|
||||
/* Icon fallback drawing now from Flint: flint_draw_icon_fallback */
|
||||
int ui_icon_btn_size(UIIconSize size);
|
||||
int ui_icon_btn_padding(UIIconSize size);
|
||||
int ui_draw_icon_btn(int x, int y, UIIconSize size, Texture2D icon, int *hover);
|
||||
int ui_draw_icon_btn_padded(int x, int y, int size, int padding, Texture2D icon, int *hover);
|
||||
int ui_draw_text_btn(int x, int y, const char *label, int *hover);
|
||||
|
||||
/* Generic button component with unified styling */
|
||||
int ui_draw_generic_button(int x, int y, int w, int h, const char *label,
|
||||
UIButtonStyle style, int disabled, int *hover);
|
||||
int ui_draw_subtab_bar(FlintUISubtabBar bar);
|
||||
|
||||
void ui_draw_icon_link(int x, int y, int icon_size, Texture2D icon, const char *url);
|
||||
int ui_draw_slider(int id, int x, int y, int w, const char *label, int min, int max, int *value, const char *suffix);
|
||||
int ui_draw_slider_vertical(int id, int x, int y, int h,
|
||||
int min, int max, int *value);
|
||||
typedef void (*ui_slider_vertical_mark_callback)(void *user_data, int x, int y, int h, int min, int max, int value);
|
||||
int ui_draw_slider_vertical_with_marks(int id, int x, int y, int h,
|
||||
int min, int max, int *value, ui_slider_vertical_mark_callback callback,
|
||||
void *callback_user_data);
|
||||
int ui_draw_toggle_switch(int x, int y, int w, int h, int *value,
|
||||
const char *off_label, const char *on_label);
|
||||
int ui_draw_checkbox_toggle(int x, int y, const char *label, int *value);
|
||||
int ui_draw_dropdown_button(int id, int x, int y, int w, int h, const char **options, int option_count, int *selected_index);
|
||||
int ui_draw_dropdown_menu(int id);
|
||||
int ui_dropdown_captures_click(Vector2 point);
|
||||
void ui_set_dropdown_clip_top(int top);
|
||||
int ui_draw_theme_switcher(int x, int y, int w, const char *label,
|
||||
const char *light_label, const char *dark_label,
|
||||
int *theme_id, int *dark_mode);
|
||||
int ui_draw_theme_picker(int x, int y, int w, const char *label,
|
||||
int dark_mode, int *theme_id);
|
||||
int ui_theme_picker_height(int w);
|
||||
typedef struct UITab {
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
UIIconType icon_type;
|
||||
void (*on_click)(void *user_data);
|
||||
void *user_data;
|
||||
} UITab;
|
||||
|
||||
typedef struct UITabBar {
|
||||
UITab *tabs;
|
||||
int count;
|
||||
} UITabBar;
|
||||
|
||||
int ui_nav_button_width(const char *label, int icon_size, int show_label, int font);
|
||||
int ui_draw_nav_button(int x, int y, int icon_size, Texture2D icon, const char *label, int show_label, int *hover);
|
||||
int ui_draw_nav_button_expand(int x, int y, int icon_size, int w, Texture2D icon, const char *label, int show_label, int *hover);
|
||||
void ui_draw_tab_bar(UITab *tabs, int count);
|
||||
void ui_draw_tutorial_image_placeholder(const char *label, int x, int y, int w, int h);
|
||||
void ui_draw_tutorial_image(Texture2D texture, const char *fallback, int x, int y, int w, int h);
|
||||
int ui_draw_modal(const char *title, const char *message, const char *cancel_btn, const char *confirm_btn);
|
||||
int ui_draw_modal_3btn(const char *title, const char *message, const char *left_btn, const char *middle_btn, const char *right_btn);
|
||||
int ui_draw_screen_header(const char *title, int show_close);
|
||||
int ui_screen_header_height(void);
|
||||
FlintUIHeader ui_draw_title_header(int height, const char *title,
|
||||
Texture2D left_icon,
|
||||
Texture2D right_icon);
|
||||
FlintUIPanelFrame ui_draw_modal_frame(int width, int height, const char *title,
|
||||
Texture2D left_icon,
|
||||
Texture2D right_icon);
|
||||
int ui_scrollbar_reserved_width(int max_scroll);
|
||||
int ui_scrollbar_content_width(int content_width, int max_scroll);
|
||||
int ui_scrollbar_safe_content_width(int content_x, int content_width,
|
||||
int scrollbar_x, int max_scroll);
|
||||
FlintUIScrollView ui_scroll_container_measure(FlintUIScrollArea area);
|
||||
FlintUIScrollView ui_scroll_container_begin(FlintUIScrollArea area);
|
||||
void ui_scroll_container_end(FlintUIScrollArea area, FlintUIScrollView view);
|
||||
int ui_draw_scrollbar(int x, int y, int viewport_h, int content_h, int *scroll_offset, int max_scroll);
|
||||
|
||||
void ui_focus_begin(void);
|
||||
void ui_focus_end(void);
|
||||
int ui_focus_register(int id, Rectangle bounds);
|
||||
int ui_focus_is_active(int id);
|
||||
int ui_focus_activate_pressed(int id);
|
||||
void ui_focus_set(int id);
|
||||
void ui_focus_clear(void);
|
||||
void ui_focus_set_text_input_active(int active);
|
||||
void ui_focus_draw(Rectangle bounds);
|
||||
|
||||
extern int ui_view_height;
|
||||
extern int ui_view_width;
|
||||
|
||||
#endif
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef FLINT_WEB_H
|
||||
#define FLINT_WEB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int flint_web_viewport_width(int fallback_width);
|
||||
int flint_web_viewport_height(int fallback_height);
|
||||
void flint_web_viewport_size(int fallback_width, int fallback_height,
|
||||
int *width, int *height);
|
||||
void flint_web_set_orientation_mode(int mode);
|
||||
|
||||
/*
|
||||
* Web builds should create a resizable raylib window in CSS-pixel units and
|
||||
* keep the window size synced to the browser viewport. Native builds return 0.
|
||||
*/
|
||||
unsigned int flint_web_window_flags(void);
|
||||
|
||||
/*
|
||||
* Resize raylib's window to the current browser viewport when it changes.
|
||||
* Returns 1 when a resize was applied, 0 otherwise.
|
||||
*/
|
||||
int flint_web_sync_window_size(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,95 +0,0 @@
|
||||
#ifndef UI_ICON_TYPES_H
|
||||
#define UI_ICON_TYPES_H
|
||||
|
||||
typedef enum {
|
||||
UI_ICON_TYPE_NONE,
|
||||
|
||||
// Core UI icons
|
||||
UI_ICON_TYPE_GEAR,
|
||||
UI_ICON_TYPE_X,
|
||||
UI_ICON_TYPE_X_RED,
|
||||
UI_ICON_TYPE_MANUAL,
|
||||
UI_ICON_TYPE_RETURN,
|
||||
UI_ICON_TYPE_BACKWARD,
|
||||
UI_ICON_TYPE_FORWARD,
|
||||
UI_ICON_TYPE_PLAY,
|
||||
UI_ICON_TYPE_PAUSE,
|
||||
UI_ICON_TYPE_STAT,
|
||||
UI_ICON_TYPE_HOME,
|
||||
UI_ICON_TYPE_TRASH,
|
||||
UI_ICON_TYPE_PENCIL,
|
||||
UI_ICON_TYPE_SAVE,
|
||||
UI_ICON_TYPE_WRENCH,
|
||||
UI_ICON_TYPE_PLUS,
|
||||
UI_ICON_TYPE_STACK,
|
||||
UI_ICON_TYPE_CALENDAR,
|
||||
|
||||
// Social & payment icons
|
||||
UI_ICON_TYPE_DISCORD,
|
||||
UI_ICON_TYPE_TELEGRAM,
|
||||
UI_ICON_TYPE_GITHUB,
|
||||
UI_ICON_TYPE_GLOBE,
|
||||
UI_ICON_TYPE_STRIPE,
|
||||
UI_ICON_TYPE_BTC,
|
||||
UI_ICON_TYPE_MONERO,
|
||||
|
||||
// Sound icons
|
||||
UI_ICON_TYPE_SOUND,
|
||||
UI_ICON_TYPE_SOUND0,
|
||||
UI_ICON_TYPE_SOUND1,
|
||||
UI_ICON_TYPE_SOUND2,
|
||||
UI_ICON_TYPE_SOUND3,
|
||||
UI_ICON_TYPE_MUTE,
|
||||
UI_ICON_TYPE_MUSIC,
|
||||
|
||||
// Habit & practice icons
|
||||
UI_ICON_TYPE_HABIT,
|
||||
UI_ICON_TYPE_AMEN,
|
||||
UI_ICON_TYPE_WEEKLY,
|
||||
UI_ICON_TYPE_INBE,
|
||||
|
||||
// Meditation & theme icons
|
||||
UI_ICON_TYPE_DROID,
|
||||
UI_ICON_TYPE_FDROID,
|
||||
UI_ICON_TYPE_LIGHTON,
|
||||
UI_ICON_TYPE_LIGHTOFF,
|
||||
UI_ICON_TYPE_MOON,
|
||||
UI_ICON_TYPE_SUN,
|
||||
UI_ICON_TYPE_JUPITER,
|
||||
UI_ICON_TYPE_MARS,
|
||||
UI_ICON_TYPE_MERCURY,
|
||||
UI_ICON_TYPE_VENUS,
|
||||
UI_ICON_TYPE_SATURN,
|
||||
|
||||
// Navigation & utility icons
|
||||
UI_ICON_TYPE_LINK,
|
||||
UI_ICON_TYPE_EDIT,
|
||||
UI_ICON_TYPE_EYE_CLOSED,
|
||||
UI_ICON_TYPE_CHECK,
|
||||
UI_ICON_TYPE_QUEST,
|
||||
UI_ICON_TYPE_ROUTINE,
|
||||
UI_ICON_TYPE_TIMELINE,
|
||||
UI_ICON_TYPE_TODOS,
|
||||
UI_ICON_TYPE_TILE,
|
||||
UI_ICON_TYPE_TILE2,
|
||||
UI_ICON_TYPE_TILE3,
|
||||
UI_ICON_TYPE_TILE4,
|
||||
UI_ICON_TYPE_TEXT,
|
||||
|
||||
// Platform & store icons
|
||||
UI_ICON_TYPE_ITCH,
|
||||
UI_ICON_TYPE_PLAYSTORE,
|
||||
UI_ICON_TYPE_TUX,
|
||||
UI_ICON_TYPE_WIN,
|
||||
UI_ICON_TYPE_UXN,
|
||||
UI_ICON_TYPE_WASM,
|
||||
UI_ICON_TYPE_WASM4,
|
||||
UI_ICON_TYPE_RAY,
|
||||
UI_ICON_TYPE_ROCKET,
|
||||
UI_ICON_TYPE_SRHT,
|
||||
UI_ICON_TYPE_TCL,
|
||||
|
||||
UI_ICON_TYPE_COUNT
|
||||
} UIIconType;
|
||||
|
||||
#endif
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
out=${1:-src/flint_embedded_asset_data.c}
|
||||
shift || true
|
||||
|
||||
tmp="${out}.tmp"
|
||||
|
||||
asset_files=""
|
||||
for path in "$@"; do
|
||||
if [ -f "$path" ]; then
|
||||
asset_files="${asset_files}
|
||||
$path"
|
||||
elif [ -d "$path" ]; then
|
||||
found=$(find "$path" -type f | LC_ALL=C sort)
|
||||
if [ -n "$found" ]; then
|
||||
asset_files="${asset_files}
|
||||
$found"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
asset_files=$(printf '%s\n' "$asset_files" | sed '/^$/d' | LC_ALL=C sort -u)
|
||||
|
||||
asset_ident()
|
||||
{
|
||||
printf '%s' "$1" | sed 's#^\./##; s#[^A-Za-z0-9]#_#g'
|
||||
}
|
||||
|
||||
asset_path()
|
||||
{
|
||||
printf '%s' "$1" | sed 's#^\./##; s#^/##'
|
||||
}
|
||||
|
||||
asset_mime()
|
||||
{
|
||||
case "$1" in
|
||||
*.png) printf 'image/png' ;;
|
||||
*.jpg|*.jpeg) printf 'image/jpeg' ;;
|
||||
*.ogg) printf 'audio/ogg' ;;
|
||||
*.ini|*.txt|*.dat) printf 'text/plain' ;;
|
||||
*) printf 'application/octet-stream' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
{
|
||||
printf '/* Generated by scripts/embed-assets.sh. */\n'
|
||||
printf '#include "flint_embedded_assets.h"\n\n'
|
||||
|
||||
index=0
|
||||
for file in $asset_files; do
|
||||
ident=$(asset_ident "$file")
|
||||
printf 'static const unsigned char flint_embedded_asset_%s_%u[] = {\n' "$ident" "$index"
|
||||
od -An -v -tx1 "$file" | awk '
|
||||
{
|
||||
printf " ";
|
||||
for(i = 1; i <= NF; i++)
|
||||
printf " 0x%s,", $i;
|
||||
printf "\n";
|
||||
}'
|
||||
printf '};\n\n'
|
||||
index=$((index + 1))
|
||||
done
|
||||
|
||||
printf 'const FlintEmbeddedAsset flint_embedded_assets[] = {\n'
|
||||
index=0
|
||||
count=0
|
||||
for file in $asset_files; do
|
||||
ident=$(asset_ident "$file")
|
||||
path=$(asset_path "$file")
|
||||
mime=$(asset_mime "$file")
|
||||
size=$(wc -c < "$file" | tr -d ' ')
|
||||
printf ' {"%s", "%s", flint_embedded_asset_%s_%u, %su},\n' "$path" "$mime" "$ident" "$index" "$size"
|
||||
index=$((index + 1))
|
||||
count=$((count + 1))
|
||||
done
|
||||
printf '};\n\n'
|
||||
printf 'const unsigned int flint_embedded_asset_count = %su;\n' "$count"
|
||||
} > "$tmp"
|
||||
|
||||
mv "$tmp" "$out"
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
icon_dir=${1:-icons}
|
||||
out=${2:-src/flint_icon_assets.c}
|
||||
tmp="${out}.tmp"
|
||||
|
||||
icon_files=$(find "$icon_dir" -maxdepth 1 -type f -name '*.png' | LC_ALL=C sort)
|
||||
|
||||
icon_ident()
|
||||
{
|
||||
printf '%s' "$1" | sed 's/[^A-Za-z0-9]/_/g'
|
||||
}
|
||||
|
||||
icon_enum()
|
||||
{
|
||||
icon_ident "$1" | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
{
|
||||
printf '/* Generated by scripts/embed-icons.sh. */\n'
|
||||
printf '#include "flint_icons.h"\n\n'
|
||||
|
||||
for file in $icon_files; do
|
||||
name=$(basename "$file" .png)
|
||||
ident=$(icon_ident "$name")
|
||||
|
||||
printf 'static const unsigned char flint_icon_%s[] = {\n' "$ident"
|
||||
od -An -v -tx1 "$file" | awk '
|
||||
{
|
||||
printf " ";
|
||||
for(i = 1; i <= NF; i++)
|
||||
printf " 0x%s,", $i;
|
||||
printf "\n";
|
||||
}'
|
||||
printf '};\n\n'
|
||||
done
|
||||
|
||||
printf 'const FlintIconAsset flint_icon_assets[] = {\n'
|
||||
count=0
|
||||
for file in $icon_files; do
|
||||
name=$(basename "$file" .png)
|
||||
ident=$(icon_ident "$name")
|
||||
enum=$(icon_enum "$name")
|
||||
size=$(wc -c < "$file" | tr -d ' ')
|
||||
printf ' {UI_ICON_TYPE_%s, "%s", flint_icon_%s, %su},\n' "$enum" "$name" "$ident" "$size"
|
||||
count=$((count + 1))
|
||||
done
|
||||
printf '};\n\n'
|
||||
printf 'const unsigned int flint_icon_asset_count = %su;\n' "$count"
|
||||
} > "$tmp"
|
||||
|
||||
mv "$tmp" "$out"
|
||||
@@ -1,68 +0,0 @@
|
||||
#include "flint_clip.h"
|
||||
|
||||
#define FLINT_CLIP_STACK_MAX 16
|
||||
|
||||
static Rectangle g_flint_clip_stack[FLINT_CLIP_STACK_MAX];
|
||||
static int g_flint_clip_stack_count = 0;
|
||||
|
||||
Rectangle
|
||||
flint_clip_intersection(Rectangle a, Rectangle b)
|
||||
{
|
||||
float x1 = a.x > b.x ? a.x : b.x;
|
||||
float y1 = a.y > b.y ? a.y : b.y;
|
||||
float x2 = a.x + a.width < b.x + b.width ? a.x + a.width : b.x + b.width;
|
||||
float y2 = a.y + a.height < b.y + b.height ? a.y + a.height : b.y + b.height;
|
||||
|
||||
if(x2 < x1)
|
||||
x2 = x1;
|
||||
if(y2 < y1)
|
||||
y2 = y1;
|
||||
|
||||
return (Rectangle){x1, y1, x2 - x1, y2 - y1};
|
||||
}
|
||||
|
||||
Rectangle
|
||||
flint_clip_effective(Rectangle bounds)
|
||||
{
|
||||
if(g_flint_clip_stack_count > 0)
|
||||
bounds = flint_clip_intersection(g_flint_clip_stack[g_flint_clip_stack_count - 1],
|
||||
bounds);
|
||||
return bounds;
|
||||
}
|
||||
|
||||
void
|
||||
flint_clip_begin(int x, int y, int w, int h)
|
||||
{
|
||||
Rectangle bounds = {(float)x, (float)y, (float)w, (float)h};
|
||||
|
||||
if(w < 0)
|
||||
bounds.width = 0;
|
||||
if(h < 0)
|
||||
bounds.height = 0;
|
||||
|
||||
bounds = flint_clip_effective(bounds);
|
||||
if(g_flint_clip_stack_count < FLINT_CLIP_STACK_MAX)
|
||||
g_flint_clip_stack[g_flint_clip_stack_count++] = bounds;
|
||||
|
||||
BeginScissorMode((int)bounds.x, (int)bounds.y,
|
||||
(int)bounds.width, (int)bounds.height);
|
||||
}
|
||||
|
||||
void
|
||||
flint_clip_end(void)
|
||||
{
|
||||
EndScissorMode();
|
||||
if(g_flint_clip_stack_count > 0)
|
||||
g_flint_clip_stack_count--;
|
||||
if(g_flint_clip_stack_count > 0) {
|
||||
Rectangle bounds = g_flint_clip_stack[g_flint_clip_stack_count - 1];
|
||||
BeginScissorMode((int)bounds.x, (int)bounds.y,
|
||||
(int)bounds.width, (int)bounds.height);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
flint_clip_reset(void)
|
||||
{
|
||||
g_flint_clip_stack_count = 0;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "flint_color.h"
|
||||
|
||||
Color
|
||||
flint_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
|
||||
flint_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
|
||||
};
|
||||
}
|
||||