improve file browser

This commit is contained in:
waozi committed 2026-06-13 21:43:41 -03:00
1 parent 4db5c1dcf7
commit 784d14ac2e
21 files changed
+228 -105

No files matched your search

+1
View File
@@ -0,0 +1 @@
unpackaged_assets/**/*.ogg filter=lfs diff=lfs merge=lfs -text
+3
View File
@@ -7,3 +7,6 @@
[submodule "vendor/otfchop"]
path = vendor/otfchop
url = https://github.com/waozixyz/otfchop
[submodule "vendor/sqlite"]
path = vendor/sqlite
url = https://github.com/sqlite/sqlite
+15 -8
View File
@@ -30,11 +30,12 @@ FLINT_SRCS := $(filter-out $(FLINT_ICON_ASSETS_C),$(wildcard $(FLINT_DIR)/src/*.
FLINT_INCLUDE := -I$(FLINT_DIR)/include
FLINT_CURL_CFLAGS ?= $(shell pkg-config --cflags libcurl 2>/dev/null)
FLINT_CURL_LDLIBS ?= $(shell pkg-config --libs libcurl 2>/dev/null)
SQLITE_CFLAGS ?= $(shell pkg-config --cflags sqlite3 2>/dev/null)
SQLITE_LDLIBS ?= $(shell pkg-config --libs sqlite3 2>/dev/null)
ifeq ($(strip $(SQLITE_LDLIBS)),)
SQLITE_LDLIBS := -lsqlite3
endif
SQLITE_DIR := vendor/sqlite
SQLITE_BUILD_DIR := $(BUILD_OBJ_DIR)/sqlite
SQLITE_AMALGAMATION_C := $(SQLITE_BUILD_DIR)/sqlite3.c
SQLITE_AMALGAMATION_H := $(SQLITE_BUILD_DIR)/sqlite3.h
SQLITE_SRC := $(SQLITE_AMALGAMATION_C)
SQLITE_INCLUDE := -I$(SQLITE_BUILD_DIR)
ifneq ($(strip $(FLINT_CURL_LDLIBS)),)
FLINT_RUNTIME_ASSET_CFLAGS := -DFLINT_HAS_LIBCURL=1 $(FLINT_CURL_CFLAGS)
FLINT_RUNTIME_ASSET_LDLIBS := $(FLINT_CURL_LDLIBS)
@@ -74,7 +75,7 @@ SRC := $(APP_SRCS) $(EMBEDDED_ASSETS_C)
APP_INCLUDE := -Isrc -Isrc/android
APP_RAYLIB_CONFIG := $(filter-out -DSUPPORT_MODULE_RAUDIO=0 -DSUPPORT_FILEFORMAT_PNG=0 -DSUPPORT_FILEFORMAT_JPG=0 -DSUPPORT_FILEFORMAT_OGG=0 -DSUPPORT_FILEFORMAT_MP3=0,$(RAY_RAYLIB_CONFIG)) -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1 -DSUPPORT_FILEFORMAT_MP3=1
CFLAGS := -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -DFLINT_EMBEDDED_ONLY=1 $(FLINT_RUNTIME_ASSET_CFLAGS) $(SQLITE_CFLAGS)
CFLAGS := -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -DFLINT_EMBEDDED_ONLY=1 $(FLINT_RUNTIME_ASSET_CFLAGS)
LDFLAGS := -Wl,--gc-sections -s
BINARY_NAME := $(APP_NAME)-linux-$(ARCH)
@@ -124,10 +125,16 @@ $(RAYLIB_A): $(RAYLIB_SOURCES)
SDL_LIBRARIES="$(RAY_SDL_LDLIBS)" \
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(RAY_CFLAGS) $(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
$(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(RAYLIB_A) | $(LINUX_BIN_DIR)
$(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H): $(SQLITE_DIR)/configure $(SQLITE_DIR)/manifest | $(BUILD_OBJ_DIR)
mkdir -p $(SQLITE_BUILD_DIR)
cd $(SQLITE_BUILD_DIR) && ../../../$(SQLITE_DIR)/configure
$(MAKE) -C $(SQLITE_BUILD_DIR) sqlite3.c sqlite3.h
$(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(RAYLIB_A) | $(LINUX_BIN_DIR)
$(CC) $(CFLAGS) \
$(APP_INCLUDE) \
$(FLINT_INCLUDE) \
$(SQLITE_INCLUDE) \
-I$(RAYLIB_DIR) \
$(RAY_CFLAGS) \
-DSUPPORT_MODULE_RAUDIO=1 \
@@ -136,10 +143,10 @@ $(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(
-o $@ \
$(SRC) \
$(FLINT_SRCS) \
$(SQLITE_SRC) \
$(RAYLIB_A) \
$(RAY_LDLIBS) \
$(FLINT_RUNTIME_ASSET_LDLIBS) \
$(SQLITE_LDLIBS) \
-lm -lpthread -ldl -lrt \
$(LDFLAGS)
+15 -1
View File
@@ -5,6 +5,10 @@ set(REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
set(SRC_DIR "${REPO_ROOT}/src")
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")
@@ -34,6 +38,15 @@ add_custom_command(
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"
"${RAYLIB_DIR}/rshapes.c"
@@ -84,6 +97,7 @@ add_library(main SHARED
"${SRC_DIR}/data.c"
"${SRC_DIR}/storage.c"
"${SRC_DIR}/miniz.c"
"${SQLITE_AMALGAMATION_C}"
"${SRC_DIR}/android/android_import.c"
"${SRC_DIR}/android/android_runtime_assets.c"
"${SRC_DIR}/android/android_share.c"
@@ -104,6 +118,7 @@ target_include_directories(main PRIVATE
"${SRC_DIR}/android"
"${NATIVE_APP_GLUE_DIR}"
"${FLINT_DIR}/include"
"${SQLITE_BUILD_DIR}"
)
target_compile_definitions(main PRIVATE
@@ -138,7 +153,6 @@ target_link_libraries(main
android
log
OpenSLES
sqlite
EGL
GLESv2
m
+1
View File
@@ -125,6 +125,7 @@
curl
emscripten
gcc
git-lfs
gnumake
gradle
imagemagick
Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 365 B

+3
View File
@@ -29,6 +29,9 @@ typedef struct {
/* 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);
+1
View File
@@ -21,6 +21,7 @@ typedef enum {
FLINT_ICON_TYPE_GEAR,
FLINT_ICON_TYPE_GITHUB,
FLINT_ICON_TYPE_GLOBE,
FLINT_ICON_TYPE_HABITMARKER,
FLINT_ICON_TYPE_HABITS,
FLINT_ICON_TYPE_HOME,
FLINT_ICON_TYPE_INBE,
+34 -19
View File
@@ -20,6 +20,21 @@
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
static char g_dialog_theme_scope[FLINT_THEME_NAME_SIZE] = "sky";
static Color dialog_theme_get(const char *key) {
return flint_theme_get(g_dialog_theme_scope, key);
}
void flint_file_dialog_set_theme_scope(const char *scope) {
if(scope == NULL || scope[0] == '\0') {
snprintf(g_dialog_theme_scope, sizeof(g_dialog_theme_scope), "%s", "sky");
return;
}
snprintf(g_dialog_theme_scope, sizeof(g_dialog_theme_scope), "%s", scope);
}
static FlintFileDialogInternal *create_internal(void) {
FlintFileDialogInternal *internal = calloc(1, sizeof(FlintFileDialogInternal));
return internal;
@@ -177,7 +192,7 @@ static void navigate_into(FlintFileDialogInternal *internal, const char *dirname
static void render_header(FlintFileDialog *dlg, Rectangle dialog_rect) {
const char *title = dlg->title;
int title_font = flint_ui_font();
Color title_color = flint_theme_get("sky", "text");
Color title_color = dialog_theme_get("text");
int title_x = dialog_rect.x + flint_px(16);
int title_y = dialog_rect.y + flint_px(12);
@@ -197,13 +212,13 @@ static void render_breadcrumb(FlintFileDialog *dlg, Rectangle dialog_rect) {
dialog_rect.width - flint_px(32), breadcrumb_height
};
Color bg = flint_theme_get("sky", "background");
Color bg = dialog_theme_get("background");
DrawRectangleRec(internal->breadcrumb_rect, bg);
Color border = flint_darken(bg, 30);
DrawRectangleLinesEx(internal->breadcrumb_rect, 1, border);
Color text = flint_theme_get("sky", "text");
Color text = dialog_theme_get("text");
int font = flint_ui_font_small();
char display_path[PATH_MAX];
@@ -239,18 +254,18 @@ static void render_file_list(FlintFileDialog *dlg, Rectangle dialog_rect) {
list_x, list_y, list_width, list_height
};
Color bg = flint_lighten(flint_theme_get("sky", "background"), 10);
Color bg = flint_lighten(dialog_theme_get("background"), 10);
DrawRectangleRec(internal->file_list_rect, bg);
Color border = flint_darken(flint_theme_get("sky", "background"), 30);
Color border = flint_darken(dialog_theme_get("background"), 30);
DrawRectangleLinesEx(internal->file_list_rect, 1, border);
BeginScissorMode(list_x, list_y, list_width, list_height);
int font = flint_ui_font_small();
Color text = flint_theme_get("sky", "text");
Color hover = flint_theme_get("sky", "button_hover");
Color selected = flint_darken(flint_theme_get("sky", "button"), 20);
Color text = dialog_theme_get("text");
Color hover = dialog_theme_get("button_hover");
Color selected = flint_darken(dialog_theme_get("button"), 20);
int start_idx = internal->scroll_offset;
int visible_items = MAX(1, (int)(list_height / FILE_DIALOG_ITEM_HEIGHT));
@@ -305,7 +320,7 @@ static void render_scrollbar(FlintFileDialog *dlg, Rectangle dialog_rect) {
scrollbar_x, scrollbar_y, scrollbar_width, scrollbar_height
};
Color bg = flint_darken(flint_theme_get("sky", "background"), 40);
Color bg = flint_darken(dialog_theme_get("background"), 40);
DrawRectangleRec(internal->scrollbar_rect, bg);
int max_scroll = MAX(1, internal->file_count - visible_items);
@@ -318,7 +333,7 @@ static void render_scrollbar(FlintFileDialog *dlg, Rectangle dialog_rect) {
int thumb_y = scrollbar_y + (int)((internal->scroll_offset / (float)max_scroll) * (float)(scrollbar_height - thumb_height));
Rectangle thumb_rect = {scrollbar_x, thumb_y, scrollbar_width, thumb_height};
Color thumb = flint_theme_get("sky", "button");
Color thumb = dialog_theme_get("button");
DrawRectangleRec(thumb_rect, thumb);
}
@@ -339,11 +354,11 @@ static void render_filename_input(FlintFileDialog *dlg, Rectangle dialog_rect) {
input_x + label_width, input_y, input_width, input_height
};
Color bg = flint_theme_get("sky", "background");
Color bg = dialog_theme_get("background");
DrawRectangleRec(internal->filename_rect, bg);
Color border = flint_darken(bg, 30);
Color accent = flint_theme_get("sky", "button");
Color accent = dialog_theme_get("button");
if(internal->focus_area == 2) {
DrawRectangleLinesEx(internal->filename_rect, 2, accent);
@@ -351,7 +366,7 @@ static void render_filename_input(FlintFileDialog *dlg, Rectangle dialog_rect) {
DrawRectangleLinesEx(internal->filename_rect, 1, border);
}
Color text = flint_theme_get("sky", "text");
Color text = dialog_theme_get("text");
Color label_dim = flint_darken(text, 40);
flint_text_draw("Filename:", input_x, flint_ui_text_y("Filename:", input_y, input_height, font), font, label_dim);
@@ -399,8 +414,8 @@ static void render_buttons(FlintFileDialog *dlg, Rectangle dialog_rect) {
button_y, button_width, button_height
};
Color cancel_bg = flint_theme_get("sky", "button");
Color cancel_text = flint_theme_get("sky", "text");
Color cancel_bg = dialog_theme_get("button");
Color cancel_text = dialog_theme_get("text");
DrawRectangleRec(internal->button_cancel_rect, cancel_bg);
DrawRectangleLinesEx(internal->button_cancel_rect, 1,
@@ -411,8 +426,8 @@ static void render_buttons(FlintFileDialog *dlg, Rectangle dialog_rect) {
internal->button_cancel_rect.y + flint_px(4),
flint_ui_font_small(), cancel_text);
Color ok_bg = flint_theme_get("sky", "button_hover");
Color ok_text = flint_theme_get("sky", "text");
Color ok_bg = dialog_theme_get("button_hover");
Color ok_text = dialog_theme_get("text");
DrawRectangleRec(internal->button_ok_rect, ok_bg);
DrawRectangleLinesEx(internal->button_ok_rect, 1,
@@ -423,7 +438,7 @@ static void render_buttons(FlintFileDialog *dlg, Rectangle dialog_rect) {
internal->button_ok_rect.y + flint_px(4),
flint_ui_font_small(), ok_text);
Color text = flint_theme_get("sky", "text");
Color text = dialog_theme_get("text");
int checkbox_size = flint_px(16);
int checkbox_x = dialog_rect.x + flint_px(16);
int checkbox_y = dialog_rect.y + internal->dialog_height - flint_px(28);
@@ -460,7 +475,7 @@ static void render_file_dialog(FlintFileDialog *dlg, Vector2 screen_size) {
DrawRectangle(0, 0, screen_size.x, screen_size.y, (Color){0, 0, 0, 180});
Color bg_color = flint_theme_get("sky", "background");
Color bg_color = dialog_theme_get("background");
DrawRectangleRec(dialog_rect, bg_color);
Color border_color = flint_darken(bg_color, 30);
+38 -22
View File
@@ -190,6 +190,21 @@ static const unsigned char flint_icon_globe[] = {
0x25, 0xe0, 0x28, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
static const unsigned char flint_icon_habitmarker[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
0x61, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
0x00, 0x72, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x60, 0xc0, 0x03, 0x12, 0xc2, 0x5d, 0xfe,
0xe3, 0x93, 0xc7, 0x0b, 0x12, 0xc2, 0x5d, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x21, 0x43, 0x98,
0xc8, 0xb6, 0x81, 0x18, 0xdb, 0x61, 0x00, 0x9f, 0x2b, 0x28, 0x76, 0x01, 0x23, 0xcc, 0x46, 0x64,
0xc1, 0xf9, 0x2b, 0x76, 0x63, 0x28, 0x4c, 0x8c, 0x70, 0x45, 0xe1, 0x2f, 0x58, 0xb9, 0x87, 0x11,
0xab, 0x73, 0x61, 0x4e, 0xc6, 0xc7, 0x47, 0xf6, 0x16, 0x75, 0x02, 0x11, 0x9f, 0x2b, 0xf0, 0xd9,
0x4e, 0x3d, 0x17, 0x10, 0x72, 0x05, 0xbe, 0x28, 0xc5, 0xeb, 0x02, 0x6c, 0xb1, 0x41, 0xb2, 0x2b,
0xf0, 0xd9, 0x4e, 0x92, 0x21, 0x24, 0x65, 0xac, 0x84, 0x70, 0x17, 0x94, 0x58, 0x20, 0x3b, 0x57,
0x12, 0xa3, 0x11, 0x00, 0x93, 0x62, 0xed, 0xc4, 0xdc, 0xd0, 0x56, 0x98, 0x00, 0x00, 0x00, 0x00,
0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
static const unsigned char flint_icon_habits[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
@@ -537,26 +552,26 @@ static const unsigned char flint_icon_practice[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a,
0xf4, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
0x01, 0x1f, 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x96, 0xbb, 0x0d, 0x84, 0x30, 0x0c, 0x86,
0xcd, 0xe9, 0x46, 0x0b, 0x33, 0x84, 0x32, 0x4c, 0x06, 0x25, 0xcc, 0x00, 0xbb, 0xe5, 0xaa, 0x48,
0xc1, 0xb2, 0x1d, 0xdb, 0x80, 0x28, 0x8e, 0xbf, 0x02, 0x02, 0xf1, 0x87, 0x9f, 0x01, 0xf8, 0x77,
0x75, 0x96, 0x97, 0x53, 0x0c, 0x59, 0x5a, 0x9f, 0xd7, 0xdd, 0xb4, 0x9f, 0x59, 0x29, 0x86, 0xcc,
0x29, 0xc5, 0x90, 0x5b, 0x80, 0x94, 0x3e, 0x57, 0xc1, 0x4d, 0xcb, 0xe6, 0xfa, 0x4e, 0x0d, 0x90,
0x62, 0xc8, 0xc5, 0xc8, 0x38, 0xf4, 0x2e, 0x63, 0x94, 0x54, 0x31, 0xe3,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ba, 0x0d, 0xb1, 0x43, 0xd5, 0x2c,
0x19, 0x1b, 0x38, 0xea, 0xe4, 0x9a, 0x4e, 0x64, 0xb5, 0xf2, 0xce, 0x84, 0x54, 0xf3, 0x71, 0xb0,
0xe4, 0x0c, 0xc4, 0x2e, 0xc0, 0x78, 0x0c, 0xe9, 0x8c, 0xa0, 0x56, 0x0c, 0x07, 0x4e, 0xea, 0x6e,
0x47, 0x62, 0x7b, 0x92, 0x9e, 0x96, 0xed, 0x46, 0x8c, 0xcd, 0x95, 0xdb, 0x71, 0xee, 0x56, 0x4c,
0xe3, 0x30, 0xa9, 0x30, 0x49, 0x6e, 0x12, 0xc0, 0xa0, 0x79, 0xdd, 0x7b, 0x4a, 0x4b, 0xea, 0x54,
0xd4, 0x33, 0xd8, 0x7a, 0xb2, 0xfb, 0x0a, 0xe7, 0x20, 0x87, 0x94, 0x88, 0xd4, 0x0b, 0xb2, 0xd7,
0xb1, 0xa4, 0x38, 0x3c, 0xfd, 0x15, 0x6f, 0x83, 0x84, 0x84, 0xea, 0x7d, 0x00, 0x16, 0xc6, 0x48,
0x1e, 0xbf, 0xf1, 0x24, 0x58, 0x02, 0xe9, 0xea, 0x71, 0x45, 0x9b, 0x81, 0x9a, 0x6a, 0xce, 0x92,
0x25, 0xb9, 0x45, 0x12, 0x5c, 0x6d, 0xb4, 0x67, 0xd2, 0x52, 0x8f, 0xa0, 0xa0, 0xba, 0xb5, 0xd2,
0xd3, 0x7d, 0xe5, 0x05, 0xe4, 0x8f, 0x96, 0xf8, 0x00, 0xb7, 0x65, 0xd0, 0x7d, 0x38, 0xae, 0x8d,
0x1b, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
static const unsigned char flint_icon_quest[] = {
@@ -1179,6 +1194,7 @@ const FlintIconAsset flint_icon_assets[] = {
{FLINT_ICON_TYPE_GEAR, "gear", flint_icon_gear, 222u},
{FLINT_ICON_TYPE_GITHUB, "github", flint_icon_github, 332u},
{FLINT_ICON_TYPE_GLOBE, "globe", flint_icon_globe, 192u},
{FLINT_ICON_TYPE_HABITMARKER, "habitmarker", flint_icon_habitmarker, 184u},
{FLINT_ICON_TYPE_HABITS, "habits", flint_icon_habits, 175u},
{FLINT_ICON_TYPE_HOME, "home", flint_icon_home, 216u},
{FLINT_ICON_TYPE_INBE, "inbe", flint_icon_inbe, 832u},
@@ -1198,7 +1214,7 @@ const FlintIconAsset flint_icon_assets[] = {
{FLINT_ICON_TYPE_PLAY, "play", flint_icon_play, 151u},
{FLINT_ICON_TYPE_PLAYSTORE, "playstore", flint_icon_playstore, 263u},
{FLINT_ICON_TYPE_PLUS, "plus", flint_icon_plus, 117u},
{FLINT_ICON_TYPE_PRACTICE, "practice", flint_icon_practice, 357u},
{FLINT_ICON_TYPE_PRACTICE, "practice", flint_icon_practice, 365u},
{FLINT_ICON_TYPE_QUEST, "quest", flint_icon_quest, 714u},
{FLINT_ICON_TYPE_RAY, "ray", flint_icon_ray, 152u},
{FLINT_ICON_TYPE_RETURN, "return", flint_icon_return, 165u},
@@ -1236,4 +1252,4 @@ const FlintIconAsset flint_icon_assets[] = {
{FLINT_ICON_TYPE_X, "x", flint_icon_x, 157u},
};
const unsigned int flint_icon_asset_count = 67u;
const unsigned int flint_icon_asset_count = 68u;
+30 -9
View File
@@ -822,8 +822,8 @@ inbe_app_init(void *vapp) {
if(app->stat_icon.id == 0) {
app->stat_icon = load_icon_texture("stat.png");
}
if(app->quest_icon.id == 0) {
app->quest_icon = load_icon_texture("quest.png");
if(app->habit_icon.id == 0) {
app->habit_icon = load_icon_texture("habitmarker.png");
}
if(app->practice_icon.id == 0) {
app->practice_icon = load_icon_texture("practice.png");
@@ -847,7 +847,7 @@ inbe_app_init(void *vapp) {
app->discord_icon = load_icon_texture("discord.png");
}
/* Update tab bar icons */
g_tabs[0].icon = app->quest_icon;
g_tabs[0].icon = app->habit_icon;
g_tabs[0].icon_type = UI_ICON_TYPE_NONE;
g_tabs[0].user_data = app;
g_tabs[1].icon = app->practice_icon;
@@ -2115,8 +2115,31 @@ draw_habits_screen(InbeApp *app)
flint_centered_column(max_w, side_padding, &content_x, &content_w);
if(app->habits.count <= 0)
inbe_habits_add_default(&app->habits);
if(app->habits.count <= 0) {
const char *empty_text = "No habits created";
const char *create_text = "Create habit";
int empty_font = flint_px(20);
int button_w = content_w < flint_px(240) ? content_w : flint_px(240);
int button_h = flint_px(42);
int empty_y = top_h + viewport_h / 2 - flint_px(46);
int empty_w = flint_text_measure(empty_text, empty_font);
int hover_empty_create = 0;
BeginScissorMode((int)app->camera.offset.x,
(int)(app->camera.offset.y + top_h * app->camera.zoom),
(int)(view_width * app->camera.zoom),
(int)(viewport_h * app->camera.zoom));
flint_text_draw(empty_text, content_x + (content_w - empty_w) / 2,
empty_y, empty_font, c_text);
if(ui_draw_generic_button(content_x + (content_w - button_w) / 2,
empty_y + flint_px(38), button_w, button_h,
create_text, UI_BUTTON_STYLE_PRIMARY,
&hover_empty_create)) {
habit_edit_begin_new(app);
}
EndScissorMode();
return;
}
if(app->habits.selected < 0 || app->habits.selected >= app->habits.count)
app->habits.selected = 0;
@@ -2281,8 +2304,6 @@ draw_habits_manager_screen(InbeApp *app)
flint_centered_column(max_w, side_padding, &content_x, &content_w);
y = top_h + flint_px(16);
if(app->habits.count <= 0)
inbe_habits_add_default(&app->habits);
if(app->habits.selected < 0 || app->habits.selected >= app->habits.count)
app->habits.selected = 0;
if(app->habit_edit_active && app->habit_edit_index >= app->habits.count)
@@ -2298,7 +2319,7 @@ draw_habits_manager_screen(InbeApp *app)
int row_x = content_x;
int row_w = content_w;
int field_x = row_x + flint_px(18);
int delete_disabled = app->habits.count <= 1;
int delete_disabled = 0;
int delete_btn_x = row_x + row_w - icon_btn_w;
int edit_btn_x = delete_btn_x - icon_btn_w - flint_px(6);
Rectangle row = {(float)row_x, (float)y, (float)row_w, (float)row_h};
@@ -2887,7 +2908,7 @@ inbe_app_destroy(void *vapp)
SafeUnloadTexture(app->play_icon);
SafeUnloadTexture(app->pause_icon);
SafeUnloadTexture(app->stat_icon);
SafeUnloadTexture(app->quest_icon);
SafeUnloadTexture(app->habit_icon);
SafeUnloadTexture(app->practice_icon);
SafeUnloadTexture(app->plus_icon);
SafeUnloadTexture(app->stack_icon);
+1 -1
View File
@@ -128,7 +128,7 @@ struct InbeApp {
Texture2D play_icon;
Texture2D pause_icon;
Texture2D stat_icon;
Texture2D quest_icon;
Texture2D habit_icon;
Texture2D practice_icon;
Texture2D plus_icon;
Texture2D stack_icon;
+1 -3
View File
@@ -80,8 +80,6 @@ inbe_habits_delete(InbeHabits *habits, int index)
{
if(habits == NULL || index < 0 || index >= habits->count)
return;
if(habits->count <= 1)
return;
for(int i = index; i < habits->count - 1; i++)
habits->items[i] = habits->items[i + 1];
@@ -92,7 +90,7 @@ inbe_habits_delete(InbeHabits *habits, int index)
habits->selected--;
else if(habits->selected >= habits->count)
habits->selected = habits->count - 1;
if(habits->selected < 0)
if(habits->selected < 0 && habits->count > 0)
habits->selected = 0;
inbe_habits_save(habits);
+31 -42
View File
@@ -4,7 +4,7 @@
#include "language_tab.h"
#include "meditation_music.h"
#include "locale.h"
#include "storage.h"
#include "theme_meta.h"
#include "flint_ui.h"
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(_WIN32) && !defined(PLATFORM_WEB)
#define INBE_HAS_FLINT_FILE_DIALOG 1
@@ -237,11 +237,7 @@ settings_draw_data_stats(int x, int y, int w)
long long data_size = data_get_total_size();
char size_str[32];
char stat_text[64];
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID)
int stats_box_h = flint_px(90);
#else
int stats_box_h = flint_px(66);
#endif
int stat_x = x + flint_px(16);
int stat_y = y + flint_px(16);
@@ -256,29 +252,22 @@ settings_draw_data_stats(int x, int y, int w)
locale_format(stat_text, sizeof(stat_text), "data_size_label", size_str);
flint_text_draw(stat_text, stat_x, stat_y, font, c_text);
stat_y += flint_px(22);
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID)
{
const char *storage_path = inbe_storage_db_path();
const char *display_path = storage_path;
char home_buf[FS_PATH_MAX];
char storage_text[FS_PATH_MAX + 32];
if(strncmp(storage_path, "/home/", 6) == 0) {
const char *slash_after_user = strchr(storage_path + 6, '/');
if(slash_after_user != NULL) {
snprintf(home_buf, sizeof(home_buf), "~%s", slash_after_user);
display_path = home_buf;
}
}
locale_format(storage_text, sizeof(storage_text), "storage_label", display_path);
flint_text_draw(storage_text, stat_x, stat_y, flint_ui_font_small(), flint_darken(c_text, 40));
}
#endif
}
#if defined(INBE_HAS_FLINT_FILE_DIALOG)
static void
settings_apply_file_dialog_theme(InbeApp *app)
{
int theme_id = app != NULL ? app->theme_id : ThemeSky;
int dark_mode = app != NULL && app->dark_mode != 0;
if(theme_id < 0 || theme_id >= THEME_COUNT)
theme_id = ThemeSky;
flint_file_dialog_set_theme_scope(flint_theme_scope_for((FlintThemeId)theme_id,
dark_mode != 0));
}
#endif
static void
settings_draw_about_block(InbeApp *app, int content_x, int content_w, int *y)
{
@@ -863,11 +852,7 @@ settings_tab_draw(InbeApp *app)
y = modal_y + flint_px(54);
settings_draw_data_stats(modal_x + flint_px(18), y, modal_w - flint_px(36));
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID)
y += flint_px(108);
#else
y += flint_px(84);
#endif
button_w = modal_w - flint_px(36);
if(ui_draw_generic_button(modal_x + flint_px(18), y, button_w, button_h,
@@ -882,6 +867,7 @@ settings_tab_draw(InbeApp *app)
settings_tab_set_status_error(locale_get("import_failed"));
}
#elif defined(INBE_HAS_FLINT_FILE_DIALOG)
settings_apply_file_dialog_theme(app);
if(flint_file_dialog_load(&import_dlg, locale_get("import_data_dialog_title"))) {
const char *path = flint_file_dialog_get_path(&import_dlg);
if(path != NULL && path[0] != '\0') {
@@ -926,20 +912,23 @@ settings_tab_draw(InbeApp *app)
TraceLog(LOG_ERROR, "DATA: Export failed");
}
#elif defined(INBE_HAS_FLINT_FILE_DIALOG)
else if(flint_file_dialog_save(&export_dlg, locale_get("export_data_dialog_title"), "inbe-export.zip")) {
const char *path = flint_file_dialog_get_path(&export_dlg);
if(path != NULL && data_export(path)) {
const char *filename = GetFileName(path);
settings_tab_set_status_success(locale_get("exported_label"), filename);
app->modal.active = 0;
app->modal.type = UIModalNone;
TraceLog(LOG_INFO, "DATA: Export successful to %s", path);
else {
settings_apply_file_dialog_theme(app);
if(flint_file_dialog_save(&export_dlg, locale_get("export_data_dialog_title"), "inbe-export.zip")) {
const char *path = flint_file_dialog_get_path(&export_dlg);
if(path != NULL && data_export(path)) {
const char *filename = GetFileName(path);
settings_tab_set_status_success(locale_get("exported_label"), filename);
app->modal.active = 0;
app->modal.type = UIModalNone;
TraceLog(LOG_INFO, "DATA: Export successful to %s", path);
} else {
settings_tab_set_status_error(locale_get("export_failed"));
TraceLog(LOG_ERROR, "DATA: Export failed");
}
} else {
settings_tab_set_status_error(locale_get("export_failed"));
TraceLog(LOG_ERROR, "DATA: Export failed");
settings_tab_set_status_error(locale_get("export_cancelled"));
}
} else {
settings_tab_set_status_error(locale_get("export_cancelled"));
}
#else
else {
Binary file not shown.
Binary file not shown.
Binary file not shown.
+35
View File
@@ -0,0 +1,35 @@
# Music License
The music files in this directory are by Elijah_K and were obtained from
Free Music Archive:
https://freemusicarchive.org/
They are licensed under the Creative Commons Attribution 4.0 International
license (CC BY 4.0):
https://creativecommons.org/licenses/by/4.0/
## Attribution
Creator: Elijah_K
Source: Free Music Archive
License: Creative Commons Attribution 4.0 International (CC BY 4.0)
Changes: No changes were made by this project unless noted elsewhere.
## Files
- Elijah_K/deep-meditation.ogg
- Elijah_K/path-of-meditation.ogg
- Elijah_K/truth-of-silence.ogg
## CC BY 4.0 Summary
You may share and adapt the material for any purpose, including commercially,
as long as appropriate credit is given, a link to the license is provided, and
changes are indicated. No additional legal or technological restrictions may be
applied that would prevent others from exercising the license rights.
This summary is not a substitute for the full license text:
https://creativecommons.org/licenses/by/4.0/legalcode
+9
View File
@@ -0,0 +1,9 @@
id=inbe-meditation-audio
version=1
archive=inbe-meditation-audio-v1.zip
license=CC BY 4.0
creator=Elijah_K
source=https://freemusicarchive.org/
track=Elijah_K/deep-meditation.ogg|Deep Meditation
track=Elijah_K/path-of-meditation.ogg|Path Of Meditation
track=Elijah_K/truth-of-silence.ogg|Truth Of Silence
Vendored Submodule
+1
Submodule vendor/sqlite added at d8f6cc7ea4.