how I can make a thread using c++ and OSLib?
I need to have a thread carrying my images, sounds, etc. To create a loading system.
This is my function Start:
Code: Select all
void PSPFLoader::Start() {
LoadThread = sceKernelCreateThread("PSPFLoaderThread", ThreadMetod, 0x10, 0x10000, PSP_THREAD_ATTR_USER, NULL);
if (LoadThread >= 0) {
sceKernelStartThread(LoadThread, 0, 0);
SceKernelThreadInfo* info;
sceKernelReferThreadStatus(LoadThread, info);
oslDebug("%d", info->status);
}
else
oslDebug("Erro #501");
Started = true;
}
Code: Select all
AngelLoader::AngelLoader() {
ThreadMetod = loa;
}
int loa(SceSize args, void *argp) {
PSPFResourceManager* r = PSPFResourceManager::getResourceManager();
oslDebug("PRE1");
PSPFImage* imagem = new PSPFImage(100, 74, OSL_PF_5551, "Anjo.png");
imagem->setFormatSheet(50, 74);
r->AddResource(imagem, "ANJO");
mywait(1000);
oslDebug("PRE1 - OK");
PSPFImage* background = new PSPFImage(500, 300, OSL_PF_5551, "fundo.jpg");
r->AddResource(background, "BACKGROUND");
mywait(1000);
PSPFSound* musica = new PSPFSound("som.wav", NONE, 1);
r->AddResource(musica, "SOM");
mywait(1000);
Mundo* fase1 = new Mundo();
PSPFWorldManager::getWorldManager()->AddPSPFWorld(fase1);
PSPFWorldManager::getWorldManager()->setWorldFocus(1);
return 1;
}