473,738 Members | 8,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XNA game window as a form control ?

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,
such as a Form type window wich displays lists of numerical details
about objects in the 3d view and allows objects to be selected from a list
as an alternative to selecting them on the 3d view
as they maybe underneath another object.

If I run the game from within a Form
it complains -"cant have more than one message loop"

so Ive made the form and XNA game window seperate threads,
wich works ok they both display and work ok
but I need to share the keyboard focus between the two
as I need to click on some controls on the form
but still have keyboard input accepted by the game window.

I can probably get round this by routing key input from either
thread, but I will need to process the mouse hover over a control in the
form
and look for 3d objects under the cursor in the game window
etc wich makes it more tricky.

What would be nice is if I could make the game window part of the form,
like a child control, is this possible ?
the XNA Game class seems to make a window wich has virtually
no control over how its created or any builtin functions to access the
window.

I gues the Window handle is acessable, I used to do some low level window
stuff
but its been a long time since, anyone know if this is possible or how to do
it?

Colin =^.^=
Nov 26 '07 #1
5 5350

Ive tried by simply calling the windows api SetParent to set the parent of
the
xna game window to be the form window, it displays and draws ok but it locks
up.

the cursor wont even move out of the form window I have to use task manager
to close it
as I cant even move the mouse to the IDE.

What else do I need to do to get it to run ?
I just need the xna window to stay visible on top of the form window.
Im so rusty with doing it the low level way...

Colin =^.^=
"colin" <co*********@nt world.NOSPAM.co mwrote in message
news:mh******** **********@news fe7-gui.ntli.net...
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,
such as a Form type window wich displays lists of numerical details
about objects in the 3d view and allows objects to be selected from a list
as an alternative to selecting them on the 3d view
as they maybe underneath another object.

If I run the game from within a Form
it complains -"cant have more than one message loop"

so Ive made the form and XNA game window seperate threads,
wich works ok they both display and work ok
but I need to share the keyboard focus between the two
as I need to click on some controls on the form
but still have keyboard input accepted by the game window.

I can probably get round this by routing key input from either
thread, but I will need to process the mouse hover over a control in the
form
and look for 3d objects under the cursor in the game window
etc wich makes it more tricky.

What would be nice is if I could make the game window part of the form,
like a child control, is this possible ?
the XNA Game class seems to make a window wich has virtually
no control over how its created or any builtin functions to access the
window.

I gues the Window handle is acessable, I used to do some low level window
stuff
but its been a long time since, anyone know if this is possible or how to
do it?


Nov 28 '07 #2
actually it runs ok exept when the form is shown so that the child game
window
is obscured by the task bar at the bottom, then it locks up,
anyone got any idea whats going on ?

I dont know why but my forms often are positioned so they are obscured
by the task bar at the bottom wich is 2 rows high wich is slightly anoying.

Colin =^.^=
"colin" <co*********@nt world.NOSPAM.co mwrote in message
news:UK******** **********@news fe3-gui.ntli.net...
>
Ive tried by simply calling the windows api SetParent to set the parent of
the
xna game window to be the form window, it displays and draws ok but it
locks up.

the cursor wont even move out of the form window I have to use task
manager to close it
as I cant even move the mouse to the IDE.

What else do I need to do to get it to run ?
I just need the xna window to stay visible on top of the form window.
Im so rusty with doing it the low level way...

Colin =^.^=
"colin" <co*********@nt world.NOSPAM.co mwrote in message
news:mh******** **********@news fe7-gui.ntli.net...
>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,
such as a Form type window wich displays lists of numerical details
about objects in the 3d view and allows objects to be selected from a
list
as an alternative to selecting them on the 3d view
as they maybe underneath another object.

If I run the game from within a Form
it complains -"cant have more than one message loop"

so Ive made the form and XNA game window seperate threads,
wich works ok they both display and work ok
but I need to share the keyboard focus between the two
as I need to click on some controls on the form
but still have keyboard input accepted by the game window.

I can probably get round this by routing key input from either
thread, but I will need to process the mouse hover over a control in the
form
and look for 3d objects under the cursor in the game window
etc wich makes it more tricky.

What would be nice is if I could make the game window part of the form,
like a child control, is this possible ?
the XNA Game class seems to make a window wich has virtually
no control over how its created or any builtin functions to access the
window.

I gues the Window handle is acessable, I used to do some low level window
stuff
but its been a long time since, anyone know if this is possible or how to
do it?



Nov 28 '07 #3
well after looking several times over the last fee days
I finally came across this
http://www.fairyengine.com/articles/xnainform.htm
looks like its what I need,

