Example #1
0
 private void AspectRatioMenu() => CreateMenu("Aspect Ratio", GotoMenu(SettingsMenu, 2),
                                              MenuItem.Create($"{Auto.ToText()} (default)").OnSelect((s, a) => Settings.AspectRatio = Auto).SetActive(() => Settings.AspectRatio == Auto),
                                              MenuItem.Create(Fixed.ToText()).OnSelect((s, a) => Settings.AspectRatio              = Fixed).SetActive(() => Settings.AspectRatio == Fixed),
                                              MenuItem.Create(Scaled.ToText()).OnSelect((s, a) => Settings.AspectRatio             = Scaled).SetActive(() => Settings.AspectRatio == Scaled),
                                              MenuItem.Create(ScaledFixed.ToText()).OnSelect((s, a) => Settings.AspectRatio        = ScaledFixed).SetActive(() => Settings.AspectRatio == ScaledFixed),
                                              MenuItem.Create(AspectRatio.Expand.ToText()).OnSelect((s, a) => Settings.AspectRatio = AspectRatio.Expand).SetActive(() => Settings.AspectRatio == AspectRatio.Expand),
                                              MenuItem.Create("Back")
                                              );
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            if (!MovingEnabled)
            {
                return;
            }

            if ((ModifierKeys & Keys.Control) == Keys.Control)
            {
                float coeff = e.Delta > 0 ? 1.2f : 0.8f;
                ScaleByCoeff(coeff);
                Scaled?.Invoke(coeff);
            }
            base.OnMouseWheel(e);
        }
Example #3
0
        /// <summary>
        /// Gets a new buffer with the specified size.
        /// </summary>
        /// <returns>The scaled buffer.</returns>
        /// <param name="NewSize">New size.</param>
        public PixelBuffer GetScaledBuffer(Vector2i newSize, FilteringType filtering)
        {
            FreeImageBitmap Scaled;

            using (FreeImageBitmap Bmp = new FreeImageBitmap(BufferSize.Width, BufferSize.Height, BufferSize.Width * 4, PixelFormat.Format32bppArgb, Pixels))
            {
                // Get scaled bitmap
                Scaled = Bmp.GetScaledInstance(newSize, (FREE_IMAGE_FILTER)filtering);
            }

            PixelBuffer buffer = new PixelBuffer(newSize);

            // Convert from GBRA to RGBA
            int z = 0;

            for (int i = newSize.Height - 1; i >= 0; i--, z++)
            {
                Marshal.Copy(Scaled.Bits + (z * newSize.Width * 4), buffer.Pixels, i * newSize.Width * 4, newSize.Width * 4);
            }

            Scaled.Dispose();

            return(buffer);
        }
    public float minElapseSinceUnterrainingUntilTerraining     = .5f; // setting: the min required time to elapse since the last successful unterraining audio playing until terraining audio may play



    // methods //


    // methods for: adjusting volume //

    // method: calculate the current player speed (but adjust it to affect the volume accordingly if playing terraining audio) //
    protected override float currentPlayerSpeed()
    => Scaled.timeSince(timeOfLastSuccessfulTerrainingAudioPlaying) <= jumpingTerrainingAudio.length ?
    speedMax :
    MoonMotionPlayer.speedY;
Example #5
0
 /// <summary> Compares the current Weight with another Weight. </summary>
 /// <param name="other"> A Weight to compare with this Weight. </param>
 /// <returns>
 /// A value that indicates the relative order of the Weights being compared. The return value has the following meanings: Value
 /// Meaning Less than zero This Weight is less than the other parameter. Zero This Weight is equal to other. Greater than zero This
 /// Weight is greater than other.
 /// </returns>
 public int CompareTo(Weight other) => Scaled.CompareTo(other.Scaled);
Example #6
0
 /// <summary> Returns the hash code for this instance. </summary>
 /// <returns> A 32-bit signed integer that is the hash code for this instance. </returns>
 public override int GetHashCode() => Scaled.GetHashCode();