Addition of IGUITable::getColumnWidth to CGUITable.cpp???

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Addition of IGUITable::getColumnWidth to CGUITable.cpp???

Post by reifsnyderb »

Hello,

Since there is a setColumnWidth, is there a chance of me talking somebody into adding a getColumnWidth into CGUITable.cpp?

The following code works:


[code]

u32 CGUITable::getColumnWidth(s32 columnIndex) const
{
if(columnIndex >= 0 && columnIndex < (s32)columns.size() )
{
return (u32)columns[columnIndex].width;
}
return 0;
}
[/code]


Regards,

Brian
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Post by reifsnyderb »

Hello,

Since there is a theoretical possibility of a column returning a 0 width, I modified the code so that a -1 is returned if a column doesn't exist. Also, since I re-typed this, as I tested it on another computer, it turns out that I forgot to capitalize "Columns" in my last post.


[code]

s32 CGUITable::getColumnWidth(s32 columnIndex) const
{
if(columnIndex >= 0 && columnIndex < (s32)Columns.size() )
{
return (u32)Columns[columnIndex].width;
}
return -1;
}
[/code]


Regards,

Brian
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Ok, I've added that function in trunk.
edit: Just noting in case you wonder:
columnIndex is u32 as in setter (Irrlicht switched at some time to using u32 throughout for indices, a topic discussed elsewhere...)
And returning 0 is fine and we should return u32 as this is an u32 value.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Post by reifsnyderb »

Great! Thank you.

Regards,

Brian
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

what about getColumnLength ?
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Post by reifsnyderb »

[quote="ent1ty"]what about getColumnLength ?[/quote]


What would getColumnLength() be used for? I figured getColumnWidth() made sense as you set the column width with setColumnWidth()

Regards,

Brian
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

I was, in fact, being sarcastic
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

ent1ty wrote:I was, in fact, being sarcastic
I was sure of that the first few times, but by now I started wondering ;-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply