當前位置: 首頁>>代碼示例>>C#>>正文


C# Camera.SetScreen方法代碼示例

本文整理匯總了C#中Camera.SetScreen方法的典型用法代碼示例。如果您正苦於以下問題:C# Camera.SetScreen方法的具體用法?C# Camera.SetScreen怎麽用?C# Camera.SetScreen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Camera的用法示例。


在下文中一共展示了Camera.SetScreen方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Test_SetupCamera

        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);
        }
開發者ID:weimingtom,項目名稱:erica,代碼行數:26,代碼來源:TestCamera.cs

示例2: Test_SetScreen

        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);
        }
開發者ID:weimingtom,項目名稱:erica,代碼行數:12,代碼來源:TestCamera.cs

示例3: Create

        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;
        }
開發者ID:weimingtom,項目名稱:erica,代碼行數:13,代碼來源:MyCamera.cs

示例4: Create

        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;
        }
開發者ID:weimingtom,項目名稱:erica,代碼行數:15,代碼來源:MyCamera2.cs

示例5: Create

        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;
        }
開發者ID:weimingtom,項目名稱:erica,代碼行數:18,代碼來源:MyCamera1.cs


注:本文中的Camera.SetScreen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。