Skip to content

Commit 6ece291

Browse files
committed
Add loading screen explorer
1 parent 53a29dd commit 6ece291

File tree

1 file changed

+15
-0
lines changed
  • sources/core/apps/explorer/source/core

1 file changed

+15
-0
lines changed

sources/core/apps/explorer/source/core/core.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#define ICON_BORDER_FOCUS_COLOR (0x14bacb)
4040
#define ICON_BORDER_MARGIN (5)
4141
#define ICON_MARGIN (20)
42+
#define LOADING_SIZE (18)
4243

4344
kfont_t font;
4445

@@ -480,6 +481,13 @@ int reload_icons(){
480481
return 0;
481482
}
482483

484+
void show_loading_screen(){
485+
memset(fb.buffer, 0, fb.size);
486+
load_pen(font, &fb, 0, 0, LOADING_SIZE, 0, DATE_TIME_COLOR);
487+
write_paragraph(font, 0, (fb.height - LOADING_SIZE) / 2, fb.width, PARAGRAPH_CENTER, "Loading...", -1);
488+
draw_frame();
489+
}
490+
483491
void get_input(){
484492
static bool arrow_pressed = false;
485493
static bool wait_release = false;
@@ -558,10 +566,12 @@ void get_input(){
558566
focus_icon_row = 0;
559567
focus_icon_column = 0;
560568
current_page = 0;
569+
show_loading_screen();
561570
process_icons();
562571
update_icon_page = true;
563572
}else{
564573
if(icons_executable_path[c] != NULL){
574+
show_loading_screen();
565575
pid_t p = fork();
566576
if(p < 0){
567577
perror("explorer: fork failed");
@@ -585,6 +595,7 @@ void get_input(){
585595
reload_icons();
586596
}
587597
}else if(icons_try_to_execute[c]){
598+
show_loading_screen();
588599
pid_t p = fork();
589600
if(p < 0){
590601
perror("explorer: fork failed");
@@ -616,6 +627,7 @@ void get_input(){
616627
}
617628
}else if(key == 62 && pressed){
618629
// open bash
630+
show_loading_screen();
619631
pid_t p = fork();
620632
if(p < 0){
621633
perror("desktop: fork failed");
@@ -641,6 +653,7 @@ void get_input(){
641653
}
642654
}else if(key == 61 && pressed){
643655
// go back directory
656+
show_loading_screen();
644657
char* parent_directory = get_parent_directory(current_path);
645658
free(current_path);
646659
current_path = parent_directory;
@@ -655,6 +668,7 @@ void get_input(){
655668
current_page++;
656669
focus_icon_row = 0;
657670
focus_icon_column = 0;
671+
show_loading_screen();
658672
process_icons();
659673
update_icon_page = true;
660674
}
@@ -664,6 +678,7 @@ void get_input(){
664678
current_page--;
665679
focus_icon_row = 0;
666680
focus_icon_column = 0;
681+
show_loading_screen();
667682
process_icons();
668683
update_icon_page = true;
669684
}

0 commit comments

Comments
 (0)