diff options
author | Mole Shang <[email protected]> | 2024-03-02 20:14:18 +0800 |
---|---|---|
committer | Mole Shang <[email protected]> | 2024-03-02 20:14:18 +0800 |
commit | cf31015f6a3cc205cb682f154478599b36040382 (patch) | |
tree | 0f4692346fd5167c050de6d415e4161915c4e75b | |
parent | 3e5ebc6dbd12f9a176baa6106a9b9f4ec5ba7346 (diff) | |
download | hinata-cf31015f6a3cc205cb682f154478599b36040382.tar.gz hinata-cf31015f6a3cc205cb682f154478599b36040382.tar.bz2 hinata-cf31015f6a3cc205cb682f154478599b36040382.zip |
ui: draw ascii-art icon in about popup
-rw-r--r-- | src/icon.h | 25 | ||||
-rw-r--r-- | src/main.h | 2 | ||||
-rw-r--r-- | src/ui.c | 25 |
3 files changed, 39 insertions, 13 deletions
diff --git a/src/icon.h b/src/icon.h new file mode 100644 index 0000000..b606091 --- /dev/null +++ b/src/icon.h @@ -0,0 +1,25 @@ +#ifndef ICON_H_ +#define ICON_H_ + +const char *icon[] = {"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%@@@@@@@@@@@", + "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#********%@@@@@@@@", + "@@@@@@@@@@@@@@@@@@@@%#**++==+++==+*#%@@@%+%@@@@@@@", + "@@@@@@@@@@@@@@@@@%*=------------------=#@@%@@@@@@@", + "@@@@@@@@@@@@@@@#+----=-:----====-=--=---=*@@@@@@@@", + "@@@@@@@@@@@@@+----=--:=--=----------------=#@@@@@@", + "@@@@@@*====*-:-----::**:=*-------:*#:+=-----=#@@@@", + "@@@@@+:-----------=-#@*-@%-------=%%-*#-----===#@@", + "@@@@%:----:------+#=#+--*%=:---:+%@@=%@-:---=@%#%@", + "@@@@#.----::-----+-=#. -+#%---=#@#-:-+#==---=@@@@@", + "@@@@%::---:.-::--++@@=---%@%+#@@@%..--:=---:#@@@@@", + "@@@@@::---:.:::=:+@%@@##%@@@@@@@@%+==++::-:-@@@@@@", + "@@@@@-::---=++:+*+@@%%%%%%@%%%@@@@%%%@=.::::#@@@@@", + "@@@@%-::::=*#%**@@@@@@@%@@@@@@%#@@%%@@-:::::*@@@@@", + "***#*::::::==+###%%@@@@@@@@@@@@%@@@@%+::::::-=====", + "###*=-:::::-=-=++===*#%@@@@@@@@@%#*+=--::::-======", + "#*+=---::::====-=====-+#%%%%%%*+=--====-:::=====-=", + "=====--=:::-==========+%######=======---==+++++**#", + "==========--==========*%#####%#++=+++#%%@@@@@@@@@@", + 0}; + +#endif
\ No newline at end of file @@ -4,6 +4,6 @@ #include <stdbool.h> #include <stdio.h> -int win_width = 800, win_height = 600; +int win_width = 1024, win_height = 768; #endif @@ -9,6 +9,7 @@ #include "process_url.h" #include "constants.h" +#include "icon.h" #include "logger.h" #include "ui.h" #include "utils/size_info.h" @@ -22,7 +23,7 @@ static nfdchar_t *outPath; void load_ui(struct ui_struct *ui) { static char text[USHRT_MAX], box_buffer[UINT16_MAX], status_string[UCHAR_MAX]; float logGroup_height = - nk_window_get_height(ui->ctx) - 30 - 85 - 45 - 50 - 35 - 80; + nk_window_get_height(ui->ctx) - 35 - 85 - 45 - 50 - 35 - 80; ui->logger->extend_box = (logGroup_height - 15) < ((ui->logger->box_lines + 1) * (ui->logger->font_height + 2)); @@ -54,11 +55,11 @@ void load_ui(struct ui_struct *ui) { } nk_menubar_begin(ui->ctx); - nk_layout_row_begin(ui->ctx, NK_STATIC, 30, 1); + nk_layout_row_begin(ui->ctx, NK_STATIC, 35, 1); nk_layout_row_push(ui->ctx, 100); if (nk_menu_begin_label(ui->ctx, "MENU", NK_TEXT_CENTERED, nk_vec2(100, 200))) { - nk_layout_row_dynamic(ui->ctx, 30, 1); + nk_layout_row_dynamic(ui->ctx, 35, 1); if (nk_menu_item_label(ui->ctx, "About", NK_TEXT_CENTERED)) show_app_about = nk_true; nk_menu_end(ui->ctx); @@ -68,18 +69,18 @@ void load_ui(struct ui_struct *ui) { if (show_app_about) { /* about popup */ - static struct nk_rect s = {100, 100, 600, 300}; - if (nk_popup_begin(ui->ctx, NK_POPUP_STATIC, "About", NK_WINDOW_CLOSABLE, + static struct nk_rect s = {128, 64, 798, 512}; + if (nk_popup_begin(ui->ctx, NK_POPUP_DYNAMIC, "About", NK_WINDOW_CLOSABLE, s)) { nk_layout_row_dynamic(ui->ctx, 30, 1); - nk_label(ui->ctx, "A cross-platform multi-thread downloader", - NK_TEXT_LEFT); - nk_label(ui->ctx, "By Mole Shang", NK_TEXT_LEFT); + for (int i = 0; icon[i]; i++) + nk_label(ui->ctx, icon[i], NK_TEXT_CENTERED); SPACER; - nk_label(ui->ctx, "hinata is licensed under LGPL-3.0.", NK_TEXT_LEFT); - nk_label(ui->ctx, "For further information, checkout", NK_TEXT_LEFT); - nk_label(ui->ctx, "<https://git.135e2.dev/135e2/hinata.git/>.", - NK_TEXT_LEFT); + nk_label(ui->ctx, "Cross-platform multi-threaded downloader", + NK_TEXT_CENTERED); + nk_label(ui->ctx, "By Mole Shang <[email protected]>", NK_TEXT_CENTERED); + nk_label(ui->ctx, "<https://git.135e2.dev/135e2/hinata.git>", + NK_TEXT_CENTERED); nk_popup_end(ui->ctx); } else show_app_about = nk_false; |