move flint back to submodule
No files matched your search
@@ -16,3 +16,6 @@
|
||||
[submodule "vendor/curl"]
|
||||
path = vendor/curl
|
||||
url = https://github.com/curl/curl.git
|
||||
[submodule "vendor/flint"]
|
||||
path = vendor/flint
|
||||
url = [email protected]:waozixyz/flint.git
|
||||
@@ -94,7 +94,7 @@ WEB_RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/web/raylib
|
||||
WEB_RAYLIB_A := $(WEB_RAYLIB_BUILD_DIR)/libraylib.web.a
|
||||
RAYLIB_SOURCES := $(shell find $(RAYLIB_DIR) -type f \( -name '*.c' -o -name '*.h' \))
|
||||
|
||||
FLINT_DIR := flint
|
||||
FLINT_DIR := vendor/flint
|
||||
FLINT_ICON_FILES := $(wildcard $(FLINT_DIR)/icons/*.png)
|
||||
FLINT_ICON_ASSETS_C := $(FLINT_DIR)/src/flint_icon_assets.c
|
||||
FLINT_ICON_STAMP := $(BUILD_OBJ_DIR)/flint-icons.sha256
|
||||
|
||||
@@ -77,8 +77,8 @@ 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
|
||||
- `vendor/flint/` - first-party UI/runtime support code used directly by Inbe
|
||||
- `wasm4/` - Standalone WASM-4 version
|
||||
- `assets/` - Images and sounds
|
||||
- `droid/` - Android build configuration
|
||||
|
||||
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 131 KiB |
@@ -9,7 +9,7 @@ endif()
|
||||
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(FLINT_DIR "${REPO_ROOT}/vendor/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")
|
||||
|
||||
@@ -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: 155 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 187 B |
|
Before Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 268 B |
|
Before Width: | Height: | Size: 153 B |
|
Before Width: | Height: | Size: 208 B |
|
Before Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 192 B |
|
Before Width: | Height: | Size: 179 B |
|
Before Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 995 B |
|
Before Width: | Height: | Size: 344 B |
|
Before Width: | Height: | Size: 151 B |
|
Before Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 213 B |
|
Before Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 173 B |
|
Before Width: | Height: | Size: 268 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 197 B |
|
Before Width: | Height: | Size: 110 B |
|
Before Width: | Height: | Size: 151 B |
|
Before Width: | Height: | Size: 263 B |
|
Before Width: | Height: | Size: 136 B |
|
Before Width: | Height: | Size: 714 B |
|
Before Width: | Height: | Size: 152 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 131 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: 233 B |
|
Before Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 150 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 197 B |
|
Before Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 164 B |
|
Before Width: | Height: | Size: 174 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 157 B |
@@ -1,20 +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_transition.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,39 +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_invalidate(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,63 +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);
|
||||
int flint_file_dialog_load_filtered(FlintFileDialog *dlg, const char *title, const char *filter);
|
||||
|
||||
/* Select folder dialog - returns 1 if folder selected, 0 if cancelled */
|
||||
int flint_file_dialog_select_folder(FlintFileDialog *dlg, const char *title);
|
||||
|
||||
/* Begin non-blocking dialogs. Call flint_file_dialog_update() each frame while active. */
|
||||
void flint_file_dialog_begin_load(FlintFileDialog *dlg, const char *title);
|
||||
void flint_file_dialog_begin_load_filtered(FlintFileDialog *dlg, const char *title, const char *filter);
|
||||
void flint_file_dialog_begin_save(FlintFileDialog *dlg, const char *title, const char *default_filename);
|
||||
|
||||
/* Draw/update active dialog: 1 confirmed, 0 cancelled, -1 still active. */
|
||||
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,36 +0,0 @@
|
||||
#ifndef FLINT_LOCALE_H
|
||||
#define FLINT_LOCALE_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct FlintLocaleEntry {
|
||||
char *key;
|
||||
char *value;
|
||||
} FlintLocaleEntry;
|
||||
|
||||
typedef struct FlintLocaleLanguage {
|
||||
char *code;
|
||||
char *label;
|
||||
} FlintLocaleLanguage;
|
||||
|
||||
void locale_init(void);
|
||||
int locale_set(const char *code);
|
||||
const char *locale_get(const char *key);
|
||||
void locale_format(char *dst, size_t dst_size, const char *key, ...);
|
||||
|
||||
int locale_count(void);
|
||||
const char *locale_code_at(int index);
|
||||
const char *locale_label_at(int index);
|
||||
int locale_index_of(const char *code);
|
||||
const char *locale_current_code(void);
|
||||
int locale_current_index(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // FLINT_LOCALE_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,29 +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_16 16
|
||||
#define FLINT_TEXT_24 24
|
||||
#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_measure(const char *text, int font_size);
|
||||
int flint_text_height(const char *text, int font_size);
|
||||
int flint_text_line_height(int font_size);
|
||||
int flint_text_measure_scaled(const char *text, int scale);
|
||||
void flint_text_draw(const char *text, int x, int y, int font_size, Color color);
|
||||
void flint_text_draw_scaled(const char *text, int x, int y, int scale, Color color);
|
||||
void flint_text_draw_centered(const char *text, int center_x, int center_y, int font_size, Color color);
|
||||
void flint_text_draw_in_rect(const char *text, Rectangle rect, int font_size, Color color);
|
||||
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,70 +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);
|
||||
|
||||
void flint_theme_set_current(int theme_id, int dark_mode);
|
||||
Color flint_theme_current_color(const char *key);
|
||||
Color flint_theme_get_text(void);
|
||||
Color flint_theme_get_bg(void);
|
||||
Color flint_theme_get_surface(void);
|
||||
Color flint_theme_get_circle(void);
|
||||
Color flint_theme_get_button(void);
|
||||
Color flint_theme_get_button_hover(void);
|
||||
Color flint_theme_get_icon(void);
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef FLINT_THEME_META_H
|
||||
#define FLINT_THEME_META_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define FLINT_THEME_COUNT 12
|
||||
|
||||
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,
|
||||
FLINT_THEME_MINT = 10,
|
||||
FLINT_THEME_COBALT = 11
|
||||
} 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,27 +0,0 @@
|
||||
#ifndef FLINT_TRANSITION_H
|
||||
#define FLINT_TRANSITION_H
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
typedef enum FlintTransitionPhase {
|
||||
FLINT_TRANSITION_NONE = 0,
|
||||
FLINT_TRANSITION_OUT = 1,
|
||||
FLINT_TRANSITION_IN = 2
|
||||
} FlintTransitionPhase;
|
||||
|
||||
typedef struct FlintTransition {
|
||||
int active;
|
||||
int phase;
|
||||
int ticks;
|
||||
int duration;
|
||||
} FlintTransition;
|
||||
|
||||
void flint_transition_reset(FlintTransition *transition);
|
||||
void flint_transition_begin(FlintTransition *transition, int duration);
|
||||
void flint_transition_reverse_to_out(FlintTransition *transition);
|
||||
float flint_transition_alpha(const FlintTransition *transition);
|
||||
int flint_transition_step(FlintTransition *transition);
|
||||
void flint_transition_draw_fade(const FlintTransition *transition,
|
||||
int width, int height, Color color);
|
||||
|
||||
#endif
|
||||
@@ -1,583 +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 {
|
||||
int id;
|
||||
int x;
|
||||
int y;
|
||||
int icon_size;
|
||||
int icon_padding;
|
||||
Texture2D icon;
|
||||
int *open;
|
||||
int *value;
|
||||
int min;
|
||||
int max;
|
||||
int popup_width;
|
||||
int popup_height;
|
||||
} FlintUIIconSliderPopup;
|
||||
|
||||
typedef struct {
|
||||
Texture2D icon;
|
||||
int disabled;
|
||||
} FlintUIIconRowItem;
|
||||
|
||||
typedef struct {
|
||||
int center_x;
|
||||
int view_width;
|
||||
int view_height;
|
||||
int count;
|
||||
const FlintUIIconRowItem *items;
|
||||
int icon_size;
|
||||
int icon_padding;
|
||||
int gap;
|
||||
int side_margin;
|
||||
int bottom_margin;
|
||||
int max_button_width;
|
||||
int min_icon_size;
|
||||
int min_icon_padding;
|
||||
int min_gap;
|
||||
} FlintUIBottomIconRow;
|
||||
|
||||
typedef struct {
|
||||
int clicked_index;
|
||||
int y;
|
||||
int button_width;
|
||||
} FlintUIIconRowResult;
|
||||
|
||||
typedef struct {
|
||||
int route;
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
int active;
|
||||
int disabled;
|
||||
} FlintUIBottomNavItem;
|
||||
|
||||
typedef struct {
|
||||
int view_width;
|
||||
int view_height;
|
||||
int count;
|
||||
const FlintUIBottomNavItem *items;
|
||||
int height;
|
||||
int icon_size;
|
||||
int icon_padding;
|
||||
int side_margin;
|
||||
int bottom_margin;
|
||||
int max_button_width;
|
||||
} FlintUIBottomNav;
|
||||
|
||||
typedef struct {
|
||||
int clicked_index;
|
||||
int clicked_route;
|
||||
int y;
|
||||
int height;
|
||||
} FlintUIBottomNavResult;
|
||||
|
||||
typedef struct {
|
||||
int route;
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
} FlintUIBottomNavOption;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
const char *title;
|
||||
int *routes;
|
||||
int *route_count;
|
||||
int max_route_count;
|
||||
const char **slot_labels;
|
||||
const FlintUIBottomNavOption *options;
|
||||
int option_count;
|
||||
const char *add_label;
|
||||
const char *cancel_label;
|
||||
const char *save_label;
|
||||
const char *reset_label;
|
||||
Texture2D close_icon;
|
||||
} FlintUIBottomNavConfigModal;
|
||||
|
||||
typedef struct {
|
||||
int action;
|
||||
int changed;
|
||||
} FlintUIBottomNavConfigResult;
|
||||
|
||||
typedef struct {
|
||||
const char *message;
|
||||
int width;
|
||||
int header_h;
|
||||
int button_h;
|
||||
int line_gap;
|
||||
int extra_lines;
|
||||
int min_height;
|
||||
int font;
|
||||
} FlintUIParagraphModalMeasure;
|
||||
|
||||
typedef struct {
|
||||
Texture2D icon;
|
||||
int disabled;
|
||||
} FlintUIToolbarAction;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
int draw_menu;
|
||||
const char **options;
|
||||
int option_count;
|
||||
int *selected_index;
|
||||
int dropdown_min_width;
|
||||
int dropdown_max_width;
|
||||
int dropdown_height;
|
||||
const FlintUIToolbarAction *actions;
|
||||
int action_count;
|
||||
int action_icon_size;
|
||||
int action_icon_padding;
|
||||
int action_gap;
|
||||
int side_padding;
|
||||
} FlintUIToolbar;
|
||||
|
||||
typedef struct {
|
||||
int selected_menu_item;
|
||||
int clicked_action;
|
||||
} FlintUIToolbarResult;
|
||||
|
||||
typedef struct {
|
||||
FlintUIToolbar toolbar;
|
||||
Texture2D leading_icon;
|
||||
int leading_width;
|
||||
int leading_icon_size;
|
||||
int leading_icon_padding;
|
||||
} FlintUIToolbarHeader;
|
||||
|
||||
typedef struct {
|
||||
FlintUIToolbarResult toolbar;
|
||||
int leading_clicked;
|
||||
} FlintUIToolbarHeaderResult;
|
||||
|
||||
typedef struct {
|
||||
const char *text;
|
||||
int font;
|
||||
Color color;
|
||||
} FlintUIInfoRow;
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int row_height;
|
||||
int padding_x;
|
||||
const FlintUIInfoRow *rows;
|
||||
int row_count;
|
||||
Color background;
|
||||
Color separator;
|
||||
Color default_text;
|
||||
} FlintUIInfoRows;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
UIButtonStyle style;
|
||||
int disabled;
|
||||
} FlintUIButtonRowItem;
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
int gap;
|
||||
const FlintUIButtonRowItem *items;
|
||||
int count;
|
||||
} FlintUIButtonRow;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
const char *text;
|
||||
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 *label;
|
||||
FlintUITextField field;
|
||||
int label_font;
|
||||
int label_h;
|
||||
int field_h;
|
||||
int gap;
|
||||
int bottom_gap;
|
||||
Color label_color;
|
||||
} FlintUILabelTextField;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
int font;
|
||||
int info_button;
|
||||
int icon_diameter;
|
||||
int height;
|
||||
Color color;
|
||||
} FlintUISectionLabel;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
int *value;
|
||||
int height;
|
||||
int disabled;
|
||||
} FlintUICheckboxRow;
|
||||
|
||||
typedef struct {
|
||||
const char *text;
|
||||
Texture2D icon;
|
||||
UIIconType icon_type;
|
||||
int icon_size;
|
||||
int width;
|
||||
int font;
|
||||
int line_gap;
|
||||
Color color;
|
||||
} FlintUIParagraph;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
int icon_size;
|
||||
int disabled;
|
||||
Color accent;
|
||||
} FlintUISubtab;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
const FlintUISubtab *tabs;
|
||||
int count;
|
||||
int selected_index;
|
||||
int font;
|
||||
} FlintUISubtabBar;
|
||||
|
||||
typedef struct {
|
||||
const char *label;
|
||||
Texture2D icon;
|
||||
int icon_size;
|
||||
int disabled;
|
||||
Color accent;
|
||||
} FlintUITab;
|
||||
|
||||
typedef struct {
|
||||
Rectangle bounds;
|
||||
const FlintUITab *tabs;
|
||||
int count;
|
||||
int selected_index;
|
||||
int font;
|
||||
int min_tab_width;
|
||||
int max_tab_width;
|
||||
int *scroll_offset;
|
||||
int focus_selected;
|
||||
} FlintUITabBar;
|
||||
|
||||
typedef struct {
|
||||
Rectangle anchor;
|
||||
const char *text;
|
||||
} FlintUIGuideStep;
|
||||
|
||||
typedef struct {
|
||||
const FlintUIGuideStep *steps;
|
||||
int count;
|
||||
int *step;
|
||||
int view_width;
|
||||
int view_height;
|
||||
int reserved_top;
|
||||
int reserved_bottom;
|
||||
int max_width;
|
||||
int line_gap;
|
||||
int paragraph_font;
|
||||
Texture2D close_icon;
|
||||
Texture2D back_icon;
|
||||
Texture2D next_icon;
|
||||
Texture2D done_icon;
|
||||
} FlintUIGuideOverlay;
|
||||
|
||||
typedef struct {
|
||||
int closed;
|
||||
int finished;
|
||||
int changed;
|
||||
int step;
|
||||
} FlintUIGuideResult;
|
||||
|
||||
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 int (*FlintUIScrollPageHeightFn)(int content_width, void *user_data);
|
||||
|
||||
typedef struct {
|
||||
int y;
|
||||
int height;
|
||||
int max_content_width;
|
||||
int min_content_width;
|
||||
int side_padding;
|
||||
int *scroll_offset;
|
||||
int wheel_step;
|
||||
int scrollbar_x;
|
||||
int measure_passes;
|
||||
FlintUIScrollPageHeightFn content_height;
|
||||
void *user_data;
|
||||
} FlintUIScrollPageSpec;
|
||||
|
||||
typedef struct {
|
||||
FlintUIScrollArea area;
|
||||
FlintUIScrollView view;
|
||||
int content_x;
|
||||
int content_y;
|
||||
int content_w;
|
||||
int content_h;
|
||||
} FlintUIScrollPage;
|
||||
|
||||
typedef void (*FlintUITextInputPlatformCallback)(int active);
|
||||
|
||||
void ui_init(int width, int height, float dpi);
|
||||
void ui_set_colors(Color text, Color bg, Color surface, Color circle, Color button, Color button_hover, Color icon);
|
||||
int ui_is_desktop_mode(void);
|
||||
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);
|
||||
int ui_hover_effects_enabled(void);
|
||||
/* DPI scaling, color, and layout functions now from Flint: flint_px, flint_clamp_px, flint_lighten, flint_darken, flint_centered_column, flint_page_side_padding */
|
||||
int flint_ui_font(void);
|
||||
int flint_ui_font_small(void);
|
||||
int flint_ui_title_font(const char *title, int max_width);
|
||||
int flint_ui_text_y(const char *text, int box_y, int box_h, int font);
|
||||
void flint_ui_draw_text_centered(const char *text, int center_x, int center_y, int font, Color color);
|
||||
void flint_ui_draw_text_left_in_rect(const char *text, Rectangle rect, int font_size, Color color);
|
||||
void ui_draw_fitted_text_in_rect(const char *text, Rectangle rect, int preferred_size, int min_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);
|
||||
FlintUIGuideResult flint_ui_draw_guide_overlay(FlintUIGuideOverlay guide);
|
||||
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_info_button(int center_x, int center_y, int diameter);
|
||||
int ui_draw_icon_slider_popup(FlintUIIconSliderPopup popup);
|
||||
FlintUIIconRowResult ui_draw_bottom_icon_row(FlintUIBottomIconRow row);
|
||||
int ui_bottom_nav_height(void);
|
||||
FlintUIBottomNavResult ui_draw_bottom_nav(FlintUIBottomNav nav);
|
||||
FlintUIBottomNavConfigResult ui_draw_bottom_nav_config_modal(FlintUIBottomNavConfigModal modal);
|
||||
FlintUIToolbarResult ui_draw_toolbar(FlintUIToolbar toolbar);
|
||||
FlintUIToolbarHeaderResult ui_draw_toolbar_header(FlintUIToolbarHeader header);
|
||||
void ui_draw_info_rows(FlintUIInfoRows rows);
|
||||
int ui_label_text_field_height(FlintUILabelTextField row);
|
||||
int ui_draw_label_text_field(FlintUILabelTextField row, int x, int y, int w);
|
||||
int ui_section_label_height(FlintUISectionLabel label);
|
||||
int ui_draw_section_label(FlintUISectionLabel label, int x, int y);
|
||||
int ui_checkbox_row_height(FlintUICheckboxRow row);
|
||||
int ui_draw_checkbox_row(FlintUICheckboxRow row, int x, int y);
|
||||
int ui_button_row_height(FlintUIButtonRow row);
|
||||
int ui_draw_button_row(FlintUIButtonRow row);
|
||||
int ui_draw_text_btn(int x, int y, const char *label, int *hover);
|
||||
|
||||
/* Generic button component with unified styling */
|
||||
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);
|
||||
int ui_draw_tab_bar(FlintUITabBar bar);
|
||||
int ui_tab_bar_height(void);
|
||||
|
||||
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_checkbox_toggle_disabled(int x, int y, const char *label,
|
||||
int *value, int disabled);
|
||||
int ui_draw_dropdown_button(int id, int x, int y, int w, int h, const char **options, int option_count, int *selected_index);
|
||||
int ui_draw_dropdown_menu(int id);
|
||||
int ui_dropdown_captures_click(Vector2 point);
|
||||
void ui_set_dropdown_clip_top(int top);
|
||||
void ui_set_dropdown_clip_bottom(int bottom);
|
||||
int ui_draw_theme_switcher(int x, int y, int w, const char *label,
|
||||
const char *light_label, const char *dark_label,
|
||||
int *theme_id, int *dark_mode);
|
||||
int ui_draw_theme_picker(int x, int y, int w, int dark_mode, int *theme_id);
|
||||
int ui_theme_picker_height(int w);
|
||||
void ui_draw_tutorial_image_placeholder(const char *label, int x, int y, int w, int h);
|
||||
void ui_draw_tutorial_image(Texture2D texture, const char *fallback, int x, int y, int w, int h);
|
||||
int ui_draw_modal(const char *title, const char *message, const char *cancel_btn, const char *confirm_btn);
|
||||
int ui_draw_modal_3btn(const char *title, const char *message, const char *left_btn, const char *middle_btn, const char *right_btn);
|
||||
int ui_paragraph_modal_height(FlintUIParagraphModalMeasure measure);
|
||||
int ui_draw_screen_header(const char *title, int show_close);
|
||||
int ui_screen_header_height(void);
|
||||
FlintUIHeader ui_draw_title_header(int height, const char *title,
|
||||
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);
|
||||
FlintUIScrollPage ui_scroll_page_begin(FlintUIScrollPageSpec spec);
|
||||
void ui_scroll_page_end(FlintUIScrollPage page);
|
||||
int ui_draw_scrollbar(int x, int y, int viewport_h, int content_h, int *scroll_offset, int max_scroll);
|
||||
|
||||
void ui_focus_begin(void);
|
||||
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,57 +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"
|
||||
|
||||
if [ -f "$out" ] && cmp -s "$tmp" "$out"; then
|
||||
rm "$tmp"
|
||||
else
|
||||
mv "$tmp" "$out"
|
||||
fi
|
||||
@@ -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;
|
||||
}
|
||||