Пример #1
0
        public void Test_SetupCamera()
        {
            var g2d = Graphics2D.GetInstance ();
            var win = g2d.GetWindow () as RenderWindow;

            var cam = new Camera ();
            cam.SetScreen (0, 0, 640, 480);
            cam.Viewport = new Rectangle (0.25f, 0.25f, 0.5f, 0.5f);

            var node = new Node ();
            node.Attach (cam);

            cam.SetupView (win);

            var view = win.GetView ();

            Assert.AreEqual (640, view.Size.X);
            Assert.AreEqual (480, view.Size.Y);
            Assert.AreEqual (320, view.Center.X);
            Assert.AreEqual (240, view.Center.Y);

            Assert.AreEqual (0.25f, view.Viewport.Top);
            Assert.AreEqual (0.25f, view.Viewport.Left);
            Assert.AreEqual (0.5f, view.Viewport.Width);
            Assert.AreEqual (0.5f, view.Viewport.Height);
        }
Пример #2
0
        public void Test_SetScreen()
        {
            var cam = new Camera ();

            cam.SetScreen (1, 2, 3, 4);

            Assert.AreEqual (ProjectionType.Screen, cam.Type);
            Assert.AreEqual (1, cam.Screen.X);
            Assert.AreEqual (2, cam.Screen.Y);
            Assert.AreEqual (3, cam.Screen.Width);
            Assert.AreEqual (4, cam.Screen.Height);
        }
Пример #3
0
        public static Node Create()
        {
            var cmp = new MyCamera ();
            var cam = new Camera ();
            cam.SetScreen (0, 0, 800, 600);
            cam.SetViewport (0, 0, 1, 1);

            var node = new Node ("Camera");
            node.Attach (cmp);
            node.Attach (cam);

            return node;
        }
Пример #4
0
        public static Node Create(Vector3 pos)
        {
            var cmp = new MyCamera ();
            var cam = new Camera ();
            cam.SetScreen (0, 0, 800, 600 + 128);
            cam.SetViewport (0, 0, 1, 1);
            var node = new Node ("Camera");
            node.Attach (cmp);
            node.Attach (cam);

            node.Translation=pos;

            return node;
        }
Пример #5
0
        public static Node Create()
        {
            var cam = new Camera ();
            cam.ClearEnabled = false;
            cam.SetScreen (0, 0, 1920, 1200);
            cam.SetViewport (0.75f, 0.05f, 0.2f, 0.2f);

            var cmp = new MyCamera1 ();

            var node = new Node ("Camera2");
            node.Attach (cmp);
            node.Attach (cam);

            return node;
        }
Пример #6
0
        public static Node Create()
        {
            var cmp = new MyCamera ();

            var cam = new Camera ();
            cam.SetScreen (0, 0, 800, 600);
            cam.SetViewport (0, 0, 1, 1);

            var node = new Node ();
            node.Attach (cmp);
            node.Attach (cam);

            node.Translation = new Vector3 (-400, -300, 0);

            return node;
        }
Пример #7
0
        public static Node Create()
        {
            var cam = new Camera ();
            cam.SetScreen (0, 0, 800, 600);
            cam.SetViewport (0, 0, 1, 1);

            var cmp = new MyCamera1 ();
            cmp.MoveSpeed = 10;
            cmp.RotateSpeed = 3;
            cmp.ZoomSpeed = 0.1f;

            var node = new Node ("Camera1");
            node.Attach (cmp);
            node.Attach (cam);
            node.Translate (-400, -300, 0);

            return node;
        }