task main() { TIconIndex icon = iconNone; string iconStr = ""; StringFormat(iconStr, "0x%0.2X", icon); drawMenu(menuFromRight, icon, icon, icon, iconStr, ""); while ( true ) { switch (nNxtButtonTransition) { case kEnterButton: case kExitButton: return; break; case kRightButton: icon++; StringFormat(iconStr, "0x%0.2X", icon); drawMenu(menuFromRight, icon, icon, icon, iconStr, ""); break; case kLeftButton: icon--; StringFormat(iconStr, "0x%0.2X", icon); drawMenu(menuFromRight, icon, icon, icon, iconStr, ""); break; } } }
void doStateMachine() { switch(state) { case(STATE_LOADING): loadStuff(); break; case(STATE_MENU_MAIN): if(isActive) drawMenu(); break; case(STATE_MENU_SCORES): if(isActive) drawMenu(); break; case(STATE_MENU_OPTIONS): break; case(STATE_PLAYING): if(isActive) drawScene(); break; case(STATE_CRASH): break; case(STATE_DEAD): break; case(STATE_FINISHED): ; } }
void Menu() { int done = 0; int ctrl = 0; // Set video mode based on aspect ratio if(CONF_GetAspectRatio() == CONF_ASPECT_16_9) isWide = 1; setVideoMode(); drawLogo(); dListTotal = findPaks(); dListCurrentPosition = 0; if(dListTotal != 1) { sortList(); getAllLogs(); initMenu(1); drawMenu(); pControl = ControlMenu; while(!done) { ctrl = Control(); switch(ctrl) { case 1: case 2: done = 1; break; case 3: drawLogs(); break; case -1: drawMenu(); break; case -2: // BGM player isn't supported break; } } freeAllLogs(); termMenu(); if(ctrl == 2) { if (filelist) { free(filelist); filelist = NULL; } borExit(0); } } getBasePath(packfile, filelist[dListCurrentPosition+dListScrollPosition].filename, 1); free(filelist); }
/************************************************************************ Function: display Description: Draws initial static openGL. Sets up buttons, menu, drawing of letters, calls mouse functionality, runs all animations. *************************************************************************/ void display(void) { // Clear the screen and redraw updated stuff glClear(GL_COLOR_BUFFER_BIT); // Draw bonus in background if button pressed // The bonus is psychadelic sqaures that are multicolor, pulsing in the // background drawBonus(); // Morphs the letter if button pressed, else stays as N morphLetter(); // Draw the background for the menu drawMenu(); // This draws the buttons // Always draw base buttons and shadows, but draw over if one is pressed drawButtons(); // Checks if mouse is pressed and records the position mouseCheck(); // Performs button operations depending on mouse position buttonLogic(); // Draw text for buttons drawButtonText(); // Use swap buffers for double buffering glutSwapBuffers(); }
int main() { FILE *arq; contato reg; int opcao = -1; char buffer[256]; if ( (arq = fopen("dados.dat", "r+")) == NULL ) { printf("Arquivo nao encontrado! Criando arquivo 'dados.dat'!\n"); // creating new file arq = fopen("dados.dat", "w+"); // create a new file } else { printf("Arquivo aberto com sucesso!\n"); } // created and print a IndexList createIndexMap(arq); printIndexMap(); getchar(); while (opcao != 0 ) // menu: 0 to exit { opcao = drawMenu(); menu(opcao, reg, buffer, arq); } return 0; }
void Lamp::LampStatus(bool isOn) { this->_lampOn = isOn; //Serial1.print("Lamp status:"); // Serial1.print(this->_lampOn); drawMenu(menuPosition()); }
/* display function - GLUT display callback function * clears the screen, sets the camera position, draws the ground plane and movable box */ void display(void) { //float origin[] = {0,0,0,1}; float m_amb[] = {0.33, 0.22, 0.03, 1.0}; float m_dif[] = {1, 0, 0, 1.0}; float m_spec[] = {0.99, 0.91, 0.81, 1.0}; float shiny = 60; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(camPos[0], camPos[1], camPos[2], 0,0,0, 0,1,0); glColor3f(1,1,1); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, m_amb); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, m_dif); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, m_spec); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shiny); drawParticles(); drawObjects(); drawMenu(); glutSwapBuffers(); }
/* initGui must be called to initialize the structures used by the GUI */ int initGUI(int level) { int i; int n = CARD_NUMBER; char cardName[50]; if (i_initGUI) return(-1); /* check the flag of GUI initialized*/ markIndex = 0; /* mark color index*/ for (i=0; i<n; i++) { if (i<10) sprintf(cardName, "%s/0%1d.xpm", xpmdir, i); else sprintf(cardName, "%s/%2d.xpm", xpmdir, i); read_cmap(cardName, &(mycard[i])); } initLayout(level); rootColor = NULL; doColorTable(mycard, 0, n); initGraphics(); setBlack(& mycard[ EMPTY_CARD ]); initColors(); remapColor(mycard, 0, CARD_NUMBER-1); initWindow(); initImages(mycard, 0, CARD_NUMBER-1); drawMenu(); /* printf(" Nex Graphics done \n"); */ i_initGUI = 1; /* set the flag of GUI initialized*/ return(0); }
void menu::drawHUD() { glColor4f(1,1,1,0.3); hudBack.drawSprites(0,screenheight-100, screenwidth,100); text menu = text((const unsigned char*) "Menu",screenwidth-110,screenheight-35,0.3,0.3); menu.setTextBoxColor(0,0,0,1); menu.drawTextBox(screenwidth-120,screenheight-80,115,60); glColor4f(1,1,1,1); glEnable(GL_LINE_SMOOTH); glLineWidth(3.0); menu.drawText(); if (isMouseInside(screenwidth-120,screenheight-80,115,60,1,1)) { menu.setTextBoxColor(1,1,1,1); menu.drawTextBox(screenwidth-120,screenheight-80,115,60); glColor4f(0,0,0,1); menu.drawText(); if(wasclicked_LB) { ingame = false; inGameMenu = true; drawMenu(); } } drawHpBar(100); drawMpBar(100); }
void displayGui(void) { drawGuiBackground(); drawGuiLogo(); drawMenu(gScreen); SystemSwapBuffers(); }
void doSceneGraph( arMasterSlaveFramework &fw ) { static int loops = 0; static ar_timeval starttime = ar_time(); static ar_timeval lastdrawtime = ar_time(); ar_timeval now = ar_time(); long long curtime = ( now.sec * 1000000 ) + now.usec, lasttime = ( lastdrawtime.sec * 1000000 ) + lastdrawtime.usec; long long sleeptime = 2000 - ( curtime - lasttime ); ar_usleep( max( (int)sleeptime, 1 ) ); fw.loadNavMatrix(); glClearColor( 0, 0.749, 1, 0 ); primary.draw(); secondary.draw(); sg->drawSceneGraph(); if( menuOn ) drawMenu( menu, fw ); lastdrawtime = ar_time(); loops++; if( lastdrawtime.sec > starttime.sec ) { cout << "fps=" << loops << endl; starttime = lastdrawtime; loops = 0; } }
void display_menu(){ //bool we use to keep from redrawing everything run_once=false; drawMenu(); wait1Msec(250); //while we are not pressing enter while(nNxtButtonPressed!=3){ //if we press the left button //and it has been .5 seconds since the last button press //and we have an upper menu to go to if(nNxtButtonPressed==2 && time1[T1] > 500 && selection > 0){ time1[T1] = 0; //reset time 1 so that we don't repeat change_menu(-1); //decrease selection }else if(nNxtButtonPressed==1 && time1[T1] > 500 && selection < 7){ //same as above but with right button and making sure we have a menu item below us change_menu(1); //increase selection time1[T1] = 0; //reset time } } while(nNxtButtonPressed==3); //do not double read enters so hang while holding enter eraseDisplay(); //clear display switch(selection) //get delection and make decision { case 0: //go back current_function=previous_function;//go back to prev page ClearSounds(); //clear sound buffer. not neccesary probably break; case 1: current_function=0;//log break; } wait1Msec(250); // don't immediately move on wait .25 seconds }
//Main menu function void openMenu(menuStruct_t *menuToShow) { int8_t selectedIndex = 0; //Current selected item chThdSleepMilliseconds(50); drawMenu(menuToShow, selectedIndex); do { if (BUTTON_DOWN) { selectedIndex--; if (selectedIndex < 0) { selectedIndex = menuToShow->numberItems + 1; } drawMenu(menuToShow, selectedIndex); } else if (BUTTON_UP) { selectedIndex++; if (selectedIndex > (menuToShow->numberItems + 1)) { selectedIndex = 0; } drawMenu(menuToShow, selectedIndex); } else if (BUTTON_SEL) { if (selectedIndex > menuToShow->numberItems) /* Last item is "exit" */ { return; } else if (menuToShow->items[selectedIndex].handler != NULL) { menuToShow->items[selectedIndex].handler(); } else if (menuToShow->items[selectedIndex].subMenu != NULL) { openMenu(menuToShow->items[selectedIndex].subMenu); } drawMenu(menuToShow, selectedIndex); } chThdSleepMilliseconds(250); } while (true); return; }
void SceneMenu::draw() { if(state==0) drawMenu(); /*else if (state==1) drawDificultyMenu();*/ }
void loopMainMenu(Inputs input, Map *map, Map *menu) { updateMenu(&input, &map); if (isOnMenu() != IS_IN_PRINCIPAL_MENU) clearWindow(); else drawMenu(menu); }
static void set_menu() { if (!blackout) { menu = true; drawMenu(); } }
void displayGui() { drawGuiBackground(); if(!game->settings->softwareRendering) drawGuiLogo(); drawMenu(game->screen); SystemSwapBuffers(); }
void Lamp::Wake() { _idleTime=0; updateMenuIndex('t'); // if (_sleeping == true) backLightBr(getLCDBrightness()); this->_sleeping = false; drawMenu(menuPosition()); }
void mSettings (uint8_t menuSize, struct sMenuEntry menu[]) { uint8_t select = 0; bool stay = true; drawMenu(menuSize, menu, "Einstellungen"); mSlected(select+2); /*Homescreen Aktualisierung unterdrücken*/ iHomescreenActiv = false; while(stay) { if(loggedKeyInput & KEY_OK) { loggedKeyInput &= ~KEY_OK; if(menu[select].function != NULL) { loggedKeyInput = NO_KEY; clrContent(); menu[select].function(); drawMenu(menuSize, menu, "Einstellungen"); mSlected(select+2); } else { clrContent(); stay = false; } } if( (loggedKeyInput & (KEY_UP)) || (loggedKeyInput & (KEY_DOWN)) ) { moveCursor(&select, menuSize); } /**********************************************************************/ workLoad(); /**********************************************************************/ } }
void drawLogs() { int i=which_logfile, j, k, l, done=0; s_screen *Viewer = NULL; bothkeys = bothnewkeys = 0; Viewer = allocscreen(Source->width, Source->height, Source->pixelformat); clearscreen(Viewer); bothkeys = bothnewkeys = 0; while(!done) { copyScreens(Viewer); //inputrefresh(); refreshInput(); printText((isWide ? 410 : 250), 3, RED, 0, 0, "Quit : 1/B"); if(buttonsPressed & (WIIMOTE_1|CC_B|GC_B)) done = 1; if(logfile[i].ready) { printText(5, 3, RED, 0, 0, "OpenBorLog.txt"); if(buttonsHeld & DIR_UP) --logfile[i].line; if(buttonsHeld & DIR_DOWN) ++logfile[i].line; if(buttonsHeld & DIR_LEFT) logfile[i].line = 0; if(buttonsHeld & DIR_RIGHT) logfile[i].line = logfile[i].rows - (LOG_SCREEN_END - LOG_SCREEN_TOP); if(logfile[i].line > logfile[i].rows - (LOG_SCREEN_END - LOG_SCREEN_TOP) - 1) logfile[i].line = logfile[i].rows - (LOG_SCREEN_END - LOG_SCREEN_TOP) - 1; if(logfile[i].line < 0) logfile[i].line = 0; for(l=LOG_SCREEN_TOP, j=logfile[i].line; j<logfile[i].rows-1; l++, j++) { if(l<LOG_SCREEN_END) { char textpad[480] = {""}; for(k=0; k<480; k++) { if(!logfile[i].buf->ptr[logfile[i].pos[j]+k]) break; textpad[k] = logfile[i].buf->ptr[logfile[i].pos[j]+k]; } if(logfile[i].rows>0xFFFF) printText(5, l*10, WHITE, 0, 0, "0x%08x: %s", j, textpad); else printText(5, l*10, WHITE, 0, 0, "0x%04x: %s", j, textpad); } else break; } } else if(i == SCRIPT_LOG) printText(5, 3, RED, 0, 0, "Log NOT Found: ScriptLog.txt"); else printText(5, 3, RED, 0, 0, "Log NOT Found: OpenBorLog.txt"); drawScreens(NULL, 0, 0); } freescreen(&Viewer); Viewer = NULL; drawMenu(); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Draw the whole video with query running message: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void drawQueryRunning(){ oslStartDrawing(); drawCommonGraphics(); drawButtonBar(MODE_MEDIA_LIBRARY); drawMenu(&commonMenu); drawMLinfo(); drawWait(langGetString("QUERY_RUNNING_TITLE"), langGetString("QUERY_RUNNING")); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); }
/*will update info on a screen. Uses WorkMode*/ inline void updateDisplay(){ switch (workMode){ case 0: case 2: drawTemperature(); break; case 1: displayClear(); drawMenu(); break; } }
void displayConfigure(void) { char message[] = "Press a key for this action!"; drawGuiBackground(); drawGuiLogo(); drawMenu(gScreen); rasonly(gScreen); glColor3f(1.0, 1.0, 1.0); drawText(guiFtx, gScreen->vp_w / 6, 20, gScreen->vp_w / (6.0f / 4.0f * strlen(message)), message); SystemSwapBuffers(); }
void run() { initDisplay(); touch->initialize(); drawMenu(); for(;;){ processEvents(); } }
void MenuState::stateRender(){ SDL_SetRenderDrawColor(gRenderer, 0xFF, 0xFF, 0xFF, 0xFF); SDL_RenderClear(gRenderer); drawMenu(); for (int index = 0; index < 3; index++) { currentSprite = index; if (hover[index]) { currentSprite += 3; } boardButtons[index].render(currentSprite); } }
void displayConfigure() { char message[] = "Press a key for this action!"; drawGuiBackground(); if(!game->settings->softwareRendering) drawGuiLogo(); drawMenu(game->screen); rasonly(game->screen); glColor3f(1.0, 1.0, 1.0); drawText(guiFtx, game->screen->vp_w / 6, 20, game->screen->vp_w / (6.0 / 4.0 * strlen(message)), message); SystemSwapBuffers(); }
void displayTport() { char message[] = "Enter port of tracker ..."; drawGuiBackground(); if(!game->settings->softwareRendering) drawGuiLogo(); drawMenu(game->screen); rasonly(game->screen); glColor3f(1.0, 1.0, 1.0); drawText(guiFtx, game->screen->vp_w / 6, 20, game->screen->vp_w / (6.0 / 4.0 * strlen(message)), message); SystemSwapBuffers(); }
void Application::run() { sf::Sprite drawing_sprite; sf::Vector2i mouse; Resource *res = Resource::GetInstance(); while (m_window->isOpen()) { while (m_window->pollEvent(m_event)) { handleEvent(); } m_window->clear(); mouse = sf::Mouse::getPosition(*m_window); switch (m_state) { case SET_START: drawing_sprite = res->getSprite(Resource::SPR_START); drawing_sprite.setPosition((float)(mouse.x / SQUARE_SIZE) * SQUARE_SIZE, (float)(mouse.y / SQUARE_SIZE) * SQUARE_SIZE); m_window->draw(drawing_sprite); break; case SET_FINISH: drawing_sprite = res->getSprite(Resource::SPR_FINISH); drawing_sprite.setPosition((float)(mouse.x / SQUARE_SIZE) * SQUARE_SIZE, (float)(mouse.y / SQUARE_SIZE) * SQUARE_SIZE); m_window->draw(drawing_sprite); break; case SET_COLLIDER: drawing_sprite = res->getSprite(Resource::SPR_COLLIDER); drawing_sprite.setPosition((float)(mouse.x / SQUARE_SIZE) * SQUARE_SIZE, (float)(mouse.y / SQUARE_SIZE) * SQUARE_SIZE); m_window->draw(drawing_sprite); } if (!m_pause) { m_level->tick(*m_window); //calculating and moving A* m_pause = true; } m_level->draw(*m_window, (m_state == SET_COLLIDER) ? true : false); if (m_drawMenu) { drawMenu(); } m_window->display(); sf::sleep(sf::milliseconds(10)); } }
void drawGUI(void) { //make main border with title box(stdscr,0,0); move(0,1); wprintw(stdscr,"ASIM Tester %s",SDM_VERSION); w_menu = subwin(stdscr,MENU_HEIGHT,MENU_WIDTH,1,1); w_out = subwin(stdscr,LINES-2,COLS-2-MENU_WIDTH,1,MENU_WIDTH+1); w_in = subwin(stdscr,LINES-2-MENU_HEIGHT,MENU_WIDTH,MENU_HEIGHT+1,1); drawInput(); drawOutput(); drawMenu(); wrefresh(stdscr); }
/** * Render the game on the screen */ void Game::renderGame() { //Clear the screen _graphic.clearWindow(); //Draw the screen's content based on the game state if (_gameState == GameState::MENU) { drawMenu(); } else { drawGame(); } //Refresh screen _graphic.refreshWindow(); }