kinda complicated as the basic xna loop is
re implemented in the form loop.
but manages to put 2 3d windows on a form :D
looks realy cool, and a pretty 3d tiger too

many thanks to the author of that article.

Colin =^.^=
"colin" <co*********@nt world.NOSPAM.co mwrote in message
news:mh******** **********@news fe7-gui.ntli.net...
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,
such as a Form type window wich displays lists of numerical details
about objects in the 3d view and allows objects to be selected from a list
as an alternative to selecting them on the 3d view
as they maybe underneath another object.
........
Nov 28 '07 #4
You need to read this thread:

http://forums.xna.com/thread/10288.aspx

I posted the head on that. The performance is just crap, though. I'd
suggest using WPF instead.
Nov 29 '07 #5
"not_a_comm ie" <no********@gma il.comwrote in message
news:2b******** *************** ***********@s8g 2000prg.googleg roups.com...
You need to read this thread:

http://forums.xna.com/thread/10288.aspx

I posted the head on that. The performance is just crap, though. I'd
suggest using WPF instead.
Cool thanks, the last post on that thread looks promising,
the XnaView class I posted does it by copying it to a texture,
then copying it to the control, xna2.0 looks like you can set
the xna destination window directly.

I just looked up WPF wich is in .net3 and gives you "richer 2d/3d etc..."
Ive already written a lot of code that works on XNA,
xbox compatability isnt an issue, its just a wire model editor.
the real headache is trying to come up with a user interface that
works well, the existing editor interface doesnt work well for me at all
although I know a lot of people have got realy used to it.

hmm wich way to go, xna2.0 or .net3 ...
I wonder wich would need the least amount of code to re write.
seems I already have xna2.0 and most people probably only have .net2 atm
im not clear if that solution for xna2.0 could handle multiple windows,
it might be usefull to have more than one view, although
for orthoganal only one true 3d view is needed,
but its easier if the same drawing system is used for each.

I might well subscribe to that forum looks right up my alley atm.
many thanks,
Colin =^.^=
Nov 29 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1980
by: Supra | last post by:
i got board working using graphic window in vb.net but no controls adding to form. i am doing checker board game. when i clicked and moved the peg to another location(grid). but how do i get bitmap or image to make invisible. here is code for moveevent: Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) Me.PegPicking = True
32
2506
by: Eli | last post by:
How can I POST a form into a new window where I control the size and other attributes of the new window? Also. Are there any implications, perhaps due to browser security (Interne Explorer?) that could cause problems if I try to post a form at www.mydomain.com to www.anotherdomain.com?
4
22211
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a description and a class_id (stored in the value attribute of each option). The user will then select a class from the drop-down list. What I want to do is have a control in the parent browser window which can store the class_id and the...
6
3249
by: DraguVaso | last post by:
Hi, In my application, on some given actions while debugging in Visual Studio, I suddenly get a "System.ComponentModel.Win32Exception was unhandled" Message="Error creating window handle." exception. The problem is that this exception isn't raised somewhere in a method, so it just shows up, and it causes the application to shut down. Is there anyway how to catch this kinds of exceptions? Can I put somewhere a
1
11580
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
6
2827
by: Supra | last post by:
i got board working using graphic window in vb.net but no controls adding to form. i am doing checker board game. when i clicked and moved the peg to another location(grid). but how do i get bitmap or image to make invisible. here is code for mouseevent: Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) Me.PegPicking = True
1
1201
by: Nathaniel | last post by:
A few stings ago I asked: I play an online game application that displays how many points I have earned. I want the number of points I have earned to appear as a string in a text box in the program I am writing in VB.net. If I already knew the window handle, is there someway of accessing the I/O stream to find out my point status? And Boo Replied: If the game client uses standard controls from comctl32 (ie, not a directX game).. it...
2
4036
by: tesa | last post by:
I am not able to figure out how to make this work. I am trying to create a hangman game. I am in a basic javascripting class. I am to only use very basic code as you can see. I am able to use any online resources to help me. I have added alot of comments for what should be happening however is not happening. I also have a teacher that teaches us one way but then asks us to do things he has not taught. I am trying my very best. Any...
2
4623
by: Netwatcher | last post by:
Hello, i am new to c++ windows and DX programming, i encountered a code in the book stated in the title, which doesn't work for a reason, here is the code // Beginning Game Programming // Chapter 5 #edit: not 4, mistake in the title // d3d_windowed program //header files to include #include <d3d9.h> #include <time.h>
0
8969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8210
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.