Advertisement
ccli

Untitled

Jan 16th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.73 KB | None | 0 0
  1. //ADD THIS IN GUI.H
  2.  
  3. void drawInfoMenu()
  4. {
  5.   char playerName[]={"ASH"};
  6.   int winNum=10;
  7.   int lostNum=5;
  8.  
  9.  
  10.   String winOut;
  11.   winOut = winNum;
  12.   String lostOut;
  13.   lostOut = lostNum;
  14.  
  15.   EsploraTFT.setTextSize(1);
  16.   EsploraTFT.stroke(255, 255, 255);
  17.   EsploraTFT.text(playerName,10,10);
  18.   EsploraTFT.text("Battles",10,20);
  19.   EsploraTFT.text("won:",10,30);
  20.   EsploraTFT.text(winOut.c_str(),35,30);
  21.   EsploraTFT.text("lost:",10,40);
  22.   EsploraTFT.text(lostOut.c_str(),40,40);
  23.  
  24.   //if you are using starterPokemon in globals using the code below
  25.   //String pokemons[6]={starterPokemon[0].name,starterPokemon[1].name,starterPokemon[2].name,starterPokemon[3].name,starterPokemon[4].name,starterPokemon[5].name};
  26.  
  27.  
  28.   int levels[6]={1,22,3,4,5,6};
  29.   //I initialize some pokemons, which you can put your start pokemon here
  30.  
  31.  
  32.  
  33.   String pokemon_data[6];
  34.  
  35.   int yPos=10;
  36.   String pokemons[6];
  37.   TypeID type[6];
  38.  
  39.  
  40.   //PRINT OUT PLAYER AND POKEMON INFORMATION
  41.   for(int i=0;i<6;++i)
  42.   {
  43.    
  44.     pokemon_data[i] =loadData(startPokemonID[i]-1, ' ', 40, "pokedex.TXT");
  45.     type[i]=getType(pokemon_data[i]);
  46.     pokemons[i]= getName(pokemon_data[i]);
  47.  
  48.  
  49.     switch(type[i])
  50.     {
  51.       case POISON:
  52.         EsploraTFT.stroke(130,0,75); break;//indigo
  53.       case NORMAL:
  54.         EsploraTFT.stroke(130,255,255); break;//white
  55.       case GRASS:
  56.         EsploraTFT.stroke(0,255,0); break;//green
  57.       case FIRE:
  58.         EsploraTFT.stroke(0,0,255); break;//red
  59.       case ELECTRIC:
  60.         EsploraTFT.stroke(0,255,255); break;//yellow
  61.       case GROUND:
  62.         EsploraTFT.stroke(65,77,90); break;//ground brown
  63.       case ROCK:
  64.         EsploraTFT.stroke(98,98,98); break;//dark grey
  65.       case ICE:
  66.         EsploraTFT.stroke(230,224,176); break;//light blue
  67.       case FIGHTING:
  68.         EsploraTFT.stroke(48,48,129); break;//dark red
  69.       case PSYCHIC:
  70.         EsploraTFT.stroke(0,204,204); break;//greenish yellow
  71.       case BUG:
  72.         EsploraTFT.stroke(102,255,102); break;//light green
  73.       case DRAGON:
  74.         EsploraTFT.stroke(0,0,102);break; //dark red
  75.       case GHOST:
  76.         EsploraTFT.stroke(128,128,128); break;//grey
  77.       case WATER:
  78.         EsploraTFT.stroke(0,0,255); break;//blue
  79.  
  80.     }
  81.    
  82.     EsploraTFT.text(pokemons[i].c_str(),65,yPos);
  83.  
  84.     int instLen=strlen(pokemons[i].c_str())*6;
  85.     int xPos=80+instLen;
  86.     String levelOut;
  87.     levelOut=levels[i];
  88.     EsploraTFT.stroke(255, 255, 255);
  89.     EsploraTFT.text("Lv",xPos-9,yPos);
  90.     EsploraTFT.text(levelOut.c_str(),xPos+4,yPos);
  91.    
  92.     yPos+=20;
  93.   }
  94.  
  95.   EsploraTFT.rect(6,6, 48, 45);
  96.  
  97.   EsploraTFT.rect(55,6, 104, 120);
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104. }
  105.  
  106. void infoMenuCursor()
  107. {
  108.  
  109.   static int cursorRow=10;
  110.   // save the height of the screen
  111.   int myHeight = EsploraTFT.height();
  112.   // map the paddle's location to the joystick's position
  113.   int yAxis = map(Esplora.readJoystickY(), -512, 512, 0, myHeight);
  114.  
  115.   EsploraTFT.stroke(0,0,0);
  116.   EsploraTFT.text(">",57,cursorRow);
  117.  
  118.   EsploraTFT.stroke(255,255,255);
  119.   EsploraTFT.text(">",57,cursorRow);
  120.    
  121.     if(yAxis>80 && cursorRow<110)
  122.     {
  123.       EsploraTFT.stroke(0,0,0);
  124.       EsploraTFT.text(">",57,cursorRow);
  125.       cursorRow+=20;
  126.        
  127.       EsploraTFT.stroke(255,255,255);
  128.       EsploraTFT.text(">",57,cursorRow);
  129.       delay(100);
  130.     }
  131.  
  132.     else if(yAxis<20 && cursorRow>10)
  133.     {
  134.       EsploraTFT.stroke(0,0,0);
  135.       EsploraTFT.text(">",57,cursorRow);
  136.       cursorRow-=20;
  137.      
  138.       EsploraTFT.stroke(255,255,255);
  139.       EsploraTFT.text(">",57,cursorRow);
  140.  
  141.       delay(100);
  142.     }
  143.  
  144.     int idNum=0;
  145.     switch(cursorRow)
  146.     {
  147.       case 10: idNum=0;break;
  148.       case 30: idNum=1; break;
  149.       case 50: idNum=2;break;
  150.       case 70: idNum=3;break;
  151.       case 90: idNum=4;break;
  152.       case 110: idNum=5;break;
  153.     }
  154.      
  155.      //if new selcetion
  156.      
  157.      if(selection!=cursorRow)
  158.      {
  159.      PImage myPokemonImg=getFrontImage(startPokemonID[idNum]+1);
  160.      EsploraTFT.image(myPokemonImg,0,60);
  161.      myPokemonImg.close();
  162.      selection=cursorRow;
  163.      }
  164.      //endif
  165.  
  166.     //if(cursorRow<10) cursorRow=10;
  167.     //if(cursorRow>110) cursorRow=110;
  168.  
  169. }
  170.  
  171. void infoMenuRoutine()
  172. {
  173.   byte infoMenuCheck=1;
  174.       drawInfoMenu();
  175.       while(infoMenuCheck)
  176.       {
  177.  
  178.         infoMenuCursor();
  179.         if(Esplora.readButton(SWITCH_DOWN) == LOW)
  180.           infoMenuCheck=0;
  181.       }
  182. }
  183.  
  184.  
  185.  
  186. //ADD THIS IN INO FILE
  187. //if(masterMenu.lineID>2)
  188. //{
  189. //  infoMenuRoutine();
  190. //}
  191.  
  192.  
  193.  
  194. //ADD THIS IN GLOBAL.H
  195. //int startPokemonID[6]={1,2,3,65,66,67};
  196. //int selection=0;
  197. //I INITIALISED A SET OF POKEMON ID, CHANGE THIS IF YOU WANT
  198.  
  199.  
  200.  
  201. //ALSO YOU NEED TO CHANGE POKEDEX
  202. //FROM   filename += "f_";
  203. //TO     filename += "small/f_";
  204. //IN ORDER TO LOAD THE SMALL IMAGE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement