开发者

Do you know of a table layout module for XNA?

I've just started doing some XNA stuff. In my screens (e.g. title screen and high score screen) I find myself more and more modifying rectangles, then drawing something, then modifying another rectangle, then drawing something... repeat multiple times.

What I'd like is a table. I'd like to specify: the amount of rows and columns, the spacing and padding, the size of the cells in pixels or percentages, and which cells are merged. e.g.

var t = new TableLayout(viewPortBounds);
t.Columns=3;
t.Rows=5;
t.Padding=5;
t.Spacing=25;
t.SetRowSize(0, new Percent( 5) );
t.SetRowSize(1, 100);

This'd create a 3x5 table with padding and spacing. I can the开发者_JAVA百科n get rectangles like:

Rectangle r = t.Cell(1,0)
drawText(@"the title", r);
drawText(@"something else", t.Cell(0,1) ) ;

etc.

I'd also like the ability to merge cell, e.g. given the first row above, I'd like to merge all the cells, then when I ask for cell(0,0), I'd get a rectangle of the full width of the table (minus the spacing).

Does such a thing exist?


Have you thought about using a GUI library like Neoforce?


I've since found a couple of alternatives that follow the WPF/Silverlight paradigm.

Red Badger's XPF and Valentin's XnamlComponent. Both look very good. Red Badger haven't yet finalised the license but assure us that it'll be free to use for non-commercial or open-source projects. Valentin doesn't yet mention licensing and is looking for testers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