- /* ===========================================
- GRRLIB (GX Version)
- - Template Code -
- test pour correction par crayon
- Minimum Code To Use GRRLIB
- ============================================ */
- #include <grrlib.h>
- #include <stdlib.h>
- #include <math.h>
- #include <string.h>
- #include <wiiuse/wpad.h>
- #include <ogc/lwp_watchdog.h> // gettime
- #include "FreeMonoBold_ttf.h"
- #include "font.h"
- #include "pointer.h"
- #include "A.h"
- #include "B.h"
- #include "C.h"
- #include "D.h"
- #include "E.h"
- #include "F.h"
- #include "G.h"
- #include "H.h"
- #include "I.h"
- #include "J.h"
- #include "K.h"
- #include "L.h"
- #include "M.h"
- #include "N.h"
- #include "O.h"
- #include "P.h"
- #include "Q.h"
- #include "R.h"
- #include "S.h"
- #include "T.h"
- #include "U.h"
- #include "V.h"
- #include "W.h"
- #include "X.h"
- #include "Y.h"
- #include "Z.h"
- //#include "Space.h"
- #define CLR_RED 0xFF0000FF
- #define CLR_WHITE 0xFFFFFFFF
- int main(int argc, char **argv) {
- // Initialise the Graphics & Video subsystem
- GRRLIB_Init();
- // Initialise the Wiimotes
- WPAD_Init();
- // **************RANG1**********************************
- GRRLIB_texImg *texK = GRRLIB_LoadTexture(K);
- GRRLIB_texImg *texE = GRRLIB_LoadTexture(E);
- GRRLIB_texImg *texT = GRRLIB_LoadTexture(T);
- GRRLIB_texImg *texC = GRRLIB_LoadTexture(C);
- GRRLIB_texImg *texR = GRRLIB_LoadTexture(R);
- GRRLIB_texImg *texA = GRRLIB_LoadTexture(A);
- GRRLIB_texImg *texY = GRRLIB_LoadTexture(Y);
- GRRLIB_texImg *texO = GRRLIB_LoadTexture(O);
- GRRLIB_texImg *texN = GRRLIB_LoadTexture(N);
- GRRLIB_texImg *texX = GRRLIB_LoadTexture(X);
- GRRLIB_texImg *texV = GRRLIB_LoadTexture(V);
- GRRLIB_texImg *texL = GRRLIB_LoadTexture(L);
- // ****************RANG2******************************
- GRRLIB_texImg *texB = GRRLIB_LoadTexture(B);
- GRRLIB_texImg *texZ = GRRLIB_LoadTexture(Z);
- GRRLIB_texImg *texH = GRRLIB_LoadTexture(H);
- GRRLIB_texImg *texJ = GRRLIB_LoadTexture(J);
- GRRLIB_texImg *texI = GRRLIB_LoadTexture(I);
- GRRLIB_texImg *texM = GRRLIB_LoadTexture(M);
- GRRLIB_texImg *texP = GRRLIB_LoadTexture(P);
- GRRLIB_texImg *texQ = GRRLIB_LoadTexture(Q);
- GRRLIB_texImg *texF = GRRLIB_LoadTexture(F);
- // ***************RANG3******************************
- GRRLIB_texImg *texU = GRRLIB_LoadTexture(U);
- GRRLIB_texImg *texS = GRRLIB_LoadTexture(S);
- GRRLIB_texImg *texD = GRRLIB_LoadTexture(D);
- GRRLIB_texImg *texG = GRRLIB_LoadTexture(G);
- // GRRLIB_texImg *texSpace = GRRLIB_LoadTexture(Space);
- // ****************************************************
- GRRLIB_texImg *texPointer = GRRLIB_LoadTexture(pointer);
- GRRLIB_SetMidHandle(texPointer, true);
- GRRLIB_texImg *texFont = GRRLIB_LoadTexture(font);
- GRRLIB_InitTileSet(texFont, 8, 16, 0);
- WPAD_SetVRes(WPAD_CHAN_ALL, rmode->fbWidth, rmode->xfbHeight);
- WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
- ir_t pointeurIR;
- WPAD_IR(WPAD_CHAN_0, &pointeurIR);
- char UserName[6] = "";
- // Loop forever
- while (1) {
- WPAD_ScanPads(); // Scan the Wiimotes
- WPAD_IR(WPAD_CHAN_0, &pointeurIR);
- // If [HOME] was pressed on the first Wiimote, break out of the loop
- if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
- break;
- // ---------------------------------------------------------------------
- // **********************lettre*******************
- GRRLIB_DrawImg(35, 80, texK, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(85, 80, texE, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(135, 80, texT, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(185, 80, texC, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(235, 80, texR, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(285, 80, texA, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(335, 80, texY, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(385, 80, texO, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(435, 80, texN, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(485, 80, texX, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(535, 80, texV, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(585, 80, texL, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(100, 180, texB, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(150, 180, texZ, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(200, 180, texH, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(250, 180, texJ, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(300, 180, texI, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(350, 180, texM, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(400, 180, texP, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(450, 180, texQ, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(500, 180, texF, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(200, 280, texU, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(250, 280, texS, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(300, 280, texD, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(350, 280, texG, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(400, 280, texH, 0, 1, 1, 0xFFFFFFFF);
- // GRRLIB_DrawImg(250, 380, texSpace, 0, 1, 1, 0xFFFFFFFF);
- GRRLIB_DrawImg(pointeurIR.x, pointeurIR.y, texPointer, 0, 1, 1,
- CLR_WHITE);
- if ((GRRLIB_PtInRect(285, 80, texA->w, texA->h, pointeurIR.x,
- pointeurIR.y) == true) &&
- (WPAD_ButtonsDown(0) & WPAD_BUTTON_A)) {
- strcat(UserName, "A"); // Ajoute la lettre A dans le nom d'utilisateur
- }
- // Place your drawing code here
- // ---------------------------------------------------------------------
- GRRLIB_Printf(250, 380, texFont, CLR_WHITE, 4, UserName);
- GRRLIB_Render(); // Render the frame buffer to the TV
- }
- GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
- exit(0); // Use exit() to exit a program, do not use 'return' from main()
- }