XNA game window as a form control ?

C

colin

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 =^.^=
 
C

colin

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 =^.^=
 
C

colin

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 =^.^=
 
C

colin

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 said:
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.
........
 
C

colin

not_a_commie said:
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 =^.^=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top