当前位置: 首页>>代码示例>>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;未经允许,请勿转载。