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

Untitled

By: a guest on May 10th, 2012  |  syntax: None  |  size: 5.88 KB  |  hits: 15  |  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. /* ===========================================
  2. GRRLIB (GX Version)
  3. - Template Code -
  4. test pour correction par crayon
  5. Minimum Code To Use GRRLIB
  6. ============================================ */
  7. #include <grrlib.h>
  8.  
  9. #include <stdlib.h>
  10. #include <math.h>
  11. #include <string.h>
  12. #include <wiiuse/wpad.h>
  13. #include <ogc/lwp_watchdog.h>  // gettime
  14.  
  15. #include "FreeMonoBold_ttf.h"
  16.  
  17. #include "font.h"
  18. #include "pointer.h"
  19. #include "A.h"
  20. #include "B.h"
  21. #include "C.h"
  22. #include "D.h"
  23. #include "E.h"
  24. #include "F.h"
  25. #include "G.h"
  26. #include "H.h"
  27. #include "I.h"
  28. #include "J.h"
  29. #include "K.h"
  30. #include "L.h"
  31. #include "M.h"
  32. #include "N.h"
  33. #include "O.h"
  34. #include "P.h"
  35. #include "Q.h"
  36. #include "R.h"
  37. #include "S.h"
  38. #include "T.h"
  39. #include "U.h"
  40. #include "V.h"
  41. #include "W.h"
  42. #include "X.h"
  43. #include "Y.h"
  44. #include "Z.h"
  45. //#include "Space.h"
  46.  
  47. #define CLR_RED   0xFF0000FF
  48. #define CLR_WHITE 0xFFFFFFFF
  49.  
  50. int main(int argc, char **argv) {
  51.     // Initialise the Graphics & Video subsystem
  52.     GRRLIB_Init();
  53.  
  54.     // Initialise the Wiimotes
  55.     WPAD_Init();
  56.  
  57.     // **************RANG1**********************************
  58.  
  59.     GRRLIB_texImg *texK = GRRLIB_LoadTexture(K);
  60.  
  61.     GRRLIB_texImg *texE = GRRLIB_LoadTexture(E);
  62.  
  63.     GRRLIB_texImg *texT = GRRLIB_LoadTexture(T);
  64.  
  65.     GRRLIB_texImg *texC = GRRLIB_LoadTexture(C);
  66.  
  67.     GRRLIB_texImg *texR = GRRLIB_LoadTexture(R);
  68.  
  69.     GRRLIB_texImg *texA = GRRLIB_LoadTexture(A);
  70.  
  71.     GRRLIB_texImg *texY = GRRLIB_LoadTexture(Y);
  72.  
  73.     GRRLIB_texImg *texO = GRRLIB_LoadTexture(O);
  74.  
  75.     GRRLIB_texImg *texN = GRRLIB_LoadTexture(N);
  76.  
  77.     GRRLIB_texImg *texX = GRRLIB_LoadTexture(X);
  78.  
  79.     GRRLIB_texImg *texV = GRRLIB_LoadTexture(V);
  80.  
  81.     GRRLIB_texImg *texL = GRRLIB_LoadTexture(L);
  82.  
  83.     // ****************RANG2******************************
  84.  
  85.     GRRLIB_texImg *texB = GRRLIB_LoadTexture(B);
  86.  
  87.     GRRLIB_texImg *texZ = GRRLIB_LoadTexture(Z);
  88.  
  89.     GRRLIB_texImg *texH = GRRLIB_LoadTexture(H);
  90.  
  91.     GRRLIB_texImg *texJ = GRRLIB_LoadTexture(J);
  92.  
  93.     GRRLIB_texImg *texI = GRRLIB_LoadTexture(I);
  94.  
  95.     GRRLIB_texImg *texM = GRRLIB_LoadTexture(M);
  96.  
  97.     GRRLIB_texImg *texP = GRRLIB_LoadTexture(P);
  98.  
  99.     GRRLIB_texImg *texQ = GRRLIB_LoadTexture(Q);
  100.  
  101.     GRRLIB_texImg *texF = GRRLIB_LoadTexture(F);
  102.  
  103.     // ***************RANG3******************************
  104.  
  105.     GRRLIB_texImg *texU = GRRLIB_LoadTexture(U);
  106.  
  107.     GRRLIB_texImg *texS = GRRLIB_LoadTexture(S);
  108.  
  109.     GRRLIB_texImg *texD = GRRLIB_LoadTexture(D);
  110.  
  111.     GRRLIB_texImg *texG = GRRLIB_LoadTexture(G);
  112.  
  113.    // GRRLIB_texImg *texSpace = GRRLIB_LoadTexture(Space);
  114.  
  115.     // ****************************************************
  116.  
  117.     GRRLIB_texImg *texPointer = GRRLIB_LoadTexture(pointer);
  118.     GRRLIB_SetMidHandle(texPointer, true);
  119.  
  120.     GRRLIB_texImg *texFont = GRRLIB_LoadTexture(font);
  121.     GRRLIB_InitTileSet(texFont, 8, 16, 0);
  122.  
  123.     WPAD_SetVRes(WPAD_CHAN_ALL, rmode->fbWidth, rmode->xfbHeight);
  124.     WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
  125.  
  126.     ir_t pointeurIR;
  127.     WPAD_IR(WPAD_CHAN_0, &pointeurIR);
  128.  
  129.     char UserName[6] = "";
  130.  
  131.     // Loop forever
  132.     while (1) {
  133.  
  134.         WPAD_ScanPads(); // Scan the Wiimotes
  135.         WPAD_IR(WPAD_CHAN_0, &pointeurIR);
  136.  
  137.         // If [HOME] was pressed on the first Wiimote, break out of the loop
  138.         if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
  139.             break;
  140.  
  141.         // ---------------------------------------------------------------------
  142.  
  143.         // **********************lettre*******************
  144.         GRRLIB_DrawImg(35, 80, texK, 0, 1, 1, 0xFFFFFFFF);
  145.         GRRLIB_DrawImg(85, 80, texE, 0, 1, 1, 0xFFFFFFFF);
  146.         GRRLIB_DrawImg(135, 80, texT, 0, 1, 1, 0xFFFFFFFF);
  147.         GRRLIB_DrawImg(185, 80, texC, 0, 1, 1, 0xFFFFFFFF);
  148.         GRRLIB_DrawImg(235, 80, texR, 0, 1, 1, 0xFFFFFFFF);
  149.         GRRLIB_DrawImg(285, 80, texA, 0, 1, 1, 0xFFFFFFFF);
  150.         GRRLIB_DrawImg(335, 80, texY, 0, 1, 1, 0xFFFFFFFF);
  151.         GRRLIB_DrawImg(385, 80, texO, 0, 1, 1, 0xFFFFFFFF);
  152.         GRRLIB_DrawImg(435, 80, texN, 0, 1, 1, 0xFFFFFFFF);
  153.         GRRLIB_DrawImg(485, 80, texX, 0, 1, 1, 0xFFFFFFFF);
  154.         GRRLIB_DrawImg(535, 80, texV, 0, 1, 1, 0xFFFFFFFF);
  155.         GRRLIB_DrawImg(585, 80, texL, 0, 1, 1, 0xFFFFFFFF);
  156.         GRRLIB_DrawImg(100, 180, texB, 0, 1, 1, 0xFFFFFFFF);
  157.         GRRLIB_DrawImg(150, 180, texZ, 0, 1, 1, 0xFFFFFFFF);
  158.         GRRLIB_DrawImg(200, 180, texH, 0, 1, 1, 0xFFFFFFFF);
  159.         GRRLIB_DrawImg(250, 180, texJ, 0, 1, 1, 0xFFFFFFFF);
  160.         GRRLIB_DrawImg(300, 180, texI, 0, 1, 1, 0xFFFFFFFF);
  161.         GRRLIB_DrawImg(350, 180, texM, 0, 1, 1, 0xFFFFFFFF);
  162.         GRRLIB_DrawImg(400, 180, texP, 0, 1, 1, 0xFFFFFFFF);
  163.         GRRLIB_DrawImg(450, 180, texQ, 0, 1, 1, 0xFFFFFFFF);
  164.         GRRLIB_DrawImg(500, 180, texF, 0, 1, 1, 0xFFFFFFFF);
  165.         GRRLIB_DrawImg(200, 280, texU, 0, 1, 1, 0xFFFFFFFF);
  166.         GRRLIB_DrawImg(250, 280, texS, 0, 1, 1, 0xFFFFFFFF);
  167.         GRRLIB_DrawImg(300, 280, texD, 0, 1, 1, 0xFFFFFFFF);
  168.         GRRLIB_DrawImg(350, 280, texG, 0, 1, 1, 0xFFFFFFFF);
  169.         GRRLIB_DrawImg(400, 280, texH, 0, 1, 1, 0xFFFFFFFF);
  170.        // GRRLIB_DrawImg(250, 380, texSpace, 0, 1, 1, 0xFFFFFFFF);
  171.  
  172.         GRRLIB_DrawImg(pointeurIR.x, pointeurIR.y, texPointer, 0, 1, 1,
  173.             CLR_WHITE);
  174.  
  175.         if ((GRRLIB_PtInRect(285, 80, texA->w, texA->h, pointeurIR.x,
  176.                     pointeurIR.y) == true) &&
  177.             (WPAD_ButtonsDown(0) & WPAD_BUTTON_A)) {
  178.             strcat(UserName, "A"); // Ajoute la lettre A dans le nom d'utilisateur
  179.         }
  180.         // Place your drawing code here
  181.         // ---------------------------------------------------------------------
  182.         GRRLIB_Printf(250, 380, texFont, CLR_WHITE, 4, UserName);
  183.  
  184.         GRRLIB_Render(); // Render the frame buffer to the TV
  185.     }
  186.  
  187.     GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
  188.     exit(0); // Use exit() to exit a program, do not use 'return' from main()
  189. }