void drawbox(char **lines) { int x = 28; int y = 64; int i,numlines = 0; //count number of lines for(i=0;lines[i+1];i++) numlines++; //clear screen memset(nesscr,0,256*240); //draw window gui_draw_window(lines[0],x,y,256-60,11 + (numlines * 6)); //draw text for(i=1;lines[i];i++) gui_draw_text(GUI_TEXT,x + 2,y + 4 + (i * 6),lines[i]); //copy old screen for neat background video_copyscreen(); //update screen video_update(nesscr,256+8); #ifdef PS2 //double buffered? video_update(nesscr,256+8); #endif }
//poll input for gui2 void gui2_poll() { static u32 old_joy1 = 0; u32 new_joy1,joy1 = 0; //hack to make sure key isnt held down if(joykeys[config.gui_keys[0]]) joy1 |= INPUT_MENU; if(joykeys[config.gui_keys[1]]) joy1 |= INPUT_LOADSTATE; if(joykeys[config.gui_keys[2]]) joy1 |= INPUT_SAVESTATE; if(joykeys[config.gui_keys[4]]) joy1 |= INPUT_SCREENSHOT; new_joy1 = joy1 & ~old_joy1; old_joy1 = joy1; //end hack if(new_joy1 & INPUT_MENU) { //dont let user exit gui if rom is not loaded if((pce == 0) || (pce->rom == 0)) return; gui_active ^= 1; memset(gui_draw_getscreen(),GUI_COLOR_OFFSET,gui_draw_getscreenpitch()*gui_draw_getscreenheight()); if(gui_active == 0) sound_play(); else { sound_pause(); video_copyscreen(); } } else if(gui_active) return; else if(new_joy1 & INPUT_LOADSTATE) loadstate(); else if(new_joy1 & INPUT_SAVESTATE) savestate(); #ifdef SCREENSHOTS else if(new_joy1 & INPUT_SCREENSHOT)screenshot(); #endif }