diff --git a/src/code.c b/src/code.c index e0fd924..73da56e 100644 --- a/src/code.c +++ b/src/code.c @@ -1677,6 +1677,15 @@ static void drawCodeToolbar(Code* code) static const u8 Icons[] = { + 0b00000000, + 0b01000000, + 0b01100000, + 0b01110000, + 0b01100000, + 0b01000000, + 0b00000000, + 0b00000000, + 0b00000000, 0b00111000, 0b01000100, @@ -1708,7 +1717,7 @@ static void drawCodeToolbar(Code* code) enum {Count = sizeof Icons / BITS_IN_BYTE}; enum {Size = 7}; - static const char* Tips[] = {"FIND [ctrl+f]", "GOTO [ctrl+g]", "OUTLINE [ctrl+o]"}; + static const char* Tips[] = {"RUN [ctrl+f]","FIND [ctrl+f]", "GOTO [ctrl+g]", "OUTLINE [ctrl+o]"}; for(s32 i = 0; i < Count; i++) { @@ -1725,14 +1734,21 @@ static void drawCodeToolbar(Code* code) if(checkMouseClick(&rect, SDL_BUTTON_LEFT)) { - s32 mode = TEXT_FIND_MODE + i; + if (i == TEXT_RUN_CODE) + { + runProject(); + } + else + { + s32 mode = TEXT_EDIT_MODE + i; - if(code->mode == mode) code->escape(code); - else setCodeMode(code, mode); + if(code->mode == mode) code->escape(code); + else setCodeMode(code, mode); + } } } - bool active = i == code->mode - TEXT_FIND_MODE; + bool active = i == code->mode - TEXT_EDIT_MODE && i != 0; if(active) code->tic->api.rect(code->tic, rect.x, rect.y, Size, Size, systemColor(tic_color_blue)); @@ -1751,6 +1767,7 @@ static void tick(Code* code) switch(code->mode) { + case TEXT_RUN_CODE: runProject(); break; case TEXT_EDIT_MODE: textEditTick(code); break; case TEXT_FIND_MODE: textFindTick(code); break; case TEXT_GOTO_MODE: textGoToTick(code); break; diff --git a/src/code.h b/src/code.h index 950a625..c05ffba 100644 --- a/src/code.h +++ b/src/code.h @@ -72,6 +72,7 @@ struct Code enum { + TEXT_RUN_CODE, TEXT_EDIT_MODE, TEXT_FIND_MODE, TEXT_GOTO_MODE, diff --git a/src/studio.c b/src/studio.c index a4e0085..0c98848 100644 --- a/src/studio.c +++ b/src/studio.c @@ -1354,7 +1354,7 @@ static void onFullscreen() SDL_SetWindowFullscreen(studio.window, studio.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); } -static void runProject() +void runProject() { studio.tic->api.reset(studio.tic);