summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2025-01-16 06:05:57 +0100
committerMitya Selivanov <automainint@guattari.tech>2025-01-16 06:05:57 +0100
commitbf17379743b283937a12340717bffccf619cc864 (patch)
tree634dd51c2435fa42be0b94941e5a3e4a538e711d /examples
parent41abfb196c524cf16107675b8e5b356827a04cd0 (diff)
downloadreduced_system_layer-bf17379743b283937a12340717bffccf619cc864.zip
Drag and drop fixes
Diffstat (limited to 'examples')
-rw-r--r--examples/ui.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/ui.c b/examples/ui.c
index 0e8e29e..6738d7e 100644
--- a/examples/ui.c
+++ b/examples/ui.c
@@ -213,6 +213,15 @@ void update_and_render_frame(void) {
}
}
+ if (g_platform.files_dropped && g_platform.num_drop_files > 0) {
+ text_len = g_platform.drop_files[0].data_size;
+ if (text_len > (i64) (sizeof text / sizeof *text))
+ text_len = sizeof text / sizeof *text;
+
+ for (i64 i = 0; i < text_len; ++i)
+ text[i] = g_platform.drop_files[0].data[i];
+ }
+
draw_text_area(RGB(0.f, 0.f, 0.f), x0 + 8, y0 - 8, w, h, 10., 10., text_len, text);
draw_text_area((Brush) { .color = with_alpha(color, 1.f) }, x0, y0, w, h, 10., 10., text_len, text);
draw_selection_cursor((Brush) { .xor_color = 1, .color = { 1.f, 1.f, 1.f, 1.f } }, x0, y0, w, h, 10., 10., cursor, selection, text_len, text);