2D Camera

Before a scene is rendered using Scene.Draw method, the rendering system will check if a there’s any camera inside the scene. If a camera is found, it will use that camera to render the scene. Otherwise, a 3D first person camera will be used.

In order to draw 2D graphics, add a Camera2D to the scene before calling Scene.Draw:

scene.Add(new Camera2D(GraphicsDevice));

Or, add it to the XAML file:

<Scene xmlns="http://schemas.microsoft.com/nine/2011/xaml">
    <Camera2D />

The 2D coordinate system used by Engine Nine is illustrated below. The X axis points to the right and the Y axis points upward. The origin of the coordinate system is placed at the center of the screen.


Last edited Sep 23, 2012 at 4:29 AM by yufeih, version 7


No comments yet.