Line 521:
Line 521:
static lwp_t guithread = LWP_THREAD_NULL;
static lwp_t guithread = LWP_THREAD_NULL;
static bool guiHalt = true;
static bool guiHalt = true;
+
+
+
+
static void
+
ResumeGui()
+
{
+
guiHalt = false;
+
LWP_ResumeThread (guithread);
+
}
+
+
+
+
+
static void
+
HaltGui()
+
{
+
guiHalt = true;
+
+
// wait for thread to finish
+
while(!LWP_ThreadIsSuspended(guithread))
+
usleep(50);
+
}
+
+
+
+
static void *
+
UpdateGUI (void *arg)
+
{
+
while(1)
+
{
+
if(guiHalt)
+
{
+
LWP_SuspendThread(guithread);
+
}
+
else
+
{
+
mainWindow->Draw();
+
+
#ifdef HW_RVL
+
for(int i=3; i >= 0; i--) // so that player 1's cursor appears on top!
+
{
+
if(userInput[i].wpad.ir.valid)
+
Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48,
+
96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, 1, 1, 255);
+
DoRumble(i);
+
}
+
#endif
+
+
Menu_Render();
+
+
for(int i=0; i < 4; i++)
+
mainWindow->Update(&userInput[i]);
+
+
if(ExitRequested)
+
{
+
for(int a = 0; a < 255; a += 15)
+
{
+
mainWindow->Draw();
+
Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, a},1);
+
Menu_Render();
+
+
}
+
ExitApp();
+
}
+
}
+
}
+
return NULL;
+
}
+
+
+
+
+
void
+
InitGUIThreads()
+
{
+
LWP_CreateThread (&guithread, UpdateGUI, NULL, NULL, 0, 70);
+
}
+
+
+