Accueil > > > INPUT POUR GAMEBOY ADVANCE AVEC VISUAL HAM
INPUT POUR GAMEBOY ADVANCE AVEC VISUAL HAM
Information sur la source
Description
Ce programme sert à rien :p mais aide à comprendre le fonctionnement INPUT sur GBA. Programmé avec Visual HAM (sorte de Visual C++ 6 plus simple que DevKit Advance pour la programmation sur GBA).
Source
- //////////////////////////////////////////
- // INPUT BY NEO_00110010101 //
- // neo_00110010101@hotmail.com //
- //////////////////////////////////////////
-
- // Toujours le même début ;-)
- #include <mygba.h>
-
- // Fonction: main()
- int main()
- {
- // Variable
- bool bouton_presse = 0;
-
- // Initialisation de HAMlib
- ham_Init();
-
- // Initialisation du système d'affichage de texte en BGMODE 0
- ham_InitText(0);
-
- // On écrit des trucs :
- ham_DrawText(0,19,"neo_00110010101");
- ham_DrawText(0,0,"Press any button");
- ham_DrawText(0,1,"-------------------------------");
- ham_DrawText(0,2,"RIGHT");
- ham_DrawText(0,3,"LEFT");
- ham_DrawText(0,4,"UP");
- ham_DrawText(0,5,"DOWN");
- ham_DrawText(0,6,"A");
- ham_DrawText(0,7,"B");
- ham_DrawText(0,8,"SELECT");
- ham_DrawText(0,9,"START");
- ham_DrawText(0,10,"L");
- ham_DrawText(0,11,"R");
- ham_DrawText(20,16,"started :");
- ham_DrawText(20,17,"22/01/2004");
- ham_DrawText(20,18,"finished :");
- ham_DrawText(20,19,"24/01/2004");
- ham_DrawText(0,14,"------------------------------");
- ham_DrawText(0,15,"Button pressed :");
-
- // Boucle jusqu'à ce qu'un bouton soit pressé
- while(bouton_presse == 0)
- {
- // On regarde s'il y a un bouton pressé
- if (F_CTRLINPUT_UP_PRESSED)
- {
-
- // Si oui, on affiche "1" et "UP" (La flèche du haut du pad)
- ham_DrawText(8,4,"1");
- ham_DrawText(0,16,"UP");
- }
- // Sinon, on affiche "0" et des espaces pour effacer la zone où est écrit UP/DOWN etc...
- else
- {
- ham_DrawText(8,4,"0");
- ham_DrawText(0,16," ");
- }
- if (F_CTRLINPUT_DOWN_PRESSED) // Même chose pour la flèche du bas du pad
- {
- ham_DrawText(8,5,"1");
- ham_DrawText(0,16,"DOWN");
- }
- else
- {
- ham_DrawText(8,5,"0");
- }
- if (F_CTRLINPUT_LEFT_PRESSED) // Pour la gauche
- {
- ham_DrawText(8,3,"1");
- ham_DrawText(0,16,"LEFT");
- }
- else
- {
- ham_DrawText(8,3,"0");
- }
- if (F_CTRLINPUT_RIGHT_PRESSED) // Pour la droite
- {
- ham_DrawText(8,2,"1");
- ham_DrawText(0,16,"RIGHT");
- }
- else
- {
- ham_DrawText(8,2,"0");
- }
- if (F_CTRLINPUT_A_PRESSED) // Pour le bouton A
- {
- ham_DrawText(8,6,"1");
- ham_DrawText(0,16,"A");
- }
- else
- {
- ham_DrawText(8,6,"0");
- }
- if (F_CTRLINPUT_B_PRESSED)// Pour le B
- {
- ham_DrawText(8,7,"1");
- ham_DrawText(0,16,"B");
- }
- else
- {
- ham_DrawText(8,7,"0");
- }
- if (F_CTRLINPUT_SELECT_PRESSED) // Pour le bouton SELECT
- {
- ham_DrawText(8,8,"1");
- ham_DrawText(0,16,"SELECT");
- }
- else
- {
- ham_DrawText(8,8,"0");
- }
- if (F_CTRLINPUT_START_PRESSED) // Pour le bouton START
- {
- ham_DrawText(8,9,"1");
- ham_DrawText(0,16,"START");
- }
- else
- {
- ham_DrawText(8,9,"0");
- }
- if (F_CTRLINPUT_L_PRESSED) // Pour la gachette L
- {
- ham_DrawText(8,10,"1");
- ham_DrawText(0,16,"L");
- }
- else
- {
- ham_DrawText(8,10,"0");
- }
- if (F_CTRLINPUT_R_PRESSED) // Pour la gachette R
- {
- ham_DrawText(8,11,"1");
- ham_DrawText(0,16,"R");
- }
- else
- {
- ham_DrawText(8,11,"0");
- }
-
-
- }
-
- return 0;
- } // Fin de la fonction main()
//////////////////////////////////////////
// INPUT BY NEO_00110010101 //
// neo_00110010101@hotmail.com //
//////////////////////////////////////////
// Toujours le même début ;-)
#include <mygba.h>
// Fonction: main()
int main()
{
// Variable
bool bouton_presse = 0;
// Initialisation de HAMlib
ham_Init();
// Initialisation du système d'affichage de texte en BGMODE 0
ham_InitText(0);
// On écrit des trucs :
ham_DrawText(0,19,"neo_00110010101");
ham_DrawText(0,0,"Press any button");
ham_DrawText(0,1,"-------------------------------");
ham_DrawText(0,2,"RIGHT");
ham_DrawText(0,3,"LEFT");
ham_DrawText(0,4,"UP");
ham_DrawText(0,5,"DOWN");
ham_DrawText(0,6,"A");
ham_DrawText(0,7,"B");
ham_DrawText(0,8,"SELECT");
ham_DrawText(0,9,"START");
ham_DrawText(0,10,"L");
ham_DrawText(0,11,"R");
ham_DrawText(20,16,"started :");
ham_DrawText(20,17,"22/01/2004");
ham_DrawText(20,18,"finished :");
ham_DrawText(20,19,"24/01/2004");
ham_DrawText(0,14,"------------------------------");
ham_DrawText(0,15,"Button pressed :");
// Boucle jusqu'à ce qu'un bouton soit pressé
while(bouton_presse == 0)
{
// On regarde s'il y a un bouton pressé
if (F_CTRLINPUT_UP_PRESSED)
{
// Si oui, on affiche "1" et "UP" (La flèche du haut du pad)
ham_DrawText(8,4,"1");
ham_DrawText(0,16,"UP");
}
// Sinon, on affiche "0" et des espaces pour effacer la zone où est écrit UP/DOWN etc...
else
{
ham_DrawText(8,4,"0");
ham_DrawText(0,16," ");
}
if (F_CTRLINPUT_DOWN_PRESSED) // Même chose pour la flèche du bas du pad
{
ham_DrawText(8,5,"1");
ham_DrawText(0,16,"DOWN");
}
else
{
ham_DrawText(8,5,"0");
}
if (F_CTRLINPUT_LEFT_PRESSED) // Pour la gauche
{
ham_DrawText(8,3,"1");
ham_DrawText(0,16,"LEFT");
}
else
{
ham_DrawText(8,3,"0");
}
if (F_CTRLINPUT_RIGHT_PRESSED) // Pour la droite
{
ham_DrawText(8,2,"1");
ham_DrawText(0,16,"RIGHT");
}
else
{
ham_DrawText(8,2,"0");
}
if (F_CTRLINPUT_A_PRESSED) // Pour le bouton A
{
ham_DrawText(8,6,"1");
ham_DrawText(0,16,"A");
}
else
{
ham_DrawText(8,6,"0");
}
if (F_CTRLINPUT_B_PRESSED)// Pour le B
{
ham_DrawText(8,7,"1");
ham_DrawText(0,16,"B");
}
else
{
ham_DrawText(8,7,"0");
}
if (F_CTRLINPUT_SELECT_PRESSED) // Pour le bouton SELECT
{
ham_DrawText(8,8,"1");
ham_DrawText(0,16,"SELECT");
}
else
{
ham_DrawText(8,8,"0");
}
if (F_CTRLINPUT_START_PRESSED) // Pour le bouton START
{
ham_DrawText(8,9,"1");
ham_DrawText(0,16,"START");
}
else
{
ham_DrawText(8,9,"0");
}
if (F_CTRLINPUT_L_PRESSED) // Pour la gachette L
{
ham_DrawText(8,10,"1");
ham_DrawText(0,16,"L");
}
else
{
ham_DrawText(8,10,"0");
}
if (F_CTRLINPUT_R_PRESSED) // Pour la gachette R
{
ham_DrawText(8,11,"1");
ham_DrawText(0,16,"R");
}
else
{
ham_DrawText(8,11,"0");
}
}
return 0;
} // Fin de la fonction main()
Conclusion
Ce programme affiche aussi le nom de la touche pressée mais je l'ai fait d'une telle manière que ça clignote parfois ... à améliorer :)
et puis il date ce programme !
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
SESSION SILVERLIGHT 5 3D : SLIDES ET DEMOSSESSION SILVERLIGHT 5 3D : SLIDES ET DEMOS par Groc
Durant les techdays, j'ai eu le plaisir d'animer une session sur Silverlight 5 et la 3D avec Simon Ferquel. Comme promis, voici nos slides et mes démos (celles avec le viper BSG) ici et là. Pour mémoire, les démos utilisent toutes le viper BSG...
Cliquez pour lire la suite de l'article par Groc [TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES[TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES par gpommier
Suite à la session que j'ai présenté sur WebMatrix 2, vous pouvez trouver les slides ici, ainsi que les démos en packages nuget : démos1 et démos2 J'en profite pour remercier chaleureusement tous ceux qui sont venus très nombreux à cette sess...
Cliquez pour lire la suite de l'article par gpommier [SHAREPOINT] LES SESSIONS TECHDAYS 2012.[SHAREPOINT] LES SESSIONS TECHDAYS 2012. par Patrick Guimonet
Voici donc pour ceux qui n'ont pas pu venir, ou ceux qui n'ont pas pu toutes les suivre la liste des sessions SharePoint aux TechDays 2012, que je mettrais à jour dès que les liens des vidéo seront disponibles. Ou ici : http...
Cliquez pour lire la suite de l'article par Patrick Guimonet TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3 par ROMELARD Fabrice
Speaker: Bernard Ourghanlian Cette session est comme chaque jour transmise en live par BrainSonic, et j'ai donc suivi cette troisième pleinière par ce moyen sur mon iPad . Elle est dédiée comme chaque année à la mise en perspective de l'é...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE !MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE ! par Vko
Hier durant une session dédiée aux Techdays 2012, j'ai eu le plaisir d'annoncer la sortie de la Béta 2 de Mishra Reader. C'est quoi ? Pour les utilisateurs, c'est une vraie expérience de lecture de flux RSS sur Windows. Rien à voir avec les produit...
Cliquez pour lire la suite de l'article par Vko
Logiciels
Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning
|