Exemple #1
0
        /// <summary>
        /// Added to the Scene.
        /// </summary>
        public override void Added()
        {
            base.Added();

            if (LifeSpan == 0)
            {
                LifeSpan = DefaultLifeSpan;
            }

            imgFlash        = Image.CreateRectangle(Game.Instance.Width, Game.Instance.Height, Color);
            imgFlash.Blend  = Blend;
            imgFlash.Scroll = 0;
            imgFlash.CenterOriginZero();
            if (Surface != null)
            {
                imgFlash.Scale = 1 / Surface.CameraZoom;
            }
            else
            {
                imgFlash.Scale = 1 / Game.Surface.CameraZoom;
            }
            SetGraphic(imgFlash);
        }
Exemple #2
0
        internal void UpdateSurface()
        {
            renderSurface = new Surface((int)game.WindowWidth, (int)game.WindowHeight);
            renderSurface.CenterOrigin();
            renderSurface.X      = game.Surface.X;
            renderSurface.Y      = game.Surface.Y;
            renderSurface.Smooth = false;

            cameraMoveRate = (int)((renderSurface.Width + renderSurface.Height) * 0.5f * 0.1f);

            imgOverlay        = Image.CreateRectangle(renderSurface.Width, renderSurface.Height, Color.Black);
            imgOverlay.Scroll = 0;

            imgError        = Image.CreateRectangle(renderSurface.Width, renderSurface.Height, Color.Red);
            imgError.Scroll = 0;
            imgError.Alpha  = 0;

            float fontScale = Util.ScaleClamp(renderSurface.Height, 400, 800, 0.67f, 1);

            padding = (int)Util.Clamp(paddingMax * fontScale, paddingMax * 0.25f, paddingMax);

            textInput.FontSize            = (int)(textSizeLarge * fontScale);
            textPastCommands.FontSize     = (int)(textSizeMedium * fontScale);
            textPastCommandsLive.FontSize = (int)(textSizeMedium * fontScale);
            textCommandsBuffered.FontSize = (int)(textSizeSmall * fontScale);
            textCountdown.FontSize        = (int)(textSizeHuge * fontScale);
            textFramesLeft.FontSize       = (int)(textSizeMedium * fontScale);
            textPerformance.FontSize      = (int)(textSizeMedium * fontScale);
            textCamera.FontSize           = (int)(textSizeLarge * fontScale);

            imgOtter.Scale = fontScale;

            textFramesLeft.Y = renderSurface.Height - textFramesLeft.LineSpacing;

            textInput.Y = renderSurface.Height - textInput.LineSpacing - padding;
            textInput.X = padding;

            textCommandsBuffered.X = textInput.X;
            textCommandsBuffered.Y = textInput.Y + textInput.LineSpacing + 3;

            textAreaHeight = renderSurface.Height - padding * 3 - textInput.LineSpacing;

            maxLines = textAreaHeight / textPastCommands.LineSpacing;
            maxChars = (int)((renderSurface.Width - padding * 2) / (textInput.FontSize * 0.6));

            textPastCommands.Y = padding;
            textPastCommands.X = padding;

            textPastCommandsLive.Y = padding / 2;
            textPastCommandsLive.X = padding / 2;

            textCountdown.X = renderSurface.HalfWidth;
            textCountdown.Y = renderSurface.HalfHeight;

            imgScrollBarBg = Image.CreateRectangle(scrollBarWidth, textAreaHeight, Color.Black);
            imgScrollBar   = Image.CreateRectangle(scrollBarWidth, textAreaHeight, Color.White);

            imgScrollBarBg.X = renderSurface.Width - padding - imgScrollBarBg.Width;
            imgScrollBarBg.Y = padding;

            imgScrollBar.X = imgScrollBarBg.X;
            imgScrollBar.Y = imgScrollBarBg.Y;

            imgOtter.X = renderSurface.HalfWidth;
            imgOtter.Y = renderSurface.HalfHeight;

            imgScrollBar.Scroll   = 0;
            imgScrollBarBg.Scroll = 0;

            textCamera.CenterTextOrigin();
            textCamera.X = renderSurface.HalfWidth;
            textCamera.Y = renderSurface.Height - padding - textCamera.LineSpacing;
        }
Exemple #3
0
 /// <summary>
 /// Creates a simple black rectangle the size of the active Game window.
 /// </summary>
 /// <returns>A new image containing the rectangle.</returns>
 static public Image CreateRectangle()
 {
     return(Image.CreateRectangle(Color.Black));
 }