Start() private method

Use this for initialization.
private Start ( ) : void
return void
示例#1
0
        private static void addDebugLabels(IGame game)
        {
            ILabel fpsLabel = game.Factory.UI.GetLabel("FPS Label", "", 30, 25, 320, 25, config: new AGSTextConfig(alignment: Alignment.TopLeft,
                                                                                                                   autoFit: AutoFit.LabelShouldFitText));

            fpsLabel.Anchor = new AGS.API.PointF(1f, 0f);
            fpsLabel.ScaleBy(0.7f, 0.7f);
            fpsLabel.RenderLayer = new AGSRenderLayer(-99999);
            var red = Colors.IndianRed;

            fpsLabel.Tint = Color.FromRgba(red.R, red.G, red.B, 125);
            FPSCounter fps = new FPSCounter(game, fpsLabel);

            fps.Start();

            ILabel label = game.Factory.UI.GetLabel("Mouse Position Label", "", 30, 25, 320, 5, config: new AGSTextConfig(alignment: Alignment.TopRight,
                                                                                                                          autoFit: AutoFit.LabelShouldFitText));
            var blue = Colors.SlateBlue;

            label.Tint   = Color.FromRgba(blue.R, blue.G, blue.B, 125);
            label.Anchor = new AGS.API.PointF(1f, 0f);
            label.ScaleBy(0.7f, 0.7f);
            label.RenderLayer = new AGSRenderLayer(-99999);
            MousePositionLabel mouseLabel = new MousePositionLabel(game, label);

            mouseLabel.Start();
        }
示例#2
0
        /// <summary>
        ///     <see cref="E:System.Windows.Forms.Form.Load" /> イベントを発生させます。
        /// </summary>
        /// <param name="e">イベント データを格納している <see cref="T:System.EventArgs" />。</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            #region デザインモード時処理

            if (DesignMode)
            {
                var label = new Label();
                label.Text      = "RenderForm\n*デザインモードでは描画できません。\n*ウィンドウの大きさ、タイトルなどはデザインビューからも変更可能です。";
                label.Dock      = DockStyle.Fill;
                label.TextAlign = ContentAlignment.MiddleCenter;
                label.Font      = new Font("Meiriyo", 30);
                Controls.Add(label);
                return;
            }

            #endregion

            if (RenderContext == null)
            {
                RenderContext = new RenderContext();
                ScreenContext = RenderContext.Initialize(this);
                RenderContext.UpdateRequireWorlds.Add(WorldSpace);
            }
            else //RenderContextがすでにあるばあい
            {
                ScreenContext = RenderContext.CreateScreenContext(this);
            }
            FpsCounter = new FPSCounter();
            FpsCounter.Start();
            ClientSizeChanged += RenderForm_ClientSizeChanged;
            IsInitialized      = true;
        }
示例#3
0
 /// <summary>
 ///     初期化処理
 /// </summary>
 /// <param name="context"></param>
 public virtual void Initialize(RenderContext context = null)
 {
     if (context == null)
     {
         RenderContext = new RenderContext();
         ScreenContext = RenderContext.Initialize(this);
         RenderContext.UpdateRequireWorlds.Add(WorldSpace);
     }
     else
     {
         RenderContext = context;
         ScreenContext = context.CreateScreenContext(this);
     }
     FpsCounter = new FPSCounter();
     FpsCounter.Start();
     IsInitialized = true;
 }
示例#4
0
        public void SetGame(IGame game, IWindowInfo gameWindow, GameDebugTree tree)
        {
            _tree = tree;
            _windowInfo = gameWindow;
            _game = game;

            game.State.Viewport.PropertyChanged += onViewportPropertyChanged;
            setPosition();

            FPSCounter fps = new FPSCounter(game, _fpsLabel);
            fps.Start();

            MousePositionLabel mouseLabel = new MousePositionLabel(game, _mousePosLabel);
            mouseLabel.Start();

            HotspotLabel hotspot = new HotspotLabel(game, _hotspotLabel) { DebugMode = true };
            hotspot.Start();
        }
