当前位置: 首页>>代码示例>>C#>>正文


C# IEntityFactory.CreateBoardRendererEntity方法代码示例

本文整理汇总了C#中IEntityFactory.CreateBoardRendererEntity方法的典型用法代码示例。如果您正苦于以下问题:C# IEntityFactory.CreateBoardRendererEntity方法的具体用法?C# IEntityFactory.CreateBoardRendererEntity怎么用?C# IEntityFactory.CreateBoardRendererEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEntityFactory的用法示例。


在下文中一共展示了IEntityFactory.CreateBoardRendererEntity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AugmentedBoardGameWorld


//.........这里部分代码省略.........
            camera640x480.Click += (sender, args) =>
            {
                deviceWidth.Text = "640";
                deviceHeight.Text = "480";
            };
            var camera720p = new Button() { Text = "Camera 720p" };
            camera720p.Click += (sender, args) =>
            {
                deviceWidth.Text = "1080";
                deviceHeight.Text = "720";
            };
            var camera1080p = new Button() { Text = "Camera 1080p" };
            camera1080p.Click += (sender, args) =>
            {
                deviceWidth.Text = "1920";
                deviceHeight.Text = "1080";
            };

            var pointThresholdEntry = new HorizontalContainer();
            pointThresholdEntry.AddChild(new Label() { Text = "Point Threshold: "}, "100");
            pointThresholdEntry.AddChild(pointThresholdTextBox, "*");

            var minPointsEntry = new HorizontalContainer();
            minPointsEntry.AddChild(new Label() { Text = "Min. Points: " }, "100");
            minPointsEntry.AddChild(minPoints, "*");

            var maxPointsEntry = new HorizontalContainer();
            maxPointsEntry.AddChild(new Label() { Text = "Max. Points: " }, "100");
            maxPointsEntry.AddChild(maxPoints, "*");

            var renderAlphaEntry = new HorizontalContainer();
            renderAlphaEntry.AddChild(new Label() { Text = "Render Alpha: " }, "100");
            renderAlphaEntry.AddChild(alpha, "*");

            var deviceWidthEntry = new HorizontalContainer();
            deviceWidthEntry.AddChild(new Label() { Text = "Device Width: " }, "100");
            deviceWidthEntry.AddChild(deviceWidth, "*");

            var deviceHeightEntry = new HorizontalContainer();
            deviceHeightEntry.AddChild(new Label() { Text = "Device Height: " }, "100");
            deviceHeightEntry.AddChild(deviceHeight, "*");

            var vert = new VerticalContainer();
            vert.AddChild(pointThresholdEntry, "24");
            vert.AddChild(minPointsEntry, "24");
            vert.AddChild(maxPointsEntry, "24");
            vert.AddChild(renderAlphaEntry, "24");
            vert.AddChild(nextColor, "24");
            vert.AddChild(showDiagnostics, "48");
            vert.AddChild(showBoard, "48");
            vert.AddChild(nextDevice, "48");
            vert.AddChild(deviceName, "24");
            vert.AddChild(deviceWidthEntry, "24");
            vert.AddChild(deviceHeightEntry, "24");
            vert.AddChild(_fullscreen, "48");
            vert.AddChild(camera640x480, "48");
            vert.AddChild(camera720p, "48");
            vert.AddChild(camera1080p, "48");

            var hor = new HorizontalContainer();
            hor.AddChild(new EmptyContainer(), "*");
            hor.AddChild(vert, "200");

            var canvas = new Canvas();
            canvas.SetChild(hor);

            canvasEntity.Canvas = canvas;

            var webcamEntity = entityFactory.CreateWebcamEntity(deviceName, deviceWidth, deviceHeight);
            var detectorEntity = entityFactory.CreateDetectorEntity(webcamEntity);
            detectorEntity.X = 0;
            detectorEntity.Y = 0;
            var boardAnalyzerEntity = entityFactory.CreateBoardAnalyzerEntity(detectorEntity, pointThresholdTextBox, minPoints, maxPoints);
            var boardRendererEntity = entityFactory.CreateBoardRendererEntity(boardAnalyzerEntity, webcamEntity, alpha);

            nextColor.Click += (sender, args) =>
            {
                detectorEntity.NextColor();
            };
            showDiagnostics.Click += (sender, args) =>
            {
                alpha.Text = "0";
            };
            showBoard.Click += (sender, args) =>
            {
                alpha.Text = "1";
            };
            nextDevice.Click += (sender, args) =>
            {
                webcamEntity.NextDevice();
            };

            _hasSetupFullscreenButton = false;

            this.Entities.Add(webcamEntity);
            this.Entities.Add(detectorEntity);
            this.Entities.Add(boardAnalyzerEntity);
            this.Entities.Add(canvasEntity);
            this.Entities.Add(boardRendererEntity);
        }
开发者ID:hach-que,项目名称:Augmented-Board-Game,代码行数:101,代码来源:AugmentedBoardGameWorld.cs


注:本文中的IEntityFactory.CreateBoardRendererEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。