(c)://Les includes#include <stdio.h>#include <stdlib.h>#include <string.h>#include <malloc.h>#include <ogcsys.h>#include <gccore.h> static void *xfb = NULL;static GXRModeObj *rmode = NULL; int main(int argc, char **argv) { VIDEO_Init(); //Init Video PAD_Init(); //Init Pad //Video Mode Console switch(VIDEO_GetCurrentTvMode()) { case VI_NTSC: rmode = &TVNtsc480IntDf; break; case VI_PAL: rmode = &TVPal528IntDf; break; case VI_MPAL: rmode = &TVMpal480IntDf; break; default: rmode = &TVNtsc480IntDf; break; } xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ); VIDEO_Configure(rmode); VIDEO_SetNextFramebuffer(xfb); VIDEO_SetBlack(FALSE); VIDEO_Flush(); VIDEO_WaitVSync(); if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); //Texte de présentation printf("Bonjour ceci est un test boutons par Cid2mizard :\n"); while(1) { //Scan touche PAD_ScanPads(); //Test touch if(PAD_ButtonsDown(0) & PAD_BUTTON_UP) {printf("You-Pressed Up:\n");} else if(PAD_ButtonsDown(0) & PAD_BUTTON_DOWN) {printf("You-Pressed Down:\n");} else if(PAD_ButtonsDown(0) & PAD_BUTTON_RIGHT) {printf("You-Pressed Right:\n");} else if(PAD_ButtonsDown(0) & PAD_BUTTON_LEFT) {printf("You-Pressed Left:\n");} if(PAD_ButtonsDown(0) & PAD_BUTTON_A) {printf("You-Pressed A:\n");} else if(PAD_ButtonsDown(0) & PAD_BUTTON_B) {printf("You-Pressed B:\n");} else if(PAD_ButtonsDown(0) & PAD_BUTTON_X) {printf("You-Pressed X:\n");} else if(PAD_ButtonsDown(0) & PAD_BUTTON_Y) {printf("You-Pressed Y:\n");} else if(PAD_ButtonsDown(0) & PAD_BUTTON_START) {printf("You-Pressed Start:\n");} if(PAD_ButtonsDown(0) & PAD_TRIGGER_Z) {printf("You-Pressed Z:\n");} else if(PAD_ButtonsDown(0) & PAD_TRIGGER_L) {printf("You-Pressed L:\n");} else if(PAD_ButtonsDown(0) & PAD_TRIGGER_R) {printf("You-Pressed R:\n");} if(PAD_StickY(0) < -65) {printf("You-Pressed Stick Analogic Down:\n");} else if(PAD_StickY(0) > 65) {printf("You-Pressed Stick Analogic Up:\n");} if(PAD_StickX(0) < -65) {printf("You-Pressed Stick Analogic Left:\n");} else if(PAD_StickX(0) > 65) {printf("You-Pressed Stick Analogic Right:\n");} VIDEO_WaitVSync(); } return 0;}
(c):ML_Init(VIDEO_CONSOLE, PADS_ENABLED);while(1){ ML_GetPads(); if(ML_ButtonReleased(PAD_BUTTON_B)) { ML_Print("Button B released"); }}