Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working in Xna 4.0 and iwant to make a program that uses the same code in 2 different windows. What i want out of this is that one player plays in one window and the other player to play in the second window.

So i have 2 different questions:

Is it possible to use 2 windows for the same program?

Is it possible for 1 window to have focus on one controller and the other window on the other?

share|improve this question
    
That's definitely something that can be implemented using networking, with the added benefit that it scales over a network. But there might me a more straightforward way. –  Laurent Couvidou May 21 '12 at 9:39
1  
Why don't you let the main window accept both inputs and just split the output over 2 windows? –  Hackworth May 21 '12 at 10:57

2 Answers 2

Xna does not work well with two active window forms running xna code at same time...

You should work with one window splitted in two viewports.

Each xbox game controller has its own index, one will be playerindex1 and the other playerindex2, this way you can identify which controller is related to a player/viewport.

share|improve this answer
    
my question was if it worked. Not if it worked well... –  Eric Nilsson May 23 '12 at 8:12

What you're asking to do is possible, but the results are not necessarily pretty. Keep in mind that with Windows, you can only have one application being 'focused' on at one time. This means that your game will need to accept updates while out of focus, since both players cannot have a focused window at the same time. Generally, you want to avoid this in favor of pausing the game whenever the window handle tells it that the player had to minimize it for some reason.

What might be a better (and simpler) idea is to do traditional 'split-screen' co-op/head-to-head. Why exactly do you need two separate windows? Perhaps there is an alternative method.

share|improve this answer
    
I can think of many GUI uses for several windows. Instead of using ingame moveable frames you create separate windows and let the user mix, match and resize them. –  MLProgrammer-CiM May 21 '12 at 11:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.