Don't like ads? PRO users don't see any ads ;-)
Guest

main.c menu.c jeu.c

By: a guest on Jun 1st, 2012  |  syntax: C  |  size: 5.97 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <pspkernel.h>
  2. #include <pspdebug.h>
  3. #include <libge/libge.h>
  4.  
  5. #include "Headers/menu.h"
  6.  
  7. #define printf pspDebugScreenPrintf
  8.  
  9. PSP_MODULE_INFO("DEMO", PSP_MODULE_USER, 0, 1);
  10. PSP_HEAP_SIZE_KB(8192);
  11.  
  12. ge_Font *intraFont;
  13. ge_Image *cross;
  14. ge_Keys *pad, *oldpad;
  15.  
  16. int main(){
  17.  
  18. int alpha = 255;
  19. int transpVar = 0;
  20.  
  21.         geInit();
  22.         pspDebugScreenInit();
  23.        
  24.         intraFont = geLoadIntraFont("flash0:/font/ltn0.pgf");
  25.         cross = geLoadImage("IMG/cross.png");
  26.        
  27.         pad = geCreateKeys();
  28.         oldpad = geCreateKeys();
  29.        
  30.         while(1){
  31.        
  32.                 geClearScreen();
  33.                 geReadKeys(pad);
  34.        
  35.        
  36.                 geIntraFontPrintScreen(100, 55, intraFont, "Ceci est une version démo.", RGB(255,255,255));
  37.                 geIntraFontPrintScreen(50, 90, intraFont, "Elle ne représente en rien le rendu final", RGB(255,255,255));
  38.                 geIntraFontPrintScreen(115, 140, intraFont, "This is a demo version.", RGB(255,255,255));
  39.                 geIntraFontPrintScreen(30, 175, intraFont, "It does not represent the final rendering.", RGB(255,255,255));
  40.                
  41.                 geDrawImage(438,230,cross);
  42.                
  43.                 geFillRectScreen(0, 0, 480, 272, RGBA(0, 0, 0, alpha));
  44.                
  45.                 pspDebugScreenSetXY(0,0);
  46.                 printf("%d\n",transpVar);
  47.                 printf("%d",alpha);
  48.                
  49.                 if(alpha <= 255 && alpha != 0 && transpVar == 0){
  50.                         sceKernelDelayThread(150);
  51.                         alpha -= ((alpha != 0) ? 1 : 0);
  52.                         }
  53.                 if(alpha < 3 && transpVar == 0){
  54.                         alpha = 0;
  55.                         }
  56.                
  57.                 if(pad->pressed[GEK_CROSS] && !oldpad->pressed[GEK_CROSS]){
  58.                         transpVar = 1;
  59.                         }
  60.                        
  61.                 if(transpVar == 1){
  62.                         sceKernelDelayThread(50);
  63.                         alpha += ((alpha != 255) ? 1 : 0);
  64.                         }
  65.                        
  66.                 if(alpha == 255 && transpVar == 1){
  67.                         break;
  68.                         }
  69.                
  70.                 geReadKeys(oldpad);
  71.                 geSwapBuffers();
  72.                 }
  73.                
  74.         menu();
  75.         return 0;
  76.         }
  77.  
  78. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  79.  
  80. #include <pspdebug.h>
  81. #include <pspkernel.h>
  82. #include <libge/libge.h>
  83.  
  84. #include "Headers/menu.h"
  85. #include "Headers/jeu.h"
  86.  
  87. ge_Image *menuBK;
  88. ge_Font *intraFont2;
  89. ge_Keys *pad, *oldpad;
  90.  
  91.  
  92.  
  93. void menu(){
  94.  
  95.  
  96.  
  97. int selecteur = 1;
  98. int selecteurmax = 4;
  99. int selecteurmin = 1;
  100. int jeuVar = 0;
  101. int chargerVar = 0;
  102. int optionsVar = 0;
  103. int alpha = 255;
  104.  
  105.         menuBK = geLoadImage("IMG/menu.png");
  106.         intraFont2 = geLoadIntraFont("flash0:/font/ltn9.pgf");
  107.         pad = geCreateKeys();
  108.         oldpad = geCreateKeys();
  109.  
  110.        
  111.         while(1){
  112.        
  113.                 geClearScreen();
  114.                 sceKernelDelayThread(2000);
  115.                 geReadKeys(pad);
  116.                
  117.                
  118.                 geDrawImage(0,0,menuBK);
  119.                
  120.                 if(alpha <= 255 && alpha != 0){
  121.                         sceKernelDelayThread(50);
  122.                         alpha -= ((alpha != 0) ? 1 : 0);
  123.                         }
  124.                        
  125.                 geFillRectScreen(0, 0, 480, 272, RGBA(0, 0, 0, alpha));
  126.                
  127.                 if(alpha < 3){ 
  128.                 geIntraFontPrintScreen(200, 140, intraFont2, "Nouvelle Partie", RGB(255,255,255));
  129.                 geIntraFontPrintScreen(200, 175, intraFont2, "Charger Partie", RGB(255,255,255));
  130.                 geIntraFontPrintScreen(200, 210, intraFont2, "Options", RGB(255,255,255));
  131.                 geIntraFontPrintScreen(200, 245, intraFont2, "Quitter", RGB(255,255,255));
  132.                
  133.                 if(pad->pressed[GEK_DOWN] && !oldpad->pressed[GEK_DOWN]){
  134.                         selecteur++;
  135.                         }
  136.                 if(pad->pressed[GEK_UP] && !oldpad->pressed[GEK_UP]){
  137.                         selecteur--;
  138.                         }
  139.                        
  140.                 if(selecteur > selecteurmax){
  141.                         selecteur = 1;
  142.                         }
  143.                 if(selecteur < selecteurmin){
  144.                         selecteur = 4;
  145.                         }
  146.                        
  147.                 if(selecteur == 1){
  148.                         geIntraFontPrintScreen(200, 140, intraFont2, "Nouvelle Partie", RGB(255,0,0));
  149.                         }
  150.                 if(selecteur == 2){
  151.                         geIntraFontPrintScreen(200, 175, intraFont2, "Charger Partie", RGB(255,0,0));
  152.                         }
  153.                 if(selecteur == 3){
  154.                         geIntraFontPrintScreen(200, 210, intraFont2, "Options", RGB(255,0,0));
  155.                         }
  156.                 if(selecteur == 4){
  157.                         geIntraFontPrintScreen(200, 245, intraFont2, "Quitter", RGB(255,0,0));
  158.                         }
  159.                        
  160.                 if(pad->pressed[GEK_CROSS] && !oldpad->pressed[GEK_CROSS] && selecteur == 1){
  161.                         geFreeImage(menuBK);
  162.                         geClearScreen();
  163.                         jeuVar = 1;
  164.                         break;
  165.                         }
  166.                 if(pad->pressed[GEK_CROSS] && !oldpad->pressed[GEK_CROSS] && selecteur == 4){
  167.                         geFreeImage(menuBK);
  168.                         sceKernelExitGame();
  169.                         }
  170.                 }
  171.        
  172.                 geReadKeys(oldpad);    
  173.                 geSwapBuffers();
  174.                 }
  175.                
  176.                 if(jeuVar == 1){
  177.                 jeu();
  178.                 }
  179.  
  180.         }
  181.  
  182. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  183.  
  184. #include <pspdebug.h>
  185. #include <pspkernel.h>
  186. #include <libge/libge.h>
  187.  
  188. #include "Headers/jeu.h"
  189.  
  190. ge_Image *map;
  191. ge_Image *heros_haut_run, *heros_haut_droite_run, *heros_haut_gauche_run, *heros_bas_run, *heros_bas_droite_run, *heros_bas_gauche_run, *heros_droite_run, *heros_droite_droite_run, *heros_droite_gauche_run, *heros_gauche_run, *heros_gauche_droite_run, *heros_gauche_gauche_run, *heros_haut, *heros_bas, *heros_droite, *heros_gauche, *heros_haut_droite, *heros_haut_gauche, *heros_bas_droite, *heros_bas_gauche, *heros_droite_droite, *heros_droite_gauche, *heros_gauche_droite, *heros_gauche_gauche;
  192. ge_Timer *sprite;
  193.  
  194. void jeu(){
  195.  
  196.         map = geLoadImage("MAP/MAP1.png");
  197.         heros_haut = geLoadImage("PJ/heros_haut.png");
  198.         heros_haut_droite = geLoadImage("PJ/heros_haut_droit.png");
  199.         heros_haut_gauche = geLoadImage("PJ/heros_haut_gauche.png");
  200.         heros_haut_run = geLoadImage("PJ/heros_haut(run).png");
  201.         heros_haut_droite_run = geLoadImage("PJ/heros_haut_droit(run).png");
  202.         heros_haut_gauche_run = geLoadImage("PJ/heros_haut_gauche(run).png");
  203.         heros_bas = geLoadImage("PJ/heros_bas.png");
  204.         heros_bas_droite = geLoadImage("PJ/heros_bas_droit.png");
  205.         heros_bas_gauche = geLoadImage("PJ/heros_bas_gauche.png");
  206.         heros_bas_run = geLoadImage("PJ/heros_bas(run).png");
  207.         heros_bas_droite_run = geLoadImage("PJ/heros_bas_droit(run).png");
  208.         heros_bas_gauche_run = geLoadImage("PJ/heros_bas_gauche(run).png");
  209.         heros_droite = geLoadImage("PJ/heros_droit.png");
  210.         heros_droite_droite = geLoadImage("PJ/heros_droit_droit.png");
  211.         heros_droite_gauche = geLoadImage("PJ/heros_droit_gauche.png");
  212.         heros_droite_run = geLoadImage("PJ/heros_droit(run).png");
  213.         heros_droite_droite_run = geLoadImage("PJ/heros_droit_droit(run).png");
  214.         heros_droite_gauche_run = geLoadImage("PJ/heros_droit_gauche(run).png");
  215.        
  216.         while(1){
  217.        
  218.                 geClearScreen();
  219.                
  220.                 }
  221.                
  222.         }