Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d92924849 | ||
|
|
407681fada | ||
|
|
6a3d3f3559 | ||
|
|
ab59ab6b83 | ||
|
|
321afdd465 | ||
|
|
c2f7d75258 | ||
|
|
eba69651a9 | ||
|
|
8fe47c8a32 |
No files matched your search
@@ -24,11 +24,11 @@ jobs:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 17
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
java-version: '21'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
@@ -43,10 +43,6 @@ jobs:
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "KEYSTORE_BASE64 secret not set"
|
||||
exit 1
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
|
||||
echo "Keystore decoded successfully"
|
||||
|
||||
@@ -66,7 +62,7 @@ jobs:
|
||||
run: |
|
||||
find droid/app/build/outputs/apk/release -name "*-universal-release.apk" -exec cp {} inbe.apk \; 2>/dev/null || true
|
||||
|
||||
- name: Upload APK
|
||||
- name: Upload APK to Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-apk
|
||||
|
||||
+7
-1
@@ -1,6 +1,12 @@
|
||||
# Changelog
|
||||
## [1.1.3] - 2026-05-29
|
||||
### Fixed
|
||||
- Icon button fallback system - buttons now render with procedural graphics when asset images fail to load (prevents empty buttons on devices with asset loading issues)
|
||||
- Added UIIconType system for icon identification and fallback rendering
|
||||
- Updated all icon button functions to support fallback graphics (ui_draw_icon_btn, ui_draw_icon_btn_padded, ui_draw_icon_link, ui_draw_nav_button, ui_draw_nav_button_expand)
|
||||
|
||||
## [1.1.2] - 2026-05-29
|
||||
## Fixed
|
||||
### Fixed
|
||||
- Data storage location
|
||||
- Punch hole spacing
|
||||
- Crashes on newer devices
|
||||
|
||||
@@ -34,14 +34,14 @@ android {
|
||||
defaultConfig {
|
||||
minSdk 19
|
||||
targetSdk 35
|
||||
versionCode 13
|
||||
versionName "1.1.2"
|
||||
versionCode 14
|
||||
versionName "1.1.3"
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
signingConfig project.hasProperty('fDroidBuild') ? null : signingConfigs.release
|
||||
minifyEnabled false
|
||||
}
|
||||
debug {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
### Fixed
|
||||
- Icon button fallback system - buttons now render with procedural graphics when asset images fail to load (prevents empty buttons on devices with asset loading issues)
|
||||
- Added UIIconType system for icon identification and fallback rendering
|
||||
- Updated all icon button functions to support fallback graphics (ui_draw_icon_btn, ui_draw_icon_btn_padded, ui_draw_icon_link, ui_draw_nav_button, ui_draw_nav_button_expand)
|
||||
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
AVD_NAME="${1:-inbe-test}"
|
||||
DEVICE="pixel_7_pro"
|
||||
# Use Android 33 with google_apis - available in Nix store
|
||||
SYSTEM_IMAGE="system-images;android-33;google_apis;x86_64"
|
||||
SYSTEM_IMAGE_PATH="/nix/store/gdl6fjkag55fqvwsgb6g2y9isq80s1bj-android-sdk-system-image-33-google_apis-arm64-v8a-system-image-33-google_apis-x86_64-33-google_apis-arm64-v8a-33-google_apis-x86_64/libexec/android-sdk/system-images/android-33/google_apis/x86_64"
|
||||
|
||||
echo "📱 Creating AVD: $AVD_NAME"
|
||||
|
||||
# Check for Android SDK location
|
||||
if [ -z "$ANDROID_SDK_ROOT" ] && [ -z "$ANDROID_HOME" ]; then
|
||||
echo "❌ Error: Neither ANDROID_SDK_ROOT nor ANDROID_HOME is set"
|
||||
echo " Make sure to run this script within 'nix develop'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set up persistent writable SDK location
|
||||
ORIGINAL_SDK_ROOT="$ANDROID_SDK_ROOT"
|
||||
PERSISTENT_SDK_ROOT="$HOME/.android-sdk-writable"
|
||||
export ANDROID_SDK_ROOT="$PERSISTENT_SDK_ROOT"
|
||||
export ANDROID_HOME="$PERSISTENT_SDK_ROOT"
|
||||
|
||||
mkdir -p "$ANDROID_SDK_ROOT"
|
||||
|
||||
# Create symlinks for SDK components
|
||||
for component in build-tools cmake cmdline-tools emulator licenses ndk platforms platform-tools tools; do
|
||||
if [ -e "$ORIGINAL_SDK_ROOT/$component" ] && [ ! -e "$ANDROID_SDK_ROOT/$component" ]; then
|
||||
ln -sf "$ORIGINAL_SDK_ROOT/$component" "$ANDROID_SDK_ROOT/$component"
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p "$ANDROID_SDK_ROOT/system-images"
|
||||
mkdir -p "$ANDROID_SDK_ROOT/avd"
|
||||
|
||||
# Check and copy system image from Nix store
|
||||
TARGET_DIR="$ANDROID_SDK_ROOT/system-images/android-33/google_apis/x86_64"
|
||||
|
||||
if [ ! -d "$TARGET_DIR" ]; then
|
||||
echo "📋 Copying system image..."
|
||||
mkdir -p "$TARGET_DIR"
|
||||
|
||||
if [ ! -d "$SYSTEM_IMAGE_PATH" ]; then
|
||||
echo "❌ Error: System image not found in Nix store"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp -r "$SYSTEM_IMAGE_PATH"/* "$TARGET_DIR/"
|
||||
fi
|
||||
|
||||
# Check if AVD already exists
|
||||
if [ -d "$ANDROID_SDK_ROOT/avd/$AVD_NAME.avd" ]; then
|
||||
rm -rf "$ANDROID_SDK_ROOT/avd/$AVD_NAME.avd"
|
||||
rm -f "$ANDROID_SDK_ROOT/avd/$AVD_NAME.ini"
|
||||
fi
|
||||
|
||||
# Create AVD
|
||||
echo "🔨 Creating AVD..."
|
||||
AVD_DIR="$ANDROID_SDK_ROOT/avd/$AVD_NAME.avd"
|
||||
AVD_INI="$ANDROID_SDK_ROOT/avd/$AVD_NAME.ini"
|
||||
|
||||
mkdir -p "$AVD_DIR"
|
||||
|
||||
# Create AVD configuration
|
||||
cat > "$AVD_DIR/config.ini" << EOF
|
||||
AvdId=$AVD_NAME
|
||||
avd.ini.encoding=UTF-8
|
||||
PlayStore.enabled=false
|
||||
abi.type=x86_64
|
||||
hw.cpu.arch=x86_64
|
||||
hw.device.name=Pixel 7 Pro
|
||||
hw.lcd.density=420
|
||||
hw.lcd.height=3120
|
||||
hw.lcd.width=1440
|
||||
hw.gpu.enabled=yes
|
||||
hw.gpu.mode=host
|
||||
hw.ramSize=2048
|
||||
vm.heapSize=512
|
||||
hw.sdCard=yes
|
||||
hw.sdCard.size=2048MB
|
||||
disk.cachePartition=yes
|
||||
disk.cachePartition.size=800MB
|
||||
hw.accelerometer=yes
|
||||
hw.audioInput=yes
|
||||
hw.battery=yes
|
||||
hw.camera.back=yes
|
||||
hw.camera.front=yes
|
||||
hw.gps=yes
|
||||
hw.gsmModem=yes
|
||||
hw.keyboard=yes
|
||||
hw.touchScreen=yes
|
||||
image.sysdir.1=system-images/android-33/google_apis/x86_64/
|
||||
showDeviceFrame=yes
|
||||
skin.name=1440x3120
|
||||
skin.path=1440x3120
|
||||
EOF
|
||||
|
||||
cat > "$AVD_INI" << EOF
|
||||
avd.ini.encoding=UTF-8
|
||||
path=$AVD_DIR
|
||||
target=default
|
||||
EOF
|
||||
|
||||
echo "✅ Done!"
|
||||
+46
-71
@@ -4,92 +4,67 @@ set -e
|
||||
|
||||
AVD_NAME="inbe-test"
|
||||
|
||||
echo "🚀 Android Emulator Manager"
|
||||
echo " This script handles emulator creation and launching"
|
||||
echo " Use './scripts/run-android.sh' to build and install the app"
|
||||
echo ""
|
||||
|
||||
# Check for Android SDK location
|
||||
if [ -z "$ANDROID_SDK_ROOT" ] && [ -z "$ANDROID_HOME" ]; then
|
||||
echo "❌ Error: Neither ANDROID_SDK_ROOT nor ANDROID_HOME environment variable is set"
|
||||
echo " Make sure to run this script within 'nix develop'"
|
||||
echo "❌ Error: Neither ANDROID_SDK_ROOT nor ANDROID_HOME is set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set up writable SDK location
|
||||
WRITABLE_SDK="/mnt/storage/Android/Sdk"
|
||||
if [ -d "$WRITABLE_SDK" ] && [ -w "$WRITABLE_SDK" ]; then
|
||||
export ANDROID_SDK_ROOT="$WRITABLE_SDK"
|
||||
export ANDROID_SDK_HOME="$WRITABLE_SDK"
|
||||
export ANDROID_AVD_HOME="$WRITABLE_SDK/avd"
|
||||
echo "📂 Using writable Android SDK: $ANDROID_SDK_ROOT"
|
||||
PERSISTENT_SDK_ROOT="$HOME/.android-sdk-writable"
|
||||
|
||||
if [ -d "$PERSISTENT_SDK_ROOT" ] && [ -d "$PERSISTENT_SDK_ROOT/avd/$AVD_NAME.avd" ]; then
|
||||
export ANDROID_SDK_ROOT="$PERSISTENT_SDK_ROOT"
|
||||
export ANDROID_SDK_HOME="$PERSISTENT_SDK_ROOT"
|
||||
export ANDROID_AVD_HOME="$PERSISTENT_SDK_ROOT/avd"
|
||||
else
|
||||
echo "❌ Error: No writable Android SDK location found"
|
||||
echo "❌ Error: AVD not found. Run: bash scripts/create-avd.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Step 1: Create AVD if missing
|
||||
# Create AVD if missing
|
||||
if [ ! -d "$ANDROID_SDK_ROOT/avd/$AVD_NAME.avd" ]; then
|
||||
echo "📱 AVD not found. Creating..."
|
||||
bash scripts/create-avd.sh "$AVD_NAME"
|
||||
echo ""
|
||||
else
|
||||
echo "✅ AVD already exists: $AVD_NAME"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Step 2: Check if emulator is running
|
||||
# Check if emulator is running
|
||||
if adb devices | grep -q "emulator"; then
|
||||
echo "✅ Emulator already running"
|
||||
echo ""
|
||||
echo "To stop the emulator:"
|
||||
echo " adb emu kill"
|
||||
else
|
||||
echo "🚀 Launching emulator..."
|
||||
|
||||
# Set environment for emulator (unset ANDROID_HOME to avoid conflicts)
|
||||
unset ANDROID_HOME
|
||||
export ANDROID_SDK_ROOT="$ANDROID_SDK_ROOT"
|
||||
|
||||
# Launch emulator in background
|
||||
emulator @"$AVD_NAME" \
|
||||
-gpu host \
|
||||
-skin 1080x2400 \
|
||||
-no-snapshot-load \
|
||||
-no-boot-anim \
|
||||
-show-kernel \
|
||||
-verbose > /tmp/emulator.log 2>&1 &
|
||||
|
||||
echo "⏳ Waiting for emulator to boot..."
|
||||
timeout_seconds=120
|
||||
elapsed=0
|
||||
|
||||
while ! adb shell getprop sys.boot_completed 2>/dev/null | grep -q "1"; do
|
||||
if [ $elapsed -ge $timeout_seconds ]; then
|
||||
echo "❌ Timeout waiting for emulator to boot"
|
||||
echo " Check /tmp/emulator.log for details"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "⏳ "
|
||||
date +"%T"
|
||||
sleep 5
|
||||
elapsed=$((elapsed + 5))
|
||||
|
||||
# Check if emulator process died
|
||||
if ! pgrep -f "emulator.*$AVD_NAME" > /dev/null; then
|
||||
echo "❌ Emulator process died"
|
||||
echo " Check /tmp/emulator.log for details"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "✅ Emulator booted successfully"
|
||||
echo ""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "📱 Emulator ready!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Build and install the app:"
|
||||
echo " ./scripts/run-android.sh"
|
||||
echo "🚀 Launching emulator..."
|
||||
|
||||
# Set environment for emulator
|
||||
unset ANDROID_HOME
|
||||
export ANDROID_SDK_ROOT="$ANDROID_SDK_ROOT"
|
||||
|
||||
# Launch emulator in background
|
||||
emulator @"$AVD_NAME" \
|
||||
-gpu host \
|
||||
-skin 1080x2400 \
|
||||
-no-snapshot-load \
|
||||
-no-boot-anim \
|
||||
-show-kernel \
|
||||
-verbose > /tmp/emulator.log 2>&1 &
|
||||
|
||||
echo "⏳ Waiting for boot..."
|
||||
timeout_seconds=120
|
||||
elapsed=0
|
||||
|
||||
while ! adb shell getprop sys.boot_completed 2>/dev/null | grep -q "1"; do
|
||||
if [ $elapsed -ge $timeout_seconds ]; then
|
||||
echo "❌ Timeout. Check /tmp/emulator.log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
elapsed=$((elapsed + 5))
|
||||
|
||||
if ! pgrep -f "emulator.*$AVD_NAME" > /dev/null; then
|
||||
echo "❌ Emulator died. Check /tmp/emulator.log"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "✅ Ready!"
|
||||
@@ -66,9 +66,9 @@ static void on_settings_tab_click(void *user_data) {
|
||||
}
|
||||
|
||||
static UITab g_tabs[] = {
|
||||
{"History", {0}, history_tab_on_click, NULL},
|
||||
{"Manual", {0}, on_manual_tab_click, NULL},
|
||||
{"Settings", {0}, on_settings_tab_click, NULL}
|
||||
{"History", {0}, UI_ICON_TYPE_STAT, history_tab_on_click, NULL},
|
||||
{"Manual", {0}, UI_ICON_TYPE_MANUAL, on_manual_tab_click, NULL},
|
||||
{"Settings", {0}, UI_ICON_TYPE_GEAR, on_settings_tab_click, NULL}
|
||||
};
|
||||
|
||||
static UITabBar g_tab_bar = {g_tabs, 3};
|
||||
@@ -933,10 +933,13 @@ inbe_app_init(void *vapp) {
|
||||
}
|
||||
/* Update tab bar icons */
|
||||
g_tabs[0].icon = app->stat_icon;
|
||||
g_tabs[0].icon_type = UI_ICON_TYPE_STAT;
|
||||
g_tabs[0].user_data = app;
|
||||
g_tabs[1].icon = app->manual_icon;
|
||||
g_tabs[1].icon_type = UI_ICON_TYPE_MANUAL;
|
||||
g_tabs[1].user_data = app;
|
||||
g_tabs[2].icon = app->gear_icon;
|
||||
g_tabs[2].icon_type = UI_ICON_TYPE_GEAR;
|
||||
g_tabs[2].user_data = app;
|
||||
|
||||
if(app->telegram_icon.id == 0) {
|
||||
@@ -1095,7 +1098,7 @@ updateapp(InbeApp *app)
|
||||
|
||||
case InbeScreenSession: {
|
||||
int return_hover = 0;
|
||||
if(app->return_icon.id != 0 && ui_draw_icon_btn_padded(app, ui_px(12), ui_px(12), ui_clamp_px(ICON_SIZE_SMALL, ICON_SIZE_SMALL_MIN, ICON_SIZE_SMALL_MAX), app->return_icon, &return_hover)) {
|
||||
if(ui_draw_icon_btn_padded(app, ui_px(12), ui_px(12), ui_clamp_px(ICON_SIZE_SMALL, ICON_SIZE_SMALL_MIN, ICON_SIZE_SMALL_MAX), app->return_icon, UI_ICON_TYPE_RETURN, &return_hover)) {
|
||||
handle_back_button(app);
|
||||
}
|
||||
|
||||
@@ -1161,16 +1164,16 @@ updateapp(InbeApp *app)
|
||||
int back_x = pause_x - control_btn_w - control_gap;
|
||||
int forward_x = pause_x + control_btn_w + control_gap;
|
||||
|
||||
if(app->backward_icon.id != 0 && ui_draw_icon_btn_padded(app, back_x, control_y, control_size,
|
||||
app->backward_icon, &back_hover)) {
|
||||
if(ui_draw_icon_btn_padded(app, back_x, control_y, control_size,
|
||||
app->backward_icon, UI_ICON_TYPE_BACKWARD, &back_hover)) {
|
||||
session_step_back(app);
|
||||
}
|
||||
if(ui_draw_icon_btn_padded(app, pause_x, control_y, control_size,
|
||||
app->session_paused ? app->play_icon : app->pause_icon, &pause_hover)) {
|
||||
app->session_paused ? app->play_icon : app->pause_icon, app->session_paused ? UI_ICON_TYPE_PLAY : UI_ICON_TYPE_PAUSE, &pause_hover)) {
|
||||
app->session_paused = !app->session_paused;
|
||||
}
|
||||
if(app->forward_icon.id != 0 && ui_draw_icon_btn_padded(app, forward_x, control_y, control_size,
|
||||
app->forward_icon, &forward_hover)) {
|
||||
if(ui_draw_icon_btn_padded(app, forward_x, control_y, control_size,
|
||||
app->forward_icon, UI_ICON_TYPE_FORWARD, &forward_hover)) {
|
||||
session_step_forward(app);
|
||||
}
|
||||
|
||||
|
||||
@@ -431,10 +431,10 @@ settings_tab_draw(InbeApp *app)
|
||||
int icon_btn_w = icon_size + icon_padding * 2;
|
||||
int total_w = icon_btn_w * 4 + icon_spacing * 3;
|
||||
int links_start_x = content_x + (content_w - total_w) / 2;
|
||||
ui_draw_icon_link(app, links_start_x + icon_padding, links_y, icon_size, app->telegram_icon, "https://t.me/lotusinbe");
|
||||
ui_draw_icon_link(app, links_start_x + icon_btn_w + icon_spacing + icon_padding, links_y, icon_size, app->globe_icon, "https://inbe.waozi.xyz/");
|
||||
ui_draw_icon_link(app, links_start_x + (icon_btn_w + icon_spacing) * 2 + icon_padding, links_y, icon_size, app->monero_icon, "https://trocador.app/en/anonpay/?ticker_to=xmr&network_to=Mainnet&address=86CbC3d4a2GhT9auh6X99JhmhTMFKVVk8Q9cLrKTHkBu8LLkoNWgkBeAT3YZrvDM6NczYe8brUJNsTiFmwpWDZYnFG5kzSH&donation=True&simple_mode=True&amount=0.1&name=Inner+Breeze&[email protected]&ticker_from=xmr&network_from=Mainnet&buttonbgcolor=445588&textcolor=ffffff&bgcolor=eaeaffff");
|
||||
ui_draw_icon_link(app, links_start_x + (icon_btn_w + icon_spacing) * 3 + icon_padding, links_y, icon_size, app->stripe_icon, "https://donate.stripe.com/4gM3cv5boaR98HH9VvfAc04");
|
||||
ui_draw_icon_link(app, links_start_x + icon_padding, links_y, icon_size, app->telegram_icon, UI_ICON_TYPE_TELEGRAM, "https://t.me/lotusinbe");
|
||||
ui_draw_icon_link(app, links_start_x + icon_btn_w + icon_spacing + icon_padding, links_y, icon_size, app->globe_icon, UI_ICON_TYPE_GLOBE, "https://inbe.waozi.xyz/");
|
||||
ui_draw_icon_link(app, links_start_x + (icon_btn_w + icon_spacing) * 2 + icon_padding, links_y, icon_size, app->monero_icon, UI_ICON_TYPE_MONERO, "https://trocador.app/en/anonpay/?ticker_to=xmr&network_to=Mainnet&address=86CbC3d4a2GhT9auh6X99JhmhTMFKVVk8Q9cLrKTHkBu8LLkoNWgkBeAT3YZrvDM6NczYe8brUJNsTiFmwpWDZYnFG5kzSH&donation=True&simple_mode=True&amount=0.1&name=Inner+Breeze&[email protected]&ticker_from=xmr&network_from=Mainnet&buttonbgcolor=445588&textcolor=ffffff&bgcolor=eaeaffff");
|
||||
ui_draw_icon_link(app, links_start_x + (icon_btn_w + icon_spacing) * 3 + icon_padding, links_y, icon_size, app->stripe_icon, UI_ICON_TYPE_STRIPE, "https://donate.stripe.com/4gM3cv5boaR98HH9VvfAc04");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
/* Global UI state */
|
||||
static float dpi_scale = 1.0f;
|
||||
@@ -153,8 +154,96 @@ ui_icon_btn_padding(UIIconSize size)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ui_draw_icon_fallback(UIIconType type, int x, int y, int size, Color color)
|
||||
{
|
||||
int center = size / 2;
|
||||
int thickness = size / 8;
|
||||
if(thickness < 1) thickness = 1;
|
||||
|
||||
switch(type) {
|
||||
case UI_ICON_TYPE_X: {
|
||||
int p = thickness / 2;
|
||||
DrawLine(x + p, y + p, x + size - p, y + size - p, color);
|
||||
DrawLine(x + size - p, y + p, x + p, y + size - p, color);
|
||||
break;
|
||||
}
|
||||
case UI_ICON_TYPE_GEAR: {
|
||||
int outer = size / 2 - thickness;
|
||||
int inner = size / 4;
|
||||
DrawCircle(x + center, y + center, outer, color);
|
||||
for(int i = 0; i < 6; i++) {
|
||||
float angle = i * 60.0f * DEG2RAD;
|
||||
int cx = x + center + (int)(cos(angle) * inner);
|
||||
int cy = y + center + (int)(sin(angle) * inner);
|
||||
DrawLine(x + center, y + center, cx, cy, color);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UI_ICON_TYPE_BACKWARD: {
|
||||
int p = thickness;
|
||||
DrawTriangle(
|
||||
(Vector2){x + size - p, y + p},
|
||||
(Vector2){x + p, y + center},
|
||||
(Vector2){x + size - p, y + size - p},
|
||||
color
|
||||
);
|
||||
break;
|
||||
}
|
||||
case UI_ICON_TYPE_FORWARD: {
|
||||
int p = thickness;
|
||||
DrawTriangle(
|
||||
(Vector2){x + p, y + p},
|
||||
(Vector2){x + size - p, y + center},
|
||||
(Vector2){x + p, y + size - p},
|
||||
color
|
||||
);
|
||||
break;
|
||||
}
|
||||
case UI_ICON_TYPE_PLAY: {
|
||||
int p = thickness;
|
||||
DrawTriangle(
|
||||
(Vector2){x + p, y + p},
|
||||
(Vector2){x + size - p, y + center},
|
||||
(Vector2){x + p, y + size - p},
|
||||
color
|
||||
);
|
||||
break;
|
||||
}
|
||||
case UI_ICON_TYPE_PAUSE: {
|
||||
int w = size / 3;
|
||||
int p = (size - w * 2) / 3;
|
||||
DrawRectangle(x + p, y + thickness, w, size - thickness * 2, color);
|
||||
DrawRectangle(x + p + w + p, y + thickness, w, size - thickness * 2, color);
|
||||
break;
|
||||
}
|
||||
case UI_ICON_TYPE_RETURN:
|
||||
case UI_ICON_TYPE_HOME: {
|
||||
int p = thickness;
|
||||
DrawLine(x + center, y + size - p, x + center, y + p, color);
|
||||
DrawLine(x + center, y + p, x + p, y + p + (size / 3), color);
|
||||
DrawLine(x + center, y + p, x + size - p, y + p + (size / 3), color);
|
||||
if(type == UI_ICON_TYPE_RETURN) {
|
||||
DrawLine(x + p, y + center, x + size - p, y + center, color);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UI_ICON_TYPE_MANUAL:
|
||||
case UI_ICON_TYPE_STAT: {
|
||||
DrawRectangle(x + thickness, y + thickness, size - thickness * 2, size - thickness * 2, color);
|
||||
DrawLine(x + thickness, y + thickness + size / 3, x + size - thickness, y + thickness + size / 3, color);
|
||||
DrawLine(x + thickness, y + thickness + size * 2 / 3, x + size - thickness, y + thickness + size * 2 / 3, color);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
DrawCircle(x + center, y + center, size / 3, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_icon_btn(InbeApp *app, int x, int y, UIIconSize size, Texture2D icon, int *hover)
|
||||
ui_draw_icon_btn(InbeApp *app, int x, int y, UIIconSize size, Texture2D icon, UIIconType icon_type, int *hover)
|
||||
{
|
||||
int btn_size = ui_icon_btn_size(size);
|
||||
int padding = ui_icon_btn_padding(size);
|
||||
@@ -189,13 +278,15 @@ ui_draw_icon_btn(InbeApp *app, int x, int y, UIIconSize size, Texture2D icon, in
|
||||
Rectangle src = {0, 0, icon.width, icon.height};
|
||||
Rectangle dst = {x + padding, y + padding, (float)btn_size, (float)btn_size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
} else {
|
||||
ui_draw_icon_fallback(icon_type, x + padding, y + padding, btn_size, c_icon);
|
||||
}
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_icon_btn_padded(InbeApp *app, int x, int y, int size, Texture2D icon, int *hover)
|
||||
ui_draw_icon_btn_padded(InbeApp *app, int x, int y, int size, Texture2D icon, UIIconType icon_type, int *hover)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int mx = (int)mouse_world.x;
|
||||
@@ -228,6 +319,8 @@ ui_draw_icon_btn_padded(InbeApp *app, int x, int y, int size, Texture2D icon, in
|
||||
Rectangle src = {0, 0, icon.width, icon.height};
|
||||
Rectangle dst = {x + padding, y + padding, (float)size, (float)size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
} else {
|
||||
ui_draw_icon_fallback(icon_type, x + padding, y + padding, size, c_icon);
|
||||
}
|
||||
|
||||
return pressed;
|
||||
@@ -273,7 +366,7 @@ ui_draw_text_btn(InbeApp *app, int x, int y, const char *label, int *hover)
|
||||
}
|
||||
|
||||
void
|
||||
ui_draw_icon_link(InbeApp *app, int x, int y, int icon_size, Texture2D icon, const char *url)
|
||||
ui_draw_icon_link(InbeApp *app, int x, int y, int icon_size, Texture2D icon, UIIconType icon_type, const char *url)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
int mx = (int)mouse_world.x;
|
||||
@@ -302,6 +395,8 @@ ui_draw_icon_link(InbeApp *app, int x, int y, int icon_size, Texture2D icon, con
|
||||
Rectangle src = {0, 0, icon.width, icon.height};
|
||||
Rectangle dst = {x, y, (float)icon_size, (float)icon_size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
} else {
|
||||
ui_draw_icon_fallback(icon_type, x, y, icon_size, c_icon);
|
||||
}
|
||||
|
||||
if(hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT) && !ui_dropdown_captures_click(mouse_world)) {
|
||||
@@ -690,7 +785,7 @@ ui_nav_button_width(const char *label, int icon_size, int show_label, int font)
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon,
|
||||
ui_draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon, UIIconType icon_type,
|
||||
const char *label, int show_label, int *hover)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
@@ -725,6 +820,9 @@ ui_draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon,
|
||||
int icon_x = show_label && label && label[0] ? x + padding : x + (w - icon_size) / 2;
|
||||
Rectangle dst = {icon_x, y + padding, (float)icon_size, (float)icon_size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
} else {
|
||||
int icon_x = show_label && label && label[0] ? x + padding : x + (w - icon_size) / 2;
|
||||
ui_draw_icon_fallback(icon_type, icon_x, y + padding, icon_size, c_icon);
|
||||
}
|
||||
|
||||
if(show_label && label != NULL && label[0] != '\0') {
|
||||
@@ -737,7 +835,7 @@ ui_draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon,
|
||||
}
|
||||
|
||||
int
|
||||
ui_draw_nav_button_expand(InbeApp *app, int x, int y, int icon_size, int w, Texture2D icon,
|
||||
ui_draw_nav_button_expand(InbeApp *app, int x, int y, int icon_size, int w, Texture2D icon, UIIconType icon_type,
|
||||
const char *label, int show_label, int *hover)
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
@@ -771,6 +869,9 @@ ui_draw_nav_button_expand(InbeApp *app, int x, int y, int icon_size, int w, Text
|
||||
int icon_x = show_label && label && label[0] ? x + padding : x + (w - icon_size) / 2;
|
||||
Rectangle dst = {icon_x, y + padding, (float)icon_size, (float)icon_size};
|
||||
DrawTexturePro(icon, src, dst, (Vector2){0}, 0, c_icon);
|
||||
} else {
|
||||
int icon_x = show_label && label && label[0] ? x + padding : x + (w - icon_size) / 2;
|
||||
ui_draw_icon_fallback(icon_type, icon_x, y + padding, icon_size, c_icon);
|
||||
}
|
||||
|
||||
if(show_label && label != NULL && label[0] != '\0') {
|
||||
@@ -839,12 +940,10 @@ ui_draw_tab_bar(UITab *tabs, int count, InbeApp *app)
|
||||
int base_w = ui_nav_button_width(tabs[i].label, button_size, show_labels, font);
|
||||
int w = base_w + extra_per_button;
|
||||
|
||||
if(tabs[i].icon.id != 0) {
|
||||
if(ui_draw_nav_button_expand(app, x, button_y, button_size, w, tabs[i].icon,
|
||||
if(ui_draw_nav_button_expand(app, x, button_y, button_size, w, tabs[i].icon, tabs[i].icon_type,
|
||||
tabs[i].label, show_labels, &tab_hover)) {
|
||||
if(tabs[i].on_click)
|
||||
tabs[i].on_click(tabs[i].user_data);
|
||||
}
|
||||
if(tabs[i].on_click)
|
||||
tabs[i].on_click(tabs[i].user_data);
|
||||
}
|
||||
|
||||
x += w + group_gap;
|
||||
@@ -1174,7 +1273,7 @@ ui_draw_screen_header(InbeApp *app, const char *title, int show_close)
|
||||
/* Draw close button if requested */
|
||||
if(show_close) {
|
||||
close_clicked = ui_draw_icon_btn(app, ui_view_width - ui_px(40) - ui_icon_btn_padding(UI_ICON_SIZE_TINY), ui_px(8),
|
||||
UI_ICON_SIZE_TINY, app->x_icon, &close_hover);
|
||||
UI_ICON_SIZE_TINY, app->x_icon, UI_ICON_TYPE_X, &close_hover);
|
||||
}
|
||||
|
||||
return close_clicked;
|
||||
|
||||
@@ -11,6 +11,24 @@ typedef enum {
|
||||
UI_ICON_SIZE_LARGE
|
||||
} UIIconSize;
|
||||
|
||||
typedef enum {
|
||||
UI_ICON_TYPE_NONE,
|
||||
UI_ICON_TYPE_GEAR,
|
||||
UI_ICON_TYPE_X,
|
||||
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_TELEGRAM,
|
||||
UI_ICON_TYPE_GLOBE,
|
||||
UI_ICON_TYPE_STRIPE,
|
||||
UI_ICON_TYPE_MONERO,
|
||||
UI_ICON_TYPE_HOME
|
||||
} UIIconType;
|
||||
|
||||
void ui_init(int width, int height, float dpi);
|
||||
void ui_set_colors(Color text, Color bg, Color circle, Color button, Color button_hover, Color icon);
|
||||
int ui_px(int px);
|
||||
@@ -22,10 +40,10 @@ 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);
|
||||
int ui_icon_btn_size(UIIconSize size);
|
||||
int ui_icon_btn_padding(UIIconSize size);
|
||||
int ui_draw_icon_btn(InbeApp *app, int x, int y, UIIconSize size, Texture2D icon, int *hover);
|
||||
int ui_draw_icon_btn_padded(InbeApp *app, int x, int y, int size, Texture2D icon, int *hover);
|
||||
int ui_draw_icon_btn(InbeApp *app, int x, int y, UIIconSize size, Texture2D icon, UIIconType icon_type, int *hover);
|
||||
int ui_draw_icon_btn_padded(InbeApp *app, int x, int y, int size, Texture2D icon, UIIconType icon_type, int *hover);
|
||||
int ui_draw_text_btn(InbeApp *app, int x, int y, const char *label, int *hover);
|
||||
void ui_draw_icon_link(InbeApp *app, int x, int y, int icon_size, Texture2D icon, const char *url);
|
||||
void ui_draw_icon_link(InbeApp *app, int x, int y, int icon_size, Texture2D icon, UIIconType icon_type, const char *url);
|
||||
int ui_draw_slider(InbeApp *app, int id, int x, int y, int w, const char *label, int min, int max, int *value, const char *suffix);
|
||||
int ui_draw_toggle_switch(InbeApp *app, int x, int y, int w, int h, int *value);
|
||||
int ui_draw_checkbox_toggle(InbeApp *app, int x, int y, const char *label, int *value);
|
||||
@@ -35,6 +53,7 @@ int ui_dropdown_captures_click(Vector2 point);
|
||||
typedef struct UITab {
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
UIIconType icon_type;
|
||||
void (*on_click)(void *user_data);
|
||||
void *user_data;
|
||||
} UITab;
|
||||
@@ -45,8 +64,8 @@ typedef struct UITabBar {
|
||||
} UITabBar;
|
||||
|
||||
int ui_nav_button_width(const char *label, int icon_size, int show_label, int font);
|
||||
int ui_draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon, const char *label, int show_label, int *hover);
|
||||
int ui_draw_nav_button_expand(InbeApp *app, int x, int y, int icon_size, int w, Texture2D icon, const char *label, int show_label, int *hover);
|
||||
int ui_draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon, UIIconType icon_type, const char *label, int show_label, int *hover);
|
||||
int ui_draw_nav_button_expand(InbeApp *app, int x, int y, int icon_size, int w, Texture2D icon, UIIconType icon_type, const char *label, int show_label, int *hover);
|
||||
void ui_draw_tab_bar(UITab *tabs, int count, InbeApp *app);
|
||||
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);
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
#define INBE_VERSION_MAJOR 1
|
||||
#define INBE_VERSION_MINOR 1
|
||||
#define INBE_VERSION_PATCH 2
|
||||
#define INBE_VERSION_STRING "1.1.2"
|
||||
#define INBE_VERSION_PATCH 3
|
||||
#define INBE_VERSION_STRING "1.1.3"
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user