static void drawPluginProgress(const Common::String &filename) { ta_sync(); void *mark = ta_txmark(); const char *fn = filename.c_str(); Label lab1, lab2, lab3; char buf[32]; unsigned memleft = 0x8cf00000-((unsigned)sbrk(0)); float ffree = memleft*(1.0/(16<<20)); int fcol = (memleft < (1<<20)? 0xffff0000: (memleft < (4<<20)? 0xffffff00: 0xff00ff00)); snprintf(buf, sizeof(buf), "%dK free memory", memleft>>10); if (fn[0] == '/') fn++; lab1.create_texture("Loading plugins, please wait..."); lab2.create_texture(fn); lab3.create_texture(buf); ta_begin_frame(); draw_solid_quad(80.0, 270.0, 560.0, 300.0, 0xff808080, 0xff808080, 0xff808080, 0xff808080); draw_solid_quad(85.0, 275.0, 555.0, 295.0, 0xff202020, 0xff202020, 0xff202020, 0xff202020); draw_solid_quad(85.0, 275.0, 85.0+470.0*ffree, 295.0, fcol, fcol, fcol, fcol); ta_commit_end(); lab1.draw(100.0, 150.0, 0xffffffff); lab2.draw(100.0, 190.0, 0xffaaffaa); lab3.draw(100.0, 230.0, 0xffffffff); ta_commit_frame(); ta_sync(); ta_txrelease(mark); }
void waitForDisk() { Label lab; int wasopen = 0; ta_sync(); void *mark = ta_txmark(); lab.create_texture("Please insert game CD."); //printf("waitForDisk, cdstate = %d\n", getCdState()); for (;;) { int s = getCdState(); if (s >= 6) wasopen = 1; if (s > 0 && s < 6 && wasopen) { cdfs_reinit(); chdir("/"); chdir("/"); ta_sync(); ta_txrelease(mark); return; } ta_begin_frame(); drawBackground(); ta_commit_end(); lab.draw(166.0, 200.0, 0xffff2020); ta_commit_frame(); int mousex = 0, mousey = 0; byte shiftFlags; int mask = getimask(); setimask(15); handleInput(locked_get_pads(), mousex, mousey, shiftFlags); setimask(mask); } }
int gameMenu(Game *games, int num_games) { int top_game = 0, selector_pos = 0; int mousex = 0, mousey = 0; float y; if (!num_games) return -1; for (;;) { if (getCdState()>=6) return -1; ta_begin_frame(); drawBackground(); ta_commit_end(); y = 40.0; for (int i=top_game, cnt=0; cnt<10 && i<num_games; i++, cnt++) { int pal = 48+(i&15); if (cnt == selector_pos) draw_trans_quad(100.0, y, 590.0, y+32.0, 0x7000ff00, 0x7000ff00, 0x7000ff00, 0x7000ff00); games[i].icon.setPalette(pal); drawGameLabel(games[i], pal, 50.0, y, (cnt == selector_pos? 0xffff00 : 0xffffff)); y += 40.0; } ta_commit_frame(); byte shiftFlags; int event; int mask = getimask(); setimask(15); event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags); setimask(mask); if (event==-Common::EVENT_LBUTTONDOWN || event==Common::KEYCODE_RETURN || event==Common::KEYCODE_F5) { int selected_game = top_game + selector_pos; for (int fade=0; fade<=256; fade+=4) { ta_begin_frame(); drawBackground(); ta_commit_end(); y = 40.0; if (fade < 256) for (int i=top_game, cnt=0; cnt<10 && i<num_games; i++, cnt++, y += 40.0) if (cnt != selector_pos) drawGameLabel(games[i], 48+(i&15), 50.0, y, 0xffffff, fade); y = (40.0/256.0 * (selector_pos + 1))*(256-fade) + 80.0/256.0*fade; float x = 50.0/256.0*(256-fade) + 160.0/256.0*fade; float scale = 1.0+9.0/256.0*fade; drawGameLabel(games[selected_game], 48+(selected_game&15), x, y, 0xffff00, 0, scale); ta_commit_frame(); } return selected_game; } if (mousey>=16) { if (selector_pos + top_game + 1 < num_games) if (++selector_pos >= 10) { --selector_pos; ++top_game; } mousey -= 16; } else if (mousey<=-16) { if (selector_pos + top_game > 0) if (--selector_pos < 0) { ++selector_pos; --top_game; } mousey += 16; } } }