![]() |
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Ouvrir sur le forum | Recherche | Messages du jour | Marquer les forums comme lus |
Publicité |
![]() |
|
Outils de la discussion | Modes d'affichage |
![]() |
#1 |
Membre confirmé
Date d'inscription: 24/02/2008
Messages: 83
|
![]() Bonjour à tous
Pour compléter mon homebrew, disponible ici, j'aimerai faire une introduction basique avec deux images et un son, puis lancer le jeu. J'ai fait le code de l'intro mais je n'arrive à l'insérer au code du homebrew sans qu'il y ait des problèmes. Si quelqu'un pouvait m'aider je lui en serai infiniment reconnaissant. Voila le code du homebrew : Code:
// Includes #include <PA9.h> // Include for PA_Lib #include "timer_beep.h" // Include the sound (found in the data folder in .raw format) #include "timer_reset.h" #include "time_out_and_abort.h" #include "key_press.h" s32 MyCounter = 388800;// 108x60x60 // Converted using PAGfx #include "gfx/all_gfx.c" #include "gfx/all_gfx.h" char text[200]; // This will be our text... //void MyVBLFunction(void){ // MyCounter--; // } //Function: main() int main(int argc, char ** argv) { PA_Init(); // Initialisation de PA_Lib PA_InitVBL(); // Initialisation de la VBL standard //Load Backgrounds with their palettes ! PA_EasyBgLoad(0, // screen 2, // background number (0-3) bg0); // Background name, used by PAGfx... PA_InitSound(); // Init the sound system PA_InitText(0,0); // Initialisation du système de texte PA_InitText(1,1); //Indique que l'on ecrit dans l'écran 1 sur l'arrière-plan (background) 2 PA_InitKeyboard(1); // Chargement du clavier sur le fond 1... PA_KeyboardIn(23, 100); // Fait glisser le clavier par le bas jusqu'à-ce qu'il soit en place s32 nletter = 0; // Lettre suivante à écrire. 0 puisqu'il n'y a pas encore de lettre char letter = 0; // Nouvelle lettre à écrire char text[200]; // Ce sera notre texte // Boucle infinie while (1){ while (MyCounter>0){ MyCounter--; PA_SetTextTileCol(1,0); PA_OutputText(1, 13, 10, "%d:%d ", MyCounter/60/60, MyCounter / 60 % 60); PA_EasyBgLoad(1,2,bg2); if (MyCounter <= 14400){ // 14400 pour 4x60x60 if(!PA_SoundChannelIsBusy (6)) PA_PlaySimpleSound(6,timer_beep); PA_SetTextTileCol(1,1); PA_OutputText(1, 1, 1, " Veuillez entrer le code"); if (letter == '\n') { if ((strcmp("4 8 15 16 23 42",text)==0)) { MyCounter = 388800; PA_ClearTextBg(0); PA_ClearTextBg(1); PA_PlaySimpleSound(5, timer_reset); } } } letter = PA_CheckKeyboard(); if (letter > 31) { // Il y a une nouvelle lettre text[nletter] = letter; nletter++; PA_PlaySimpleSound(4, key_press); } else if ((letter == PA_BACKSPACE)&&nletter) { nletter--; text[nletter] = ' '; PA_PlaySimpleSound(4, key_press); } PA_SetTextTileCol(0,2); PA_OutputSimpleText(0, 9, 2, text); PA_WaitForVBL(); } PA_ClearTextBg(0); PA_EasyBgLoad(1,0,bg1); PA_PlaySimpleSound(7, time_out_and_abort); PA_WaitForVBL(); } return 0; } // End of main() Code:
// Include any GIF file and output it on an 8bit or 16bit screen ! // Includes #include <PA9.h> // Include for PA_Lib #include "compo_top.h" // gif to include #include "compo_bottom.h" // gif to include #include "intro.h" // Function: main() int main(int argc, char ** argv){ u8 volume = 127; PA_Init(); // PA Init... PA_InitVBL(); // VBL Init... PA_InitSound(); // Init the sound system PA_Init8bitBg(0, 3); // Init a 16 bit Bg on screen 0 PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 PA_SetBrightness(0, -31); // all black PA_SetBrightness(1, -31); // all black // Load splash while hidden PA_LoadGif( 1, (void*)compo_top); // Gif File PA_LoadGif( 0, (void*)compo_bottom); // Gif File volume &= 300; PA_PlaySimpleSound(5, intro); s8 i; // Transition to normal visible background for(i = -31; i <= 0; i++){ PA_SetBrightness(0, i); PA_SetBrightness(1, i); PA_WaitForVBL(); } s16 time = 1260; // 180 frames = 3 seconds while(time && (!Pad.Newpress.Anykey) && (!Stylus.Newpress)){ // Display until time over or keys pressed time--; // time goes by PA_WaitForVBL(); } // Transition to black for(i = 0; i > -32; i--){ PA_SetBrightness(0, i); PA_SetBrightness(1, i); PA_WaitForVBL(); } // Now that it's all black, clean all that and you're ready to go ! PA_ResetBgSys(); PA_SetBrightness(0, 0); // normal PA_SetBrightness(1, 0); // normal while(1) { PA_WaitForVBL(); } return 0; } // End of main() |
![]() |
![]() |
Publicité |
![]() |
#2 |
Membre confirmé
Date d'inscription: 16/05/2007
Messages: 312
|
![]() Quel est ton problème exactement?
tu n'as qu'a regrouper les 2 ![]() Quel sont tes problèmes? Post le code comme tu l'as assemblé et dis quel sont les bugs... |
![]() |
![]() |
![]() |
#3 |
Membre confirmé
Date d'inscription: 24/02/2008
Messages: 83
|
![]() C'est ce que j'ai essayé de faire mais au début les images ne sont pas affiché (des bandes bleues et marrons) et après quand le jeu démarre le texte que l'no ecrit au clavier ne s'affiche pas et le compteur aussi, ce qui fait que y'a le son quand le compteur est à 0.
Voila le code : Code:
// Includes #include <PA9.h> // Include for PA_Lib #include "timer_beep.h" // Include the sound (found in the data folder in .raw format) #include "timer_reset.h" #include "time_out_and_abort.h" #include "key_press.h" #include "compo_top.h" // gif to include #include "compo_bottom.h" // gif to include #include "intro.h" s32 MyCounter = 388800;// 108x60x60 // Converted using PAGfx #include "gfx/all_gfx.c" #include "gfx/all_gfx.h" char text[200]; // This will be our text... //void MyVBLFunction(void){ // MyCounter--; // } //Function: main() int main(int argc, char ** argv) { PA_Init(); // Initialisation de PA_Lib PA_InitVBL(); // Initialisation de la VBL standard PA_InitSound(); // Init the sound system PA_InitText(0,0); // Initialisation du système de texte PA_InitText(1,1); //Indique que l'on ecrit dans l'écran 1 sur l'arrière-plan (background) 2 PA_Init8bitBg(0, 3); // Init a 16 bit Bg on screen 0 PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 PA_SetBrightness(0, -31); // all black PA_SetBrightness(1, -31); // all black // Load splash while hidden PA_LoadGif( 1, (void*)compo_top); // Gif File PA_LoadGif( 0, (void*)compo_bottom); // Gif File PA_PlaySimpleSound(5, intro); s8 i; // Transition to normal visible background for(i = -31; i <= 0; i++){ PA_SetBrightness(0, i); PA_SetBrightness(1, i); PA_WaitForVBL(); } s16 time = 1260; // 180 frames = 3 seconds while(time && (!Pad.Newpress.Anykey) && (!Stylus.Newpress)){ // Display until time over or keys pressed time--; // time goes by PA_WaitForVBL(); } // Transition to black for(i = 0; i > -32; i--){ PA_SetBrightness(0, i); PA_SetBrightness(1, i); PA_WaitForVBL(); } // Now that it's all black, clean all that and you're ready to go ! PA_ResetBgSys(); PA_SetBrightness(0, 0); // normal PA_SetBrightness(1, 0); // normal // Boucle infinie while (1){ PA_EasyBgLoad(0,2,bg0) PA_InitKeyboard(1); // Chargement du clavier sur le fond 1... PA_KeyboardIn(23, 100); // Fait glisser le clavier par le bas jusqu'à-ce qu'il soit en place s32 nletter = 0; // Lettre suivante à écrire. 0 puisqu'il n'y a pas encore de lettre char letter = 0; // Nouvelle lettre à écrire char text[200]; // Ce sera notre texte while (MyCounter>0){ MyCounter--; PA_SetTextTileCol(1,0); PA_OutputText(1, 13, 10, "%d:%d ", MyCounter/60/60, MyCounter / 60 % 60); PA_EasyBgLoad(1,2,bg2); if (MyCounter <= 14400){ // 14400 pour 4x60x60 if(!PA_SoundChannelIsBusy (6)) PA_PlaySimpleSound(6,timer_beep); PA_SetTextTileCol(1,1); PA_OutputText(1, 1, 1, " Veuillez entrer le code"); if (letter == '\n') { if ((strcmp("4 8 15 16 23 42",text)==0)) { MyCounter = 388800; PA_ClearTextBg(0); PA_ClearTextBg(1); PA_PlaySimpleSound(5, timer_reset); } } } letter = PA_CheckKeyboard(); if (letter > 31) { // Il y a une nouvelle lettre text[nletter] = letter; nletter++; PA_PlaySimpleSound(4, key_press); } else if ((letter == PA_BACKSPACE)&&nletter) { nletter--; text[nletter] = ' '; PA_PlaySimpleSound(4, key_press); } PA_SetTextTileCol(0,2); PA_OutputSimpleText(0, 9, 2, text); PA_WaitForVBL(); } PA_ClearTextBg(0); PA_EasyBgLoad(1,0,bg1); PA_PlaySimpleSound(7, time_out_and_abort); PA_WaitForVBL(); } return 0; } // End of main() |
![]() |
![]() |
![]() |
#4 |
Membre confirmé
Date d'inscription: 16/05/2007
Messages: 312
|
![]() Déjà pour le soucis avec le texte change de place les PA_InitText pour voir, met les juste avant le while (1) car je pense qu'il faut réinitialiser le texte après un PA_ResetBgSys();
|
![]() |
![]() |
![]() |
#5 |
Membre confirmé
Date d'inscription: 24/02/2008
Messages: 83
|
![]() Ah oui effectivement les images s'affichent !! Merci beaucoup liberty !
Tout marche parfaitement : je vais pouvoir poster une nouvelle version !! Dernière modification par youpitou ; 08/03/2008 à 13h48. |
![]() |
![]() |
![]() |
Liens sociaux |
Publicité |
Utilisateurs regardant la discussion actuelle : 1 (0 membre(s) et 1 invité(s)) | |
Outils de la discussion | |
Modes d'affichage | |
|
|