XNA WinForms Reduex!

Published 6/15/2009 by createdbyx in News | Programming | XNA

First start a new xna window game project. Then add a new "MDI Parent Form" to the project. After that change the code in the Program.cs file to look like this ...

static void Main(string[] args)
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);

    using (Game1 game = new Game1())
    {
        MDIParent1 mainMDIForm = new MDIParent1();
        var gameWindow = Control.FromHandle(game.Window.Handle) as Form;
        if (gameWindow != null)
        {
            gameWindow.MdiParent = mainMDIForm;
        }

        mainMDIForm.Show();
        gameWindow.Show();
        game.Run();
    }
}

Now press F5 to run the application. Voila! You can now proceed to add game editing or other win form controls to the MDI window for what ever you need. But some initial testing raised a few minor issues.

The first one is that once in a while the viewport does not get updated if the game window is resized. There is also a issue where keyboard keys don't work properly if the game window is the active window. To over come this just make sure that after you are finished interacting with the game window to just deactivate the window again. Then you will be able to press Alt-F to bring up the file menu for example.


If you have been fallowing my blog and read my last post it stated that I would have Release 2 of my xGameConsoleXNA library up and posted within a week. Well a week has come and gone. 2 weeks, ... 3 Weeks, 4 Weeks, ... What can I say. When a person sleeps when there tired and not when social doctrine declares when it is time, the days seem to blend into one another and time passes. 4 whole weeks. Hmm, seems like only yesterday that I made my last post.

Anyway it has been a busy few weeks. The house has been sold and we need to be out by mid July, so we have been packing and getting ready to move. And I am destined to be home less for the next few months until the mushroom season starts up again in late august. Which means my computer use and internet connection will be severely limited for some time.

I have also started working on a new project with my brother these last two weeks. I don't want to say too much about it because it's not finished but suffice it to say I have written some apps that have crawled over 1.2 million page links in just a few days, and out of those 625000+ are blog related. We are thinking about creating a service and doing a search engine designed for a select group of people, that will offer much more detailed info that a standard Google search can. My brother seems to think we could make up to $20,000 a month each if we can get it working and it really starts to take off. It would also be the first project I have worked on whose end result is intended to put some money in my pocket. For someone who can live comfortably on less then $4800 a year, $20,000 a month seems like millions. But until that happens it is a wait and see game.

And lest you think I have forgotten about the xGameConsoleXNA library, check out the xGameConsoleXNA page for the link to the Release 2 download as well as some how to articles. Better late then never!

I have gone back and finally done some more work on my xGameConsoleXNA library for the XNA platform. The next release will be Release 2 and will mainly contain updates to how the user interacts with the console.

  1. It can now do things like scroll through the text that was written out to the console
  2. Pressing the left and right arrow keys on the keyboard you can set the insertion point for typing text
  3. If you type a really long line of text in the entry line that is too long to fit within the console the text will now gracefully scroll left or right depending on where the insertion point is
  4. More comments in the code as well as xml 'summery' comments for the methods
  5. Made a number of optomizations so some parts of the code are more simplified
  6. There are some breaking changes such as some properties have been renamed to better more understandable names. I also moved a few methods and properties out of the console class and into the ConsoleComponent class because they really were more suited being in the ConsoleComponent class.
  7. I also added a WordWrap property to the ConsoleComponent class so that text that gets written to the console will now wrap to the next line if it does not fit.
I should hopefully upload Release 2 within the next week. I would also like to mention that I noticed some of the xGameConsoleXNA code may not be 360 compatible, even though I cannot test it on the 360 because I do not have a creators club subscription. For example the LoadAlias command was using the IO.File.ReadAllLines method and the 360 xna api's do not contain the ReadAllLines method. I will try to keep an eye out for more code like that. I modified the code so that it no longer uses the ReadAllLines method but I will not be able to ensure that xGameConsoleXNA will seamlessly run on the 360 until I get a creators club subscription.

It is my intention to eventually get the xGameConsoleXNA working on the 360 but I promised myself that I would only purchase a creators club subscription after I had completed or had come close to completed a working game. So yeah, being more of a tool developer it might take me a while to get a subscription. :(

The first release of the xMessages component was really just a introduction to what I was working on. I have yet to see any other components out there that does what the xMessages component does. Anyway I updated the code (Release 2) so that it now supports a interface driven modal so that text effects and image effects can be created and applied to the message. I am still no where close to being done. There are still some minor bugs here and there, and I put a little more comments in my code. Future releases will continue to improve the code as well as provide better documentation.

Eventually I hope to write some content pipeline processors so that an entire conversation can be created and stored in a xml file and then use the content.Load method to load that whole conversations in one line of code rather then having to write many lines of code by hand to get it to do stuff. i am also thinking of writing a tool for authoring conversations and saving them out to xml files so that you do not have to write the xml files by hand. But that will not be for some time.

If you watch the updated video you can start to see what the end goal for the xMessage component is trying to achieve.

I have posted a video of the xMessage component in action to give people a sense of what it can do. You can find the video here.

I thought it would be cool having 3 computers. Boy was I wrong. I have been spending the last few months consolidating all my files down to a more manageable level. I just got a new HP nx9420 laptop and am trying to move all my files from my three old computers over to it. Little did I know I had about +500,000 files to transfer. Yikes. Not to mention I had numerous duplicate files and trying to sort through the old duplicates from the new is a serious time waster, but at least I can start to see light at the end of the tunnel.

I have also posted a new image browsing application on the projects page called xImageSV. It's not actually new, I have been using it for some time but I have decided to post it on the site in the off chance anybody wishes to use it.

Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume