3d camera
Please, be more explicit.
You have to implement all from zero?
You have already developed a camera class on an XNA game and you want to make some similar on a windows form project started from the "windows form series" xna tutorials?
However I try a reply:
If you want a continuous rendering you need to add these lines at the end of Initialize() method of ViewportControl (you need to override it from base class):
otherwise you need to manually update the rendering calling Invalidate() method on ViewportControl when the camera or objects in the scene moves.
Look at this link from App Hub: http://xbox.create.m...nforms_series_1
I hope I've hit the target
You have to implement all from zero?
You have already developed a camera class on an XNA game and you want to make some similar on a windows form project started from the "windows form series" xna tutorials?
However I try a reply:
- Add the camera class to the project or write a new one (on this case is easier to develop it on a xna game project for debug and move to windows form when it works).
- Add all needed XNA assembly references: Microsoft.Xna.Framework, Microsoft.Xna.Framework.Graphics, Microsoft.Xna.Game (and others maybe).
- Derive a control from the GraphicsDeviceControl, you can name this ViewportControl
- Intercept windows forms events of ViewportControl overriding: OnKeyDown(), OnKeyUp(), OnMouseDown(), OnMouseUp(), OnMouseClick(), etc.
- On the body of previous methods update the camera moving and/or rotating it, in example:
// handle mouse wheel movement and react with a camera action
protected override void OnMouseWheel(MouseEventArgs e)
{
HandleCamera(e.Button, 0.0f, 0.0f, e.Delta);
base.OnMouseWheel(e);
}
- Override the method Draw in ViewportControl like this:
protected override void Draw()
{
// code to draw the scene like in Draw() method of an XNA game.
}
If you want a continuous rendering you need to add these lines at the end of Initialize() method of ViewportControl (you need to override it from base class):
// Hook the idle event to constantly redraw
Application.Idle += delegate { Invalidate(); };
Invalidate();
otherwise you need to manually update the rendering calling Invalidate() method on ViewportControl when the camera or objects in the scene moves.
Look at this link from App Hub: http://xbox.create.m...nforms_series_1
I hope I've hit the target
thanks
i use the windows form serie 2
is in 3d
i using the neoforce project i can put two textbox in the center and two bottons
i use the windows form serie 2
is in 3d
i using the neoforce project i can put two textbox in the center and two bottons
I don't know your knowledge of windows forms programming, but if your GUI is complex you can add the GraphicsDeviceControl into a windows form (like the tutorial) to display only the scene, but handle all the GUI with windows forms controls. It's more simple (for me) and you get a better performace due to the different threads that .NET use for GUI and code logic.
I know the neoforce project and I think is better to use it on a real-time enviroment like game menus etc.
As you can see in the attached image (an editor based on XNA .NET I'm developing) all the interface is done by windows forms, and the 4 viewports are made like in the "windows forms series" with some enhancements I've writed you on previous post.
I know the neoforce project and I think is better to use it on a real-time enviroment like game menus etc.
As you can see in the attached image (an editor based on XNA .NET I'm developing) all the interface is done by windows forms, and the 4 viewports are made like in the "windows forms series" with some enhancements I've writed you on previous post.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement