473,385 Members | 1,973 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,385 software developers and data experts.

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 5331

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*********@ntworld.NOSPAM.comwrote in message
news:mh******************@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?


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*********@ntworld.NOSPAM.comwrote in message
news:UK******************@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" <co*********@ntworld.NOSPAM.comwrote in message
news:mh******************@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?



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*********@ntworld.NOSPAM.comwrote in message
news:mh******************@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.
........
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_commie" <no********@gmail.comwrote in message
news:2b**********************************@s8g2000p rg.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.
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
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...
32
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?)...
4
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...
6
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."...
1
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...
6
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...
1
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...
2
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
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...

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.