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 

Menus APP

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
mplacona



Joined: 07 Aug 2007
Posts: 28

PostPosted: Sun Sep 09, 2007 10:26 am    Post subject: Menus APP Reply with quote

Hi Guys, I'm creating a menu for an HB I'm currently developing and got stuck in one thing.

I wanna create a very large menu coming from an array (may have 50+ items) and would like to be able to display it in one go on the screen, and let the user scroll over it showing a selector over the item selected, just like IRSHELL when it displays the list of remote controls.

Actually I'm having two probs.

First is that I can't seem to be able to create a char array the same way I create an int array like

Code:
int myArr = {1,2,3,4,5};


If I do the same with char, the program won't compile

And second is that I have no idea about how to make my list scroll when the users uses up and down arrows as well as how to know which position I have to show my selector. I guess I can figure ou the position by getting the last position plus x pixels. But the scrolling thing, I have no idea how to do.

Can anyone help me on that? Even if it's pointing me out to some code samples?

Thanks,

Marcos
Back to top
View user's profile Send private message
crazyc



Joined: 17 Jun 2005
Posts: 410

PostPosted: Sun Sep 09, 2007 10:36 am    Post subject: Re: Menus APP Reply with quote

Code:
int myArr = {1,2,3,4,5};


You should probably define that as an array like int myArr[5];
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Sun Sep 09, 2007 1:29 pm    Post subject: Reply with quote

Scrolling?
Smooth scrolling?
Silky smooth scrolling? chek out Academic Aid 2.3. Want it like dat?
Back to top
View user's profile Send private message
Vincent_M



Joined: 03 Apr 2007
Posts: 73

PostPosted: Mon Sep 10, 2007 5:36 am    Post subject: Reply with quote

The best way to do this would be implement a linked list. The reason to go with a linked list is because the number of different items in your list will change making the number of elements in your linked list not static. However, an array would be every bit useful if you have a limit of the number of (possibly different kinds) items. Let's say that you can only hold up to 100 different kinds of items, or that you can only hold up to 100 items, you'll make an array of 100 items. I would make an sItem structure to contain the definition of what your items can do (like have a name, possibly quantity, an int-typed ID to tell what kind of item it is with macros, etc). Then, you would have an array of sItems. The size of the array would be the max amount of items you can have.

For example, your item structure could look something similar like this:
Code:

struct sItem
{
     char name[16];
     int id;
     int quantity;

     sItem() {
          sprintf(name, " ");
          id = -1;
          quantity = 0;
     }
};


No, notice how I set 'id' to -1. You can treat the array of item's as slots. If there isn't an item in your slot, you just set the number to -1, and if there is, then set the id to the number of the corresponding type of the item it is. You can setup a list of macros to determine the type of items you use.

I'd go into more specifics, but it's getting late here. I might have the source code to my inventory system still too. I'll check on that.
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
Page 1 of 1

 
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