473,408 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

[C#][XNA 3.1] How can I host two different XNA windows inside one Windows Form?

15
I am making a Map Editor for a 2D tile-based game. I would like to host two XNA controls inside the Windows Form - the first to render the map; the second to render the tileset. I used the code here to make the XNA control host inside the Windows Form. This all works very well - as long as there is only one XNA control inside the Windows Form. But I need two - one for the map; the second for the tileset. How can I run two XNA controls inside the Windows Form? While googling, I came across the terms "swap chain" and "multiple viewports", but I can't understand them and would appreciate support.

Just as a side note, I know the XNA control example was designed so that even if you ran 100 XNA controls, they would all share the same GraphicsDevice - essentially, all 100 XNA controls would share the same screen. I tried modifying the code to instantiate a new GraphicsDevice for each XNA control, but the rest of the code doesn't work. The code is a bit long to post, so I won't post it unless someone needs it to be able to help me.

Thanks in advance.
Mar 14 '10 #1
4 3526
GaryTexmo
1,501 Expert 1GB
I've only ever done it with one XNA object myself, so I can't really tell you exactly how, but on the topic of multiple viewports it didn't look so bad... give it a try?

http://msdn.microsoft.com/en-us/libr....viewport.aspx
http://msdn.microsoft.com/en-us/library/bb313965.aspx
Mar 15 '10 #2
Hi Secutos,
i found lately a working example which show how to add an xna frame on a WinForm.
The only thing you have to do is change the SpinningTriangleControl.cs to your liking.
It's a custom Control which you can add to your form in the designer.
Here is the link to the Tutorial:
1) http://creators.xna.com/en-us/sample/winforms_series1
2) http://creators.xna.com/en-us/sample/winforms_series2

Hope you like it just like i do ;)

greets regalis

I have attached a sample preoject with a spinning Sphere and some spritebatch text ;)
Btw.: You have to change the project options to compile for x86 processor x64 won't run ;)
Attached Files
File Type: zip WindowsFormsApplication1.zip (72.8 KB, 216 views)
Mar 17 '10 #3
Ops, just saw that the compiled binary is in the attached .zip
--> SORRY about that! (Just delete it)
Mar 17 '10 #4
secutos
15
Thanks so much for the replies everybody.
Mar 21 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Tim.D | last post by:
People, I've ventured into the wonderful world of Stored Procedures. My first experience has been relatively successful however I am stuck on using host variables to specifiy actualy table or...
7
by: MounilK | last post by:
Hi all, I am not sure if this is the right NG to post this question. If that's the case please point me to the correct NG. I have a class library(myLib.dll) which has a class(myClass) which has...
3
by: Claudia Fong | last post by:
Hi I was using a console application to host the windows workflow and when I change to winforms, I don't know how to do it... I pass the parameters into the workflow from the winform and is...
1
by: =?Utf-8?B?UmV1YmVu?= | last post by:
Hi, Sorry if I'm in the wrong newsgroup, but I couldn't find anything that dealt solely with XNA. I was wondering if there is any way to compile content into XNA binary files without using the...
1
by: RTY-p 6 [marc] | last post by:
hi, i'm not sure if this is the right newsgroup, but i'm pretty sure there are a lot of guys, who know about this subject: shortly xna 2.0 will be released by msft. my question: i already...
5
by: colin | last post by:
Hi, Ive got a 3d model editor wich im developing with XNA c# development environment, using the game window to display the wireframe mesh in 3d. however I need to use some other windows too,...
1
by: Smokey Grindel | last post by:
Anyone know when XNA 2 will be made available on VS2008? I guess all they have to do is fix the project templates?
3
FishVal
by: FishVal | last post by:
Windows Script Host Object library. Full name: Windows Script Host Object Model LibName: IWshRuntimeScripting Location: ...\WINDOWS\system32\wshom.ocx The present tip is closely related to...
2
by: Dean Slindee | last post by:
I am not looking for a "hybrid" WPF/WinForm or WinForm/WPF solution, but rather a pure WPF/WPFsolution. I want to host a WPF window inside another WPF window. I want to host a WPF window as a...
3
GaryTexmo
by: GaryTexmo | last post by:
I'm curious about XNA and drawing speeds... I'm finding I'm not getting what I would have expected. First, a little background on me. I started programming in QuickBasic and really liked the graphics...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.