void menu(char *args) { char buf[64]; menu_execute(args, 1); while (1) { kprintf("OS/161 kernel [? for menu]: "); kgets(buf, sizeof(buf)); menu_execute(buf, 0); } }
void menu(char *args) { char buf[64]; menu_execute(args, 1); while (1) { kprintf("Kernel awaiting your command [? for menu]: "); kgets(buf, sizeof(buf)); menu_execute(buf, 0); } }
void menu(char *args) { char buf[64]; menu_execute(args, 1); while (1) { kprintf("\033[1;33mOS/161 kernel \033[1;36m[? for menu]\033[5m: \033[0m"); kgets(buf, sizeof(buf)); menu_execute(buf, 0); } }
void menu(char *args) { char buf[64]; menu_execute(args, 1); while (1) { kprintf("testing the shellscript !!! /n"); kprintf("OS/161 kernel [? for menu]: "); kgets(buf, sizeof(buf)); menu_execute(buf, 0); } }
int main() { phonebook_item_t* phonebook = NULL; size_t count = 0; //Создаем меню menu_t* main_menu = menu_create(Rus("Главное меню")); if (!main_menu) { return 1; } //Добавляем пункты в меню menu_add_item(main_menu, Rus("Добавить запись"), &add_record, &phonebook, &count); menu_add_item(main_menu, Rus("Добавить тестовые записи"), &add_test_records, &phonebook, &count); menu_add_item(main_menu, Rus("Вывести записи"), &print_records, &phonebook, &count); menu_add_item(main_menu, Rus("Выполнить задание"), &do_work, &phonebook, &count); menu_add_item(main_menu, "Exit", &exit_program, NULL, NULL); //Выполняем меню menu_execute(main_menu, NULL); menu_free(main_menu); return 0; }
void menu(char *args) { char buf[64]; menu_execute(args, 1); while (1) { /* * Defined in overwrite.h. If you want to change the kernel prompt, please * do it in that file. Otherwise automated test testing will break. */ kprintf(KERNEL_PROMPT); kgets(buf, sizeof(buf)); menu_execute(buf, 0); } }
void select_file(void *arg) { int selected = *((int *) arg); char *tmp, *tmp2; tmp = dir[selected]; while(*tmp++ != '\t'); while(*tmp++ != '\t'); pathcat(pathbuf, path, tmp); tmp = pathbuf; tmp2 = path; while((*tmp2++ = *tmp++)); if(dir[selected][1] == 'D') { menu_dir.selected = 8; menu_execute(&menu_dir); tmp = path; while(*tmp++); while(tmp != path) { *tmp = 0; if(*tmp == '/') { break; } tmp--; } } else { menu_dir.selected = 0; menu_execute(&menu_file); tmp = path; while(*tmp++); while(tmp != path) { *tmp = 0; if(*tmp == '/') { break; } tmp--; } } }
void menu(char *args) { char buf[64]; /* BEGIN A3 SETUP */ /* Initialize hacky semaphore solution to make menu thread * wait for command program to finish. */ cmd_sem = sem_create("cmdsem", 0); if (cmd_sem == NULL) { panic("menu: could not create cmd_sem\n"); } /* END A3 SETUP */ menu_execute(args, 1); while (1) { kprintf("OS/161 kernel [? for menu]: "); kgets(buf, sizeof(buf)); menu_execute(buf, 0); } }
int main(int ac, char *av[]){ static struct termios origt,newt; volatile char c; printf("Welcome to the menu system\n"); if( tcgetattr(STDIN_FILENO,&origt) < 0 ) gtfo("tcgetattr failed!\n"); newt = origt; newt.c_lflag &= ~(ICANON); if( tcsetattr(STDIN_FILENO, TCSANOW, &newt) < 0 ){ tcsetattr(STDIN_FILENO, TCSANOW, &origt); gtfo("tcsetattr failed!\n"); } menu *m1 = newMenu("Ultimate control",3); m1->items[0] = *newItem("Item 1", &item1); m1->items[1] = *newItem("Item 2", &item2); m1->items[2] = *newItem("Item 3", &item3); // Do some useful shit while(1){ c = getchar(); if( c == 'q' ) break; switch(c){ case 'j': menu_down(m1); break; case 'k': menu_up(m1); break; case 'e': // execute menu_execute(m1); break; } } // Done with useful shit tcsetattr(STDIN_FILENO, TCSANOW, &origt); printf("We're done, bye!\n"); }
state task2(void* data, void* params) { str_count = 0; system("cls"); char ch; if (exist(STR_FILE_NAME)) { printf(Rus("Файл существует, прочитать? Y/N: ")); do { ch = fgetc(stdin); } while (ch != 'Y' && ch != 'y' && ch != 'N' && ch != 'n'); switch (ch) { case 'Y': case 'y': read_str(NULL, NULL); break; default: break; } } //Создаем меню menu_t* menu = menu_create("Задание 2"); //Добавляем пункты в меню menu_add_item(menu, Rus("Добавить строки с клавиатуры"), &input_str, NULL, NULL); menu_add_item(menu, Rus("Вывести текст на экран"), &print_str, NULL, NULL); menu_add_item(menu, Rus("Сохранить текст в файл"), &save_str, NULL, NULL); menu_add_item(menu, Rus("Прочитать текст из файла"), &read_str, NULL, NULL); menu_add_item(menu, Rus("Выполнить задание варианта 2"), &do_task2, NULL, NULL); menu_add_item(menu, Rus("Вернутся в главное меню"), &exit_sub, menu, NULL); //Выполняем меню menu_execute(menu, NULL); menu_free(menu); return REDRAW_ALL; }
int main() { //Сохраняем текущие параметры консоли hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, DEFAULT_COLOR); //Создаем меню menu_t* main_menu = menu_create("Главное меню"); //Добавляем пункты в меню menu_add_item(main_menu, Rus("Задание 1"), &task1, NULL, NULL); menu_add_item(main_menu, Rus("Задание 2"), &task2, NULL, NULL); menu_add_item(main_menu, "Exit", &exit_program, NULL, NULL); //Выполняем меню menu_execute(main_menu, NULL); menu_free(main_menu); return 0; }
void Main_Game::main_loop() { menu_execute(); // call menu before start game bool change; while (true) { // loop our game if (lvl < 0) break; EndSprite1.setPosition(0, -250); EndSprite2.setPosition(0, 500); algoLoop = true; change = true; p.reset(new Game_Algorithm()); // create new game algorithm p->set_lvl(lvl); won_lost_text.setString("YOU LOST!"); while (algoLoop) // loop game algorithm { _time = clock.getElapsedTime().asMicroseconds(); clock.restart(); _time = _time / 600; while (window.pollEvent(event)) { p->ClicMouse(event, window); if (event.type == sf::Event::LostFocus) { _time = pause->pause(_time); if (!_time) algoLoop = false; clock.restart(); } if (event.type == sf::Event::KeyPressed) if (event.key.code == sf::Keyboard::Pause || event.key.code == sf::Keyboard::P || event.key.code == sf::Keyboard::Escape) { _time = pause->pause(_time); if (!_time) algoLoop = false; clock.restart(); } } p->setAreaHum(interfac->GetHummerSp()); p->setAreaCol(interfac->GetColorSp()); p->update(_time); interfac->Set_Text(p->getSwapCount(), p->getScore(), p->getHumBunus(), p->getColBonus()); interfac->Set_Buttons(p->getHumBunus(), p->getColBonus(), p->get_Color()); interfac->TimeLine(p->getTimelvl(), p->getSwapCount()); interfac->Set_Button(_time); window.clear(); interfac->Draw(window); p->Show(window); p->Graphics_Blow(_time, window); int succ = p->Successlvl(lvl); if (succ == 1) { if (lvl < 5) { if ((pl_info[lvl] == 0) && change) { pl_info[lvl] = 1; // give access to the next level pl_info[5] += p->getScore(); // add scores file.change_info_player(file.read_temporary_data(), pl_info); // and make changes to the file change = false; // stop algorithm loop } } won_lost_text.setString("YOU WON!"); EndSprite1.move(0, _time*0.1); EndSprite2.move(0, _time*-0.1); window.draw(EndSprite1); window.draw(EndSprite2); window.draw(won_lost_text); if (EndSprite1.getPosition().y >= 0) { break; } } else if (succ == 2) { EndSprite1.move(0, _time*0.1); EndSprite2.move(0, _time*-0.1); window.draw(EndSprite1); window.draw(EndSprite2); window.draw(won_lost_text); if (EndSprite1.getPosition().y >= 0) { break; } } window.display(); } menu_execute(3); // call MenuChoiceLevel } }