示例#5
0
        private static void addDebugLabels(IGame game)
        {
            ILabel fpsLabel = game.Factory.UI.GetLabel("FPS Label", "", 30, 25, 320, 2, config: new AGSTextConfig(alignment: Alignment.TopLeft,
                                                                                                                  autoFit: AutoFit.LabelShouldFitText));

            fpsLabel.Pivot       = new PointF(1f, 0f);
            fpsLabel.Scale       = new PointF(0.5f, 0.5f);
            fpsLabel.RenderLayer = new AGSRenderLayer(-99999);
            fpsLabel.Enabled     = true;
            fpsLabel.MouseEnter.Subscribe(_ => fpsLabel.Tint = Colors.Indigo);
            fpsLabel.MouseLeave.Subscribe(_ => fpsLabel.Tint = Colors.IndianRed.WithAlpha(125));
            fpsLabel.Tint = Colors.IndianRed.WithAlpha(125);
            FPSCounter fps = new FPSCounter(game, fpsLabel);

            fps.Start();

            ILabel label = game.Factory.UI.GetLabel("Mouse Position Label", "", 1, 1, 320, 17, config: new AGSTextConfig(alignment: Alignment.TopRight,
                                                                                                                         autoFit: AutoFit.LabelShouldFitText));

            label.Tint        = Colors.SlateBlue.WithAlpha(125);
            label.Pivot       = new PointF(1f, 0f);
            label.Scale       = new PointF(0.5f, 0.5f);
            label.RenderLayer = fpsLabel.RenderLayer;
            MousePositionLabel mouseLabel = new MousePositionLabel(game, label);

            mouseLabel.Start();

            ILabel debugHotspotLabel = game.Factory.UI.GetLabel("Debug Hotspot Label", "", 1f, 1f, 320, 32, config: new AGSTextConfig(alignment: Alignment.TopRight,
                                                                                                                                      autoFit: AutoFit.LabelShouldFitText));

            debugHotspotLabel.Tint        = Colors.DarkSeaGreen.WithAlpha(125);
            debugHotspotLabel.Pivot       = new PointF(1f, 0f);
            debugHotspotLabel.Scale       = new PointF(0.5f, 0.5f);
            debugHotspotLabel.RenderLayer = fpsLabel.RenderLayer;
            HotspotLabel hotspot = new HotspotLabel(game, debugHotspotLabel)
            {
                DebugMode = true
            };

            hotspot.Start();
        }
示例#6
0
        private void addDebugLabels(IGame game)
        {
            var    resolution = new Size(1200, 800);
            ILabel fpsLabel   = game.Factory.UI.GetLabel("FPS Label", "", 30, 25, resolution.Width, 2, config: game.Factory.Fonts.GetTextConfig(alignment: Alignment.TopLeft,
                                                                                                                                                autoFit: AutoFit.LabelShouldFitText));

            fpsLabel.Pivot       = (1f, 0f);
            fpsLabel.RenderLayer = new AGSRenderLayer(-99999, independentResolution: resolution);
            fpsLabel.Enabled     = true;
            fpsLabel.MouseEnter.Subscribe(_ => fpsLabel.Tint = Colors.Indigo);
            fpsLabel.MouseLeave.Subscribe(_ => fpsLabel.Tint = Colors.IndianRed.WithAlpha(125));
            fpsLabel.Tint = Colors.IndianRed.WithAlpha(125);
            FPSCounter fps = new FPSCounter(game, fpsLabel);

            fps.Start();

            ILabel label = game.Factory.UI.GetLabel("Mouse Position Label", "", 1, 1, resolution.Width, 32, config: game.Factory.Fonts.GetTextConfig(alignment: Alignment.TopRight,
                                                                                                                                                     autoFit: AutoFit.LabelShouldFitText));

            label.Tint        = Colors.SlateBlue.WithAlpha(125);
            label.Pivot       = (1f, 0f);
            label.RenderLayer = fpsLabel.RenderLayer;
            MousePositionLabel mouseLabel = new MousePositionLabel(game, label);

            mouseLabel.Start();

            ILabel debugHotspotLabel = game.Factory.UI.GetLabel("Debug Hotspot Label", "", 1f, 1f, resolution.Width, 62, config: game.Factory.Fonts.GetTextConfig(alignment: Alignment.TopRight,
                                                                                                                                                                  autoFit: AutoFit.LabelShouldFitText));

            debugHotspotLabel.Tint        = Colors.DarkSeaGreen.WithAlpha(125);
            debugHotspotLabel.Pivot       = (1f, 0f);
            debugHotspotLabel.RenderLayer = fpsLabel.RenderLayer;
            HotspotLabel hotspot = new HotspotLabel(game, debugHotspotLabel)
            {
                DebugMode = true
            };

            hotspot.Start();
        }