Create Xref-Html Frames                    Remove All Frames
file:/home/jivera/wd/pcsx/Dreamcast/gui.c        (Tue Nov 25 22:46:14 2003 )


   1: #include <kos.h>
   2: #include "Dcast.h"
   3: #include "gui.h"
   4: #include "PlugCD.h"
   5: 
   6: const char* cd_start[] = {"Run CD", "Run CD (Bios)", "Run %s"};
   7: 
   8: static uint8 mcont = 0;
   9: int check_start() {
  10:         cont_cond_t cond;
  11: 
  12:         if (!mcont) {
  13:                 mcont = maple_first_controller();
  14:                 if (!mcont) { return -1; }
  15:         }
  16:         if (cont_get_cond(mcont, &cond)) { return -1; }
  17: 
  18:         if (!(cond.buttons & CONT_START)) {// exit
  19:                 return -1;
  20:         }
  21: 
  22:         if (!(cond.buttons & CONT_A)) { // start
  23:                 return 1;
  24:         }
  25: 
  26:         if (!(cond.buttons & CONT_Y)) { // config
  27:                 return 2;
  28:         }
  29: 
  30:         if (!(cond.buttons & CONT_X)) { // about
  31:                 return 3;
  32:         }
  33: 
  34:         return 0;
  35: }
  36: /*
  37: int check_start() {
  38:         MAPLE_FOREACH_BEGIN(MAPLE_FUNC_CONTROLLER, cont_state_t, st)
  39:                 if (st->buttons & CONT_START) {
  40:                         printf("Pressed start\n");
  41:                         return 1;
  42:                 }
  43:         MAPLE_FOREACH_END()
  44: 
  45:         return 0;
  46: }
  47: */
  48: 
  49: int check_about() {
  50:         cont_cond_t cond;
  51: 
  52:         if (!mcont) {
  53:                 mcont = maple_first_controller();
  54:                 if (!mcont) { return -1; }
  55:         }
  56:         if (cont_get_cond(mcont, &cond)) { return -1; }
  57: 
  58:         if (!(cond.buttons & CONT_START)) {// exit
  59:                 return -1;
  60:         }
  61: 
  62:         if (!(cond.buttons & CONT_B)) { // return
  63:                 return 1;
  64:         }
  65: 
  66:         return 0;
  67: }
  68: 
  69: void menu_about()
  70: {
  71:         int mloop = 0;
  72:         while (!mloop) {
  73:                 pvr_wait_ready();
  74:                 pvr_scene_begin();
  75:                 pvr_list_begin(PVR_LIST_OP_POLY);
  76: 
  77:                 /* Opaque list *************************************/
  78: //              bkg_render();
  79: 
  80:                 /* End of opaque list */
  81:                 pvr_list_finish();
  82:                 pvr_list_begin(PVR_LIST_TR_POLY);
  83: 
  84:                 /* Translucent list ********************************/
  85: 
  86:                 /* Top Banner */
  87:                 float x1 = (640.0f - strlen("Credits")*12.0) / 2, y1;
  88:                 
  89:                 draw_poly_strf(x1, 20.0f,100.0f,1.0f,1.0f,1.0f,1.0f, "Credits");
  90: 
  91:                 x1 = 30.0f; y1 = 56.0f;
  92:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"PCSX written by:");
  93:                 y1 += 28.0f;
  94:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"main coder: linuzappz");
  95:                 y1 += 28.0f;
  96:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"co-coders: shadow");
  97:                 y1 += 28.0f;
  98:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"ex-coders: Nocomp, Pete Bernett, nik3d");
  99:                 y1 += 28.0f;
 100:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"webmaster: AkumaX");
 101:                 y1 += 28.0f;
 102:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"Greets to: Duddie, Tratax, Kazzuya, JNS,");
 103:                 y1 += 28.0f;
 104:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"           Bobbi, Psychojak and Shunt");
 105:                 y1 += 28.0f;
 106:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"Special thanks to: Twin, Roor, calb, now3d,");
 107:                 y1 += 28.0f;
 108:                 draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"  Dan Potter and the other people from KOS");
 109: 
 110:                 draw_poly_strf(456.0f, 308.0f,100.0f,1.0f,1.0f,1.0f,1.0f, "B  Return");
 111:                 
 112:                 /* End of translucent list */
 113:                 pvr_list_finish();
 114: 
 115:                 /* Finish the frame *******************************/
 116:                 pvr_scene_finish();
 117:                 
 118:                 mloop = check_about();
 119:         }
 120: }
 121: 
 122: /* Draws the top banner (pvr_list_begin(PVR_LIST_TR_POLY) already called) */
 123: void render_top(char *title)
 124: {
 125:         float x1 = (640.0f - strlen(title)*12.0) / 2;
 126: 
 127:         /* Top Banner */
 128:         draw_poly_box(0.0f, 10.0f, 640.0f, 20.0f+(24.0f*1.0f)+10.0f, 90.0f, 
 129:                 0.3f, 0.2f, 0.5f, 0.0f, 0.5f, 0.1f, 0.8f, 0.2f);
 130: 
 131:         draw_poly_strf(x1, 20.0f,100.0f,1.0f,1.0f,1.0f,1.0f, title);
 132: }
 133: 
 134: void render_startmenu()
 135: {
 136:         float x1 = 400.0f, y1 = 252.0f;
 137:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"A  Start");
 138:         y1 += 28.0f;
 139:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"Y  Configuration");
 140:         y1 += 28.0f;
 141:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"X  About");
 142: }
 143: 
 144: void render_bottom()
 145: {
 146:         /* Configuration Information */
 147:         draw_poly_box(20.0f, 440.0f-96.0f+4, 640.0f-20.0f, 440.0f, 90.0f, 
 148:                 0.3f, 0.2f, 0.5f, 0.0f, 0.5f, 0.1f, 0.8f, 0.2f);
 149:                 
 150:         draw_poly_strf(30.0f,440.0f-96.0f+6,            100.0f,1.0f,1.0f,1.0f,1.0f,"Configuration");
 151:         draw_poly_strf(30.0f,440.0f-96.0f+6+24.0f+10.0f,100.0f,1.0f,1.0f,1.0f,1.0f,"Start: %s", cd_start[0]);
 152:         draw_poly_strf(320.0f,440.0f-96.0f+6+24.0f+10.0f,100.0f,1.0f,1.0f,1.0f,1.0f,"Memcards: ");
 153:         draw_poly_strf(30.0f,440.0f-96.0f+6+48.0f+10.0f,100.0f,1.0f,1.0f,1.0f,1.0f,"BIOS:  %s", Config.Bios);
 154:         draw_poly_strf(320.0f,440.0f-96.0f+6+48.0f+10.0f,100.0f,1.0f,1.0f,1.0f,1.0f,"CDROM: %s", CDConfiguration.fn);
 155: }
 156: 
 157: void menu_start()
 158: {
 159:         framecnt = 0;
 160:         int mloop = 0;
 161:         while (!mloop) {
 162:                 pvr_wait_ready();
 163:                 pvr_scene_begin();
 164:                 pvr_list_begin(PVR_LIST_OP_POLY);
 165: 
 166:                 /* Opaque list *************************************/
 167: //              bkg_render();
 168: 
 169:                 /* End of opaque list */
 170:                 pvr_list_finish();
 171:                 pvr_list_begin(PVR_LIST_TR_POLY);
 172: 
 173:                 /* Translucent list ********************************/
 174: 
 175:                 /* Top Banner */
 176:                 render_top("PcSX Version " PCSX_VERSION);
 177: 
 178:                 render_startmenu();
 179: 
 180:                 render_bottom();
 181:                 
 182:                 /* End of translucent list */
 183:                 pvr_list_finish();
 184: 
 185:                 /* Finish the frame *******************************/
 186:                 pvr_scene_finish();
 187:                 
 188:                 mloop = check_start();
 189:                 switch (mloop) {
 190:                         case 1: break;  // start
 191:                         case 2: menu_config(); mloop = 0; break;
 192:                         case 3: menu_about(); mloop = 0; break;
 193:                 }
 194:         }
 195: }
 196: 
 197: void gui_disclaimer()
 198: {
 199:         pvr_wait_ready();
 200:         pvr_scene_begin();
 201:         pvr_list_begin(PVR_LIST_OP_POLY);
 202: 
 203:         /* Opaque list *************************************/
 204: //              bkg_render();
 205: 
 206:         /* End of opaque list */
 207:         pvr_list_finish();
 208:         pvr_list_begin(PVR_LIST_TR_POLY);
 209: 
 210:         /* Translucent list ********************************/
 211: 
 212:         float x1 = 20.0f, y1 = 56.0f;
 213:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"This program was not actually produced by");
 214:         y1 += 28.0f;
 215:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"or under license from Sega Enterprises(tm).");
 216:         y1 += 28.0f;
 217:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"It was produced using KallistiOS from");
 218:         y1 += 28.0f;
 219:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"Cryptic Allusion. For more information,");
 220:         y1 += 28.0f;
 221:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"please visit");
 222:         y1 += 56.0f;
 223:         draw_poly_strf(x1,y1,100.0f,1.0f,1.0f,1.0f,1.0f,"       http://dcdev.allusion.net/");
 224:                 
 225:         /* End of translucent list */
 226:         pvr_list_finish();
 227:         pvr_scene_finish();
 228: 
 229:     pvr_wait_ready();   /* Flip screen to first buffer */
 230:     pvr_scene_begin();
 231:     pvr_scene_finish();
 232:         
 233: }
 234: /* arch-tag: Matthew Dempsky Wed Oct 15 10:34:23 CST 2003 (Dreamcast/gui.c)
 235:  */
 236: 








































Html form generated by Xrefactory version 1.6.4 on Fri Dec 12 20:52:56 2003
Trial version.