void uiPause( char *msg) { uiClear(FOOTER); uiPrintLine(FOOTER, PA_NONE, "-"); uiPrint(FOOTER, PA_NONE, msg); uiPrintLine(FOOTER, PA_NONE, "-"); raw(); wgetch(gFooterWin); uiClear(FOOTER); }
void renderMenu(struct Menu *mnu) { // Only render 15 elems max so we make a sub array of printable entries struct MenuEntry* entries[15] = {0}; // find first node to print struct ListNode* firstNode = mnu->menuEntries->rootNode; struct ListNode* node = NULL; int offset = 0, cpt; // to detect current pos if( mnu->currentPos >= mnu->_maxEntries ) { int toRemove = mnu->_maxEntries - 1; firstNode = lstGetElement(mnu->menuEntries, mnu->currentPos - toRemove); offset = mnu->currentPos - toRemove; } node = firstNode; // collect node entries to print cpt = 0; while( node != NULL && cpt < mnu->_maxEntries) { entries[cpt] = (struct MenuEntry*) node->data; node = node->next; ++cpt; } // Print texts uiClear(BODY); uiClear(FOOTER); uiPrintLine(FOOTER, PA_NONE, "-"); uiPrint(FOOTER,PA_NONE, "ARROW: Deplacer | ENTER: Valider | F1: aide | ESC: Quitter\n"); uiPrintLine(FOOTER, PA_NONE, "-"); uiPrint(BODY, PA_NONE, mnu->description); for(cpt = 0; cpt < mnu->_maxEntries; ++cpt) { struct MenuEntry* entry = entries[cpt]; if( entry != NULL ) { int printAttribs = mnu->printAttribs; if( cpt + offset == mnu->currentPos ) printAttribs |= PA_RCOLOR; if( mnu->margin != 0 ) uiMoveCursor(BODY, mnu->margin); uiPrint(BODY,printAttribs, entry->text); uiPrint(BODY,PA_NONE, "\n"); } } }
void uiStatus(Uint8 lvl, const char* format, ...) { short pairs[4] = { COLOR_PAIR_INFO, COLOR_PAIR_WARNING, COLOR_PAIR_ERROR, COLOR_PAIR_OK }; va_list argList; va_start(argList, format); char txt[255]; vsprintf(txt, format, argList); va_end(argList); short pair = pairs[lvl]; uiClear(STATUS); if( pair != COLOR_PAIR_INFO ) wattron(gStatusWin, COLOR_PAIR(pair)); wprintw(gStatusWin, txt); if( pair != COLOR_PAIR_INFO ) wattroff(gStatusWin, COLOR_PAIR(pair)); uiRefresh(STATUS); }
void redrawCheatMenu() { cheatsPerPage = uiGetHeight() - 2; int numCheats = cheatEngine->getNumCheats(); int numPages = (numCheats - 1) / cheatsPerPage + 1; int page = cheatMenuSelection / cheatsPerPage; uiClear(); uiPrint(" Cheat Menu "); uiPrint("%d/%d\n\n", page + 1, numPages); for(int i = page * cheatsPerPage; i < numCheats && i < (page + 1) * cheatsPerPage; i++) { if(cheatMenuSelection == i) { uiSetLineHighlighted(true); } uiPrint("%s", cheatEngine->cheats[i].name); for(unsigned int j = 0; j < 25 - strlen(cheatEngine->cheats[i].name); j++) { uiPrint(" "); } if(cheatEngine->isCheatEnabled(i)) { if(cheatMenuSelection == i) { uiSetTextColor(TEXT_COLOR_YELLOW); uiPrint("* "); uiSetTextColor(TEXT_COLOR_GREEN); uiPrint("On"); uiSetTextColor(TEXT_COLOR_YELLOW); uiPrint(" *"); uiSetTextColor(TEXT_COLOR_NONE); } else { uiSetTextColor(TEXT_COLOR_GREEN); uiPrint(" On "); uiSetTextColor(TEXT_COLOR_NONE); } } else { if(cheatMenuSelection == i) { uiSetTextColor(TEXT_COLOR_YELLOW); uiPrint("* "); uiSetTextColor(TEXT_COLOR_RED); uiPrint("Off"); uiSetTextColor(TEXT_COLOR_YELLOW); uiPrint(" *"); uiSetTextColor(TEXT_COLOR_NONE); } else { uiSetTextColor(TEXT_COLOR_RED); uiPrint(" Off "); uiSetTextColor(TEXT_COLOR_NONE); } } uiPrint("\n"); uiSetLineHighlighted(false); } uiFlush(); }
void createUI(NVGcontext *vg, float w, float h) { int col; uiClear(); { int root = uiItem(); // position root element uiSetLayout(root,UI_LEFT|UI_TOP); uiSetMargins(root,50,50,0,0); uiSetSize(root,250,400); } col = column(0); uiSetLayout(col, UI_TOP|UI_HFILL); button(col, __LINE__, BND_ICONID(6,3), "Item 1", demohandler); button(col, __LINE__, BND_ICONID(6,3), "Item 2", demohandler); { int h = hgroup(col); radio(h, __LINE__, BND_ICONID(6,3), "Item 3.0", &enum1); radio(h, __LINE__, BND_ICONID(0,10), NULL, &enum1); radio(h, __LINE__, BND_ICONID(1,10), NULL, &enum1); radio(h, __LINE__, BND_ICONID(6,3), "Item 3.3", &enum1); } { int colr; int rows = row(col); int coll = vgroup(rows); label(coll, -1, "Items 4.0:"); coll = vgroup(coll); button(coll, __LINE__, BND_ICONID(6,3), "Item 4.0.0", demohandler); button(coll, __LINE__, BND_ICONID(6,3), "Item 4.0.1", demohandler); colr = vgroup(rows); uiSetFrozen(colr, option1); label(colr, -1, "Items 4.1:"); colr = vgroup(colr); slider(colr, __LINE__, "Item 4.1.0", &progress1); slider(colr,__LINE__, "Item 4.1.1", &progress2); } button(col, __LINE__, BND_ICONID(6,3), "Item 5", NULL); check(col, __LINE__, "Frozen", &option1); check(col, __LINE__, "Item 7", &option2); check(col, __LINE__, "Item 8", &option3); textbox(col, (UIhandle)textbuffer, textbuffer, 32); uiLayout(); }
void printLists() { const int nbLists = 6; struct List* lists[6] = {gAbsences, gAppointments, gConsultations, gDoctors, gPatients, gRooms}; char* labels[6] = {"Liste des absences\n", "Liste des rdv\n", "Liste des consultations\n", "Liste des docteurs\n", "Liste des patients\n", "Liste des salles\n"}; int cpt; for(cpt = 0; cpt < nbLists; ++cpt) { uiPrint(HEADER, PA_CENTER, labels[cpt]); uiPrint(HEADER, PA_CENTER, "============================\n"); lstPrint(lists[cpt]); uiPause("Tapez ENTER pour voir la liste suivante...\n"); uiClear(ALL); } }