|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XNA game window as a form control ?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 =^.^= 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 =^.^= Show quote "colin" <colin.rowe1@ntworld.NOSPAM.com> wrote in message news:mhE2j.14060$Ew3.1103@newsfe7-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? 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 =^.^= Show quote "colin" <colin.rowe1@ntworld.NOSPAM.com> wrote in message news:UKg3j.60667$Eq.55879@newsfe3-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" <colin.rowe1@ntworld.NOSPAM.com> wrote in message > news:mhE2j.14060$Ew3.1103@newsfe7-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? > > > 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 =^.^= Show quote "colin" <colin.rowe1@ntworld.NOSPAM.com> wrote in message news:mhE2j.14060$Ew3.1103@newsfe7-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. > ........ 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. "not_a_commie" <notacom***@gmail.com> wrote in message Cool thanks, the last post on that thread looks promising,news:2b8513d7-e20e-4d7e-8334-0659d59052a2@s8g2000prg.googlegroups.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. 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 =^.^= |
|||||||||||||||||||||||