Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show WinForm and then run XNA game? [duplicate]

Tags:

c#

xna

Possible Duplicate:
Embed XNA in WinForms

HEY, please this is NOT DUPLICATE of that post. Its because you cant get any answer from it because its links are not working... and someone comments me that he got new link and when i saw that site it wasnt that i need...

I am making game that needs to login, and i want to make login in WinForm... but when i run winform and then after successfull login it should run game. I saw this Post on StackOverflow but the link for answer is ... abanonded ...

like image 325
GemHunter1 Avatar asked Nov 19 '25 17:11

GemHunter1


1 Answers

XNA is bootstrapped in the Program.cs. Just add code in your winforms when the client is authenticated that starts the XNA game like in the Program.cs.

See http://www.codeproject.com/Questions/303672/XNA-And-Windows-forms

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        button1.Text = "Start!";
    }

    private void button1_Click(object sender, EventArgs e)
    {
        Thread theThread = new Thread(StartGame);
        theThread.Start();
    }
    public void StartGame()
    {
        Game1 game = new Game1();
        game.Run();
    }
}
like image 110
Dustin Kingen Avatar answered Nov 22 '25 06:11

Dustin Kingen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!