Solevis
02/12/2007, 17h50
Bonjour a tous,
Pour mon Troisième topic dans cette section, je vous offre une fleur :fleur:
Mon problème est tout bête, je lance mon Homebrew, mon image s'affiche, mon texte
également, puis "pouf" reboot de la machine.:ninja:
J'ai tenté de virer des conditions ,des variables mais toujours ce même problème.
Je pense (quasiment sur) que ca vient de ma fonction Distribuer().
Comme je suis généreux obligé pour que vous m'aidiez voici tout le Code source :
//The main library OSLib
#include <oslib/oslib.h>
#include <time.h>
//The callbacks
PSP_MODULE_INFO("Battle Card", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
#define NOMBRE_CARTE 30
void Distribuer();
OSL_IMAGE *plateau;
int Carte[4] = {0};
int DebutJeu = 1;
int main()
{
//Initialization of the library
oslInit(0);
oslInitGfx(OSL_PF_8888, 1);
//Chargement des images
plateau = oslLoadImageFile("plateau.png", OSL_IN_RAM, OSL_PF_5551);
if (!plateau)
oslDebug("Impossible to load one or more files. Check if all the files are copied in the game folder.");
//Boucle Principale
while (!osl_quit)
{
oslStartDrawing();
//Read the keys
oslReadKeys();
//Dessine
oslDrawImage(plateau);
//Distribution des cartes
Distribuer();
if (osl_keys->pressed.start) oslQuit();
oslEndDrawing();
//Synchronize the screen
oslSyncFrame();
}
//Leaving the program
oslEndGfx();
oslQuit();
return 0;
}
void Distribuer()
{
int MAX = NOMBRE_CARTE;
int MIN = 1;
int i = 0;
//Initialise le Random
srand(time(NULL));
if(DebutJeu) //Si le jeu debute, on distribue 5 cartes
{
for(i=0;i<5;i++)
{
Carte[i] = (rand() % (MAX - MIN + 1)) + MIN;
oslPrintf("%d\n",Carte[i]);
}
DebutJeu = 0;
}
}
Merci d'avance :snif2:
Pour mon Troisième topic dans cette section, je vous offre une fleur :fleur:
Mon problème est tout bête, je lance mon Homebrew, mon image s'affiche, mon texte
également, puis "pouf" reboot de la machine.:ninja:
J'ai tenté de virer des conditions ,des variables mais toujours ce même problème.
Je pense (quasiment sur) que ca vient de ma fonction Distribuer().
Comme je suis généreux obligé pour que vous m'aidiez voici tout le Code source :
//The main library OSLib
#include <oslib/oslib.h>
#include <time.h>
//The callbacks
PSP_MODULE_INFO("Battle Card", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
#define NOMBRE_CARTE 30
void Distribuer();
OSL_IMAGE *plateau;
int Carte[4] = {0};
int DebutJeu = 1;
int main()
{
//Initialization of the library
oslInit(0);
oslInitGfx(OSL_PF_8888, 1);
//Chargement des images
plateau = oslLoadImageFile("plateau.png", OSL_IN_RAM, OSL_PF_5551);
if (!plateau)
oslDebug("Impossible to load one or more files. Check if all the files are copied in the game folder.");
//Boucle Principale
while (!osl_quit)
{
oslStartDrawing();
//Read the keys
oslReadKeys();
//Dessine
oslDrawImage(plateau);
//Distribution des cartes
Distribuer();
if (osl_keys->pressed.start) oslQuit();
oslEndDrawing();
//Synchronize the screen
oslSyncFrame();
}
//Leaving the program
oslEndGfx();
oslQuit();
return 0;
}
void Distribuer()
{
int MAX = NOMBRE_CARTE;
int MIN = 1;
int i = 0;
//Initialise le Random
srand(time(NULL));
if(DebutJeu) //Si le jeu debute, on distribue 5 cartes
{
for(i=0;i<5;i++)
{
Carte[i] = (rand() % (MAX - MIN + 1)) + MIN;
oslPrintf("%d\n",Carte[i]);
}
DebutJeu = 0;
}
}
Merci d'avance :snif2: