當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。