Window System for XNA allows you to easily add GUI functionality to your games and tools that target the XNA Framework. It is being actively developed at the moment, so if anybody is interested in contributing to the project, then please leave a message in the forums.Documentation
- 18th May 2008
New release has the promised improved performance as well as various bug fixes. See release notes for more information.
- 17th May 2008
Last night I gave a demo of Window System for XNA to a group of XNA developers. The reception was good, and very much appreciated. The event was organised by XNA UK User Group (http://xna-uk.net), and sponsored by Microsoft. Thanks for all the food and drink!
The other projects I saw were really cool, some of which I can't wait until they are finished. Make sure you check out the site, especially if you're from the UK.
The evening also made me feel like working on my library again, so I've spent today bug fixing and thinking about new features. If you check out source control, you'll notice lot's of updates. The next thing I'll be working on it improving performance, by making my own implementation of SpriteFont, so I can do software clipping instead of using scissor rectangles.
- 26th March 2008
The promised release has finally been finished! The project has been updated to XNA 2.0, and adds XML skinning support.
In order to add XNA 2.0 support, I removed the remnants of the old render target system from Label. Scissor rectangles are now used, which has affected performance, but I will be doing some optimization for the next major release.
All the old static property calls have been removed, in favour of the new skinning system. During implementation I also cleaned up existing property interfaces and added new ones that were previously missing. These changes will likely break your current code, but it shouldn't be too difficult to fix.
The other changes are minor bug fixes.
I will be also adding full documentation to the wiki in the near future, with the possibility of new tutorials (if anybody suggests something). I also am looking for new team members to help contribute to the project.
At the moment I am working on a 2D game framework in XNA with a friend, that should have an alpha release in two weeks or so. I will post a link here when it is published on CodePlex.News
- 9th February 2008
There have been a lack of updates lately. Unfortunately I haven't really had time to work with XNA lately because of my job. I get to work on the PlayStation 3 every day, so I can't really complain!
The good news is that I have a release ready today! The bad news is that something seems wrong with the CodePlex site, so I can't upload the project. Below I've posted some information about the release. I'll try again later today.
"This release adds support for XML skin definitions. This method replaces the previous method of static properties to change GUI defaults, and is far more flexible. A skin definition can be applied to all subsequent controls, all existing controls, and also to individual controls.
I will add a short tutorial soon to explain the usage. For now check out the WindowSystemTestbed project that is included in the download, in particular DefaultSkin.skin, which is an XML skin featuring all possible properties set to their defaults.
Please note that many of the control properties have been changed, removed, or added to accommodate this new skinning system. It is likely that your existing code will break upon first compilation. It shouldn't be too difficult to go through the new class definitions to update your code.
Additionally, while implementing this I noticed some existing bugs that I had previously missed. I fixed most of them, but the ones remaining may prevent certain control skins from appearing as expected. Please submit all bugs to this site."News
- 5th November 2007
Sorry about the delay in uploading a new release, but it's finally ready! If anybody is thinking about a broadband provider in the UK, don't use Tiscali!
As promised, anti-aliased fonts are supported, and XNAExtras has been replaced with XNA SpriteFont. There is a chance it could break some code, as DrawableUIComponent has been removed, because it is now redundant with the new rendering code.
Now that these long-running problems have been fixed, look forward to new features in the near future.News
- 21st September 2007
Just to let everybody know that there should be a new release within the next week, basically when my internet connection is back up. The reason for the sudden release is because I've finally managed to fix the GUI rendering, with correct alpha values. The most important impact is that anti-aliased SpriteFont will be used from now on, and the old XNAExtras stuff is to be removed.
If anyone is interested in what the problem was, and how I fixed it, then read on.
In the old system, every control was rendered to its own texture using render targets. Each child control would have its texture combined with those of the other children, to make up the texture of the parent control (after drawing itself). It was quite efficient because only the top level controls (generally windows) actually get their textures drawn to the screen, with the textures only redrawn when necessary, such as when the mouse hovers over a button, and a different image must be displayed. Render targets were also an easy way to perform clipping of child controls within their parent, and allowed the alpha value of a control to affect all children as well.
The problem with render targets was that control textures had to be drawn to a transparent texture, causing incorrect colour and alpha values to be produced during the alpha blending operation. In practical terms, it means that the edges of sprites with partial transparency and anti-aliased text would be mixed with white (or any other colour depending on the clear colour of the render target). This made either anti-aliased text unreadable, or made the edges of some controls the wrong colour. The reason I couldn't use SpriteFont, was because it created anti-aliased fonts. With XNAExtras I could make a simple font bitmap with colour keyed transparency, which made the text problem go away.
After playing with render states and pre multiplied alpha for a long time, I finally got fed up and tried to find another way to get it working. I was advised to draw directly to the screen, and use scissor rectangles to handle clipping. This worked great, except performance was abysmal. With just 4 complex windows on the screen, the framerate would start to drop. That was without any game running in the background! The reason for the poor performance was because scissor rectangles must be the same until SpriteBatch.End() is called. This means that I had a SpriteBatch.Begin() and End() call for every single control!
Next I decided to implement my own texture clipping, which all worked great, but there wasn't an obvious way to clip text. When using scissor rectangles for just text, the performance was still really bad. The final method was to use a hybrid approach. I would clip sprites on the CPU, and render text to textures which would be cached to allow fast draw calls. The text texture can then be clipped in the same way as the rest of the GUI sprites. Of course there was still the problem of partial alpha pixels being blended with the transparent texture colour. Basically I set the render states to draw with pre multiplied alpha, and set the background clear colour of the texture to the text colour, with the alpha channel set to 0. This means that the blending still takes place, but it produces the correct results. The performance is good once again!
So yeah, the project isn't dead, I've just had some big problems to deal with. Now that this is working, I will go back to adding more features like Xbox 360 support, and more widgets.