Set no of Elements in a list.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
rtr_18
Posts: 60
Joined: Thu Jun 10, 2010 8:35 am
Location: Programmer

Set no of Elements in a list.

Post by rtr_18 »

Hi!
I've to set the maximum no. of elements in a list. i.e My list should contain only 5 elements. How to do this?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

If you refer to the irr::core::list than what you could do is check if the maximum is not reached yet, if not add another item.

Code: Select all

int max = 5; // or you could use define, up to you to decide.
.....
if(mylist.getSize()!=max)
  mylist.push_back(ITEM);
Working on game: Marrbles (Currently stopped).
rtr_18
Posts: 60
Joined: Thu Jun 10, 2010 8:35 am
Location: Programmer

Post by rtr_18 »

serengeor Wrote: If you refer to the irr::core::list
I mean the irr::gui::IGUIListBox.
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

All the same

Code: Select all

getItemCount()

addItem(...)
Never take advice from someone who likes to give advice, so take my advice and don't take it.
Post Reply