forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dc v6 graphics
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Mon Mar 09, 2009 11:31 pm    Post subject: Reply with quote

Can someone help with this. For some reason the callback OnOffMenuFadeOut never gets called. It used to work fine with the previous beta version.

Is my usage of VLF correct (i.e. correct cancellation of dialogs, callback usage etc?)

Code:
void OnOffFadeOut(void * ptr)
{
   //asm("break\n");
   vlfGuiRemoveText(relayname);
   vlfGuiCancelCentralMenu();
   vlfGuiCancelBottomDialog();
   MainMenu(g_relaySel);
}

int BackToMainMenuFromOnOffMenu(int enter)
{
   if (enter)
   {
      if (bConnected)
      {
         unsigned char msg;
         switch (vlfGuiCentralMenuSelection())
         {
            case 0:
               msg = 'A' + (unsigned char)g_relaySel;
               sceNetInetSend(g_sock, &msg, 1, 0);
               break;

            case 1:
               msg = 'a' + (unsigned char)g_relaySel;
               sceNetInetSend(g_sock, &msg, 1, 0);
               break;
         }
         vlfGuiSetRectangleFade(0, 56, 350, 272 - 56, VLF_FADE_MODE_OUT, VLF_FADE_SPEED_SUPER_FAST, 0, OnOffFadeOut, NULL, 0);
         return VLF_EV_RET_REMOVE_HANDLERS;
      }

      vlfGuiMessageDialog("No connection to Home Automation Server.", VLF_MD_TYPE_ERROR);
      return VLF_EV_RET_NOTHING;
   }

   vlfGuiSetRectangleFade(0, 56, 350, 272 - 56, VLF_FADE_MODE_OUT, VLF_FADE_SPEED_SUPER_FAST, 0, OnOffFadeOut, NULL, 0);
   return VLF_EV_RET_REMOVE_HANDLERS;
}

void OnOffMenu(int sel)
{
   char *items[] =
   {
      "On",
      "Off"
   };

   relayname = vlfGuiAddText(240, 90, names[g_relaySel]);
   vlfGuiSetTextAlignment(relayname, VLF_ALIGNMENT_CENTER);
   vlfGuiCentralMenu(2, items, sel, NULL, 0, 0);
   vlfGuiBottomDialog(VLF_DI_ENTER, VLF_DI_CANCEL, 0, 1, VLF_DEFAULT, BackToMainMenuFromOnOffMenu);
   vlfGuiSetRectangleFade(0, 56, 350, 272 - 56, VLF_FADE_MODE_IN, VLF_FADE_SPEED_SUPER_FAST, 0, NULL, NULL, 0);
}

void MainMenuFadeOut(void * ptr)
{
   vlfGuiCancelCentralMenu();
   vlfGuiCancelBottomDialog();
   OnOffMenu(g_relayStatus[g_relaySel]?0:1);
}

int MainMenuSelect(int sel)
{
   g_relaySel = sel;

   vlfGuiSetRectangleFade(0, 56, 480, 272 - 56, VLF_FADE_MODE_OUT, VLF_FADE_SPEED_SUPER_FAST, 0, MainMenuFadeOut, NULL, 0);
   return VLF_EV_RET_REMOVE_HANDLERS;
}

void MainMenu(int sel)
{
   char *items[] =
   {
      &names[0][0],
      &names[1][0],
      &names[2][0],
      &names[3][0],
      &names[4][0],
      &names[5][0],
      &names[6][0],
      &names[7][0]
   };

   vlfGuiCentralMenu(8, items, sel, MainMenuSelect, 0, 5);
   vlfGuiBottomDialog(VLF_DI_ENTER, VLF_DI_CANCEL, 0, 1, VLF_DEFAULT, NULL);
   vlfGuiSetRectangleFade(0, 56, 480, 272 - 56, VLF_FADE_MODE_IN, VLF_FADE_SPEED_SUPER_FAST, 0, NULL, NULL, 0);
}
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Mar 10, 2009 12:17 am    Post subject: Reply with quote

Well, I found that the problem was that I had some text items hidden and lying around. I kept these so I could reuse them later by making them visible, which worked in the beta. But v1.0 doesn't seem to like hidden objects that aren't used. It causes all kinds of strange problems.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9
Page 9 of 9

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group