简体   繁体   中英

Do you know of a table layout module for XNA?

I've just started doing some XNA stuff. In my screens (eg 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. eg

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 then 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, eg 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?

您是否考虑过使用像Neoforce这样的GUI库?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM