diff --git a/src/code.c b/src/code.c index d42be5f..37d497e 100644 --- a/src/code.c +++ b/src/code.c @@ -1682,6 +1682,15 @@ static void drawCodeToolbar(Code* code) static const u8 Icons[] = { + 0b00000000, + 0b01000000, + 0b01100000, + 0b01110000, + 0b01100000, + 0b01000000, + 0b00000000, + 0b00000000, + 0b00000000, 0b00111000, 0b01000100, @@ -1713,7 +1722,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++) { @@ -1730,14 +1739,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)); @@ -1756,6 +1772,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 673f187..da4b293 100644 --- a/src/studio.c +++ b/src/studio.c @@ -1363,7 +1363,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);