void intro_display() { std::ifstream Art ("art.txt"); std::ifstream Intro("intro.txt"); std::ifstream Banner("banner.txt"); displaytext(Art); displaytext_delay(Intro); displaytext(Banner); Art.close(); Intro.close(); }
int showmenu(const int score) { char scorestring[12] = ""; SDL_Event event; snprintf(scorestring, sizeof scorestring, "%d", score); displaytext(scorestring); while (1) { if (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) return 0; if (event.type != SDL_KEYDOWN) continue; if (event.key.keysym.sym == SDLK_ESCAPE) return 0; if (event.key.keysym.sym != SDLK_SPACE && event.key.keysym.sym != SDLK_RETURN) { continue; } break; } else SDL_Delay(10); } clearscreen(); return 1; }
void clearDisplay(int num){ if(num==0) clear(); else{ clear(); std::ifstream banner ("banner.txt"); displaytext(banner);} refresh(); }
void cps2_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh) { static int qcode; int stop=0; int oldq=qcode; int i,offset; if (cps1_palette) { for (i=0; i<cps1_palette_size; i+=2) { int color=0x0fff+((i&0x0f)<<(8+4)); WRITE_WORD(&cps1_palette[i],color); } } /* Get video memory base registers */ cps1_get_video_base(); cps1_build_palette(); for (i = offset = 0; i < cps1_palette_entries; i++) { int j; for (j = 0; j < 15; j++) { palette_used_colors[offset++] = PALETTE_COLOR_USED; } palette_used_colors[offset++] = PALETTE_COLOR_TRANSPARENT; } palette_recalc (); cps1_debug_tiles(bitmap); if (keyboard_pressed_memory(KEYCODE_UP)) qcode++; if (keyboard_pressed_memory(KEYCODE_DOWN)) qcode--; qcode &= 0xffff; if (keyboard_pressed_memory(KEYCODE_ENTER)) stop=0xff; if (qcode != oldq) { int mode=0; cps2_qsound_sharedram_w(0x1ffa, 0x0088); cps2_qsound_sharedram_w(0x1ffe, 0xffff); cps2_qsound_sharedram_w(0x00, 0x0000); cps2_qsound_sharedram_w(0x02, qcode); cps2_qsound_sharedram_w(0x06, 0x0000); cps2_qsound_sharedram_w(0x08, 0x0000); cps2_qsound_sharedram_w(0x0c, mode); cps2_qsound_sharedram_w(0x0e, 0x0010); cps2_qsound_sharedram_w(0x10, 0x0000); cps2_qsound_sharedram_w(0x12, 0x0000); cps2_qsound_sharedram_w(0x14, 0x0000); cps2_qsound_sharedram_w(0x16, 0x0000); cps2_qsound_sharedram_w(0x18, 0x0000); cps2_qsound_sharedram_w(0x1e, 0x0000); } { struct DisplayText dt[3]; char *instructions="PRESS: PGUP/PGDN=CODE 1=8x8 2=16x16 3=32x32 UP/DN=QCODE"; char text1[256]; sprintf(text1, "GFX CODE=%06x : QSOUND CODE=%04x", cps2_start, qcode ); dt[0].text = text1; dt[0].color = UI_COLOR_INVERSE; dt[0].x = (Machine->uiwidth - Machine->uifontwidth * strlen(text1)) / 2; dt[0].y = 8*23; dt[1].text = instructions; dt[1].color = UI_COLOR_NORMAL; dt[1].x = (Machine->uiwidth - Machine->uifontwidth * strlen(instructions)) / 2; dt[1].y = dt[0].y+2*Machine->uifontheight; dt[2].text = 0; /* terminate array */ displaytext(Machine->scrbitmap,dt,0,0); } }
static void zn_vh_screenrefresh( struct osd_bitmap *bitmap, int full_refresh ) { int refresh = full_refresh; if( queue_len == 0 ) { if( keyboard_pressed_memory( KEYCODE_UP ) ) { qcode=( qcode & 0xff00 ) | ( ( qcode + 0x0001 ) & 0xff ); } if( keyboard_pressed_memory( KEYCODE_DOWN ) ) { qcode=( qcode & 0xff00 ) | ( ( qcode - 0x0001 ) & 0xff ); } if( keyboard_pressed_memory( KEYCODE_RIGHT ) ) { qcode=( ( qcode + 0x0100 ) & 0xff00 ) | ( qcode & 0xff ); } if( keyboard_pressed_memory( KEYCODE_LEFT ) ) { qcode=( ( qcode - 0x0100 ) & 0xff00 ) | ( qcode & 0xff ); } if( qcode != qcode_last ) { qsound_queue_w( 0, qcode ); qcode_last = qcode; refresh = 1; } } if( refresh ) { struct DisplayText dt[ 4 ]; char text1[ 256 ]; char text2[ 256 ]; char text3[ 256 ]; strcpy( text1, Machine->gamedrv->description ); if( strlen( text1 ) > Machine->uiwidth / Machine->uifontwidth ) { text1[ Machine->uiwidth / Machine->uifontwidth ] = 0; } sprintf( text2, "QSOUND CODE=%02x/%02x", qcode >> 8, qcode & 0xff ); if( strlen( text2 ) > Machine->uiwidth / Machine->uifontwidth ) { text2[ Machine->uiwidth / Machine->uifontwidth ] = 0; } strcpy( text3, "SELECT WITH RIGHT&LEFT/UP&DN" ); if( strlen( text3 ) > Machine->uiwidth / Machine->uifontwidth ) { text3[ Machine->uiwidth / Machine->uifontwidth ] = 0; } dt[ 0 ].text = text1; dt[ 0 ].color = UI_COLOR_NORMAL; dt[ 0 ].x = ( Machine->uiwidth - Machine->uifontwidth * strlen( dt[ 0 ].text ) ) / 2; dt[ 0 ].y = Machine->uiheight - Machine->uifontheight * 5; dt[ 1 ].text = text2; dt[ 1 ].color = UI_COLOR_NORMAL; dt[ 1 ].x = ( Machine->uiwidth - Machine->uifontwidth * strlen( dt[ 1 ].text ) ) / 2; dt[ 1 ].y = Machine->uiheight - Machine->uifontheight * 3; dt[ 2 ].text = text3; dt[ 2 ].color = UI_COLOR_NORMAL; dt[ 2 ].x = ( Machine->uiwidth - Machine->uifontwidth * strlen( dt[ 2 ].text ) ) / 2; dt[ 2 ].y = Machine->uiheight - Machine->uifontheight * 1; dt[ 3 ].text = 0; /* terminate array */ displaytext( Machine->scrbitmap, dt, 0, 0 ); } }
/*************************************************************************** This function takes care of refreshing the screen, processing user input, and throttling the emulation speed to obtain the required frames per second. ***************************************************************************/ int updatescreen(void) { static int framecount = 0; /* read hi scores from disk */ if (hiscoreloaded == 0 && *gamedrv->hiscore_load) hiscoreloaded = (*gamedrv->hiscore_load)(hiscorename); /* if the user pressed ESC, stop the emulation */ if (osd_key_pressed(OSD_KEY_ESC)) return 1; /* if the user pressed F3, reset the emulation */ if (osd_key_pressed(OSD_KEY_F3)) { /* write hi scores to disk */ if (hiscoreloaded != 0 && *gamedrv->hiscore_save) (*gamedrv->hiscore_save)(hiscorename); hiscoreloaded = 0; return 2; } if (osd_key_pressed(OSD_KEY_F9)) { if (++VolumePTR > 4) VolumePTR = 0; ActualVolume = VolumiDefault[VolumePTR]; osd_set_mastervolume(ActualVolume); while (osd_key_pressed(OSD_KEY_F9)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } } if (osd_key_pressed(OSD_KEY_P)) /* pause the game */ { struct DisplayText dt[2]; int key; dt[0].text = "PAUSED"; dt[0].color = gamedrv->paused_color; dt[0].x = gamedrv->paused_x; dt[0].y = gamedrv->paused_y; dt[1].text = 0; displaytext(dt,0); osd_set_mastervolume(0); while (osd_key_pressed(OSD_KEY_P)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } /* wait for key release */ do { key = osd_read_key(); if (key == OSD_KEY_ESC) return 1; else if (key == OSD_KEY_TAB) { if (setdipswitches()) return 1; (*drv->vh_update)(Machine->scrbitmap); /* redraw screen */ displaytext(dt,0); } } while (key != OSD_KEY_P); while (osd_key_pressed(key)); osd_set_mastervolume(ActualVolume); } /* if the user pressed TAB, go to dipswitch setup menu */ if (osd_key_pressed(OSD_KEY_TAB)) { osd_set_mastervolume(0); while (osd_key_pressed(OSD_KEY_TAB)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } if (setdipswitches()) return 1; osd_set_mastervolume(ActualVolume); } /* if the user pressed F8, go to keys setup menu */ if (osd_key_pressed(OSD_KEY_F8)) { osd_set_mastervolume(0); while (osd_key_pressed(OSD_KEY_F8)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } if (setkeysettings()) return 1; osd_set_mastervolume(ActualVolume); } /* if the user pressed F4, show the character set */ if (osd_key_pressed(OSD_KEY_F4)) { osd_set_mastervolume(0); while (osd_key_pressed(OSD_KEY_F4)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } if (showcharset()) return 1; osd_set_mastervolume(ActualVolume); } if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } if (++framecount > frameskip) { static int showfps,f11pressed; static int throttle = 1,f10pressed; uclock_t curr,mtpf; #define MEMORY 10 static uclock_t prev[MEMORY]; static int i,fps; framecount = 0; if (osd_key_pressed(OSD_KEY_F11)) { if (f11pressed == 0) { showfps ^= 1; if (showfps == 0) clearbitmap(Machine->scrbitmap); } f11pressed = 1; } else f11pressed = 0; if (osd_key_pressed(OSD_KEY_F10)) { if (f10pressed == 0) throttle ^= 1; f10pressed = 1; } else f10pressed = 0; (*drv->vh_update)(Machine->scrbitmap); /* update screen */ if (showfps) { drawgfx(Machine->scrbitmap,Machine->gfx[0],gamedrv->charset[(fps%1000)/100],gamedrv->white_text,0,0,0,0,0,TRANSPARENCY_NONE,0); drawgfx(Machine->scrbitmap,Machine->gfx[0],gamedrv->charset[(fps%100)/10],gamedrv->white_text,0,0,Machine->gfx[0]->width,0,0,TRANSPARENCY_NONE,0); drawgfx(Machine->scrbitmap,Machine->gfx[0],gamedrv->charset[fps%10],gamedrv->white_text,0,0,2*Machine->gfx[0]->width,0,0,TRANSPARENCY_NONE,0); } osd_update_display(); osd_poll_joystick(); /* now wait until it's time to trigger the interrupt */ do { curr = uclock(); } while (video_sync == 0 && throttle != 0 && (curr - prev[i]) < (frameskip+1) * UCLOCKS_PER_SEC/drv->frames_per_second); i = (i+1) % MEMORY; mtpf = ((curr - prev[i])/(MEMORY))/2; if (mtpf) fps = (UCLOCKS_PER_SEC+mtpf)/2/mtpf; prev[i] = curr; } return 0; }
int vh_open(void) { int i; unsigned char pens[MAX_COLORS]; const unsigned char *palette,*colortable; unsigned char convpalette[3 * MAX_COLORS]; unsigned char convtable[MAX_COLOR_TUPLE*MAX_COLOR_CODES]; struct DisplayText dt[2]; if ((Machine->scrbitmap = osd_create_display(drv->screen_width,drv->screen_height)) == 0) return 1; if (drv->vh_convert_color_prom) { (*drv->vh_convert_color_prom)(convpalette,convtable,gamedrv->color_prom); palette = convpalette; colortable = convtable; } else { palette = gamedrv->palette; colortable = gamedrv->colortable; } for (i = 0;i < drv->total_colors;i++) pens[i] = osd_obtain_pen(palette[3*i],palette[3*i+1],palette[3*i+2]); Machine->background_pen = pens[0]; for (i = 0;i < drv->color_table_len;i++) remappedtable[i] = pens[colortable[i]]; for (i = 0;i < MAX_GFX_ELEMENTS;i++) Machine->gfx[i] = 0; for (i = 0;i < MAX_GFX_ELEMENTS && drv->gfxdecodeinfo[i].memory_region != -1;i++) { if ((Machine->gfx[i] = decodegfx(Machine->memory_region[drv->gfxdecodeinfo[i].memory_region] + drv->gfxdecodeinfo[i].start, drv->gfxdecodeinfo[i].gfxlayout)) == 0) { vh_close(); return 1; } Machine->gfx[i]->colortable = &remappedtable[drv->gfxdecodeinfo[i].color_codes_start]; Machine->gfx[i]->total_colors = drv->gfxdecodeinfo[i].total_color_codes; } /* free the graphics ROMs, they are no longer needed */ free(Machine->memory_region[1]); Machine->memory_region[1] = 0; dt[0].text = "PLEASE DO NOT DISTRIBUTE THE SOURCE CODE AND OR THE EXECUTABLE " "APPLICATION WITH ANY ROM IMAGES\n" "DOING AS SUCH WILL HARM ANY FURTHER DEVELOPMENT OF MAME AND COULD " "RESULT IN LEGAL ACTION BEING TAKEN BY THE LAWFUL COPYRIGHT HOLDERS " "OF ANY ROM IMAGES\n\n" "IF YOU DO NOT AGREE WITH THESE CONDITIONS THEN PLEASE PRESS ESC NOW"; dt[0].color = gamedrv->paused_color; dt[0].x = 0; dt[0].y = 0; dt[1].text = 0; displaytext(dt,0); i = osd_read_key(); while (osd_key_pressed(i)); /* wait for key release */ if (i == OSD_KEY_ESC) return 1; clearbitmap(Machine->scrbitmap); /* initialize the bitmap to the correct background color */ osd_update_display(); return 0; }
void credits2(void) { int i, ch; int p; int plast = -1; clrscr(); centerprint(aa_imgwidth(context) / 2, aa_imgheight(context) / 3, 3, 128, "The", 0); centerprint(aa_imgwidth(context) / 2, 2 * aa_imgheight(context) / 3, 3, 128, "END", 0); drawptr = decrand; params->randomval = 50; timestuff(0, NULL, draw, 5000000); drawptr = NULL; params->randomval = 0; drawptr = pryc; timestuff(0, NULL, draw, MAXTIME); drawptr = NULL; clrscr(); draw(); load_song("bb3.s3m"); bbupdate(); starttime = endtime = TIME; play(); bbwait(1); for (i = 0; i < LOGOHEIGHT; i++) { aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i, AA_BOLD, "8 8"); if (i) aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i - 1, AA_NORMAL, "8 8"); bbflushwait(100000); } aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i - 1, AA_NORMAL, "8 8"); #define LWIDTH for (i = aa_scrwidth(context) / 2; i; i--) { display8(); displaya(i); bbflushwait(10000); } for (; i < 100; i++) { textclrscr(); displaya(10 * sin(i * M_PI / 100)); display8(); bbflushwait(10000); } aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_DIM, "<PROJECT><PROJECT>"); bbflushwait(100000); aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_NORMAL, "<PROJECT><PROJECT>"); bbflushwait(100000); aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_BOLD, "<PROJECT><PROJECT>"); bbflushwait(100000); aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_NORMAL, "<PROJECT><PROJECT>"); bbflushwait(100000); bbwait(1000000); for (i = LOGOY; i > 1; i--) { textclrscr(); displogo(i); bbflushwait(30000); } source = malloc(aa_imgwidth(context) * (aa_imgheight(context))); target = malloc(aa_imgwidth(context) * (aa_imgheight(context))); params->dither = AA_NONE; format(dual ? aa_scrwidth(context) / 2 : aa_scrwidth(context)); p = 0; while (1) { if (p != plast) { getsource(); displaytext(p); gettarget(); morph(); displaytext(p); aa_flush(context); emscripten_sleep(1); plast = p; } again: emscripten_sleep(100); #ifndef __DJGPP__ //ch = aa_getkey(context, 100); ch = AA_NONE; #else while ((ch = bbupdate()) == AA_NONE) ; #endif switch (ch) { case '1': load_song("bb.s3m"); bbupdate(); play(); break; case '2': load_song("bb2.s3m"); bbupdate(); play(); break; case '3': load_song("bb3.s3m"); bbupdate(); play(); break; case 'b': case 'k': case 'B': case 'K': case AA_BACKSPACE: case AA_UP: p -= (aa_scrheight(context) - YSTART) / 2 * (dual + 1); if (p < 0) p = 0; break; case AA_DOWN: case AA_LEFT: case 'f': case 'F': case ' ': case 'j': case 'J': p += (aa_scrheight(context) - YSTART) / 2 * (dual + 1); if (p > textsize) p = textsize; break; case 'q': case 'Q': case AA_ESC: finish_stuff = 0; backconvert(0, 0, aa_scrwidth(context), aa_scrheight(context)); bbupdate(); starttime = endtime = TIME; drawptr = decbright; timestuff(0, NULL, draw, 1000000); textclrscr(); drawptr = NULL; aa_flush(context); emscripten_sleep(1); free(source); free(target); return; default: goto again; } bbupdate(); starttime = endtime = TIME; } }